Revision 32924 branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/impl/Geometry2D.java
Geometry2D.java | ||
---|---|---|
38 | 38 |
import org.gvsig.fmap.geom.Geometry; |
39 | 39 |
import org.gvsig.fmap.geom.GeometryLocator; |
40 | 40 |
import org.gvsig.fmap.geom.GeometryManager; |
41 |
import org.gvsig.fmap.geom.Geometry.OPERATIONS; |
|
41 | 42 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
43 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
42 | 44 |
import org.gvsig.fmap.geom.handler.Handler; |
43 | 45 |
import org.gvsig.fmap.geom.operation.GeometryOperation; |
44 | 46 |
import org.gvsig.fmap.geom.operation.GeometryOperationContext; |
... | ... | |
48 | 50 |
import org.gvsig.fmap.geom.primitive.Envelope; |
49 | 51 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
50 | 52 |
import org.gvsig.fmap.geom.type.GeometryType; |
53 |
import org.gvsig.fmap.geom.util.Converter; |
|
51 | 54 |
import org.slf4j.Logger; |
52 | 55 |
import org.slf4j.LoggerFactory; |
53 | 56 |
|
... | ... | |
434 | 437 |
|
435 | 438 |
} |
436 | 439 |
|
440 |
|
|
441 |
private com.vividsolutions.jts.geom.Geometry getJTS() { |
|
442 |
return Converter.geometryToJts(this); |
|
443 |
} |
|
444 |
|
|
445 |
public byte[] convertToWKB() throws GeometryOperationNotSupportedException, |
|
446 |
GeometryOperationException { |
|
447 |
return (byte[]) this.invokeOperation(OPERATIONS.CONVERTTOWKB, null); |
|
448 |
} |
|
449 |
|
|
450 |
public String convertToWKT() throws GeometryOperationNotSupportedException, |
|
451 |
GeometryOperationException { |
|
452 |
return (String) this.invokeOperation(OPERATIONS.CONVERTTOWKT, null); |
|
453 |
} |
|
454 |
|
|
455 |
public Geometry buffer(double distance) |
|
456 |
throws GeometryOperationNotSupportedException, |
|
457 |
GeometryOperationException { |
|
458 |
// TODO: this method can be implemented throw invokeOperation |
|
459 |
try { |
|
460 |
return Converter.jtsToGeometry( getJTS().buffer(distance) ); |
|
461 |
} catch (CreateGeometryException e) { |
|
462 |
throw new GeometryOperationException(e); |
|
463 |
} |
|
464 |
} |
|
465 |
|
|
466 |
public boolean contains(Geometry geometry) |
|
467 |
throws GeometryOperationNotSupportedException, |
|
468 |
GeometryOperationException { |
|
469 |
// TODO: this method can be implemented throw invokeOperation |
|
470 |
return getJTS().contains(Converter.geometryToJts(geometry)); |
|
471 |
} |
|
472 |
|
|
473 |
public double distance(Geometry geometry) |
|
474 |
throws GeometryOperationNotSupportedException, |
|
475 |
GeometryOperationException { |
|
476 |
// TODO: this method can be implemented throw invokeOperation |
|
477 |
return getJTS().distance( Converter.geometryToJts(geometry)); |
|
478 |
} |
|
479 |
|
|
480 |
public boolean overlaps(Geometry geometry) |
|
481 |
throws GeometryOperationNotSupportedException, |
|
482 |
GeometryOperationException { |
|
483 |
// TODO: this method can be implemented throw invokeOperation |
|
484 |
return getJTS().overlaps(Converter.geometryToJts(geometry)); |
|
485 |
} |
|
486 |
|
|
487 |
public Geometry convexHull() throws GeometryOperationNotSupportedException, |
|
488 |
GeometryOperationException { |
|
489 |
// TODO: this method can be implemented throw invokeOperation |
|
490 |
try { |
|
491 |
return Converter.jtsToGeometry( getJTS().convexHull() ); |
|
492 |
} catch (CreateGeometryException e) { |
|
493 |
throw new GeometryOperationException(e); |
|
494 |
} |
|
495 |
} |
|
496 |
|
|
497 |
public boolean coveredBy(Geometry geometry) |
|
498 |
throws GeometryOperationNotSupportedException, |
|
499 |
GeometryOperationException { |
|
500 |
// TODO: this method can be implemented throw invokeOperation |
|
501 |
return getJTS().coveredBy( Converter.geometryToJts(geometry)); |
|
502 |
} |
|
503 |
|
|
504 |
public boolean crosses(Geometry geometry) |
|
505 |
throws GeometryOperationNotSupportedException, |
|
506 |
GeometryOperationException { |
|
507 |
// TODO: this method can be implemented throw invokeOperation |
|
508 |
return getJTS().crosses(Converter.geometryToJts(geometry)); |
|
509 |
} |
|
510 |
|
|
511 |
public Geometry difference(Geometry other) |
|
512 |
throws GeometryOperationNotSupportedException, |
|
513 |
GeometryOperationException { |
|
514 |
// TODO: this method can be implemented throw invokeOperation |
|
515 |
try { |
|
516 |
return Converter.jtsToGeometry( getJTS().difference( Converter.geometryToJts(other)) ); |
|
517 |
} catch (CreateGeometryException e) { |
|
518 |
throw new GeometryOperationException(e); |
|
519 |
} |
|
520 |
} |
|
521 |
|
|
522 |
public Geometry intersection(Geometry other) |
|
523 |
throws GeometryOperationNotSupportedException, |
|
524 |
GeometryOperationException { |
|
525 |
// TODO: this method can be implemented throw invokeOperation |
|
526 |
try { |
|
527 |
return Converter.jtsToGeometry( getJTS().intersection(Converter.geometryToJts(other)) ); |
|
528 |
} catch (CreateGeometryException e) { |
|
529 |
throw new GeometryOperationException(e); |
|
530 |
} |
|
531 |
} |
|
532 |
|
|
533 |
public boolean intersects(Geometry geometry) |
|
534 |
throws GeometryOperationNotSupportedException, |
|
535 |
GeometryOperationException { |
|
536 |
// TODO: this method can be implemented throw invokeOperation |
|
537 |
return getJTS().intersects(Converter.geometryToJts(geometry)); |
|
538 |
} |
|
539 |
|
|
540 |
public boolean touches(Geometry geometry) |
|
541 |
throws GeometryOperationNotSupportedException, |
|
542 |
GeometryOperationException { |
|
543 |
// TODO: this method can be implemented throw invokeOperation |
|
544 |
return getJTS().touches(Converter.geometryToJts(geometry)); |
|
545 |
} |
|
546 |
|
|
547 |
public Geometry union(Geometry other) |
|
548 |
throws GeometryOperationNotSupportedException, |
|
549 |
GeometryOperationException { |
|
550 |
// TODO: this method can be implemented throw invokeOperation |
|
551 |
try { |
|
552 |
return Converter.jtsToGeometry( getJTS().union(Converter.geometryToJts(other)) ); |
|
553 |
} catch (CreateGeometryException e) { |
|
554 |
throw new GeometryOperationException(e); |
|
555 |
} |
|
556 |
} |
|
557 |
|
|
558 |
public boolean disjoint(Geometry geometry) |
|
559 |
throws GeometryOperationNotSupportedException, |
|
560 |
GeometryOperationException { |
|
561 |
// TODO: this method can be implemented throw invokeOperation |
|
562 |
return getJTS().disjoint(Converter.geometryToJts(geometry)); |
|
563 |
} |
|
564 |
|
|
565 |
public boolean within(Geometry geometry) |
|
566 |
throws GeometryOperationNotSupportedException, |
|
567 |
GeometryOperationException { |
|
568 |
// TODO: this method can be implemented throw invokeOperation |
|
569 |
return getJTS().within(Converter.geometryToJts(geometry)); |
|
570 |
} |
|
571 |
|
|
572 |
|
|
573 |
|
|
574 |
|
|
437 | 575 |
} |
438 | 576 |
|
Also available in: Unified diff