Revision 39048 branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/gui/cad/tools/ScaleCADTool.java
ScaleCADTool.java | ||
---|---|---|
28 | 28 |
import java.awt.geom.Point2D.Double; |
29 | 29 |
import java.util.ArrayList; |
30 | 30 |
|
31 |
import javax.swing.JOptionPane; |
|
32 |
|
|
33 |
import org.slf4j.Logger; |
|
34 |
import org.slf4j.LoggerFactory; |
|
35 |
|
|
31 | 36 |
import org.gvsig.andami.PluginServices; |
32 | 37 |
import org.gvsig.andami.messages.NotificationManager; |
38 |
import org.gvsig.app.ApplicationLocator; |
|
33 | 39 |
import org.gvsig.editing.CADExtension; |
34 | 40 |
import org.gvsig.editing.gui.cad.CADTool; |
35 | 41 |
import org.gvsig.editing.gui.cad.DefaultCADTool; |
... | ... | |
45 | 51 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
46 | 52 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
47 | 53 |
import org.gvsig.fmap.geom.Geometry; |
54 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
55 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
56 |
import org.gvsig.fmap.geom.primitive.Point; |
|
48 | 57 |
import org.gvsig.fmap.geom.type.GeometryType; |
49 |
import org.gvsig.fmap.geom.util.UtilFunctions; |
|
50 | 58 |
import org.gvsig.fmap.mapcontext.ViewPort; |
51 | 59 |
import org.gvsig.fmap.mapcontrol.MapControlDrawer; |
52 | 60 |
import org.gvsig.tools.dispose.DisposableIterator; |
... | ... | |
58 | 66 |
*/ |
59 | 67 |
public class ScaleCADTool extends DefaultCADTool { |
60 | 68 |
|
69 |
private static Logger logger = LoggerFactory.getLogger(ScaleCADTool.class); |
|
70 |
|
|
61 | 71 |
private ScaleCADToolContext _fsm; |
62 | 72 |
private Point2D firstPoint; |
63 | 73 |
private Point2D lastPoint; |
... | ... | |
257 | 267 |
Geometry geometry = |
258 | 268 |
(feature.getDefaultGeometry()).cloneGeometry(); |
259 | 269 |
|
260 |
UtilFunctions.scaleGeom(geometry, firstPoint, scale, |
|
261 |
scale); |
|
270 |
try { |
|
271 |
Point po = geomManager.createPoint( |
|
272 |
firstPoint.getX(), |
|
273 |
firstPoint.getY(), |
|
274 |
SUBTYPES.GEOM2D); |
|
275 |
|
|
276 |
geometry.scale(po, scale, scale); |
|
277 |
} catch (CreateGeometryException cge) { |
|
278 |
logger.info("Error while scaling geometry", cge); |
|
279 |
ApplicationLocator.getManager().message("Unable to scale geometry", |
|
280 |
JOptionPane.ERROR_MESSAGE); |
|
281 |
} |
|
262 | 282 |
|
263 | 283 |
renderer.draw(geometry, |
264 | 284 |
mapControlManager.getAxisReferenceSymbol()); |
... | ... | |
294 | 314 |
// .get(i)).getLinkedRow(); |
295 | 315 |
Geometry geometry = |
296 | 316 |
(feature.getDefaultGeometry()).cloneGeometry(); |
297 |
UtilFunctions.scaleGeom(geometry, scalePoint, |
|
298 |
escalado, escalado); |
|
299 | 317 |
|
318 |
try { |
|
319 |
Point po = geomManager.createPoint( |
|
320 |
scalePoint.getX(), |
|
321 |
scalePoint.getY(), |
|
322 |
SUBTYPES.GEOM2D); |
|
323 |
|
|
324 |
geometry.scale(po, escalado, escalado); |
|
325 |
} catch (CreateGeometryException cge) { |
|
326 |
logger.info("Error while scaling geometry", cge); |
|
327 |
ApplicationLocator.getManager().message("Unable to scale geometry", |
|
328 |
JOptionPane.ERROR_MESSAGE); |
|
329 |
} |
|
330 |
|
|
300 | 331 |
renderer.draw(geometry, |
301 | 332 |
mapControlManager.getAxisReferenceSymbol()); |
302 | 333 |
} |
... | ... | |
378 | 409 |
// edRow.getLinkedRow().cloneRow(); |
379 | 410 |
Geometry geometry = |
380 | 411 |
(feature.getDefaultGeometry()).cloneGeometry(); |
381 |
UtilFunctions.scaleGeom(geometry, scalePoint, scaleFactor, |
|
382 |
scaleFactor); |
|
412 |
|
|
413 |
|
|
414 |
try { |
|
415 |
Point po = geomManager.createPoint( |
|
416 |
scalePoint.getX(), |
|
417 |
scalePoint.getY(), |
|
418 |
SUBTYPES.GEOM2D); |
|
419 |
|
|
420 |
geometry.scale(po, scaleFactor, scaleFactor); |
|
421 |
} catch (CreateGeometryException cge) { |
|
422 |
logger.info("Error while scaling geometry", cge); |
|
423 |
ApplicationLocator.getManager().message("Unable to scale geometry", |
|
424 |
JOptionPane.ERROR_MESSAGE); |
|
425 |
} |
|
383 | 426 |
|
384 | 427 |
EditableFeature eFeature = feature.getEditable(); |
385 | 428 |
eFeature.setGeometry(featureStore.getDefaultFeatureType() |
Also available in: Unified diff