Revision 47432 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/AbstractLine.java
AbstractLine.java | ||
---|---|---|
23 | 23 |
package org.gvsig.fmap.geom.jts.primitive.curve.line; |
24 | 24 |
|
25 | 25 |
import com.vividsolutions.jts.geom.Coordinate; |
26 |
import com.vividsolutions.jts.geom.CoordinateSequence; |
|
26 | 27 |
import java.awt.Shape; |
27 | 28 |
import java.awt.geom.AffineTransform; |
28 | 29 |
import java.awt.geom.GeneralPath; |
... | ... | |
34 | 35 |
import org.gvsig.fmap.geom.Geometry; |
35 | 36 |
import org.gvsig.fmap.geom.jts.gputils.DefaultGeneralPathX; |
36 | 37 |
import org.gvsig.fmap.geom.jts.gputils.GeneralPathXIterator; |
38 |
import org.gvsig.fmap.geom.jts.mgeom.MCoordinate; |
|
37 | 39 |
import org.gvsig.fmap.geom.jts.primitive.curve.AbstractCurve; |
38 | 40 |
import org.gvsig.fmap.geom.jts.primitive.point.Point2D; |
39 | 41 |
import org.gvsig.fmap.geom.jts.primitive.point.PointJTS; |
... | ... | |
536 | 538 |
} |
537 | 539 |
|
538 | 540 |
@Override |
541 |
public Geometry force2DM() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
542 |
if(this instanceof Line2DM){ |
|
543 |
return this; |
|
544 |
} |
|
545 |
ArrayListCoordinateSequence coordinates2DM = new ArrayListCoordinateSequence(coordinates.size()); |
|
546 |
for (Coordinate coordinate : this.coordinates) { |
|
547 |
coordinates2DM.add(MCoordinate.create2dWithMeasure( |
|
548 |
coordinate.x, |
|
549 |
coordinate.y, |
|
550 |
(coordinate instanceof MCoordinate)?coordinate.getOrdinate(CoordinateSequence.M):0)); |
|
551 |
} |
|
552 |
Line2DM line = new Line2DM(coordinates2DM); |
|
553 |
line.setProjection(this.getProjection()); |
|
554 |
return line; |
|
555 |
} |
|
556 |
|
|
557 |
@Override |
|
558 |
public Geometry force3D() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
559 |
ArrayListCoordinateSequence coordinates3D = new ArrayListCoordinateSequence(coordinates.size()); |
|
560 |
for (Coordinate coordinate : this.coordinates) { |
|
561 |
coordinates3D.add(new Coordinate( |
|
562 |
coordinate.x, |
|
563 |
coordinate.y, |
|
564 |
Double.isNaN(coordinate.z)?0:coordinate.z |
|
565 |
)); |
|
566 |
} |
|
567 |
Line3D line = new Line3D(coordinates3D); |
|
568 |
line.setProjection(this.getProjection()); |
|
569 |
return line; |
|
570 |
} |
|
571 |
|
|
572 |
@Override |
|
573 |
public Geometry force3DM() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
574 |
ArrayListCoordinateSequence coordinates3DM = new ArrayListCoordinateSequence(coordinates.size()); |
|
575 |
for (Coordinate coordinate : this.coordinates) { |
|
576 |
coordinates3DM.add(MCoordinate.create3dWithMeasure( |
|
577 |
coordinate.x, |
|
578 |
coordinate.y, |
|
579 |
(Double.isNaN(coordinate.z))?0:coordinate.z, |
|
580 |
(coordinate instanceof MCoordinate)?coordinate.getOrdinate(CoordinateSequence.M):0 |
|
581 |
)); |
|
582 |
} |
|
583 |
Line3DM line = new Line3DM(coordinates3DM); |
|
584 |
line.setProjection(this.getProjection()); |
|
585 |
return line; |
|
586 |
} |
|
587 |
|
|
588 |
|
|
589 |
@Override |
|
539 | 590 |
public int size() { |
540 | 591 |
return this.getNumVertices(); |
541 | 592 |
} |
Also available in: Unified diff