Revision 13263

View differences:

trunk/libraries/libTopology/.classpath
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="src" path="src"/>
4
	<classpathentry kind="src" output="bin-test" path="src-test"/>
5
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
6
	<classpathentry kind="output" path="bin"/>
7
</classpath>
0 8

  
trunk/libraries/libTopology/uml-jude/org/gvsig/topology/ITwoLyrRule.java
1
package org.gvsig.topology;
2

  
3

  
4
/**
5
 *Marker interface for all rules that applies to two layers
6
 */
7
public interface ITwoLyrRule extends ITopologyRule {
8
 
9
}
10
 
0 11

  
trunk/libraries/libTopology/uml-jude/org/gvsig/topology/ITopologyErrorContainer.java
1
package org.gvsig.topology;
2

  
3
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
4
import org.cresques.cts.IProjection;
5

  
6

  
7
/**
8
 *All the classes that contains TopologyError must 
9
 *implement this interface.
10
 */
11
public interface ITopologyErrorContainer {
12
 
13
	public static final int ONLY_ERRORS = 0;
14
	 
15
	public static final int ONLY_EXCEPTIONS = 1;
16
	 
17
	public static final int BOTH_ERROR_EXCEPTIONS = 2;
18
	 
19
	public void addTopologyError(TopologyError topologyError);
20
	/**
21
	 *Returns the errors contained. In function
22
	 *of the specified params, returned errors 
23
	 *will be reprojected, filtered by rule, geometry type,
24
	 *etc.
25
	 */
26
	public TopologyError[] getTopologyErrors(String ruleName, int shapeType, FLyrVect sourceLayer, IProjection desiredProjection, int includeExceptions);
27
	/**
28
	 *Marks the specified feature as the
29
	 *specified status (exception or not exception)
30
	 */
31
	public void markAsTopologyException(TopologyError topologyError, boolean markAsException);
32
}
33
 
0 34

  
trunk/libraries/libTopology/uml-jude/org/gvsig/topology/TopologyError.java
1
package org.gvsig.topology;
2

  
3
import com.iver.cit.gvsig.fmap.core.IFeature;
4

  
5

  
6
/**
7
 *Error produced when one or many features ?
8
 *violates a topology rule.
9
 */
10
public class TopologyError implements IFeature {
11
 
12
	/**
13
	 *rule which has been violated
14
	 */
15
	private AbstractTopologyRule violatedRule;
16
	 
17
	/**
18
	 *features of the source layer that
19
	 *violates the rule (if the rule is a self-rule,
20
	 *the error will only have source layer features)
21
	 */
22
	private IFeature[] sourceLyrFeatures;
23
	 
24
	/**
25
	 *features of the destination layer
26
	 *that violate the rule (only in rules between
27
	 *two layers)
28
	 */
29
	private IFeature[] destinationLyrFeatures;
30
	 
31
	private boolean exception;
32
	 
33
	public void setViolatedRule(AbstractTopologyRule violatedRule) {
34
	}
35
	 
36
	public AbstractTopologyRule getViolatedRule() {
37
		return null;
38
	}
39
	 
40
	public void setSourceLyrFeatures(IFeature[] sourceLyrFeatures) {
41
	}
42
	 
43
	public IFeature[] getSourceLyrFeatures() {
44
		return null;
45
	}
46
	 
47
	public void setDestinationLyrFeatures(IFeature[] destinationLyrFeatures) {
48
	}
49
	 
50
	public IFeature[] getDestinationLyrFeatures() {
51
		return null;
52
	}
53
	 
54
	/**
55
	 *Ruturns the type of geometry of the error
56
	 */
57
	public int getShapeType() {
58
		return 0;
59
	}
60
	 
61
	public void setException(boolean exception) {
62
	}
63
	 
64
	public boolean isException() {
65
		return false;
66
	}
67
	 
68
}
69
 
0 70

  
trunk/libraries/libTopology/uml-jude/org/gvsig/topology/topologyrules/LineMustNotHaveDangles.java
1
package org.gvsig.topology.topologyrules;
2

  
3
import org.gvsig.topology.AbstractTopologyRule;
4
import org.gvsig.topology.IOneLyrRule;
5

  
6

  
7
/**
8
 *All end points of a line must touch at least another line.
9
 *(if only touch one line, its a pseudonode, not a dangle)
10
 *This rule is checked for the two ends of a line.
11
 *
12
 */
13
public class LineMustNotHaveDangles extends AbstractTopologyRule implements IOneLyrRule {
14
 
15
}
16
 
0 17

  
trunk/libraries/libTopology/uml-jude/org/gvsig/topology/topologyrules/MustNotHaveRepeatedPoints.java
1
package org.gvsig.topology.topologyrules;
2

  
3
import org.gvsig.topology.AbstractTopologyRule;
4
import org.gvsig.topology.IOneLyrRule;
5

  
6

  
7
/**
8
 *This rule checks that a geometry (line or polygon)
9
 *dont have consecutive repeated points)
10
 *
11
 */
12
public class MustNotHaveRepeatedPoints extends AbstractTopologyRule implements IOneLyrRule {
13
 
14
}
15
 
0 16

  
trunk/libraries/libTopology/uml-jude/org/gvsig/topology/topologyrules/MustBeLargerThanClusterTolerance.java
1
package org.gvsig.topology.topologyrules;
2

  
3
import org.gvsig.topology.IOneLyrRule;
4
import org.gvsig.topology.AbstractTopologyRule;
5
import org.gvsig.topology.Topology;
6

  
7

  
8
/**
9
 *For lines o polygons. The lenght of a line or the perimeter
10
 *of a polygon must be larger than the cluster tolerance
11
 *
12
 */
13
public class MustBeLargerThanClusterTolerance extends AbstractTopologyRule implements IOneLyrRule {
14
 
15
	private Topology topology;
16
	 
17
}
18
 
0 19

  
trunk/libraries/libTopology/uml-jude/org/gvsig/topology/topologyrules/JtsValidRule.java
1
package org.gvsig.topology.topologyrules;
2

  
3
import org.gvsig.topology.AbstractTopologyRule;
4
import org.gvsig.topology.IOneLyrRule;
5

  
6

  
7
/**
8
 *Any validated geometry must be a right JTS geometry.
9
 */
10
public class JtsValidRule extends AbstractTopologyRule implements IOneLyrRule {
11
 
12
}
13
 
0 14

  
trunk/libraries/libTopology/uml-jude/org/gvsig/topology/topologyrules/LineMustNotSelfIntersect.java
1
package org.gvsig.topology.topologyrules;
2

  
3
import org.gvsig.topology.AbstractTopologyRule;
4
import org.gvsig.topology.IOneLyrRule;
5

  
6

  
7
/**
8
 *Lines of a layer must not have self intersections.
9
 *JTS allows this. This is one of the restrictions that must
10
 *not have pseudonodos checks.
11
 *
12
 */
13
public class LineMustNotSelfIntersect extends AbstractTopologyRule implements IOneLyrRule {
14
 
15
}
16
 
0 17

  
trunk/libraries/libTopology/uml-jude/org/gvsig/topology/topologyrules/PolygonMustNotSelfIntersect.java
1
package org.gvsig.topology.topologyrules;
2

  
3
import org.gvsig.topology.AbstractTopologyRule;
4
import org.gvsig.topology.IOneLyrRule;
5

  
6

  
7
/**
8
 *The polygons of a layer must not have self intersections
9
 *
10
 */
11
public class PolygonMustNotSelfIntersect extends AbstractTopologyRule implements IOneLyrRule {
12
 
13
}
14
 
0 15

  
trunk/libraries/libTopology/uml-jude/org/gvsig/topology/topologyrules/PolygonsMustNotOverlap.java
1
package org.gvsig.topology.topologyrules;
2

  
3
import org.gvsig.topology.AbstractTopologyRule;
4
import org.gvsig.topology.IOneLyrRule;
5

  
6

  
7
/**
8
 *The polygons of a given layer must not overlaps
9
 *each other (their intersection must be a line, not an area)
10
 *
11
 */
12
public class PolygonsMustNotOverlap extends AbstractTopologyRule implements IOneLyrRule {
13
 
14
}
15
 
0 16

  
trunk/libraries/libTopology/uml-jude/org/gvsig/topology/topologyrules/LinesMustNotHavePseudonodes.java
1
package org.gvsig.topology.topologyrules;
2

  
3
import org.gvsig.topology.AbstractTopologyRule;
4
import org.gvsig.topology.IOneLyrRule;
5

  
6

  
7
/**
8
 *This rule checks that lines of a line layer dont have
9
 *pseudonodes ends (a point that only touch another line)
10
 */
11
public class LinesMustNotHavePseudonodes extends AbstractTopologyRule implements IOneLyrRule {
12
 
13
}
14
 
0 15

  
trunk/libraries/libTopology/uml-jude/org/gvsig/topology/AbstractTopologyRule.java
1
package org.gvsig.topology;
2

  
3
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
4
import com.iver.cit.gvsig.fmap.core.IFeature;
5
import java.awt.geom.Rectangle2D;
6
import java.util.Collection;
7

  
8
public abstract class AbstractTopologyRule implements ITopologyRule {
9
 
10
	private FLyrVect originLyr;
11
	 
12
	private FLyrVect destinationLyr;
13
	 
14
	private Topology topology;
15
	 
16
	public void setOriginLyr(FLyrVect originLyr) {
17
	}
18
	 
19
	public FLyrVect getOriginLyr() {
20
		return null;
21
	}
22
	 
23
	public void setDestinationLyr(FLyrVect destinationLyr) {
24
	}
25
	 
26
	public FLyrVect getDestinationLyr() {
27
		return null;
28
	}
29
	 
30
	public String getName() {
31
		return null;
32
	}
33
	 
34
	/**
35
	 *Checks if the rule's parameters 
36
	 *(sourceLyr, destinationLyr) verify 
37
	 *rule preconditions (geometry type, etc.)
38
	 */
39
	public void checkPreconditions() {
40
	}
41
	 
42
	public void checkRule() {
43
	}
44
	 
45
	void validateFeature(IFeature feature) {
46
	}
47
	 
48
	public void checkRule(Rectangle2D rect) {
49
	}
50
	 
51
	public Collection getTopologyErrors() {
52
		return null;
53
	}
54
	 
55
}
56
 
0 57

  
trunk/libraries/libTopology/uml-jude/org/gvsig/topology/IOneLyrRule.java
1
package org.gvsig.topology;
2

  
3

  
4
/**
5
 *Marker interface for all rules that applies to only one layer
6
 *
7
 */
8
public interface IOneLyrRule extends ITopologyRule {
9
 
10
}
11
 
0 12

  
trunk/libraries/libTopology/uml-jude/org/gvsig/topology/ITopologyStatus.java
1
package org.gvsig.topology;
2

  
3
public interface ITopologyStatus {
4
 
5
	public static final byte VALIDATED = 0;
6
	 
7
	public static final byte VALIDATED_WITH_ERRORS = 1;
8
	 
9
	public static final byte NON_VALIDATED = 2;
10
	 
11
}
12
 
0 13

  
trunk/libraries/libTopology/uml-jude/org/gvsig/topology/Topology.java
1
package org.gvsig.topology;
2

  
3
import com.iver.cit.gvsig.fmap.layers.FLayers;
4
import com.vividsolutions.jts.geom.Envelope;
5
import java.awt.geom.Rectangle2D;
6
import org.gvsig.topology.topologyrules.MustBeLargerThanClusterTolerance;
7
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
8

  
9
public class Topology extends FLayers implements ITopologyErrorContainer, ITopologyStatus {
10
 
11
	private double clusterTolerance;
12
	 
13
	private int status;
14
	 
15
	/**
16
	 *If during validation process a topoly
17
	 *exceeds this parameters, validation will be stopped.
18
	 *
19
	 */
20
	private int maxNumberOfErrors = -1;
21
	 
22
	private AbstractTopologyRule[] abstractTopologyRule;
23
	 
24
	private Envelope[] envelope;
25
	 
26
	private Rectangle2D[] dirtyZones;
27
	 
28
	private MustBeLargerThanClusterTolerance[] clusterTolRule;
29
	 
30
	public double getClusterTolerance() {
31
		return 0;
32
	}
33
	 
34
	/**
35
	 *Adds a new topology rule to the topology.
36
	 */
37
	public void addRule(AbstractTopologyRule rule) {
38
	}
39
	 
40
	/**
41
	 *Adds a layer to the topology. If the topology has been validated, changes
42
	 *topology status to NON-VALIDATED and adds a dirty zone equals to
43
	 *the layer extent.
44
	 */
45
	public void addLayer(FLyrVect layer, int xyRank, int zRank) {
46
	}
47
	 
48
	public void setStatus(int status) {
49
	}
50
	 
51
	public int getStatus() {
52
		return 0;
53
	}
54
	 
55
	/**
56
	 *Adds a dirty zone to the topology
57
	 *(usually whe a feature of a layer
58
	 *of the topology has been edited)
59
	 */
60
	public void addDirtyZone(Rectangle2D dirtyZone) {
61
	}
62
	 
63
	public Rectangle2D getDirtyZone() {
64
		return null;
65
	}
66
	 
67
	public void validate() {
68
	}
69
	 
70
	public int getLayerCount() {
71
		return 0;
72
	}
73
	 
74
	public int getRuleCount() {
75
		return 0;
76
	}
77
	 
78
	public FLyrVect getLyr(int lyrIndex) {
79
		return null;
80
	}
81
	 
82
	public AbstractTopologyRule getRule(int ruleIndex) {
83
		return null;
84
	}
85
	 
86
	/**
87
	 *Returns if a specified rectangle touch one
88
	 *of the existing dirty zones. If not, probably
89
	 *is needed to add to the dirty zones collection.
90
	 *If true, maybe it could modify the dirty zone.
91
	 */
92
	public boolean isInDirtyZone() {
93
		return false;
94
	}
95
	 
96
	/**
97
	 *Modify the dirty zone of the specified index
98
	 */
99
	public void updateDirtyZone(int dirtyZoneIndex, Rectangle2D dirtyZone) {
100
	}
101
	 
102
	public void setMaxNumberOfErrors(int maxNumberOfErrors) {
103
	}
104
	 
105
	public int getMaxNumberOfErrors() {
106
		return 0;
107
	}
108
	 
109
}
110
 
0 111

  
trunk/libraries/libTopology/uml-jude/org/gvsig/topology/ITopologyRule.java
1
package org.gvsig.topology;
2

  
3
public interface ITopologyRule {
4
 
5
}
6
 
0 7

  
trunk/libraries/libTopology/uml-jude/org/gvsig/topology/TopologyPersister.java
1
package org.gvsig.topology;
2

  
3
import java.util.Map;
4

  
5

  
6
/**
7
 *Class with the responsability of persist topologies
8
 *and their elements.
9
 */
10
public class TopologyPersister {
11
 
12
	public static void persist(Topology topology) {
13
	}
14
	 
15
	public static Topology load(Map storeParams) {
16
		return null;
17
	}
18
	 
19
}
20
 
0 21

  
trunk/libraries/libTopology/.project
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>libTopology</name>
4
	<comment>@key 32303036313030362D31303030206C6962546F706F6C6F67792F416C7661726F205A6162616C61 </comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>com.omondo.uml.std.Builder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
	</buildSpec>
19
	<natures>
20
		<nature>org.eclipse.jdt.core.javanature</nature>
21
		<nature>com.omondo.uml.std.Nature</nature>
22
	</natures>
23
</projectDescription>
0 24

  

Also available in: Unified diff