Revision 42271 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/arc/Arc2D.java
Arc2D.java | ||
---|---|---|
69 | 69 |
*/ |
70 | 70 |
public void setPoints(Point center, double radius, double startAngle, double angleExt) { |
71 | 71 |
|
72 |
double diameter = radius*2; |
|
72 | 73 |
double x; |
73 | 74 |
double y; |
74 |
double w; |
|
75 |
double h; |
|
76 | 75 |
double start; |
77 | 76 |
double extent; |
78 | 77 |
double angleOffset; |
... | ... | |
85 | 84 |
} |
86 | 85 |
x = center.getX() - radius; |
87 | 86 |
y = center.getY() - radius; |
88 |
w = radius * 2; |
|
89 |
h = w; // Son siempre arcos de circunferencia |
|
90 | 87 |
|
91 | 88 |
if( angleExt > 0 && (angleExt % pi2) == 0 ) { |
92 | 89 |
start = 0; |
... | ... | |
100 | 97 |
|
101 | 98 |
|
102 | 99 |
double angleStart = Math.toRadians(-start); |
103 |
double initX = x + (Math.cos(angleStart) * 0.5 + 0.5) * radius*2;
|
|
104 |
double initY = y + (Math.sin(angleStart) * 0.5 + 0.5) * radius*2;
|
|
100 |
double initX = x + (Math.cos(angleStart) * 0.5 + 0.5) * diameter;
|
|
101 |
double initY = y + (Math.sin(angleStart) * 0.5 + 0.5) * diameter;
|
|
105 | 102 |
init = new Point2D(initX, initY); |
106 | 103 |
|
107 | 104 |
double angleEnd = Math.toRadians(-start - extent); |
108 |
double endX = x + (Math.cos(angleEnd) * 0.5 + 0.5) * radius*2;
|
|
109 |
double endY = y + (Math.sin(angleEnd) * 0.5 + 0.5) * radius*2;
|
|
105 |
double endX = x + (Math.cos(angleEnd) * 0.5 + 0.5) * diameter;
|
|
106 |
double endY = y + (Math.sin(angleEnd) * 0.5 + 0.5) * diameter;
|
|
110 | 107 |
end = new Point2D(endX, endY); |
111 | 108 |
|
112 | 109 |
double angleMiddle = Math.toRadians(-start - extent)/2; |
113 |
double middleX = x + (Math.cos(angleMiddle) * 0.5 + 0.5) * radius*2;
|
|
114 |
double middleY = y + (Math.sin(angleMiddle) * 0.5 + 0.5) * radius*2;
|
|
110 |
double middleX = x + (Math.cos(angleMiddle) * 0.5 + 0.5) * diameter;
|
|
111 |
double middleY = y + (Math.sin(angleMiddle) * 0.5 + 0.5) * diameter;
|
|
115 | 112 |
end = new Point2D(middleX, middleY); |
116 | 113 |
} |
117 | 114 |
|
... | ... | |
189 | 186 |
public MultiPoint toPoints() throws GeometryException { |
190 | 187 |
MultiPoint multiPoint = new MultiPoint2D(); |
191 | 188 |
Coordinate[] coordinates = getJTS().getCoordinates(); |
189 |
multiPoint.ensureCapacity(coordinates.length); |
|
192 | 190 |
for (int i = 0; i < coordinates.length; i++) { |
193 | 191 |
multiPoint.addPoint(new Point2D(coordinates[i])); |
194 | 192 |
} |
Also available in: Unified diff