Revision 42309
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/GeometryLibrary.java | ||
---|---|---|
36 | 36 |
|
37 | 37 |
/** |
38 | 38 |
* Registers the default implementation for {@link GeometryManager}. |
39 |
*
|
|
39 |
* |
|
40 | 40 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
41 | 41 |
*/ |
42 | 42 |
public class GeometryLibrary extends AbstractLibrary { |
... | ... | |
48 | 48 |
} |
49 | 49 |
|
50 | 50 |
protected void doInitialize() throws LibraryException { |
51 |
} |
|
52 |
|
|
53 |
protected void doPostInitialize() throws LibraryException { |
|
54 | 51 |
// Validate there is any implementation registered. |
55 | 52 |
if(! GeometryLocator.getInstance().exists(GeometryLocator.GEOMETRY_MANAGER_NAME)) { |
56 | 53 |
throw new ReferenceNotRegisteredException( |
57 | 54 |
GeometryLocator.GEOMETRY_MANAGER_NAME, |
58 | 55 |
GeometryLocator.getInstance()); |
59 | 56 |
} |
57 |
} |
|
58 |
|
|
59 |
protected void doPostInitialize() throws LibraryException { |
|
60 | 60 |
DataTypesManager dataTypesManager = ToolsLocator.getDataTypesManager(); |
61 | 61 |
dataTypesManager.addtype(DataTypes.GEOMETRY, "Geometry", "Geometry", |
62 | 62 |
Geometry.class, null); |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/primitive/FilledSpline.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
package org.gvsig.fmap.geom.primitive; |
|
26 |
/** |
|
27 |
* @author fdiaz |
|
28 |
*/ |
|
29 |
public interface FilledSpline extends Surface{ |
|
30 |
|
|
31 |
} |
|
32 |
|
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/primitive/Circumference.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
package org.gvsig.fmap.geom.primitive; |
|
26 |
|
|
27 |
|
|
28 |
public interface Circumference extends Curve { |
|
29 |
|
|
30 |
/** |
|
31 |
* Sets the two values to define a circumference. |
|
32 |
* @param center |
|
33 |
* The center point of the circumference. |
|
34 |
* @param radious |
|
35 |
* A point that is used to calculate the radius. |
|
36 |
*/ |
|
37 |
void setPoints(Point center, Point radious); |
|
38 |
|
|
39 |
/** |
|
40 |
* Sets the two values to define a circumference. |
|
41 |
* @param center |
|
42 |
* The center point of the circumference. |
|
43 |
* @param radious |
|
44 |
* The radius of the circumference. |
|
45 |
*/ |
|
46 |
void setPoints(Point center, double radious); |
|
47 |
|
|
48 |
/** |
|
49 |
* Sets the values to define a circumference from three points. |
|
50 |
* @param p1 |
|
51 |
* First point |
|
52 |
* @param p2 |
|
53 |
* Second point |
|
54 |
* @param p3 |
|
55 |
* Third point |
|
56 |
*/ |
|
57 |
void setPoints(Point p1, Point p2, Point p3); |
|
58 |
|
|
59 |
/** |
|
60 |
* Returns the center of the circumference. |
|
61 |
* @return |
|
62 |
* The center of the circumference. |
|
63 |
*/ |
|
64 |
Point getCenter(); |
|
65 |
|
|
66 |
/** |
|
67 |
* Returns the radius of the circumference |
|
68 |
* @return |
|
69 |
* The radius of the circumference |
|
70 |
*/ |
|
71 |
double getRadious(); |
|
72 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/primitive/OrientablePrimitive.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
package org.gvsig.fmap.geom.primitive; |
26 | 26 |
|
27 |
import org.gvsig.fmap.geom.aggregate.MultiPoint; |
|
28 | 27 |
|
29 | 28 |
/** |
30 | 29 |
* <p> |
31 |
* This interface is equivalent to the GM_OrientablePrimitive specified in
|
|
30 |
* This interface is equivalent to the GM_OrientablePrimitive specified in |
|
32 | 31 |
* <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a>. |
33 |
* Orientable primitives are those that can be mirrored into new
|
|
34 |
* geometric objects in terms of their internal local coordinate
|
|
32 |
* Orientable primitives are those that can be mirrored into new |
|
33 |
* geometric objects in terms of their internal local coordinate |
|
35 | 34 |
* systems (manifold charts). |
36 | 35 |
* </p> |
37 | 36 |
* <p> |
38 |
* For curves, the orientation reflects the direction in which the curve is traversed,
|
|
39 |
* that is, the sense of its parameterization. When used as boundary curves,
|
|
40 |
* the surface being bounded is to the "left" of the oriented curve.
|
|
37 |
* For curves, the orientation reflects the direction in which the curve is traversed, |
|
38 |
* that is, the sense of its parameterization. When used as boundary curves, |
|
39 |
* the surface being bounded is to the "left" of the oriented curve. |
|
41 | 40 |
* </p> |
42 | 41 |
* <p> |
43 |
* For surfaces, the orientation reflects from which direction the local coordinate
|
|
44 |
* system can be viewed as right handed, the "top" or the surface being the direction
|
|
42 |
* For surfaces, the orientation reflects from which direction the local coordinate |
|
43 |
* system can be viewed as right handed, the "top" or the surface being the direction |
|
45 | 44 |
* of a completing z-axis that would form a right-handed system. |
46 | 45 |
* </p> |
47 | 46 |
* <p> |
48 |
* When used as a boundary surface, the bounded solid is "below" the surface.
|
|
49 |
* The orientation of points and solids has no immediate geometric interpretation
|
|
47 |
* When used as a boundary surface, the bounded solid is "below" the surface. |
|
48 |
* The orientation of points and solids has no immediate geometric interpretation |
|
50 | 49 |
* in 3-dimensional space. |
51 | 50 |
* </p> |
52 |
* <p> OrientablePrimitive objects are essentially references to geometric primitives
|
|
53 |
* that carry an "orientation" reversal flag (either "+" or "-") that determines whether
|
|
51 |
* <p> OrientablePrimitive objects are essentially references to geometric primitives |
|
52 |
* that carry an "orientation" reversal flag (either "+" or "-") that determines whether |
|
54 | 53 |
* this primitive agrees or disagrees with the orientation of the referenced object. |
55 | 54 |
* </p> |
56 | 55 |
* @see <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a> |
57 | 56 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
58 | 57 |
*/ |
59 | 58 |
public interface OrientablePrimitive extends Primitive { |
60 |
|
|
59 |
|
|
61 | 60 |
/** |
62 | 61 |
* Gets the one of the values of a coordinate (direct position) in a |
63 | 62 |
* concrete dimension. |
64 |
*
|
|
63 |
* |
|
65 | 64 |
* @param index |
66 | 65 |
* The index of the direct position to set. |
67 | 66 |
* @param dimension |
... | ... | |
69 | 68 |
* @return The value of the coordinate |
70 | 69 |
*/ |
71 | 70 |
public double getCoordinateAt(int index, int dimension); |
72 |
|
|
73 |
|
|
71 |
|
|
72 |
|
|
74 | 73 |
/** |
75 | 74 |
* Sets the value of a coordinate (direct position) in a concrete dimension |
76 | 75 |
* @param index |
... | ... | |
81 | 80 |
* The value to set |
82 | 81 |
*/ |
83 | 82 |
public void setCoordinateAt(int index, int dimension, double value); |
84 |
|
|
83 |
|
|
85 | 84 |
/** |
86 | 85 |
* Adds a vertex (or direct position) to the curve |
87 | 86 |
* @param point |
88 | 87 |
* The new point to add |
89 | 88 |
*/ |
90 | 89 |
public void addVertex(Point point); |
91 |
|
|
90 |
|
|
92 | 91 |
/** |
93 | 92 |
* Utility method for add a vertex |
94 | 93 |
* @param x |
... | ... | |
105 | 104 |
* @see #addVertex(Point) |
106 | 105 |
*/ |
107 | 106 |
public void addVertex(double x, double y, double z); |
108 |
|
|
107 |
|
|
109 | 108 |
/** |
110 | 109 |
* Remove a vertex (direct position) to the curve |
111 | 110 |
* @param index |
112 | 111 |
* The index of the vertex to remove |
113 | 112 |
*/ |
114 | 113 |
public void removeVertex(int index); |
115 |
|
|
114 |
|
|
116 | 115 |
/** |
117 |
* Gets a vertex (direct position)
|
|
116 |
* Gets a vertex (direct position) |
|
118 | 117 |
* @param index |
119 | 118 |
* The index of the vertex to get |
120 | 119 |
* @return |
121 | 120 |
* One point |
122 | 121 |
*/ |
123 | 122 |
public Point getVertex(int index); |
124 |
|
|
123 |
|
|
125 | 124 |
/** |
126 | 125 |
* Gets the number of vertices (direct positions) of the curve |
127 | 126 |
* @return |
128 | 127 |
* The number of vertices |
129 | 128 |
*/ |
130 | 129 |
public int getNumVertices(); |
131 |
|
|
130 |
|
|
132 | 131 |
/** |
133 | 132 |
* Inserts a vertex (direct position) to the curve. |
134 | 133 |
* @param index |
... | ... | |
137 | 136 |
* The vertex to add. |
138 | 137 |
*/ |
139 | 138 |
public void insertVertex(int index, Point p); |
140 |
|
|
139 |
|
|
141 | 140 |
/** |
142 | 141 |
* Sets a vertex in a concrete position and replaces the |
143 | 142 |
* previous one that was in this position. |
... | ... | |
149 | 148 |
public void setVertex(int index, Point p); |
150 | 149 |
|
151 | 150 |
/** |
152 |
* Sets all the coordinates of the curve
|
|
151 |
* Sets all the coordinates of the curve |
|
153 | 152 |
* @param generalPathX The generalPath that contains all the coordinates |
154 | 153 |
* @deprecated use addVertex |
155 | 154 |
*/ |
156 | 155 |
public void setGeneralPath(GeneralPathX generalPathX); |
157 |
|
|
156 |
|
|
158 | 157 |
/** |
159 | 158 |
* Adds a vertex (or direct position) to the curve |
160 | 159 |
* @param point |
... | ... | |
164 | 163 |
* add an inner surface |
165 | 164 |
*/ |
166 | 165 |
public void addMoveToVertex(Point point); |
167 |
|
|
166 |
|
|
168 | 167 |
/** |
169 | 168 |
* Closes the geometry |
170 | 169 |
* @deprecated |
... | ... | |
172 | 171 |
* geometry. |
173 | 172 |
*/ |
174 | 173 |
public void closePrimitive(); |
175 |
|
|
174 |
|
|
176 | 175 |
public void ensureCapacity(int capacity); |
176 |
|
|
177 | 177 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/primitive/PeriEllipse.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
package org.gvsig.fmap.geom.primitive; |
|
26 |
|
|
27 |
|
|
28 |
/** |
|
29 |
* <p> |
|
30 |
* This class represents the perimeter o an ellipse. |
|
31 |
* </p> |
|
32 |
* @author fdiaz</a> |
|
33 |
*/ |
|
34 |
public interface PeriEllipse extends Curve { |
|
35 |
|
|
36 |
/** |
|
37 |
* Sets the values to define a ellipse. |
|
38 |
* @param axis1Start |
|
39 |
* The point where the first axis starts. |
|
40 |
* @param axis1End |
|
41 |
* The point where the first axis ends. |
|
42 |
* @param axis2Length |
|
43 |
* The length of the second axis. |
|
44 |
*/ |
|
45 |
void setPoints(Point axis1Start, Point axis1End, double axis2Length); |
|
46 |
|
|
47 |
/** |
|
48 |
* Returns the point where the first axis starts. |
|
49 |
* @return |
|
50 |
* The point where the first axis starts. |
|
51 |
*/ |
|
52 |
Point getAxis1Start(); |
|
53 |
|
|
54 |
/** |
|
55 |
* Returns the point where the first axis ends. |
|
56 |
* @return |
|
57 |
* The point where the first axis ends. |
|
58 |
*/ |
|
59 |
Point getAxis1End(); |
|
60 |
|
|
61 |
/** |
|
62 |
* Returns the length of the second axis. |
|
63 |
* @return |
|
64 |
* The length of the second axis. |
|
65 |
*/ |
|
66 |
double getAxis2Dist(); |
|
67 |
} |
|
68 |
|
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/primitive/Line.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
package org.gvsig.fmap.geom.primitive; |
26 | 26 |
|
27 |
import org.gvsig.fmap.geom.GeometryException; |
|
28 |
import org.gvsig.fmap.geom.aggregate.MultiLine; |
|
29 |
import org.gvsig.fmap.geom.aggregate.MultiPoint; |
|
30 |
import org.gvsig.fmap.geom.aggregate.MultiPolygon; |
|
31 | 27 |
|
32 | 28 |
public interface Line extends Curve { |
33 |
|
|
34 |
public MultiPoint toPoints() throws GeometryException; |
|
35 | 29 |
|
36 |
public MultiLine toLines() throws GeometryException; |
|
37 |
|
|
38 |
public MultiPolygon toPolygons() throws GeometryException; |
|
39 |
|
|
40 | 30 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/primitive/Polygon.java | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
package org.gvsig.fmap.geom.primitive; |
25 | 25 |
|
26 |
import org.gvsig.fmap.geom.GeometryException; |
|
27 |
import org.gvsig.fmap.geom.aggregate.MultiLine; |
|
28 |
import org.gvsig.fmap.geom.aggregate.MultiPoint; |
|
29 |
import org.gvsig.fmap.geom.aggregate.MultiPolygon; |
|
30 | 26 |
|
31 |
|
|
32 | 27 |
public interface Polygon extends Surface { |
33 | 28 |
|
34 |
public MultiPoint toPoints() throws GeometryException; |
|
35 |
|
|
36 |
public MultiLine toLines() throws GeometryException; |
|
37 |
|
|
38 |
public MultiPolygon toPolygons() throws GeometryException; |
|
39 |
|
|
40 | 29 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/primitive/Surface.java | ||
---|---|---|
43 | 43 |
* outward. For closed surfaces, which have no boundary, the up direction is |
44 | 44 |
* that of the surface patches, which must be consistent with one another. |
45 | 45 |
* </p> |
46 |
*
|
|
46 |
* |
|
47 | 47 |
* @see <a |
48 | 48 |
* href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO |
49 | 49 |
* 19107</a> |
... | ... | |
54 | 54 |
|
55 | 55 |
/** |
56 | 56 |
* Sets the appearance of the Surface |
57 |
*
|
|
57 |
* |
|
58 | 58 |
* @param app |
59 | 59 |
* The appearance of the surface |
60 | 60 |
*/ |
... | ... | |
62 | 62 |
|
63 | 63 |
/** |
64 | 64 |
* Gets surface appearance |
65 |
*
|
|
65 |
* |
|
66 | 66 |
* @return the surface appearance |
67 |
*
|
|
67 |
* |
|
68 | 68 |
*/ |
69 | 69 |
public SurfaceAppearance getSurfaceAppearance(); |
70 | 70 |
|
71 | 71 |
public int getNumInteriorRings(); |
72 |
|
|
72 |
|
|
73 | 73 |
public Ring getInteriorRing(int index); |
74 |
|
|
74 |
|
|
75 | 75 |
public void addInteriorRing(Ring ring); |
76 |
|
|
76 |
|
|
77 |
/** |
|
78 |
* Creates a ring from the coordinates of the line and adds it to the surface like an inner ring. |
|
79 |
* |
|
80 |
* @param ring |
|
81 |
*/ |
|
82 |
public void addInteriorRing(Line line); |
|
83 |
|
|
84 |
/** |
|
85 |
* Creates a ring from the coordinates of the shell of the polygon and adds it to the surface like an inner ring. |
|
86 |
* |
|
87 |
* @param polygon |
|
88 |
*/ |
|
89 |
public void addInteriorRing(Polygon polygon); |
|
90 |
|
|
77 | 91 |
public void removeInteriorRing(int index); |
78 |
|
|
92 |
|
|
79 | 93 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/primitive/Point.java | ||
---|---|---|
25 | 25 |
package org.gvsig.fmap.geom.primitive; |
26 | 26 |
|
27 | 27 |
import org.gvsig.fmap.geom.DirectPosition; |
28 |
import org.gvsig.fmap.geom.GeometryException; |
|
29 |
import org.gvsig.fmap.geom.aggregate.MultiPoint; |
|
30 | 28 |
|
31 | 29 |
/** |
32 | 30 |
* <p> |
33 |
* This interface is equivalent to the GM_Point specified in
|
|
31 |
* This interface is equivalent to the GM_Point specified in |
|
34 | 32 |
* <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a>. |
35 |
* It is the basic data type for a geometric object consisting
|
|
36 |
* of one and only one point.
|
|
33 |
* It is the basic data type for a geometric object consisting |
|
34 |
* of one and only one point. |
|
37 | 35 |
* </p> |
38 | 36 |
* @see <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a> |
39 | 37 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
40 | 38 |
*/ |
41 | 39 |
public interface Point extends Primitive { |
42 |
|
|
40 |
|
|
43 | 41 |
/** |
44 | 42 |
* Gets the {@link DirectPosition of a point}, that is |
45 | 43 |
* composed by a set of ordinates |
... | ... | |
47 | 45 |
* The direct position |
48 | 46 |
*/ |
49 | 47 |
public DirectPosition getDirectPosition(); |
50 |
|
|
48 |
|
|
51 | 49 |
/** |
52 | 50 |
* Sets a ordinate in a concrete dimension |
53 | 51 |
* @param dimension |
... | ... | |
59 | 57 |
|
60 | 58 |
/** |
61 | 59 |
* Sets the point coordinates |
62 |
*
|
|
60 |
* |
|
63 | 61 |
* @param value |
64 | 62 |
* The coordinates to set |
65 | 63 |
* @deprecated Use {@link #setCoordinateAt(int, double))} instead |
66 | 64 |
*/ |
67 | 65 |
void setCoordinates(double[] values); |
68 |
|
|
66 |
|
|
69 | 67 |
/** |
70 | 68 |
* Sets the X coordinate |
71 | 69 |
* @param x |
72 | 70 |
* The value to set |
73 | 71 |
*/ |
74 | 72 |
void setX(double x); |
75 |
|
|
73 |
|
|
76 | 74 |
/** |
77 | 75 |
* Sets the Y coordinate |
78 | 76 |
* @param y |
79 | 77 |
* The value to set |
80 | 78 |
*/ |
81 | 79 |
void setY(double y); |
82 |
|
|
80 |
|
|
83 | 81 |
/** |
84 | 82 |
* Gets the coordinate in a concrete dimension |
85 | 83 |
* @param dimension |
... | ... | |
93 | 91 |
* Returns an array of coordinates. Don't use the provided array to modify |
94 | 92 |
* the point coordinates, but use the {@link #setCoordinateAt(int, double))} |
95 | 93 |
* , {@link #setX(double))} or {@link #setY(double))} methods instead. |
96 |
*
|
|
94 |
* |
|
97 | 95 |
* @return The point coordinates |
98 | 96 |
* @deprecated Use {@link #getCoordinateAt(int)} instead |
99 | 97 |
*/ |
100 | 98 |
double[] getCoordinates(); |
101 |
|
|
99 |
|
|
102 | 100 |
/** |
103 |
* Returns the X coordinate
|
|
101 |
* Returns the X coordinate |
|
104 | 102 |
* @return |
105 | 103 |
* The X coordinate |
106 | 104 |
*/ |
107 | 105 |
double getX(); |
108 |
|
|
106 |
|
|
109 | 107 |
/** |
110 |
* Returns the Y coordinate
|
|
108 |
* Returns the Y coordinate |
|
111 | 109 |
* @return |
112 | 110 |
* The Y coordinate |
113 | 111 |
*/ |
114 | 112 |
double getY(); |
115 |
|
|
116 |
public MultiPoint toPoints() throws GeometryException ; |
|
117 | 113 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/primitive/Arc.java | ||
---|---|---|
26 | 26 |
|
27 | 27 |
/** |
28 | 28 |
* <p> |
29 |
* This interface is equivalent to the GM_Arc specified in
|
|
29 |
* This interface is equivalent to the GM_Arc specified in |
|
30 | 30 |
* <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a>. |
31 |
* A Arc is defined by 3 points, and consists of the arc of the circle determined by the 3 points,
|
|
32 |
* starting at the first, passing through the second and terminating at the third.
|
|
33 |
* If the 3 points are co-linear, then the arc shall be a 3-point line string, and will
|
|
34 |
* not be able to return values for center, radius, start angle and end angle.
|
|
35 |
* </p>
|
|
31 |
* A Arc is defined by 3 points, and consists of the arc of the circle determined by the 3 points, |
|
32 |
* starting at the first, passing through the second and terminating at the third. |
|
33 |
* If the 3 points are co-linear, then the arc shall be a 3-point line string, and will |
|
34 |
* not be able to return values for center, radius, start angle and end angle. |
|
35 |
* </p> |
|
36 | 36 |
* @see <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a> |
37 | 37 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
38 | 38 |
*/ |
39 | 39 |
public interface Arc extends Curve { |
40 |
|
|
40 |
|
|
41 | 41 |
/** |
42 | 42 |
* Sets the three points to define an arc. |
43 | 43 |
* These are three ordered points that belong to the arc |
44 | 44 |
* (none of them is the center of the ellipse/circle). Therefore |
45 | 45 |
* they must not be aligned. |
46 |
*
|
|
46 |
* |
|
47 | 47 |
* @param startPoint |
48 | 48 |
* The start point of an arc. |
49 | 49 |
* @param midPoint |
... | ... | |
52 | 52 |
* The end point of an arc. |
53 | 53 |
* @exception IllegalArgumentException if the three points are aligned or |
54 | 54 |
* there is a repeated point. |
55 |
*
|
|
55 |
* |
|
56 | 56 |
*/ |
57 | 57 |
void setPoints(Point startPoint, Point midPoint, Point endPoint); |
58 |
|
|
58 |
|
|
59 | 59 |
/** |
60 | 60 |
* Sets the values to define an arc. |
61 | 61 |
* @param center The center of the arc. |
62 | 62 |
* @param radius The radius. |
63 | 63 |
* @param startAngle The start angle of the arc (in radians) |
64 |
* @param angleExt The angular extent of the arc (in radians).
|
|
65 |
*
|
|
66 |
* The sign convention is:
|
|
67 |
*
|
|
68 |
* startAngle = 0 is "3 o'clock";
|
|
69 |
* startAngle = (PI / 3) is "1 o'clock";
|
|
70 |
* angleExt > 0 means "advancing clockwise";
|
|
64 |
* @param angleExt The angular extent of the arc (in radians). |
|
65 |
* |
|
66 |
* The sign convention is: |
|
67 |
* |
|
68 |
* startAngle = 0 is "3 o'clock"; |
|
69 |
* startAngle = (PI / 3) is "1 o'clock"; |
|
70 |
* angleExt > 0 means "advancing clockwise"; |
|
71 | 71 |
* angleExt < 0 means "advancing counterclockwise". |
72 | 72 |
*/ |
73 | 73 |
void setPoints (Point center, double radius, double startAngle, double angleExt); |
... | ... | |
77 | 77 |
* @param center The center of the arc. |
78 | 78 |
* @param radius The radius. |
79 | 79 |
* @param startAngle The start angle of the arc (in radians) |
80 |
* @param angleExt The angular extent of the arc (in radians).
|
|
81 |
*
|
|
82 |
* The sign convention is:
|
|
83 |
*
|
|
84 |
* startAngle = 0 is "3 o'clock";
|
|
85 |
* startAngle = (PI / 3) is "1 o'clock";
|
|
86 |
* angleExt > 0 means "advancing clockwise";
|
|
80 |
* @param angleExt The angular extent of the arc (in radians). |
|
81 |
* |
|
82 |
* The sign convention is: |
|
83 |
* |
|
84 |
* startAngle = 0 is "3 o'clock"; |
|
85 |
* startAngle = (PI / 3) is "1 o'clock"; |
|
86 |
* angleExt > 0 means "advancing clockwise"; |
|
87 | 87 |
* angleExt < 0 means "advancing counterclockwise". |
88 | 88 |
*/ |
89 | 89 |
void setPointsStartExt (Point center, double radius, double startAngle, double angleExt); |
90 |
|
|
90 |
|
|
91 | 91 |
/** |
92 | 92 |
* Sets the values to define an arc. The arc will go from |
93 | 93 |
* startAngle to endAngle clockwise. Angles will be |
94 | 94 |
* normalized to ]-PI, PI] (-PI excluded) before creating |
95 |
* the arc.
|
|
96 |
*
|
|
95 |
* the arc. |
|
96 |
* |
|
97 | 97 |
* @param center The center of the arc. |
98 | 98 |
* @param radius The radius. |
99 | 99 |
* @param startAngle The start angle of the arc (in radians) |
100 |
* @param endAngle The end angle of the arc (in radians).
|
|
101 |
*
|
|
100 |
* @param endAngle The end angle of the arc (in radians). |
|
101 |
* |
|
102 | 102 |
*/ |
103 | 103 |
void setPointsStartEnd (Point center, double radius, double startAngle, double endAngle ); |
104 |
|
|
104 |
|
|
105 | 105 |
/** |
106 | 106 |
* Return the first point that has been used to create the arc. |
107 | 107 |
* @return |
108 | 108 |
* The first point of the arc. |
109 | 109 |
*/ |
110 | 110 |
Point getInitPoint(); |
111 |
|
|
111 |
|
|
112 | 112 |
/** |
113 | 113 |
* Return the end point that has been used to create the arc. |
114 | 114 |
* @return |
115 | 115 |
* The end point of the arc. |
116 | 116 |
*/ |
117 | 117 |
Point getEndPoint(); |
118 |
|
|
118 |
|
|
119 | 119 |
/** |
120 | 120 |
* Return the center of the arc, that is, the center of the ellipse/circle |
121 | 121 |
* in which the arc is based. |
122 |
*
|
|
122 |
* |
|
123 | 123 |
* @return The center of the arc. |
124 | 124 |
*/ |
125 | 125 |
Point getCenterPoint(); |
126 |
|
|
127 |
|
|
126 |
|
|
127 |
/** |
|
128 |
* Return the middle point of the arc. |
|
129 |
* |
|
130 |
* @return The middle point of the arc. |
|
131 |
*/ |
|
132 |
Point getMiddlePoint(); |
|
133 |
|
|
134 |
|
|
128 | 135 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/primitive/PointGeometryType.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
/** |
29 | 29 |
* Geometry type for point geometries. |
30 |
*
|
|
30 |
* |
|
31 | 31 |
* @author gvSIG Team |
32 | 32 |
*/ |
33 |
/** |
|
34 |
* |
|
35 |
* This class is deprecated. |
|
36 |
* Use GeometryType. |
|
37 |
* |
|
38 |
* @deprecated use GeometryType |
|
39 |
*/ |
|
33 | 40 |
public interface PointGeometryType extends GeometryType { |
34 | 41 |
|
35 | 42 |
/** |
36 |
* Creates a new point object
|
|
43 |
* Creates a new point object |
|
37 | 44 |
* @param x the x coordinate of the point |
38 | 45 |
* @param y the y coordinate of the point |
39 | 46 |
* @return the new point |
40 | 47 |
*/ |
41 | 48 |
Point createPoint(double x, double y); |
42 |
|
|
49 |
|
|
43 | 50 |
/** |
44 |
* Creates a new point object
|
|
51 |
* Creates a new point object |
|
45 | 52 |
* @param coordinates the coordinates of the point |
46 | 53 |
* @return the new point |
47 | 54 |
*/ |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/Geometry.java | ||
---|---|---|
32 | 32 |
|
33 | 33 |
import org.cresques.cts.ICoordTrans; |
34 | 34 |
|
35 |
import org.gvsig.fmap.geom.aggregate.MultiLine; |
|
36 |
import org.gvsig.fmap.geom.aggregate.MultiPoint; |
|
37 |
import org.gvsig.fmap.geom.aggregate.MultiPolygon; |
|
35 | 38 |
import org.gvsig.fmap.geom.handler.Handler; |
36 | 39 |
import org.gvsig.fmap.geom.operation.GeometryOperationContext; |
37 | 40 |
import org.gvsig.fmap.geom.operation.GeometryOperationException; |
... | ... | |
154 | 157 |
* NO DATA geometry. |
155 | 158 |
*/ |
156 | 159 |
public final static int NULL = 16; |
157 |
|
|
158 |
public final static int COMPLEX = 17; |
|
159 |
|
|
160 |
|
|
160 |
|
|
161 |
public final static int COMPLEX = 17; |
|
162 |
|
|
161 | 163 |
public final static int LINE = 18; |
162 |
|
|
164 |
|
|
163 | 165 |
public final static int POLYGON = 19; |
164 |
} |
|
165 | 166 |
|
167 |
public final static int RING = 20; |
|
168 |
|
|
169 |
public final static int MULTILINE = 21; |
|
170 |
|
|
171 |
public final static int MULTIPOLYGON = 22; |
|
172 |
|
|
173 |
public final static int CIRCUMFERENCE = 23; |
|
174 |
|
|
175 |
public final static int PERIELLIPSE = 24; |
|
176 |
|
|
177 |
public final static int FILLEDSPLINE = 25; |
|
178 |
|
|
179 |
} |
|
180 |
|
|
166 | 181 |
public interface DIMENSIONS { |
167 | 182 |
public final static int X = 0; |
168 | 183 |
public final static int Y = 1; |
... | ... | |
173 | 188 |
* The subtype of a geometry is related with the dimension of the geometry, |
174 | 189 |
* that is a combination between the spatial dimension (2D, 2ZD, 3D) and the |
175 | 190 |
* M coordinate or "measure". |
176 |
*
|
|
191 |
* |
|
177 | 192 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
178 | 193 |
*/ |
179 | 194 |
public interface SUBTYPES { |
... | ... | |
254 | 269 |
|
255 | 270 |
/** |
256 | 271 |
* True if the geoemtry are valid. |
257 |
*
|
|
272 |
* |
|
258 | 273 |
* @return true form valid geometries |
259 | 274 |
*/ |
260 | 275 |
public boolean isValid(); |
261 |
|
|
276 |
|
|
262 | 277 |
/** |
263 | 278 |
* Return the status code results of validate the geometry. |
264 |
*
|
|
279 |
* |
|
265 | 280 |
* @return validation code |
266 | 281 |
*/ |
267 | 282 |
public int getStatusCode(); |
268 | 283 |
|
269 | 284 |
/** |
270 | 285 |
* Return the nearest point to the problem when validate the geometry. |
271 |
*
|
|
286 |
* |
|
272 | 287 |
* If the geometry is valid, this return null. |
273 |
*
|
|
288 |
* |
|
274 | 289 |
* @return the nearest point to the problem or null. |
275 | 290 |
*/ |
276 | 291 |
public Point getProblemLocation(); |
277 | 292 |
|
278 | 293 |
/** |
279 | 294 |
* Return a human readable message explaining the cause of the problem. |
280 |
*
|
|
295 |
* |
|
281 | 296 |
* If the geometry is valid this is null. |
282 |
*
|
|
297 |
* |
|
283 | 298 |
* @return the message cause of the problem. |
284 | 299 |
*/ |
285 | 300 |
public String getMessage(); |
286 | 301 |
} |
287 |
|
|
302 |
|
|
288 | 303 |
public static int BEST = 0; |
289 | 304 |
/** |
290 | 305 |
* North. |
... | ... | |
336 | 351 |
* constant that identifies its type. By convention this value is stored in |
337 | 352 |
* a constant called .CODE within the geometry class, for instance: |
338 | 353 |
* Point2D.CODE. |
339 |
*
|
|
354 |
* |
|
340 | 355 |
* @return If this geometry is a predefined interface then one of |
341 | 356 |
* {@link Geometry.TYPES} or a runtime constant if it is an extended |
342 | 357 |
* type. |
... | ... | |
345 | 360 |
|
346 | 361 |
/** |
347 | 362 |
* Creates a clone of this geometry. |
348 |
*
|
|
363 |
* |
|
349 | 364 |
* @return A clone of this geometry. |
350 | 365 |
*/ |
351 | 366 |
public Geometry cloneGeometry(); |
... | ... | |
353 | 368 |
/** |
354 | 369 |
* Returns true if this geometry intersects the rectangle passed as |
355 | 370 |
* parameter. |
356 |
*
|
|
371 |
* |
|
357 | 372 |
* @param r |
358 | 373 |
* Rectangle. |
359 |
*
|
|
374 |
* |
|
360 | 375 |
* @return True, if <code>this</code> intersects <code>r</code>. |
361 | 376 |
*/ |
362 | 377 |
public boolean intersects(Rectangle2D r); |
... | ... | |
364 | 379 |
/** |
365 | 380 |
* Used by the drawing strategies to quickly test whether this geometry |
366 | 381 |
* intersects with the visible rectangle. |
367 |
*
|
|
382 |
* |
|
368 | 383 |
* @param x |
369 | 384 |
* The minimum X coordinate. |
370 | 385 |
* @param y |
... | ... | |
387 | 402 |
* one containing all the minimums for each ordinate, and second one |
388 | 403 |
* containing all the maximums. |
389 | 404 |
* </p> |
390 |
*
|
|
405 |
* |
|
391 | 406 |
* @return The minimum bounding box for this Geometry. |
392 | 407 |
*/ |
393 | 408 |
public Envelope getEnvelope(); |
... | ... | |
395 | 410 |
/** |
396 | 411 |
* Reprojects this geometry by the coordinate transformer passed as |
397 | 412 |
* parameter. |
398 |
*
|
|
413 |
* |
|
399 | 414 |
* @param ct |
400 | 415 |
* Coordinate Transformer. |
401 | 416 |
*/ |
... | ... | |
406 | 421 |
* If parameter value is null, it will be considered an |
407 | 422 |
* empty transformation, therefore equivalent to the identity |
408 | 423 |
* transformation. |
409 |
*
|
|
424 |
* |
|
410 | 425 |
* @param at |
411 | 426 |
* The transformation to apply. |
412 | 427 |
*/ |
... | ... | |
416 | 431 |
* geometric set can be associated with a subset that has the direct |
417 | 432 |
* position in its interior and is similar (isomorphic) to Rn, Euclidean |
418 | 433 |
* n-space. |
419 |
*
|
|
434 |
* |
|
420 | 435 |
* @return The dimension. |
421 | 436 |
*/ |
422 | 437 |
public int getDimension(); |
... | ... | |
427 | 442 |
* means that every point in the interior of the object must have a metric |
428 | 443 |
* neighborhood whose intersection with the object is isomorphic to an |
429 | 444 |
* n-sphere, where n is the dimension of this Geometry. |
430 |
*
|
|
445 |
* |
|
431 | 446 |
* @return If the geometry is simple. |
432 | 447 |
*/ |
433 | 448 |
public boolean isSimple(); |
... | ... | |
438 | 453 |
|
439 | 454 |
/** |
440 | 455 |
* Invokes a geometry operation given its index and context. |
441 |
*
|
|
456 |
* |
|
442 | 457 |
* @param index |
443 | 458 |
* Unique index of the operation. Operation code. |
444 | 459 |
* @param ctx |
... | ... | |
456 | 471 |
|
457 | 472 |
/** |
458 | 473 |
* Invokes a geometry operation given its name and context. |
459 |
*
|
|
474 |
* |
|
460 | 475 |
* @param opName |
461 | 476 |
* Operation name. |
462 | 477 |
* @param ctx |
... | ... | |
474 | 489 |
|
475 | 490 |
/** |
476 | 491 |
* Instance of the GeometryType associated to this geometry. |
477 |
*
|
|
492 |
* |
|
478 | 493 |
* @return The geometry type. |
479 | 494 |
*/ |
480 | 495 |
public GeometryType getGeometryType(); |
481 | 496 |
|
482 | 497 |
/** |
483 | 498 |
* Return a byte array with the equivalent in WKB format of the Geometry. |
484 |
*
|
|
499 |
* |
|
485 | 500 |
* Utility method to wrap the invocation to the operation |
486 | 501 |
* {@link OPERATIONS#CONVERTTOWKB}. |
487 |
*
|
|
502 |
* |
|
488 | 503 |
* @return the WKB version of the geometry |
489 | 504 |
*/ |
490 | 505 |
public byte[] convertToWKB() throws GeometryOperationNotSupportedException, |
491 | 506 |
GeometryOperationException; |
492 | 507 |
|
493 |
public byte[] convertToWKB(int srs)
|
|
508 |
public byte[] convertToWKB(int srs) |
|
494 | 509 |
throws GeometryOperationNotSupportedException, GeometryOperationException; |
495 |
|
|
496 |
public byte[] convertToWKBForcingType(int srs, int type)
|
|
510 |
|
|
511 |
public byte[] convertToWKBForcingType(int srs, int type) |
|
497 | 512 |
throws GeometryOperationNotSupportedException, GeometryOperationException; |
498 | 513 |
|
499 | 514 |
/** |
500 | 515 |
* Return a string with the equivalent in WKT format of the Geometry. |
501 |
*
|
|
516 |
* |
|
502 | 517 |
* This is a utility method to wrap the invocation to the operation |
503 | 518 |
* {@link OPERATIONS#CONVERTTOWKT}. |
504 |
*
|
|
519 |
* |
|
505 | 520 |
* @return the WKT version of the geometry. |
506 |
*
|
|
521 |
* |
|
507 | 522 |
* @throws GeometryOperationNotSupportedException |
508 | 523 |
* @throws GeometryOperationException |
509 | 524 |
*/ |
... | ... | |
512 | 527 |
|
513 | 528 |
/** |
514 | 529 |
* Computes a buffer area around this geometry having the given width |
515 |
*
|
|
530 |
* |
|
516 | 531 |
* This is a utility method to wrap the invocation to the operation |
517 | 532 |
* {@link OPERATIONS#BUFFER}. |
518 |
*
|
|
533 |
* |
|
519 | 534 |
* @param distance |
520 | 535 |
* the width of the buffer |
521 |
*
|
|
536 |
* |
|
522 | 537 |
* @return a new Geometry with the computed buffer. |
523 |
*
|
|
538 |
* |
|
524 | 539 |
* @throws GeometryOperationNotSupportedException |
525 | 540 |
* @throws GeometryOperationException |
526 | 541 |
*/ |
... | ... | |
530 | 545 |
|
531 | 546 |
/** |
532 | 547 |
* Tests whether this geometry contains the specified geometry. |
533 |
*
|
|
548 |
* |
|
534 | 549 |
* This is a utility method to wrap the invocation to the operation |
535 | 550 |
* {@link OPERATIONS#CONTAINS}. |
536 |
*
|
|
551 |
* |
|
537 | 552 |
* @param geometry |
538 | 553 |
* the Geometry with which to compare this Geometry |
539 |
*
|
|
554 |
* |
|
540 | 555 |
* @return if this Geometry contains the specified geometry |
541 |
*
|
|
556 |
* |
|
542 | 557 |
* @throws GeometryOperationNotSupportedException |
543 | 558 |
* @throws GeometryOperationException |
544 | 559 |
*/ |
... | ... | |
549 | 564 |
/** |
550 | 565 |
* Returns the minimum distance between this Geometry and the specified |
551 | 566 |
* geometry. |
552 |
*
|
|
567 |
* |
|
553 | 568 |
* This is a utility method to wrap the invocation to the operation |
554 | 569 |
* {@link OPERATIONS#DISTANCE}. |
555 |
*
|
|
570 |
* |
|
556 | 571 |
* @param geometry |
557 | 572 |
* the Geometry from which to compute the distance |
558 |
*
|
|
573 |
* |
|
559 | 574 |
* @return the distance between the geometries |
560 |
*
|
|
575 |
* |
|
561 | 576 |
* @throws GeometryOperationNotSupportedException |
562 | 577 |
* @throws GeometryOperationException |
563 | 578 |
*/ |
... | ... | |
568 | 583 |
public Geometry[] closestPoints(Geometry other) |
569 | 584 |
throws GeometryOperationNotSupportedException, |
570 | 585 |
GeometryOperationException; |
571 |
|
|
572 |
boolean isWithinDistance(Geometry other, double distance)
|
|
586 |
|
|
587 |
boolean isWithinDistance(Geometry other, double distance) |
|
573 | 588 |
throws GeometryOperationNotSupportedException, |
574 | 589 |
GeometryOperationException; |
575 | 590 |
|
576 | 591 |
/** |
577 | 592 |
* Tests whether this geometry overlaps the specified geometry. |
578 |
*
|
|
593 |
* |
|
579 | 594 |
* This is a utility method to wrap the invocation to the operation |
580 | 595 |
* {@link OPERATIONS#OVERLAPS}. |
581 |
*
|
|
596 |
* |
|
582 | 597 |
* @param geometry |
583 | 598 |
* the Geometry with which to compare this Geometry |
584 |
*
|
|
599 |
* |
|
585 | 600 |
* @return true if the two geometries overlap. |
586 |
*
|
|
601 |
* |
|
587 | 602 |
* @throws GeometryOperationNotSupportedException |
588 | 603 |
* @throws GeometryOperationException |
589 | 604 |
*/ |
... | ... | |
597 | 612 |
public boolean coveredBy(Geometry geometry) |
598 | 613 |
throws GeometryOperationNotSupportedException, |
599 | 614 |
GeometryOperationException; |
600 |
|
|
615 |
|
|
601 | 616 |
public boolean covers(Geometry geometry) |
602 | 617 |
throws GeometryOperationNotSupportedException, |
603 | 618 |
GeometryOperationException; |
604 |
|
|
619 |
|
|
605 | 620 |
public boolean crosses(Geometry geometry) |
606 | 621 |
throws GeometryOperationNotSupportedException, |
607 | 622 |
GeometryOperationException; |
... | ... | |
625 | 640 |
public Geometry snapTo(Geometry other, double snapTolerance) |
626 | 641 |
throws GeometryOperationNotSupportedException, |
627 | 642 |
GeometryOperationException; |
628 |
|
|
643 |
|
|
629 | 644 |
public boolean touches(Geometry geometry) |
630 | 645 |
throws GeometryOperationNotSupportedException, |
631 | 646 |
GeometryOperationException; |
... | ... | |
639 | 654 |
GeometryOperationException; |
640 | 655 |
|
641 | 656 |
public Point centroid() throws GeometryOperationNotSupportedException, GeometryOperationException; |
642 |
|
|
657 |
|
|
643 | 658 |
/** |
644 | 659 |
* This method returns a point which is inside the geometry. |
645 | 660 |
* This is useful for mathematical purposes but it is very unlikely |
646 | 661 |
* to be a suitable place for a label, for example. |
647 |
*
|
|
648 |
*
|
|
662 |
* |
|
663 |
* |
|
649 | 664 |
* @return an interior point |
650 | 665 |
* @throws GeometryOperationNotSupportedException |
651 | 666 |
* @throws GeometryOperationException |
... | ... | |
653 | 668 |
public Point getInteriorPoint() throws GeometryOperationNotSupportedException, GeometryOperationException; |
654 | 669 |
|
655 | 670 |
public double area() throws GeometryOperationNotSupportedException, GeometryOperationException; |
656 |
|
|
671 |
|
|
657 | 672 |
public double perimeter() throws GeometryOperationNotSupportedException, GeometryOperationException; |
658 | 673 |
|
659 |
|
|
660 |
|
|
661 |
|
|
674 |
|
|
675 |
|
|
676 |
|
|
662 | 677 |
/** |
663 | 678 |
* Rotates the geometry by radAngle radians using the given |
664 | 679 |
* coordinates as center of rotation. Rotating with a positive |
... | ... | |
666 | 681 |
* positive y axis. In most cases, we assume x increases |
667 | 682 |
* rightwards and y increases upwards, so in most cases, |
668 | 683 |
* a positive angle will mean counter-clockwise rotation. |
669 |
*
|
|
684 |
* |
|
670 | 685 |
* @param radAngle the amount of rotation, in radians |
671 | 686 |
* @param basex x coordinate of center of rotation |
672 | 687 |
* @param basey y coordinate of center of rotation |
673 | 688 |
*/ |
674 | 689 |
public void rotate(double radAngle, double basex, double basey); |
675 |
|
|
690 |
|
|
676 | 691 |
/** |
677 | 692 |
* Shifts geometry by given amount in x and y axes |
678 |
*
|
|
679 |
* @param dx
|
|
693 |
* |
|
694 |
* @param dx |
|
680 | 695 |
* @param dy |
681 | 696 |
*/ |
682 | 697 |
public void move(double dx, double dy); |
683 |
|
|
684 |
|
|
698 |
|
|
699 |
|
|
685 | 700 |
/** |
686 | 701 |
* Scales geometry in x and y axes by given scale factors |
687 | 702 |
* using the given point as center of projection. |
688 |
*
|
|
703 |
* |
|
689 | 704 |
* @param basePoint |
690 | 705 |
* @param sx scale factor in x axis |
691 | 706 |
* @param sy scale factor in y axis |
692 | 707 |
*/ |
693 | 708 |
public void scale(Point basePoint, double sx, double sy); |
694 |
|
|
709 |
|
|
695 | 710 |
/** |
696 | 711 |
* Check if the geometry is valid. |
697 |
*
|
|
712 |
* |
|
698 | 713 |
* @return true if the geometry is valid. |
699 | 714 |
*/ |
700 | 715 |
public boolean isValid(); |
701 |
|
|
716 |
|
|
702 | 717 |
/** |
703 | 718 |
* Check if the geometry is valid and returns the validation status. |
704 |
*
|
|
705 |
* @return the ValidationStatus
|
|
719 |
* |
|
720 |
* @return the ValidationStatus |
|
706 | 721 |
*/ |
707 | 722 |
public ValidationStatus getValidationStatus(); |
708 | 723 |
|
... | ... | |
710 | 725 |
* Try to fix the geometry and return the new geometry. |
711 | 726 |
* If the geometry is valid return the same geometry. |
712 | 727 |
* If the geometry is corrupt or can't fix it, return null. |
713 |
*
|
|
728 |
* |
|
714 | 729 |
* @return the new fixed geometry |
715 | 730 |
*/ |
716 | 731 |
public Geometry makeValid(); |
717 |
|
|
732 |
|
|
718 | 733 |
// |
719 | 734 |
// =============================================== |
720 | 735 |
// |
721 |
|
|
722 |
|
|
736 |
|
|
737 |
|
|
723 | 738 |
/** |
724 |
* @return the awt shape used to display the geometry. It
|
|
739 |
* @return the awt shape used to display the geometry. It |
|
725 | 740 |
* applies a tranformation before to return the coordinates |
726 | 741 |
* of the shape |
727 | 742 |
* @deprecated this class inherits of {@link Shape} by historical |
... | ... | |
729 | 744 |
* the {@link Shape} class but it will removed in a future. |
730 | 745 |
*/ |
731 | 746 |
public Shape getShape(AffineTransform affineTransform); |
732 |
|
|
747 |
|
|
733 | 748 |
/** |
734 |
* @return the awt shape used to display the geometry.
|
|
749 |
* @return the awt shape used to display the geometry. |
|
735 | 750 |
* @deprecated this class inherits of {@link Shape} by historical |
736 | 751 |
* reasons. This method has been added just to control the usage of |
737 | 752 |
* the {@link Shape} class but it will removed in a future. |
... | ... | |
740 | 755 |
|
741 | 756 |
/** |
742 | 757 |
* Returns this geometry's boundary rectangle. |
743 |
*
|
|
758 |
* |
|
744 | 759 |
* @deprecated use getEnvelope. |
745 | 760 |
* @return Boundary rectangle. |
746 | 761 |
*/ |
... | ... | |
749 | 764 |
/** |
750 | 765 |
* If applies an affine transformation and returns the GeneralPathXIterator |
751 | 766 |
* with this geometry's information. |
752 |
*
|
|
767 |
* |
|
753 | 768 |
* @param at |
754 | 769 |
* The transformation to apply. |
755 | 770 |
* @return The GeneralPathXIterator with this geometry's information. |
756 | 771 |
* @deprecated don't use PathIterator over geometries, use instead specific API for each operation. If not has API for that operation let the project team. |
757 |
*
|
|
772 |
* |
|
758 | 773 |
*/ |
759 | 774 |
public PathIterator getPathIterator(AffineTransform at); |
760 | 775 |
|
761 | 776 |
/** |
762 | 777 |
* It returns the handlers of the geometry, these they can be of two types |
763 | 778 |
* is straightening and of selection. |
764 |
*
|
|
779 |
* |
|
765 | 780 |
* @param type |
766 | 781 |
* Type of handlers. |
767 |
*
|
|
782 |
* |
|
768 | 783 |
* @deprecated don't use Handlers over geometries, use instead specific API for each operation. If not has API for that operation let the project team. |
769 | 784 |
* @return The handlers. |
770 | 785 |
*/ |
... | ... | |
774 | 789 |
/** |
775 | 790 |
* If applies an affine transformation and returns the GeneralPathXIterator |
776 | 791 |
* with this geometry's information. |
777 |
*
|
|
792 |
* |
|
778 | 793 |
* @param at |
779 | 794 |
* The affine transformation. |
780 | 795 |
* @param flatness |
781 |
*
|
|
796 |
* |
|
782 | 797 |
* @return The GeneralPathXIterator with this geometry's information. |
783 | 798 |
* @deprecated don't use PathIterator over geometries, use instead specific API for each operation. If not has API for that operation let the project team. |
784 | 799 |
*/ |
... | ... | |
787 | 802 |
/** |
788 | 803 |
* Useful to have the real shape behind the scenes. May be uses to edit it |
789 | 804 |
* knowing it it is a Circle, Ellipse, etc. |
790 |
*
|
|
805 |
* |
|
791 | 806 |
* @return The awt shape |
792 | 807 |
* @deprecated |
793 | 808 |
*/ |
... | ... | |
796 | 811 |
|
797 | 812 |
/** |
798 | 813 |
* Get GeneralPathIterator, to do registered operations to it. |
799 |
*
|
|
814 |
* |
|
800 | 815 |
* @return The GeneralPathX. |
801 | 816 |
* @deprecated don't use GeneralPathX over geometries, use instead specific API for each operation. If not has API for that operation let the project team. |
802 | 817 |
*/ |
803 | 818 |
public GeneralPathX getGeneralPath(); |
804 | 819 |
|
820 |
|
|
821 |
/** |
|
822 |
* Converts the geometry to be points and makes with them a multiPoint |
|
823 |
* |
|
824 |
* @return MultiPoint |
|
825 |
* @throws GeometryException |
|
826 |
*/ |
|
827 |
public MultiPoint toPoints() throws GeometryException; |
|
828 |
|
|
829 |
/** |
|
830 |
* Converts the geometry to be lines and makes with them a multiLine |
|
831 |
* @return |
|
832 |
* @throws GeometryException |
|
833 |
*/ |
|
834 |
public MultiLine toLines() throws GeometryException; |
|
835 |
|
|
836 |
/** |
|
837 |
* Converts the geometry to be polygons and makes with them a multiPolygon |
|
838 |
* @return |
|
839 |
* @throws GeometryException |
|
840 |
*/ |
|
841 |
public MultiPolygon toPolygons() throws GeometryException; |
|
842 |
|
|
843 |
public void flip() throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
844 |
|
|
845 |
public boolean ensureOrientation(boolean ccw) throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
846 |
|
|
847 |
public boolean out(Geometry geometry) throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
805 | 848 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/aggregate/MultiLine.java | ||
---|---|---|
13 | 13 |
* @author jjdelcerro |
14 | 14 |
*/ |
15 | 15 |
public interface MultiLine extends MultiCurve { |
16 |
public MultiPoint toPoints() throws GeometryException; |
|
17 | 16 |
|
18 |
public MultiLine toLines() throws GeometryException; |
|
19 |
|
|
20 |
public MultiPolygon toPolygons() throws GeometryException; |
|
21 | 17 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/aggregate/MultiPolygon.java | ||
---|---|---|
14 | 14 |
* @author jjdelcerro |
15 | 15 |
*/ |
16 | 16 |
public interface MultiPolygon extends MultiSurface { |
17 |
|
|
18 |
public MultiPoint toPoints() throws GeometryException; |
|
19 |
|
|
20 |
public MultiLine toLines() throws GeometryException; |
|
21 |
|
|
22 |
public MultiPolygon toPolygons() throws GeometryException; |
|
23 |
|
|
24 | 17 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/pom.xml | ||
---|---|---|
4 | 4 |
|
5 | 5 |
<modelVersion>4.0.0</modelVersion> |
6 | 6 |
<artifactId>org.gvsig.fmap.geometry</artifactId> |
7 |
<packaging>pom</packaging>
|
|
7 |
<packaging>pom</packaging> |
|
8 | 8 |
<name>${project.artifactId}</name> |
9 | 9 |
<parent> |
10 | 10 |
<groupId>org.gvsig</groupId> |
11 | 11 |
<artifactId>org.gvsig.desktop.compat.cdc</artifactId> |
12 | 12 |
<version>2.0.103-SNAPSHOT</version> |
13 |
</parent>
|
|
13 |
</parent> |
|
14 | 14 |
|
15 | 15 |
<modules> |
16 | 16 |
<module>org.gvsig.fmap.geometry.api</module> |
17 |
<module>org.gvsig.fmap.geometry.generalpath</module> |
|
18 |
<module>org.gvsig.fmap.geometry.operation</module> |
|
17 |
<!-- <module>org.gvsig.fmap.geometry.generalpath</module> |
|
18 |
<module>org.gvsig.fmap.geometry.operation</module> --> |
|
19 |
<module>org.gvsig.fmap.geometry.jts</module> |
|
20 |
<module>org.gvsig.fmap.geometry.operation.jts</module> |
|
19 | 21 |
</modules> |
20 | 22 |
|
21 | 23 |
<description>This project contains the geometry library used in gvSIG. </description> |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/curve/line/BaseLine2DM.java | ||
---|---|---|
112 | 112 |
* @see org.gvsig.fmap.geom.primitive.OrientablePrimitive#addVertex(double, double) |
113 | 113 |
*/ |
114 | 114 |
public void addVertex(double x, double y) { |
115 |
double m = 0; |
|
116 |
if(coordinates.size()>0){ |
|
117 |
MCoordinate coordinateAnt = (MCoordinate) coordinates.get(coordinates.size()-1); |
|
118 |
m = coordinateAnt.m + coordinateAnt.distance(JTSUtils.createMCoordinate(x, y, coordinateAnt.m)); |
|
119 |
} |
|
120 |
this.addVertex(new Point2DM(x, y, m)); |
|
115 |
this.addVertex(new Point2DM(x, y, 0)); |
|
121 | 116 |
} |
122 | 117 |
|
123 | 118 |
/* (non-Javadoc) |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/curve/line/BaseLine3DM.java | ||
---|---|---|
121 | 121 |
* @see org.gvsig.fmap.geom.primitive.OrientablePrimitive#addVertex(double, double, double) |
122 | 122 |
*/ |
123 | 123 |
public void addVertex(double x, double y, double z) { |
124 |
double m = 0; |
|
125 |
if (coordinates.size() > 0) { |
|
126 |
MCoordinate coordinateAnt = (MCoordinate) coordinates.get(coordinates.size() - 1); |
|
127 |
m = coordinateAnt.m + coordinateAnt.distance(JTSUtils.createMCoordinate(x, y, coordinateAnt.m)); |
|
128 |
} |
|
129 |
|
|
130 |
this.coordinates.add(new Point3DM(x, y, z, m).getJTSCoordinate()); |
|
131 |
|
|
124 |
this.coordinates.add(new Point3DM(x, y, z, 0).getJTSCoordinate()); |
|
132 | 125 |
} |
133 | 126 |
|
134 | 127 |
/* (non-Javadoc) |
Also available in: Unified diff