Revision 1436 branches/pilotoDWG/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/ShapeFactory.java
ShapeFactory.java | ||
---|---|---|
150 | 150 |
double xAxis = axis1Start.distance(axis1End); |
151 | 151 |
Arc2D.Double arc = new Arc2D.Double(axis1Start.getX(), |
152 | 152 |
axis1Start.getY() - axis2Length, xAxis, 2 * axis2Length, 0, 360, Arc2D.OPEN); |
153 |
|
|
153 |
Point2D rotationPoint = new Point2D.Double(axis1Start.getX() + xAxis /2, axis1Start.getY()); |
|
154 |
|
|
154 | 155 |
// double angle = Math.atan2(axis1End.getX() - axis1Start.getX(), |
155 | 156 |
// axis1End.getY() - axis1Start.getY()); |
156 | 157 |
double angle = Math.acos((axis1End.getX() - axis1Start.getX())/xAxis); |
157 |
|
|
158 |
if (axis1Start.getY() > axis1End.getY()){ |
|
159 |
angle = -angle; |
|
160 |
} |
|
158 | 161 |
double distortedAngle = Math.atan2(Math.sin(angle) * xAxis, Math.cos(angle) * 2 * axis2Length); |
159 |
|
|
160 |
AffineTransform mT = AffineTransform.getRotateInstance(angle, (axis1Start.getX() + axis1End.getX()) / 2, (axis1Start.getY() + axis1End.getY()) / 2); |
|
161 |
|
|
162 |
AffineTransform mT = AffineTransform.getRotateInstance(angle, axis1Start.getX(), axis1Start.getY()); |
|
162 | 163 |
GeneralPathX gp = new GeneralPathX(arc); |
163 |
|
|
164 | 164 |
gp.transform(mT); |
165 | 165 |
|
166 | 166 |
return new FGeometry(new FPolyline2D(new GeneralPathX(gp))); |
Also available in: Unified diff