Revision 3783 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/ShapeFactory.java
ShapeFactory.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.cit.gvsig.fmap.core; |
42 | 42 |
|
43 |
import java.awt.geom.AffineTransform; |
|
43 | 44 |
import java.awt.geom.Arc2D; |
44 | 45 |
import java.awt.geom.Point2D; |
45 | 46 |
|
... | ... | |
189 | 190 |
FArc2D arc=new FArc2D(new GeneralPathX(arco),p1,p2,p3); |
190 | 191 |
return new FGeometry(arc); |
191 | 192 |
} |
193 |
public static IGeometry createEllipse(Point2D axis1Start, Point2D axis1End, double axis2Length){ |
|
194 |
double xAxis = axis1Start.distance(axis1End); |
|
195 |
Arc2D.Double arc = new Arc2D.Double(axis1Start.getX(), |
|
196 |
axis1Start.getY() - axis2Length, xAxis, 2 * axis2Length, 0, 360, Arc2D.OPEN); |
|
197 |
Point2D rotationPoint = new Point2D.Double(axis1Start.getX() + xAxis /2, axis1Start.getY()); |
|
198 |
double angle = UtilFunctions.getAngle(axis1Start, axis1End); |
|
199 |
AffineTransform mT = AffineTransform.getRotateInstance(angle, axis1Start.getX(), axis1Start.getY()); |
|
200 |
GeneralPathX gp = new GeneralPathX(arc); |
|
201 |
gp.transform(mT); |
|
202 |
|
|
203 |
return new FGeometry(new FEllipse2D(new GeneralPathX(gp),axis1Start,axis1End,axis2Length)); |
|
204 |
} |
|
192 | 205 |
} |
Also available in: Unified diff