Revision 39048
branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/gui/cad/DefaultCADTool.java | ||
---|---|---|
235 | 235 |
currentPoint = ct.getInverted().convert(currentPoint, null); |
236 | 236 |
} |
237 | 237 |
|
238 |
UtilFunctions.moveGeom(geometry, currentPoint.getX() |
|
239 |
- firstPoint.getX(), |
|
238 |
geometry.move(currentPoint.getX() - firstPoint.getX(), |
|
240 | 239 |
currentPoint.getY() - firstPoint.getY()); |
241 | 240 |
|
242 | 241 |
mapControlDrawer.draw(geometry, |
... | ... | |
291 | 290 |
continue; |
292 | 291 |
} |
293 | 292 |
|
294 |
UtilFunctions.rotateGeom(geometry, -Math.atan2(w, h)
|
|
295 |
+ (Math.PI / 2), firstPoint.getX(), firstPoint.getY());
|
|
293 |
geometry.rotate(-Math.atan2(w, h) + (Math.PI / 2),
|
|
294 |
firstPoint.getX(), firstPoint.getY()); |
|
296 | 295 |
|
297 | 296 |
mapControlDrawer.draw(geometry, |
298 | 297 |
mapControlManager.getGeometrySelectionSymbol()); |
branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/gui/cad/tools/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() |
branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/gui/cad/tools/RotateCADTool.java | ||
---|---|---|
184 | 184 |
Geometry geometry = |
185 | 185 |
(feature.getDefaultGeometry()).cloneGeometry(); |
186 | 186 |
EditableFeature eFeature = feature.getEditable(); |
187 |
UtilFunctions.rotateGeom(geometry, |
|
188 |
-Math.atan2(w, h) + (Math.PI / 2),
|
|
187 |
|
|
188 |
geometry.rotate(-Math.atan2(w, h) + (Math.PI / 2),
|
|
189 | 189 |
firstPoint.getX(), firstPoint.getY()); |
190 |
|
|
190 | 191 |
eFeature.setGeometry(featureStore |
191 | 192 |
.getDefaultFeatureType() |
192 | 193 |
.getDefaultGeometryAttributeName(), geometry); |
branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/gui/cad/tools/MoveCADTool.java | ||
---|---|---|
189 | 189 |
// if (ct!=null) |
190 | 190 |
// ig.reProject(ct); |
191 | 191 |
// Movemos la geometr?a |
192 |
UtilFunctions.moveGeom(ig, lastPoint.getX() |
|
193 |
- firstPoint.getX(), lastPoint.getY() |
|
194 |
- firstPoint.getY()); |
|
192 |
ig.move(lastPoint.getX() - firstPoint.getX(), |
|
193 |
lastPoint.getY() - firstPoint.getY()); |
|
195 | 194 |
|
196 | 195 |
// if (ct!=null) |
197 | 196 |
// ig.reProject(ct.getInverted()); |
branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/gui/cad/tools/CopyCADTool.java | ||
---|---|---|
173 | 173 |
(feature.getDefaultGeometry()).cloneGeometry(); |
174 | 174 |
// EditableFeature |
175 | 175 |
// eFeature=featureStore.createNewFeature(true); |
176 |
UtilFunctions.moveGeom(geometry, lastPoint.getX()
|
|
177 |
- firstPoint.getX(), lastPoint.getY()
|
|
178 |
- firstPoint.getY()); |
|
176 |
geometry.move(lastPoint.getX() - firstPoint.getX(),
|
|
177 |
lastPoint.getY() - firstPoint.getY());
|
|
178 |
|
|
179 | 179 |
// eFeature.setGeometry(featureStore.getDefaultFeatureType().getDefaultGeometryAttributeName(),geometry); |
180 | 180 |
// featureStore.insert(eFeature); |
181 | 181 |
newSelection.select(insertGeometry(geometry, |
Also available in: Unified diff