Revision 42441 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/surface/ellipticarc/AbstractEllipticArc.java
AbstractEllipticArc.java | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import org.cresques.cts.ICoordTrans; |
31 | 31 |
|
32 |
import org.gvsig.fmap.geom.Geometry; |
|
32 | 33 |
import org.gvsig.fmap.geom.GeometryLocator; |
33 | 34 |
import org.gvsig.fmap.geom.GeometryManager; |
34 | 35 |
import org.gvsig.fmap.geom.jts.gputils.DefaultGeneralPathX; |
... | ... | |
39 | 40 |
import org.gvsig.fmap.geom.jts.util.UtilFunctions; |
40 | 41 |
import org.gvsig.fmap.geom.operation.GeometryOperationException; |
41 | 42 |
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException; |
43 |
import org.gvsig.fmap.geom.primitive.EllipticArc; |
|
42 | 44 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
43 | 45 |
import org.gvsig.fmap.geom.primitive.Line; |
44 | 46 |
import org.gvsig.fmap.geom.primitive.Point; |
... | ... | |
428 | 430 |
// throw new UnsupportedOperationException(message); |
429 | 431 |
} |
430 | 432 |
|
433 |
|
|
434 |
/* (non-Javadoc) |
|
435 |
* @see org.gvsig.fmap.geom.Geometry#offset(double) |
|
436 |
*/ |
|
437 |
public Geometry offset(double distance) throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
438 |
EllipticArc cloned = (EllipticArc) this.cloneGeometry(); |
|
439 |
|
|
440 |
Point center = new Point2D((getAxis1Start().getX()+getAxis1End().getX())/2, |
|
441 |
(getAxis1Start().getY()+getAxis1End().getY())/2); |
|
442 |
double axis1Lenght = getAxis1Start().distance(getAxis1End()); |
|
443 |
|
|
444 |
Point clonedAxis1Start = (Point) getAxis1Start().cloneGeometry(); |
|
445 |
Point clonedAxis1End = (Point) getAxis1End().cloneGeometry(); |
|
446 |
double clonedYDist = this.semiAxis2Length+distance; |
|
447 |
|
|
448 |
clonedAxis1Start.setX(JTSUtils.straightLineThroughTwoPointsEquation(0, axis1Lenght/2, center.getX(), getAxis1Start().getX(), axis1Lenght/2+distance)); |
|
449 |
clonedAxis1Start.setY(JTSUtils.straightLineThroughTwoPointsEquation(0, axis1Lenght/2, center.getY(), getAxis1Start().getY(), axis1Lenght/2+distance)); |
|
450 |
|
|
451 |
clonedAxis1End.setX(JTSUtils.straightLineThroughTwoPointsEquation(0, axis1Lenght/2, center.getX(), getAxis1End().getX(), axis1Lenght/2+distance)); |
|
452 |
clonedAxis1End.setY(JTSUtils.straightLineThroughTwoPointsEquation(0, axis1Lenght/2, center.getY(), getAxis1End().getY(), axis1Lenght/2+distance)); |
|
453 |
|
|
454 |
cloned.setPoints(clonedAxis1Start, clonedAxis1End, clonedYDist, this.angSt, this.angExt); |
|
455 |
return cloned; |
|
456 |
} |
|
431 | 457 |
} |
Also available in: Unified diff