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/spline/AbstractSpline.java
AbstractSpline.java | ||
---|---|---|
22 | 22 |
*/ |
23 | 23 |
package org.gvsig.fmap.geom.jts.primitive.curve.spline; |
24 | 24 |
|
25 |
import com.vividsolutions.jts.geom.Coordinate; |
|
26 |
import com.vividsolutions.jts.geom.CoordinateSequence; |
|
25 | 27 |
import java.awt.Shape; |
26 | 28 |
import java.awt.geom.AffineTransform; |
27 | 29 |
import java.awt.geom.PathIterator; |
28 | 30 |
import java.util.Collections; |
29 |
|
|
30 |
import com.vividsolutions.jts.geom.Coordinate; |
|
31 |
|
|
32 | 31 |
import org.apache.commons.lang3.StringUtils; |
33 | 32 |
import org.cresques.cts.ICoordTrans; |
34 | 33 |
import org.gvsig.fmap.geom.Geometry; |
35 |
|
|
36 | 34 |
import org.gvsig.fmap.geom.jts.gputils.DefaultGeneralPathX; |
37 | 35 |
import org.gvsig.fmap.geom.jts.gputils.GeneralPathXIterator; |
36 |
import org.gvsig.fmap.geom.jts.mgeom.MCoordinate; |
|
38 | 37 |
import org.gvsig.fmap.geom.jts.primitive.curve.AbstractCurve; |
39 | 38 |
import org.gvsig.fmap.geom.jts.primitive.point.Point2D; |
40 | 39 |
import org.gvsig.fmap.geom.jts.primitive.point.PointJTS; |
... | ... | |
433 | 432 |
s.setProjection(this.getProjection()); |
434 | 433 |
return s; |
435 | 434 |
} |
435 |
|
|
436 |
@Override |
|
437 |
public Geometry force2DM() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
438 |
ArrayListCoordinateSequence coordinates2DM = new ArrayListCoordinateSequence(coordinates.size()); |
|
439 |
for (Coordinate coordinate : this.coordinates) { |
|
440 |
coordinates2DM.add(MCoordinate.create2dWithMeasure( |
|
441 |
coordinate.x, |
|
442 |
coordinate.y, |
|
443 |
(coordinate instanceof MCoordinate)?coordinate.getOrdinate(CoordinateSequence.M):0 |
|
444 |
)); |
|
445 |
} |
|
446 |
Spline2DM s = new Spline2DM(coordinates2DM); |
|
447 |
s.setProjection(this.getProjection()); |
|
448 |
return s; |
|
449 |
} |
|
436 | 450 |
|
451 |
@Override |
|
452 |
public Geometry force3D() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
453 |
ArrayListCoordinateSequence coordinates3D = new ArrayListCoordinateSequence(coordinates.size()); |
|
454 |
for (Coordinate coordinate : this.coordinates) { |
|
455 |
coordinates3D.add(new Coordinate( |
|
456 |
coordinate.x, |
|
457 |
coordinate.y, |
|
458 |
Double.isNaN(coordinate.z)?0:coordinate.z |
|
459 |
)); |
|
460 |
} |
|
461 |
Spline3D s = new Spline3D(coordinates3D); |
|
462 |
s.setProjection(this.getProjection()); |
|
463 |
return s; |
|
464 |
} |
|
465 |
|
|
466 |
@Override |
|
467 |
public Geometry force3DM() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
468 |
ArrayListCoordinateSequence coordinates3DM = new ArrayListCoordinateSequence(coordinates.size()); |
|
469 |
for (Coordinate coordinate : this.coordinates) { |
|
470 |
coordinates3DM.add(MCoordinate.create3dWithMeasure( |
|
471 |
coordinate.x, |
|
472 |
coordinate.y, |
|
473 |
(Double.isNaN(coordinate.z))?0:coordinate.z, |
|
474 |
(coordinate instanceof MCoordinate)?coordinate.getOrdinate(CoordinateSequence.M):0 |
|
475 |
)); |
|
476 |
} |
|
477 |
Spline3DM s = new Spline3DM(coordinates3DM); |
|
478 |
s.setProjection(this.getProjection()); |
|
479 |
return s; |
|
480 |
} |
|
481 |
|
|
482 |
|
|
437 | 483 |
protected boolean isClosed(){ |
438 | 484 |
return coordinates.get(0).equals(coordinates.get(coordinates.size()-1)); |
439 | 485 |
} |
Also available in: Unified diff