root / branches / v2_0_0_prep / libraries / libFMap_geometries / src / org / gvsig / fmap / geom / primitive / impl / Arc2D.java @ 29972
History | View | Annotate | Download (16 KB)
1 |
/*
|
---|---|
2 |
* Created on 09-feb-2005
|
3 |
*
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
5 |
*
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
7 |
*
|
8 |
* This program is free software; you can redistribute it and/or
|
9 |
* modify it under the terms of the GNU General Public License
|
10 |
* as published by the Free Software Foundation; either version 2
|
11 |
* of the License, or (at your option) any later version.
|
12 |
*
|
13 |
* This program is distributed in the hope that it will be useful,
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
* GNU General Public License for more details.
|
17 |
*
|
18 |
* You should have received a copy of the GNU General Public License
|
19 |
* along with this program; if not, write to the Free Software
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
21 |
USA.
|
22 |
*
|
23 |
* For more information, contact:
|
24 |
*
|
25 |
* Generalitat Valenciana
|
26 |
* Conselleria d'Infraestructures i Transport
|
27 |
* Av. Blasco Ib??ez, 50
|
28 |
* 46010 VALENCIA
|
29 |
* SPAIN
|
30 |
*
|
31 |
* +34 963862235
|
32 |
* gvsig@gva.es
|
33 |
* www.gvsig.gva.es
|
34 |
*
|
35 |
* or
|
36 |
*
|
37 |
* IVER T.I. S.A
|
38 |
* Salamanca 50
|
39 |
* 46005 Valencia
|
40 |
* Spain
|
41 |
*
|
42 |
* +34 963163400
|
43 |
* dac@iver.es
|
44 |
*/
|
45 |
package org.gvsig.fmap.geom.primitive.impl; |
46 |
|
47 |
import java.awt.geom.AffineTransform; |
48 |
import java.awt.geom.Point2D; |
49 |
import java.awt.geom.Rectangle2D; |
50 |
import java.util.ArrayList; |
51 |
|
52 |
import org.cresques.cts.IProjection; |
53 |
import org.gvsig.fmap.geom.Geometry; |
54 |
import org.gvsig.fmap.geom.GeometryLocator; |
55 |
import org.gvsig.fmap.geom.GeometryManager; |
56 |
import org.gvsig.fmap.geom.handler.AbstractHandler; |
57 |
import org.gvsig.fmap.geom.handler.CenterHandler; |
58 |
import org.gvsig.fmap.geom.handler.FinalHandler; |
59 |
import org.gvsig.fmap.geom.handler.Handler; |
60 |
import org.gvsig.fmap.geom.primitive.Arc; |
61 |
import org.gvsig.fmap.geom.primitive.FShape; |
62 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
63 |
import org.gvsig.fmap.geom.primitive.Point; |
64 |
import org.gvsig.fmap.geom.type.GeometryType; |
65 |
import org.gvsig.fmap.geom.util.UtilFunctions; |
66 |
|
67 |
|
68 |
|
69 |
/**
|
70 |
* DOCUMENT ME!
|
71 |
*
|
72 |
* @author Vicente Caballero Navarro
|
73 |
*/
|
74 |
public class Arc2D extends Curve2D implements Arc { |
75 |
private static final long serialVersionUID = 6416027005106924030L; |
76 |
|
77 |
private Point2D init; |
78 |
private Point2D center; |
79 |
private Point2D end; |
80 |
|
81 |
private static final GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
82 |
|
83 |
/**
|
84 |
* The constructor with the GeometryType like and argument
|
85 |
* is used by the {@link GeometryType}{@link #create()}
|
86 |
* to create the geometry
|
87 |
* @param type
|
88 |
* The geometry type
|
89 |
*/
|
90 |
public Arc2D(GeometryType geometryType) { |
91 |
super(geometryType);
|
92 |
} |
93 |
|
94 |
/**
|
95 |
* Constructor used in the {@link Geometry#cloneGeometry()} method
|
96 |
* @param id
|
97 |
* @param projection
|
98 |
* @param gpx
|
99 |
* @param i
|
100 |
* @param c
|
101 |
* @param e
|
102 |
*/
|
103 |
protected Arc2D(GeometryType geometryType, String id, IProjection projection, GeneralPathX gpx, Point2D i,Point2D c, Point2D e) { |
104 |
super(geometryType, id, projection, gpx);
|
105 |
init=i; |
106 |
center=c; |
107 |
end=e; |
108 |
} |
109 |
|
110 |
/* (non-Javadoc)
|
111 |
* @see com.iver.cit.gvsig.fmap.core.FShape#cloneFShape()
|
112 |
*/
|
113 |
public FShape cloneFShape() {
|
114 |
Arc2D arc = new Arc2D(getGeometryType(), id, projection, (GeneralPathX) gp.clone(),init,center,end); |
115 |
return arc;
|
116 |
} |
117 |
|
118 |
/*
|
119 |
* (non-Javadoc)
|
120 |
* @see org.gvsig.fmap.geom.primitive.impl.OrientablePrimitive2D#transform(java.awt.geom.AffineTransform)
|
121 |
*/
|
122 |
public void transform(AffineTransform at) { |
123 |
gp.transform(at); |
124 |
InitHandler inithandler=(InitHandler)getStretchingHandlers()[0];
|
125 |
//CenterHandler centerhandler=(CenterHandler)getHandlers()[1];
|
126 |
EndHandler endhandler=(EndHandler)getStretchingHandlers()[1];
|
127 |
Point2D aux1=new Point2D.Double(); |
128 |
Point2D aux2=new Point2D.Double(); |
129 |
Point2D aux3=new Point2D.Double(); |
130 |
at.transform(inithandler.getPoint(),aux1); |
131 |
inithandler.setPoint(aux1); |
132 |
//at.transform(centerhandler.getPoint(),aux2);
|
133 |
//centerhandler.setPoint(aux2);
|
134 |
at.transform(endhandler.getPoint(),aux3); |
135 |
endhandler.setPoint(aux3); |
136 |
CenterSelHandler centerhandler=(CenterSelHandler)getSelectHandlers()[1];
|
137 |
at.transform(centerhandler.getPoint(),aux2); |
138 |
centerhandler.setPoint(aux2); |
139 |
|
140 |
} |
141 |
|
142 |
/*
|
143 |
* (non-Javadoc)
|
144 |
* @see org.gvsig.fmap.geom.primitive.impl.Curve2D#getShapeType()
|
145 |
*/
|
146 |
public int getShapeType() { |
147 |
return TYPES.ARC;
|
148 |
} |
149 |
|
150 |
/*
|
151 |
* (non-Javadoc)
|
152 |
* @see org.gvsig.fmap.geom.primitive.impl.OrientablePrimitive2D#getStretchingHandlers()
|
153 |
*/
|
154 |
public Handler[] getStretchingHandlers() { |
155 |
ArrayList handlers = new ArrayList(); |
156 |
|
157 |
handlers.add(new InitHandler(0, init.getX(), init.getY())); |
158 |
//handlers.add(new CenterHandler(1, center.getX(), center.getY()));
|
159 |
handlers.add(new EndHandler(1, end.getX(), end.getY())); |
160 |
|
161 |
return (Handler[]) handlers.toArray(new Handler[0]); |
162 |
} |
163 |
|
164 |
/*
|
165 |
* (non-Javadoc)
|
166 |
* @see org.gvsig.fmap.geom.primitive.impl.OrientablePrimitive2D#getSelectHandlers()
|
167 |
*/
|
168 |
public Handler[] getSelectHandlers() { |
169 |
ArrayList handlers = new ArrayList(); |
170 |
|
171 |
handlers.add(new InitSelHandler(0, init.getX(), init.getY())); |
172 |
handlers.add(new CenterSelHandler(1, center.getX(), center.getY())); |
173 |
handlers.add(new EndSelHandler(2, end.getX(), end.getY())); |
174 |
|
175 |
return (Handler[]) handlers.toArray(new Handler[0]); |
176 |
} |
177 |
/**
|
178 |
* DOCUMENT ME!
|
179 |
*
|
180 |
* @author Vicente Caballero Navarro
|
181 |
*/
|
182 |
class CenterSelHandler extends AbstractHandler implements CenterHandler{ |
183 |
/**
|
184 |
* Crea un nuevo PointHandler.
|
185 |
*
|
186 |
* @param i DOCUMENT ME!
|
187 |
* @param x DOCUMENT ME!
|
188 |
* @param y DOCUMENT ME!
|
189 |
*/
|
190 |
public CenterSelHandler(int i, double x, double y) { |
191 |
center = new Point2D.Double(x, y); |
192 |
index = i; |
193 |
} |
194 |
|
195 |
/**
|
196 |
* DOCUMENT ME!
|
197 |
*
|
198 |
* @param x DOCUMENT ME!
|
199 |
* @param y DOCUMENT ME!
|
200 |
*
|
201 |
* @return DOCUMENT ME!
|
202 |
*/
|
203 |
public void move(double x, double y) { |
204 |
} |
205 |
public void setPoint(Point2D p){ |
206 |
center=p; |
207 |
} |
208 |
public Point2D getPoint(){ |
209 |
return center;
|
210 |
} |
211 |
|
212 |
/**
|
213 |
* @see org.gvsig.fmap.geom.handler.Handler#set(double, double)
|
214 |
*/
|
215 |
public void set(double x, double y) { |
216 |
center=new Point2D.Double(x,y); |
217 |
java.awt.geom.Arc2D arco = UtilFunctions.createArc(init, center, end); |
218 |
gp = new GeneralPathX(arco.getPathIterator(null)); |
219 |
} |
220 |
} |
221 |
|
222 |
/**
|
223 |
* DOCUMENT ME!
|
224 |
*
|
225 |
* @author Vicente Caballero Navarro
|
226 |
*/
|
227 |
class InitHandler extends AbstractHandler implements FinalHandler{ |
228 |
/**
|
229 |
* Crea un nuevo PointHandler.
|
230 |
*
|
231 |
* @param i DOCUMENT ME!
|
232 |
* @param x DOCUMENT ME!
|
233 |
* @param y DOCUMENT ME!
|
234 |
*/
|
235 |
public InitHandler(int i, double x, double y) { |
236 |
init = new Point2D.Double(x, y); |
237 |
index = i; |
238 |
} |
239 |
|
240 |
/**
|
241 |
* DOCUMENT ME!
|
242 |
*
|
243 |
* @param x DOCUMENT ME!
|
244 |
* @param y DOCUMENT ME!
|
245 |
*
|
246 |
* @return DOCUMENT ME!
|
247 |
*/
|
248 |
public void move(double x, double y) { |
249 |
Point2D mediop=new Point2D.Double((init.getX()+end.getX())/2,(init.getY()+end.getY())/2); |
250 |
double dist=mediop.distance(center);
|
251 |
init=new Point2D.Double(init.getX()+x,init.getY()+y); |
252 |
|
253 |
mediop=new Point2D.Double((init.getX()+end.getX())/2,(init.getY()+end.getY())/2); |
254 |
Point2D[] perp=UtilFunctions.getPerpendicular(init,end,mediop); |
255 |
if (UtilFunctions.getAngle(end,init)<=Math.PI){ |
256 |
dist=-dist; |
257 |
} |
258 |
center=UtilFunctions.getPoint(mediop,perp[1],dist);
|
259 |
|
260 |
java.awt.geom.Arc2D arco = UtilFunctions.createArc(init,center, end); |
261 |
gp=new GeneralPathX(arco.getPathIterator(null)); |
262 |
} |
263 |
public void setPoint(Point2D p){ |
264 |
init=p; |
265 |
} |
266 |
public Point2D getPoint(){ |
267 |
return init;
|
268 |
} |
269 |
|
270 |
/**
|
271 |
* @see org.gvsig.fmap.geom.handler.Handler#set(double, double)
|
272 |
*/
|
273 |
public void set(double x, double y) { |
274 |
} |
275 |
} |
276 |
|
277 |
/**
|
278 |
* DOCUMENT ME!
|
279 |
*
|
280 |
* @author Vicente Caballero Navarro
|
281 |
*/
|
282 |
class EndHandler extends AbstractHandler implements FinalHandler{ |
283 |
/**
|
284 |
* Crea un nuevo PointHandler.
|
285 |
*
|
286 |
* @param i DOCUMENT ME!
|
287 |
* @param x DOCUMENT ME!
|
288 |
* @param y DOCUMENT ME!
|
289 |
*/
|
290 |
public EndHandler(int i, double x, double y) { |
291 |
end = new Point2D.Double(x, y); |
292 |
index = i; |
293 |
} |
294 |
|
295 |
/**
|
296 |
* DOCUMENT ME!
|
297 |
*
|
298 |
* @param x DOCUMENT ME!
|
299 |
* @param y DOCUMENT ME!
|
300 |
*
|
301 |
* @return DOCUMENT ME!
|
302 |
*/
|
303 |
public void move(double x, double y) { |
304 |
Point2D mediop=new Point2D.Double((init.getX()+end.getX())/2,(init.getY()+end.getY())/2); |
305 |
double dist=mediop.distance(center);
|
306 |
end=new Point2D.Double(end.getX()+x,end.getY()+y); |
307 |
|
308 |
mediop=new Point2D.Double((init.getX()+end.getX())/2,(init.getY()+end.getY())/2); |
309 |
Point2D[] perp=UtilFunctions.getPerpendicular(init,end,mediop); |
310 |
if (UtilFunctions.getAngle(end,init)<=Math.PI){ |
311 |
dist=-dist; |
312 |
} |
313 |
center=UtilFunctions.getPoint(mediop,perp[1],dist);
|
314 |
|
315 |
java.awt.geom.Arc2D arco = UtilFunctions.createArc(init,center, end); |
316 |
gp=new GeneralPathX(arco.getPathIterator(null)); |
317 |
} |
318 |
public void setPoint(Point2D p){ |
319 |
end=p; |
320 |
} |
321 |
public Point2D getPoint(){ |
322 |
return end;
|
323 |
} |
324 |
|
325 |
/**
|
326 |
* @see org.gvsig.fmap.geom.handler.Handler#set(double, double)
|
327 |
*/
|
328 |
public void set(double x, double y) { |
329 |
|
330 |
} |
331 |
} |
332 |
|
333 |
/**
|
334 |
* DOCUMENT ME!
|
335 |
*
|
336 |
* @author Vicente Caballero Navarro
|
337 |
*/
|
338 |
class InitSelHandler extends AbstractHandler implements FinalHandler{ |
339 |
/**
|
340 |
* Crea un nuevo PointHandler.
|
341 |
*
|
342 |
* @param i DOCUMENT ME!
|
343 |
* @param x DOCUMENT ME!
|
344 |
* @param y DOCUMENT ME!
|
345 |
*/
|
346 |
public InitSelHandler(int i, double x, double y) { |
347 |
init = new Point2D.Double(x, y); |
348 |
index = i; |
349 |
} |
350 |
|
351 |
/**
|
352 |
* DOCUMENT ME!
|
353 |
*
|
354 |
* @param x DOCUMENT ME!
|
355 |
* @param y DOCUMENT ME!
|
356 |
*
|
357 |
* @return DOCUMENT ME!
|
358 |
*/
|
359 |
public void move(double x, double y) { |
360 |
Point2D mediop=new Point2D.Double((init.getX()+end.getX())/2,(init.getY()+end.getY())/2); |
361 |
double dist=mediop.distance(center);
|
362 |
init=new Point2D.Double(init.getX()+x,init.getY()+y); |
363 |
|
364 |
mediop=new Point2D.Double((init.getX()+end.getX())/2,(init.getY()+end.getY())/2); |
365 |
Point2D[] perp=UtilFunctions.getPerpendicular(init,end,mediop); |
366 |
if (UtilFunctions.getAngle(end,init)<=Math.PI){ |
367 |
dist=-dist; |
368 |
} |
369 |
center=UtilFunctions.getPoint(mediop,perp[1],dist);
|
370 |
|
371 |
java.awt.geom.Arc2D arco = UtilFunctions.createArc(init,center, end); |
372 |
gp=new GeneralPathX(arco.getPathIterator(null)); |
373 |
} |
374 |
public void setPoint(Point2D p){ |
375 |
init=p; |
376 |
} |
377 |
public Point2D getPoint(){ |
378 |
return init;
|
379 |
} |
380 |
|
381 |
/**
|
382 |
* @see org.gvsig.fmap.geom.handler.Handler#set(double, double)
|
383 |
*/
|
384 |
public void set(double x, double y) { |
385 |
Point2D mediop=new Point2D.Double((init.getX()+end.getX())/2,(init.getY()+end.getY())/2); |
386 |
double dist=mediop.distance(center);
|
387 |
init=new Point2D.Double(x,y); |
388 |
|
389 |
mediop=new Point2D.Double((init.getX()+end.getX())/2,(init.getY()+end.getY())/2); |
390 |
// TODO comentado para quitar warning: Point2D[] perp=UtilFunctions.getPerpendicular(init,end,mediop);
|
391 |
if (UtilFunctions.getAngle(end,init)<=Math.PI){ |
392 |
dist=-dist; |
393 |
} |
394 |
///center=TrigonometricalFunctions.getPoint(mediop,perp[1],dist);
|
395 |
java.awt.geom.Arc2D arco = UtilFunctions.createArc(init,center, end); |
396 |
gp=new GeneralPathX(arco.getPathIterator(null)); |
397 |
} |
398 |
} |
399 |
|
400 |
/**
|
401 |
* DOCUMENT ME!
|
402 |
*
|
403 |
* @author Vicente Caballero Navarro
|
404 |
*/
|
405 |
class EndSelHandler extends AbstractHandler implements FinalHandler{ |
406 |
/**
|
407 |
* Crea un nuevo PointHandler.
|
408 |
*
|
409 |
* @param i DOCUMENT ME!
|
410 |
* @param x DOCUMENT ME!
|
411 |
* @param y DOCUMENT ME!
|
412 |
*/
|
413 |
public EndSelHandler(int i, double x, double y) { |
414 |
end = new Point2D.Double(x, y); |
415 |
index = i; |
416 |
} |
417 |
|
418 |
/**
|
419 |
* DOCUMENT ME!
|
420 |
*
|
421 |
* @param x DOCUMENT ME!
|
422 |
* @param y DOCUMENT ME!
|
423 |
*
|
424 |
* @return DOCUMENT ME!
|
425 |
*/
|
426 |
public void move(double x, double y) { |
427 |
Point2D mediop=new Point2D.Double((init.getX()+end.getX())/2,(init.getY()+end.getY())/2); |
428 |
double dist=mediop.distance(center);
|
429 |
end=new Point2D.Double(end.getX()+x,end.getY()+y); |
430 |
|
431 |
mediop=new Point2D.Double((init.getX()+end.getX())/2,(init.getY()+end.getY())/2); |
432 |
Point2D[] perp=UtilFunctions.getPerpendicular(init,end,mediop); |
433 |
if (UtilFunctions.getAngle(end,init)<=Math.PI){ |
434 |
dist=-dist; |
435 |
} |
436 |
center=UtilFunctions.getPoint(mediop,perp[1],dist);
|
437 |
|
438 |
java.awt.geom.Arc2D arco = UtilFunctions.createArc(init,center, end); |
439 |
gp=new GeneralPathX(arco.getPathIterator(null)); |
440 |
} |
441 |
public void setPoint(Point2D p){ |
442 |
end=p; |
443 |
} |
444 |
public Point2D getPoint(){ |
445 |
return end;
|
446 |
} |
447 |
|
448 |
/**
|
449 |
* @see org.gvsig.fmap.geom.handler.Handler#set(double, double)
|
450 |
*/
|
451 |
public void set(double x, double y) { |
452 |
Point2D mediop=new Point2D.Double((init.getX()+end.getX())/2,(init.getY()+end.getY())/2); |
453 |
double dist=mediop.distance(center);
|
454 |
end=new Point2D.Double(x,y); |
455 |
|
456 |
mediop=new Point2D.Double((init.getX()+end.getX())/2,(init.getY()+end.getY())/2); |
457 |
// TODO comentado para quitar warning: Point2D[] perp=UtilFunctions.getPerpendicular(init,end,mediop);
|
458 |
if (UtilFunctions.getAngle(end,init)<=Math.PI){ |
459 |
dist=-dist; |
460 |
} |
461 |
///center=TrigonometricalFunctions.getPoint(mediop,perp[1],dist);
|
462 |
java.awt.geom.Arc2D arco = UtilFunctions.createArc(init,center, end); |
463 |
gp=new GeneralPathX(arco.getPathIterator(null)); |
464 |
} |
465 |
} |
466 |
|
467 |
/* (non-Javadoc)
|
468 |
* @see com.iver.cit.gvsig.fmap.core.FPolyline2D#intersects(java.awt.geom.Rectangle2D)
|
469 |
*/
|
470 |
public boolean intersects(Rectangle2D r) { |
471 |
return gp.intersects(r);
|
472 |
} |
473 |
|
474 |
/* (non-Javadoc)
|
475 |
* @see org.gvsig.fmap.geom.primitive.Arc#setPoints(org.gvsig.fmap.geom.primitive.Point, org.gvsig.fmap.geom.primitive.Point, org.gvsig.fmap.geom.primitive.Point)
|
476 |
*/
|
477 |
public void setPoints(Point p1, Point p2, Point p3) { |
478 |
Point2D _p1 = new java.awt.geom.Point2D.Double(p1.getCoordinateAt(0), p1.getCoordinateAt(1)); |
479 |
Point2D _p2 = new java.awt.geom.Point2D.Double(p2.getCoordinateAt(0), p2.getCoordinateAt(1)); |
480 |
Point2D _p3 = new java.awt.geom.Point2D.Double(p3.getCoordinateAt(0), p3.getCoordinateAt(1)); |
481 |
setPoints(_p1, _p2, _p3); |
482 |
} |
483 |
|
484 |
/* (non-Javadoc)
|
485 |
* @see org.gvsig.fmap.geom.primitive.Curve2D#setGeneralPath(org.gvsig.fmap.geom.primitive.GeneralPathX)
|
486 |
*/
|
487 |
public void setGeneralPath(GeneralPathX generalPathX) { |
488 |
throw new UnsupportedOperationException("Use setPoints(Point p1, Point p2, Point p3)"); |
489 |
} |
490 |
|
491 |
/* (non-Javadoc)
|
492 |
* @see org.gvsig.fmap.geom.primitive.Arc#setPoints(java.awt.geom.Point2D, java.awt.geom.Point2D, java.awt.geom.Point2D)
|
493 |
*/
|
494 |
private void setPoints(Point2D p1, Point2D p2, Point2D p3) { |
495 |
java.awt.geom.Arc2D arco = UtilFunctions.createArc(p1, p2, p3); |
496 |
if (arco == null) { |
497 |
throw new IllegalArgumentException(); |
498 |
} |
499 |
this.gp = new GeneralPathX(arco.getPathIterator(null)); |
500 |
this.center = p1;
|
501 |
this.init = p2;
|
502 |
this.end = p3;
|
503 |
} |
504 |
|
505 |
/* (non-Javadoc)
|
506 |
* @see org.gvsig.fmap.geom.primitive.Arc#setPoints(org.gvsig.fmap.geom.primitive.Point, double, double, double)
|
507 |
*/
|
508 |
public void setPoints(Point center, double radius, double initAngle, |
509 |
double angleExt) {
|
510 |
Point2D _center = new java.awt.geom.Point2D.Double(center.getCoordinateAt(0), center.getCoordinateAt(1)); |
511 |
setPoints(_center, radius, initAngle, angleExt); |
512 |
} |
513 |
|
514 |
/* (non-Javadoc)
|
515 |
* @see org.gvsig.fmap.geom.primitive.Arc#setPoints(java.awt.geom.Point2D, double, double, double)
|
516 |
*/
|
517 |
private void setPoints(Point2D center, double radius, double initAngle, |
518 |
double angleExt) {
|
519 |
java.awt.geom.Arc2D arco = UtilFunctions.createArc(center, radius, initAngle, angleExt); |
520 |
|
521 |
java.awt.geom.Arc2D semiarco = UtilFunctions.createArc(center, radius, initAngle, angleExt/2);
|
522 |
if (arco == null || semiarco == null) { |
523 |
return;
|
524 |
} |
525 |
|
526 |
Point2D p1 = arco.getStartPoint();
|
527 |
Point2D p2 = semiarco.getEndPoint();
|
528 |
Point2D p3 = arco.getEndPoint();
|
529 |
|
530 |
setPoints(p1, p2, p3); |
531 |
} |
532 |
|
533 |
/* (non-Javadoc)
|
534 |
* @see org.gvsig.fmap.geom.primitive.Curve2D#setPoints(org.gvsig.fmap.geom.primitive.Point, org.gvsig.fmap.geom.primitive.Point)
|
535 |
*/
|
536 |
public void setPoints(Point startPoint, Point endPoint) { |
537 |
throw new UnsupportedOperationException("Use setGeneralPathX"); |
538 |
} |
539 |
|
540 |
/* (non-Javadoc)
|
541 |
* @see org.gvsig.fmap.geom.primitive.Arc#getEndPoint()
|
542 |
*/
|
543 |
public Point getEndPoint() { |
544 |
return new org.gvsig.fmap.geom.primitive.impl.Point2D(end.getX(), end.getY()); |
545 |
} |
546 |
|
547 |
/* (non-Javadoc)
|
548 |
* @see org.gvsig.fmap.geom.primitive.Arc#getInitPoint()
|
549 |
*/
|
550 |
public Point getInitPoint() { |
551 |
return new org.gvsig.fmap.geom.primitive.impl.Point2D(init.getX(), init.getY()); |
552 |
} |
553 |
|
554 |
/* (non-Javadoc)
|
555 |
* @see org.gvsig.fmap.geom.primitive.Arc#getCenterPoint()
|
556 |
*/
|
557 |
public Point getCenterPoint() { |
558 |
Point2D p = UtilFunctions.getCenter(init, center,end);
|
559 |
try {
|
560 |
return new org.gvsig.fmap.geom.primitive.impl.Point2D(p.getX(), p.getY()); |
561 |
} catch (Exception e) { |
562 |
return null; |
563 |
} |
564 |
} |
565 |
} |