Revision 39063
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/impl/Arc2D.java | ||
---|---|---|
50 | 50 |
import java.util.ArrayList; |
51 | 51 |
|
52 | 52 |
import org.cresques.cts.IProjection; |
53 |
import org.slf4j.Logger; |
|
54 |
import org.slf4j.LoggerFactory; |
|
55 |
|
|
53 | 56 |
import org.gvsig.fmap.geom.Geometry; |
54 | 57 |
import org.gvsig.fmap.geom.GeometryLocator; |
55 | 58 |
import org.gvsig.fmap.geom.GeometryManager; |
... | ... | |
73 | 76 |
*/ |
74 | 77 |
public class Arc2D extends Curve2D implements Arc { |
75 | 78 |
private static final long serialVersionUID = 6416027005106924030L; |
79 |
|
|
80 |
private static final Logger logger = LoggerFactory.getLogger(Arc2D.class); |
|
76 | 81 |
|
77 | 82 |
private Point2D init; |
78 | 83 |
|
... | ... | |
499 | 504 |
private void setPoints(Point2D p1, Point2D p2, Point2D p3) { |
500 | 505 |
java.awt.geom.Arc2D arco = UtilFunctions.createArc(p1, p2, p3); |
501 | 506 |
if (arco == null) { |
502 |
throw new IllegalArgumentException(); |
|
507 |
logger.info("Did not set arc points (probably aligned points): " |
|
508 |
+ p1.getX() + " " + p1.getY() + " :: " |
|
509 |
+ p2.getX() + " " + p2.getY() + " :: " |
|
510 |
+ p3.getX() + " " + p3.getY()); |
|
511 |
return; |
|
503 | 512 |
} |
504 | 513 |
this.gp = new GeneralPathX(arco.getPathIterator(null)); |
505 | 514 |
this.init = p1; |
... | ... | |
602 | 611 |
|
603 | 612 |
java.awt.geom.Arc2D semiarco = UtilFunctions.createArc(center, radius, initAngle, angleExt/2); |
604 | 613 |
if (arco == null || semiarco == null) { |
614 |
logger.info("Did not set arc points (probably aligned points)"); |
|
605 | 615 |
return; |
606 | 616 |
} |
607 | 617 |
|
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/aggregate/impl/BaseMultiPrimitive.java | ||
---|---|---|
317 | 317 |
GeneralPathX gpx = new GeneralPathX(); |
318 | 318 |
int primiNum = getPrimitivesNumber(); |
319 | 319 |
if (primiNum > 0) { |
320 |
Point2D p = ((Geometry)geometries.get(0)).getHandlers(Geometry.SELECTHANDLER)[0] |
|
321 |
.getPoint(); |
|
322 |
gpx.moveTo(p.getX(), p.getY()); |
|
323 | 320 |
|
324 |
for (int i = 1; i < primiNum; i++) { |
|
325 |
p = ((Geometry)geometries.get(i)).getHandlers(Geometry.SELECTHANDLER)[0] |
|
326 |
.getPoint(); |
|
327 |
gpx.lineTo(p.getX(), p.getY()); |
|
321 |
Geometry prim = null; |
|
322 |
for (int i = 0; i < primiNum; i++) { |
|
323 |
prim = (Geometry) geometries.get(i); |
|
324 |
gpx.append( |
|
325 |
prim.getPathIterator(at, flatness), |
|
326 |
/* |
|
327 |
* This is a relevant change. |
|
328 |
* After BN 2056 this class will not return |
|
329 |
* connected path iterator. There will be MOVE_TO |
|
330 |
* between iterator of each primitive |
|
331 |
*/ |
|
332 |
false); |
|
328 | 333 |
} |
329 |
Point2D p2 = ((Geometry)geometries.get(primiNum-1)).getHandlers(Geometry.SELECTHANDLER)[((Geometry)geometries.get(primiNum-1)).getHandlers(Geometry.SELECTHANDLER).length-1] |
|
330 |
.getPoint(); |
|
331 |
gpx.lineTo(p2.getX(), p2.getY()); |
|
332 | 334 |
} |
333 |
return gpx.getPathIterator(at, flatness); |
|
335 |
/* |
|
336 |
* affine transform and flatness already applied in loop |
|
337 |
*/ |
|
338 |
return gpx.getPathIterator(null); |
|
334 | 339 |
} |
335 | 340 |
|
336 | 341 |
/* |
branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/CADExtension.java | ||
---|---|---|
380 | 380 |
//if (Character.isLetterOrDigit(e.getKeyChar())) { |
381 | 381 |
Character keyChar = new Character(e.getKeyChar()); |
382 | 382 |
if (e.getComponent().getName() != null) { |
383 |
/* |
|
383 | 384 |
System.out |
384 | 385 |
.println("Evento de teclado desde el componente " |
385 | 386 |
+ e.getComponent().getName()); |
387 |
*/ |
|
386 | 388 |
if (!e.getComponent().getName().equals( |
387 | 389 |
"CADConsole")) { |
388 | 390 |
view.focusConsole(keyChar + ""); |
branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/gui/cad/DefaultCADTool.java | ||
---|---|---|
134 | 134 |
} |
135 | 135 |
|
136 | 136 |
public void addTemporalCache(Geometry geom) { |
137 |
|
|
138 |
if (geom == null) { |
|
139 |
try { |
|
140 |
throw new IllegalArgumentException("Null geometry"); |
|
141 |
} catch (Exception ex) { |
|
142 |
LOG.info("Tried to add null geometry to temporal cache", ex); |
|
143 |
} |
|
144 |
return; |
|
145 |
} |
|
146 |
|
|
137 | 147 |
temporalCache.add(geom); |
138 | 148 |
try { |
139 | 149 |
insertSpatialCache(geom); |
branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/gui/cad/tools/SplineCADTool.java | ||
---|---|---|
119 | 119 |
list.add(new Point2D.Double(x, y)); |
120 | 120 |
Geometry spline = |
121 | 121 |
createSpline((Point2D[]) list.toArray(new Point2D[0])); |
122 |
addTemporalCache(spline); |
|
122 |
|
|
123 |
if (spline != null) { |
|
124 |
addTemporalCache(spline); |
|
125 |
} |
|
123 | 126 |
} |
124 | 127 |
} |
125 | 128 |
|
branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/gui/cad/tools/PolylineCADTool.java | ||
---|---|---|
181 | 181 |
elShape.moveTo(antPoint.getX(), antPoint.getY()); |
182 | 182 |
elShape.lineTo(point.getX(), point.getY()); |
183 | 183 |
Geometry geom = createCurve(elShape); |
184 |
list.add(geom); |
|
185 |
addTemporalCache(geom); |
|
184 |
if (geom != null) { |
|
185 |
list.add(geom); |
|
186 |
addTemporalCache(geom); |
|
187 |
} |
|
186 | 188 |
} |
187 | 189 |
if (antPoint == null) |
188 | 190 |
antPoint = (Point2D) firstPoint.clone(); |
... | ... | |
313 | 315 |
UtilFunctions.getPoint(interp, mediop, radio); |
314 | 316 |
antCenter = centerp; |
315 | 317 |
Geometry geom = createArc(lastp, centerp, point); |
316 |
list.add(geom); |
|
317 |
addTemporalCache(geom); |
|
318 |
|
|
319 |
if (geom != null) { |
|
320 |
list.add(geom); |
|
321 |
addTemporalCache(geom); |
|
322 |
} |
|
318 | 323 |
} |
319 | 324 |
|
320 | 325 |
antantPoint = antPoint; |
branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/gui/cad/tools/ArcCADTool.java | ||
---|---|---|
121 | 121 |
Point current = createPoint(x, y); |
122 | 122 |
|
123 | 123 |
Geometry ig = createArc(p1, p2, current); |
124 |
renderer.draw(ig, |
|
125 |
mapControlManager.getGeometrySelectionSymbol()); |
|
124 |
|
|
125 |
if (ig != null) { |
|
126 |
/* |
|
127 |
* sometims it's not possible to create arc |
|
128 |
* (example: aligned points) |
|
129 |
*/ |
|
130 |
renderer.draw(ig, |
|
131 |
mapControlManager.getGeometrySelectionSymbol()); |
|
126 | 132 |
|
127 |
Point2D p = |
|
128 |
getCadToolAdapter().getMapControl().getViewPort() |
|
129 |
.fromMapPoint(p1.getX(), p1.getY()); |
|
130 |
renderer.drawRect((int) p.getX(), (int) p.getY(), 1, 1); |
|
131 |
p = |
|
132 |
getCadToolAdapter().getMapControl().getViewPort() |
|
133 |
.fromMapPoint(p2.getX(), p2.getY()); |
|
134 |
renderer.drawRect((int) p.getX(), (int) p.getY(), 1, 1); |
|
133 |
Point2D p = |
|
134 |
getCadToolAdapter().getMapControl().getViewPort() |
|
135 |
.fromMapPoint(p1.getX(), p1.getY()); |
|
136 |
renderer.drawRect((int) p.getX(), (int) p.getY(), 1, 1); |
|
137 |
p = |
|
138 |
getCadToolAdapter().getMapControl().getViewPort() |
|
139 |
.fromMapPoint(p2.getX(), p2.getY()); |
|
140 |
renderer.drawRect((int) p.getX(), (int) p.getY(), 1, 1); |
|
141 |
} |
|
135 | 142 |
} |
136 | 143 |
} |
137 | 144 |
|
Also available in: Unified diff