Revision 45748 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/AbstractGeometry.java
AbstractGeometry.java | ||
---|---|---|
22 | 22 |
*/ |
23 | 23 |
package org.gvsig.fmap.geom.jts; |
24 | 24 |
|
25 |
import java.awt.Rectangle; |
|
26 |
import java.awt.Shape; |
|
27 |
import java.awt.geom.AffineTransform; |
|
28 |
import java.awt.geom.Rectangle2D; |
|
29 |
|
|
30 | 25 |
import com.vividsolutions.jts.algorithm.CGAlgorithms; |
31 | 26 |
import com.vividsolutions.jts.geom.Coordinate; |
27 |
import com.vividsolutions.jts.operation.buffer.BufferParameters; |
|
32 | 28 |
import com.vividsolutions.jts.operation.distance.DistanceOp; |
33 | 29 |
import com.vividsolutions.jts.operation.overlay.snap.GeometrySnapper; |
34 | 30 |
import com.vividsolutions.jts.operation.valid.IsValidOp; |
35 | 31 |
import com.vividsolutions.jts.operation.valid.TopologyValidationError; |
32 |
import java.awt.Rectangle; |
|
33 |
import java.awt.Shape; |
|
34 |
import java.awt.geom.AffineTransform; |
|
35 |
import java.awt.geom.Rectangle2D; |
|
36 | 36 |
import org.apache.commons.codec.binary.Hex; |
37 | 37 |
import org.apache.commons.lang3.StringUtils; |
38 | 38 |
import org.cresques.cts.IProjection; |
39 | 39 |
import org.gvsig.fmap.crs.CRSFactory; |
40 |
|
|
41 |
import org.slf4j.Logger; |
|
42 |
import org.slf4j.LoggerFactory; |
|
43 |
|
|
44 | 40 |
import org.gvsig.fmap.geom.Geometry; |
45 | 41 |
import org.gvsig.fmap.geom.GeometryLocator; |
46 | 42 |
import org.gvsig.fmap.geom.GeometryManager; |
... | ... | |
61 | 57 |
import org.gvsig.fmap.geom.primitive.OrientableSurface; |
62 | 58 |
import org.gvsig.fmap.geom.primitive.Point; |
63 | 59 |
import org.gvsig.fmap.geom.type.GeometryType; |
60 |
import org.slf4j.Logger; |
|
61 |
import org.slf4j.LoggerFactory; |
|
64 | 62 |
|
65 | 63 |
/** |
66 | 64 |
* @author gvSIG Team |
... | ... | |
82 | 80 |
|
83 | 81 |
/** |
84 | 82 |
* |
83 |
* @param type |
|
84 |
* @param subtype |
|
85 | 85 |
*/ |
86 | 86 |
public AbstractGeometry(int type, int subtype) { |
87 | 87 |
try { |
... | ... | |
96 | 96 |
this.geometryType = geometryType; |
97 | 97 |
} |
98 | 98 |
|
99 |
@Override |
|
99 | 100 |
public GeometryType getGeometryType() { |
100 | 101 |
return geometryType; |
101 | 102 |
} |
... | ... | |
109 | 110 |
* |
110 | 111 |
* @see org.gvsig.fmap.geom.Geometry#contains(org.gvsig.fmap.geom.Geometry) |
111 | 112 |
*/ |
113 |
@Override |
|
112 | 114 |
public boolean contains(Geometry geometry) throws GeometryOperationNotSupportedException, |
113 | 115 |
GeometryOperationException { |
114 | 116 |
if (!(geometry instanceof GeometryJTS)) { |
... | ... | |
122 | 124 |
* |
123 | 125 |
* @see java.lang.Comparable#compareTo(java.lang.Object) |
124 | 126 |
*/ |
127 |
@Override |
|
125 | 128 |
public int compareTo(Object o) { |
126 | 129 |
return getJTS().compareTo(((GeometryJTS) o).getJTS()); |
127 | 130 |
} |
... | ... | |
131 | 134 |
* |
132 | 135 |
* @see java.awt.Shape#contains(double, double) |
133 | 136 |
*/ |
137 |
@Override |
|
134 | 138 |
public boolean contains(double x, double y) { |
135 | 139 |
notifyDeprecated("Calling deprecated method of geometry contains from shape interface"); |
136 | 140 |
Shape shp = getShape(); |
... | ... | |
142 | 146 |
* |
143 | 147 |
* @see java.awt.Shape#intersects(double, double, double, double) |
144 | 148 |
*/ |
149 |
@Override |
|
145 | 150 |
public boolean intersects(double x, double y, double w, double h) { |
146 | 151 |
|
147 | 152 |
notifyDeprecated("Calling deprecated method of geometry intersects from shape interface"); |
... | ... | |
154 | 159 |
* |
155 | 160 |
* @see java.awt.Shape#contains(double, double, double, double) |
156 | 161 |
*/ |
162 |
@Override |
|
157 | 163 |
public boolean contains(double x, double y, double w, double h) { |
158 | 164 |
notifyDeprecated("Calling deprecated method of geometry contains from shape interface"); |
159 | 165 |
Shape shp = this.getShape(); |
... | ... | |
165 | 171 |
* |
166 | 172 |
* @see java.awt.Shape#contains(java.awt.geom.Point2D) |
167 | 173 |
*/ |
174 |
@Override |
|
168 | 175 |
public boolean contains(java.awt.geom.Point2D p) { |
169 | 176 |
notifyDeprecated("Calling deprecated method of geometry contains from shape interface"); |
170 | 177 |
Shape shp = this.getShape(); |
... | ... | |
176 | 183 |
* |
177 | 184 |
* @see java.awt.Shape#contains(java.awt.geom.Rectangle2D) |
178 | 185 |
*/ |
186 |
@Override |
|
179 | 187 |
public boolean contains(Rectangle2D r) { |
180 | 188 |
notifyDeprecated("Calling deprecated method of geometry contains from shape interface"); |
181 | 189 |
Shape shp = this.getShape(); |
... | ... | |
187 | 195 |
* |
188 | 196 |
* @see org.gvsig.fmap.geom.Geometry#distance(org.gvsig.fmap.geom.Geometry) |
189 | 197 |
*/ |
198 |
@Override |
|
190 | 199 |
public double distance(org.gvsig.fmap.geom.Geometry other) throws GeometryOperationNotSupportedException, |
191 | 200 |
GeometryOperationException { |
192 | 201 |
return getJTS().distance(((GeometryJTS) other).getJTS()); |
... | ... | |
199 | 208 |
* org.gvsig.fmap.geom.Geometry#isWithinDistance(org.gvsig.fmap.geom.Geometry |
200 | 209 |
* , double) |
201 | 210 |
*/ |
211 |
@Override |
|
202 | 212 |
public boolean isWithinDistance(org.gvsig.fmap.geom.Geometry other, double distance) |
203 | 213 |
throws GeometryOperationNotSupportedException, GeometryOperationException { |
204 | 214 |
return com.vividsolutions.jts.operation.distance.DistanceOp.isWithinDistance(this.getJTS(), |
... | ... | |
210 | 220 |
* |
211 | 221 |
* @see org.gvsig.fmap.geom.Geometry#overlaps(org.gvsig.fmap.geom.Geometry) |
212 | 222 |
*/ |
223 |
@Override |
|
213 | 224 |
public boolean overlaps(org.gvsig.fmap.geom.Geometry geometry) throws GeometryOperationNotSupportedException, |
214 | 225 |
GeometryOperationException { |
215 | 226 |
// TODO: this method can be implemented throw invokeOperation |
216 | 227 |
return getJTS().overlaps(((GeometryJTS) geometry).getJTS()); |
217 | 228 |
} |
218 | 229 |
|
230 |
@Override |
|
219 | 231 |
public boolean coveredBy(Geometry geometry) throws GeometryOperationNotSupportedException, |
220 | 232 |
GeometryOperationException { |
221 | 233 |
|
222 | 234 |
return getJTS().coveredBy(((GeometryJTS) geometry).getJTS()); |
223 | 235 |
} |
224 | 236 |
|
237 |
@Override |
|
225 | 238 |
public boolean covers(Geometry geometry) throws GeometryOperationNotSupportedException, GeometryOperationException { |
226 | 239 |
// TODO: this method can be implemented throw invokeOperation |
227 | 240 |
return getJTS().covers(((GeometryJTS) geometry).getJTS()); |
228 | 241 |
|
229 | 242 |
} |
230 | 243 |
|
244 |
@Override |
|
231 | 245 |
public boolean crosses(Geometry geometry) throws GeometryOperationNotSupportedException, GeometryOperationException { |
232 | 246 |
// TODO: this method can be implemented throw invokeOperation |
233 | 247 |
return getJTS().crosses(((GeometryJTS) geometry).getJTS()); |
234 | 248 |
} |
235 | 249 |
|
250 |
@Override |
|
236 | 251 |
public boolean intersects(Geometry geometry) throws GeometryOperationNotSupportedException, |
237 | 252 |
GeometryOperationException { |
238 | 253 |
return getJTS().intersects(((GeometryJTS) geometry).getJTS()); |
239 | 254 |
} |
240 | 255 |
|
256 |
@Override |
|
241 | 257 |
public boolean touches(Geometry geometry) throws GeometryOperationNotSupportedException, GeometryOperationException { |
242 | 258 |
// TODO: this method can be implemented throw invokeOperation |
243 | 259 |
return getJTS().touches(((GeometryJTS) geometry).getJTS()); |
244 | 260 |
} |
245 | 261 |
|
262 |
@Override |
|
246 | 263 |
public boolean disjoint(Geometry geometry) throws GeometryOperationNotSupportedException, |
247 | 264 |
GeometryOperationException { |
248 | 265 |
// TODO: this method can be implemented throw invokeOperation |
249 | 266 |
return getJTS().disjoint(((GeometryJTS) geometry).getJTS()); |
250 | 267 |
} |
251 | 268 |
|
269 |
@Override |
|
252 | 270 |
public boolean within(Geometry geometry) throws GeometryOperationNotSupportedException, GeometryOperationException { |
253 | 271 |
// TODO: this method can be implemented throw invokeOperation |
254 | 272 |
return getJTS().within(((GeometryJTS) geometry).getJTS()); |
255 | 273 |
} |
256 | 274 |
|
275 |
@Override |
|
257 | 276 |
public double area() throws GeometryOperationNotSupportedException, GeometryOperationException { |
258 | 277 |
return getJTS().getArea(); |
259 | 278 |
} |
260 | 279 |
|
280 |
@Override |
|
261 | 281 |
public double perimeter() throws GeometryOperationNotSupportedException, GeometryOperationException { |
262 | 282 |
return getJTS().getLength(); |
263 | 283 |
} |
... | ... | |
267 | 287 |
* |
268 | 288 |
* @see org.gvsig.fmap.geom.Geometry#intersects(java.awt.geom.Rectangle2D) |
269 | 289 |
*/ |
290 |
@Override |
|
270 | 291 |
public boolean intersects(Rectangle2D r) { |
271 | 292 |
double x = r.getMinX(); |
272 | 293 |
double y = r.getMinY(); |
... | ... | |
282 | 303 |
* @see org.gvsig.fmap.geom.Geometry#fastIntersects(double, double, double, |
283 | 304 |
* double) |
284 | 305 |
*/ |
306 |
@Override |
|
285 | 307 |
public boolean fastIntersects(double x, double y, double w, double h) { |
286 |
com.vividsolutions.jts.geom.Geometry rect = null;
|
|
308 |
com.vividsolutions.jts.geom.Geometry rect;
|
|
287 | 309 |
com.vividsolutions.jts.geom.Coordinate[] coord = new com.vividsolutions.jts.geom.Coordinate[5]; |
288 | 310 |
coord[0] = new com.vividsolutions.jts.geom.Coordinate(x, y); |
289 | 311 |
coord[1] = new com.vividsolutions.jts.geom.Coordinate(x + w, y); |
... | ... | |
300 | 322 |
* |
301 | 323 |
* @see org.gvsig.fmap.geom.Geometry#getEnvelope() |
302 | 324 |
*/ |
325 |
@Override |
|
303 | 326 |
public Envelope getEnvelope() { |
304 | 327 |
if (is3D()) { |
305 | 328 |
Coordinate[] coordinates = getJTS().getCoordinates(); |
... | ... | |
316 | 339 |
double y; |
317 | 340 |
double z; |
318 | 341 |
|
319 |
for (int i = 0; i < coordinates.length; i++) {
|
|
320 |
x = coordinates[i].x;
|
|
321 |
y = coordinates[i].y;
|
|
322 |
z = coordinates[i].z;
|
|
342 |
for (Coordinate coordinate : coordinates) {
|
|
343 |
x = coordinate.x; |
|
344 |
y = coordinate.y; |
|
345 |
z = coordinate.z; |
|
323 | 346 |
minx = Math.min(x, minx); |
324 | 347 |
miny = Math.min(y, miny); |
325 | 348 |
minz = Math.min(z, minz); |
... | ... | |
345 | 368 |
* |
346 | 369 |
* @see org.gvsig.fmap.geom.Geometry#isSimple() |
347 | 370 |
*/ |
371 |
@Override |
|
348 | 372 |
public boolean isSimple() { |
349 | 373 |
return this.getJTS().isSimple(); |
350 | 374 |
} |
... | ... | |
354 | 378 |
* |
355 | 379 |
* @see org.gvsig.fmap.geom.Geometry#isCCW() |
356 | 380 |
*/ |
381 |
@Override |
|
357 | 382 |
public boolean isCCW() throws GeometryOperationNotSupportedException, GeometryOperationException { |
358 | 383 |
return CGAlgorithms.isCCW(this.getJTS().getCoordinates()); |
359 | 384 |
} |
... | ... | |
364 | 389 |
* @see org.gvsig.fmap.geom.Geometry#invokeOperation(int, |
365 | 390 |
* org.gvsig.fmap.geom.operation.GeometryOperationContext) |
366 | 391 |
*/ |
392 |
@Override |
|
367 | 393 |
public Object invokeOperation(int index, GeometryOperationContext ctx) |
368 | 394 |
throws GeometryOperationNotSupportedException, GeometryOperationException { |
369 | 395 |
return getManager().invokeOperation(index, this, ctx); |
... | ... | |
376 | 402 |
* @see org.gvsig.fmap.geom.Geometry#invokeOperation(java.lang.String, |
377 | 403 |
* org.gvsig.fmap.geom.operation.GeometryOperationContext) |
378 | 404 |
*/ |
405 |
@Override |
|
379 | 406 |
public Object invokeOperation(String opName, GeometryOperationContext ctx) |
380 | 407 |
throws GeometryOperationNotSupportedException, GeometryOperationException { |
381 | 408 |
return getManager().invokeOperation(opName, this, ctx); |
... | ... | |
387 | 414 |
* |
388 | 415 |
* @see org.gvsig.fmap.geom.Geometry#getType() |
389 | 416 |
*/ |
417 |
@Override |
|
390 | 418 |
public int getType() { |
391 | 419 |
return this.getGeometryType().getType(); |
392 | 420 |
} |
... | ... | |
500 | 528 |
|
501 | 529 |
} |
502 | 530 |
|
531 |
@Override |
|
503 | 532 |
public byte[] convertToEWKB() throws GeometryOperationNotSupportedException, GeometryOperationException { |
504 | 533 |
try { |
505 | 534 |
return new PostGISEWKBEncoder().encode(this); |
... | ... | |
509 | 538 |
|
510 | 539 |
} |
511 | 540 |
|
541 |
@Override |
|
512 | 542 |
public byte[] convertToEWKB(int srs) throws GeometryOperationNotSupportedException, GeometryOperationException { |
513 | 543 |
/* |
514 | 544 |
* No se sabe si la especificaci?n de OGC soporta SRS. OGCWKBEncoder no. |
... | ... | |
521 | 551 |
} |
522 | 552 |
} |
523 | 553 |
|
554 |
@Override |
|
524 | 555 |
public byte[] convertToEWKBForcingType(int srs, int type) throws GeometryOperationNotSupportedException, |
525 | 556 |
GeometryOperationException { |
526 | 557 |
/* |
... | ... | |
545 | 576 |
public String convertToWKT() throws GeometryOperationNotSupportedException, GeometryOperationException { |
546 | 577 |
int subType = getGeometryType().getSubType(); |
547 | 578 |
|
548 |
EWKTWriter writer = null; |
|
579 |
EWKTWriter writer; // = null;
|
|
549 | 580 |
|
550 | 581 |
switch (subType) { |
551 | 582 |
case Geometry.SUBTYPES.GEOM3D: |
... | ... | |
583 | 614 |
} |
584 | 615 |
return JTSUtils.createGeometry(this.getProjection(), getJTS().buffer(distance)); |
585 | 616 |
} |
617 |
|
|
618 |
|
|
619 |
@Override |
|
620 |
public org.gvsig.fmap.geom.Geometry buffer(double distance, int joinStyle, boolean capButt) throws GeometryOperationNotSupportedException, |
|
621 |
GeometryOperationException { |
|
622 |
if( distance==0 ) { |
|
623 |
return this; |
|
624 |
} |
|
625 |
|
|
626 |
int quadrantSegments = BufferParameters.DEFAULT_QUADRANT_SEGMENTS; |
|
627 |
switch(joinStyle){ |
|
628 |
case JOIN_STYLE_ROUND: |
|
629 |
quadrantSegments = BufferParameters.DEFAULT_QUADRANT_SEGMENTS; |
|
630 |
break; |
|
631 |
case JOIN_STYLE_MITRE: |
|
632 |
quadrantSegments = - (int) BufferParameters.DEFAULT_MITRE_LIMIT; |
|
633 |
break; |
|
634 |
case JOIN_STYLE_BEVEL: |
|
635 |
quadrantSegments = 0; |
|
636 |
break; |
|
637 |
default: |
|
638 |
throw new IllegalArgumentException("Invalid jointStyle "+joinStyle); |
|
639 |
} |
|
640 |
|
|
641 |
return JTSUtils.createGeometry(this.getProjection(), getJTS().buffer( |
|
642 |
distance, |
|
643 |
quadrantSegments, |
|
644 |
capButt ? BufferParameters.CAP_FLAT : BufferParameters.CAP_ROUND |
|
645 |
)); |
|
646 |
} |
|
586 | 647 |
|
587 | 648 |
/* |
588 | 649 |
* (non-Javadoc) |
... | ... | |
590 | 651 |
* @see org.gvsig.fmap.geom.Geometry#snapTo(org.gvsig.fmap.geom.Geometry, |
591 | 652 |
* double) |
592 | 653 |
*/ |
654 |
@Override |
|
593 | 655 |
public org.gvsig.fmap.geom.Geometry snapTo(org.gvsig.fmap.geom.Geometry other, double snapTolerance) |
594 | 656 |
throws GeometryOperationNotSupportedException, GeometryOperationException { |
595 |
Geometry result = null; |
|
657 |
Geometry result; // = null;
|
|
596 | 658 |
GeometrySnapper snapper = new GeometrySnapper(getJTS()); |
597 | 659 |
com.vividsolutions.jts.geom.Geometry jts_result = snapper.snapTo(((GeometryJTS) other).getJTS(), snapTolerance); |
598 | 660 |
result = JTSUtils.createGeometry(this.getProjection(), jts_result); |
... | ... | |
604 | 666 |
* |
605 | 667 |
* @see org.gvsig.fmap.geom.Geometry#getInteriorPoint() |
606 | 668 |
*/ |
669 |
@Override |
|
607 | 670 |
public Point getInteriorPoint() throws GeometryOperationNotSupportedException, GeometryOperationException { |
608 | 671 |
|
609 | 672 |
com.vividsolutions.jts.geom.Geometry geometry = getJTS(); |
... | ... | |
617 | 680 |
* |
618 | 681 |
* @see org.gvsig.fmap.geom.Geometry#isValid() |
619 | 682 |
*/ |
683 |
@Override |
|
620 | 684 |
public boolean isValid() { |
621 | 685 |
return getJTS().isValid(); |
622 | 686 |
} |
... | ... | |
624 | 688 |
@Override |
625 | 689 |
public ValidationStatus getValidationStatus() { |
626 | 690 |
DefaultValidationStatus status = new DefaultValidationStatus(ValidationStatus.VALID, null); |
627 |
com.vividsolutions.jts.geom.Geometry jtsgeom = null; |
|
691 |
com.vividsolutions.jts.geom.Geometry jtsgeom; // = null;
|
|
628 | 692 |
try { |
629 | 693 |
jtsgeom = this.getJTS(); |
630 | 694 |
IsValidOp validOp = new IsValidOp(jtsgeom); |
... | ... | |
656 | 720 |
* |
657 | 721 |
* @see org.gvsig.fmap.geom.Geometry#makeValid() |
658 | 722 |
*/ |
723 |
@Override |
|
659 | 724 |
public org.gvsig.fmap.geom.Geometry makeValid() { |
660 | 725 |
try { |
661 | 726 |
ValidationStatus vs = this.getValidationStatus(); |
662 | 727 |
if (vs.isValid()) { |
663 | 728 |
return this; |
664 | 729 |
} |
665 |
Geometry g = null; |
|
730 |
Geometry g; // = null;
|
|
666 | 731 |
switch (vs.getStatusCode()) { |
667 | 732 |
case Geometry.ValidationStatus.RING_SELF_INTERSECTION: |
668 | 733 |
case Geometry.ValidationStatus.SELF_INTERSECTION: |
... | ... | |
699 | 764 |
* |
700 | 765 |
* @see org.gvsig.fmap.geom.Geometry#getBounds2D() |
701 | 766 |
*/ |
767 |
@Override |
|
702 | 768 |
public Rectangle2D getBounds2D() { |
703 | 769 |
com.vividsolutions.jts.geom.Envelope envInternal = getJTS().getEnvelopeInternal(); |
704 | 770 |
return new Rectangle2D.Double(envInternal.getMinX(), envInternal.getMinY(), envInternal.getWidth(), |
... | ... | |
710 | 776 |
* |
711 | 777 |
* @see java.awt.Shape#getBounds() |
712 | 778 |
*/ |
779 |
@Override |
|
713 | 780 |
public Rectangle getBounds() { |
714 | 781 |
return this.getShape().getBounds(); |
715 | 782 |
} |
... | ... | |
719 | 786 |
* |
720 | 787 |
* @see org.gvsig.fmap.geom.Geometry#getInternalShape() |
721 | 788 |
*/ |
789 |
@Override |
|
722 | 790 |
public Shape getInternalShape() { |
723 | 791 |
return getShape(); |
724 | 792 |
} |
725 | 793 |
|
794 |
@Override |
|
726 | 795 |
public void rotate(double radAngle, double basex, double basey) { |
727 | 796 |
|
728 | 797 |
AffineTransform at = new AffineTransform(); |
... | ... | |
730 | 799 |
this.transform(at); |
731 | 800 |
} |
732 | 801 |
|
802 |
@Override |
|
733 | 803 |
public void move(double dx, double dy) { |
734 | 804 |
|
735 | 805 |
AffineTransform at = new AffineTransform(); |
... | ... | |
737 | 807 |
this.transform(at); |
738 | 808 |
} |
739 | 809 |
|
810 |
@Override |
|
740 | 811 |
public void scale(Point basePoint, double sx, double sy) { |
741 | 812 |
|
742 | 813 |
AffineTransform at = new AffineTransform(); |
... | ... | |
746 | 817 |
this.transform(at); |
747 | 818 |
} |
748 | 819 |
|
820 |
@Override |
|
749 | 821 |
public Geometry[] closestPoints(Geometry other) throws GeometryOperationNotSupportedException, |
750 | 822 |
GeometryOperationException { |
751 |
Point[] points = null;
|
|
823 |
Point[] points; |
|
752 | 824 |
|
753 | 825 |
Coordinate[] jts_points = DistanceOp.nearestPoints(getJTS(), ((GeometryJTS) other).getJTS()); |
754 | 826 |
points = new Point[jts_points.length]; |
... | ... | |
763 | 835 |
return (Geometry[]) points; |
764 | 836 |
} |
765 | 837 |
|
838 |
@Override |
|
766 | 839 |
public Geometry convexHull() throws GeometryOperationNotSupportedException, GeometryOperationException { |
767 | 840 |
|
768 | 841 |
return JTSUtils.createGeometry(this.getProjection(), getJTS().convexHull()); |
769 | 842 |
} |
770 | 843 |
|
844 |
@Override |
|
771 | 845 |
public Geometry difference(Geometry other) throws GeometryOperationNotSupportedException, |
772 | 846 |
GeometryOperationException { |
773 | 847 |
return JTSUtils.createGeometry(this.getProjection(), getJTS().difference(((GeometryJTS) other).getJTS())); |
774 | 848 |
} |
775 | 849 |
|
850 |
@Override |
|
776 | 851 |
public Geometry intersection(Geometry other) throws GeometryOperationNotSupportedException, |
777 | 852 |
GeometryOperationException { |
778 | 853 |
return JTSUtils.createGeometry(this.getProjection(), getJTS().intersection(((GeometryJTS) other).getJTS())); |
779 | 854 |
} |
780 | 855 |
|
856 |
@Override |
|
781 | 857 |
public Geometry union(Geometry other) throws GeometryOperationNotSupportedException, GeometryOperationException { |
782 | 858 |
return JTSUtils.createGeometry(this.getProjection(), getJTS().union(((GeometryJTS) other).getJTS())); |
783 | 859 |
} |
784 | 860 |
|
861 |
@Override |
|
785 | 862 |
public org.gvsig.fmap.geom.primitive.Point centroid() throws GeometryOperationNotSupportedException, |
786 | 863 |
GeometryOperationException { |
787 | 864 |
try { |
... | ... | |
797 | 874 |
} |
798 | 875 |
|
799 | 876 |
|
800 |
/* (non-Javadoc) |
|
801 |
* @see org.gvsig.fmap.geom.jts.GeometryJTS#ensureOrientation(boolean) |
|
802 |
*/ |
|
877 |
@Override |
|
803 | 878 |
public boolean ensureOrientation(boolean ccw) throws GeometryOperationNotSupportedException, GeometryOperationException { |
804 | 879 |
if (ccw != isCCW()) { |
805 | 880 |
flip(); |
... | ... | |
811 | 886 |
/* (non-Javadoc) |
812 | 887 |
* @see org.gvsig.fmap.geom.jts.GeometryJTS#out(org.gvsig.fmap.geom.Geometry) |
813 | 888 |
*/ |
889 |
@Override |
|
814 | 890 |
public boolean out(Geometry geometry) throws GeometryOperationNotSupportedException, GeometryOperationException { |
815 | 891 |
GeometryJTS otherJtsGeom = (GeometryJTS) geometry; |
816 | 892 |
return (!contains(otherJtsGeom) && !intersects(otherJtsGeom)); |
... | ... | |
827 | 903 |
return false; |
828 | 904 |
} |
829 | 905 |
|
906 |
@Override |
|
830 | 907 |
public String toString() { |
831 | 908 |
return this.getGeometryType().getFullName(); |
832 | 909 |
} |
Also available in: Unified diff