Revision 79
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.main/pom.xml | ||
---|---|---|
146 | 146 |
</dependency> |
147 | 147 |
<dependency> |
148 | 148 |
<groupId>org.gvsig</groupId> |
149 |
<artifactId>org.gvsig.andami</artifactId> |
|
150 |
<scope>runtime</scope> |
|
151 |
</dependency> |
|
152 |
<dependency> |
|
153 |
<groupId>org.gvsig</groupId> |
|
154 | 149 |
<artifactId> |
155 | 150 |
org.gvsig.vectorediting.lib.prov.symmetry |
156 | 151 |
</artifactId> |
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.main/src/main/java/org/gvsig/vectorediting/main/Main.java | ||
---|---|---|
83 | 83 |
import org.gvsig.vectorediting.swing.api.EditingSwingLocator; |
84 | 84 |
import org.gvsig.vectorediting.swing.api.EditingSwingManager; |
85 | 85 |
import org.gvsig.vectorediting.swing.impl.DefaultEditingBehavior; |
86 |
import org.gvsig.vectorediting.swing.impl.EditingCompoundBehavior; |
|
86 | 87 |
import org.slf4j.Logger; |
87 | 88 |
import org.slf4j.LoggerFactory; |
88 | 89 |
|
... | ... | |
180 | 181 |
|
181 | 182 |
try { |
182 | 183 |
mapControl = mapControlManager.createJMapControlPanel(); |
184 |
|
|
183 | 185 |
editingBehavior = new DefaultEditingBehavior(mapControl); |
186 |
EditingCompoundBehavior editingCompoundBehavior = new EditingCompoundBehavior(editingBehavior); |
|
187 |
mapControl.addBehavior("VectorEditing", editingCompoundBehavior); |
|
188 |
|
|
184 | 189 |
mapControl.addBehavior("zoom", new Behavior[] { |
185 | 190 |
new RectangleBehavior(new ZoomInListenerImpl(mapControl)), |
186 | 191 |
new PointBehavior(new ZoomOutRightButtonListener(mapControl)) }); |
187 |
mapControl.addBehavior("pan", new MoveBehavior(new PanListenerImpl( |
|
188 |
mapControl))); |
|
192 |
mapControl.addBehavior("pan", new MoveBehavior(new PanListenerImpl(mapControl))); |
|
189 | 193 |
|
190 | 194 |
|
191 | 195 |
IProjection defaultProjection = CRSFactory.getCRS(DEFAULT_CRS_CODE); |
192 | 196 |
mapControl.getViewPort().setProjection(defaultProjection); |
193 |
mapControl.addBehavior("VectorEditing", (Behavior) editingBehavior); |
|
194 | 197 |
|
195 | 198 |
// Create actions |
196 | 199 |
createActions(); |
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.lib/org.gvsig.vectorediting.lib.api/pom.xml | ||
---|---|---|
33 | 33 |
<groupId>org.gvsig</groupId> |
34 | 34 |
<artifactId>org.gvsig.fmap.control</artifactId> |
35 | 35 |
</dependency> |
36 |
<dependency> |
|
37 |
<groupId>org.gvsig</groupId> |
|
38 |
<artifactId>org.gvsig.app.mainplugin</artifactId> |
|
39 |
</dependency> |
|
40 | 36 |
</dependencies> |
41 | 37 |
</project> |
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.impl/src/main/java/org/gvsig/vectorediting/swing/impl/DefaultEditingSwingManager.java | ||
---|---|---|
291 | 291 |
else { |
292 | 292 |
editingCompoundBehavior = (EditingCompoundBehavior) mapControl.getMapTool("VectorEditing"); |
293 | 293 |
editingBehavior = (EditingBehavior) editingCompoundBehavior.getBehavior(EditingCompoundBehavior.EDITING_INDEX); |
294 |
((DefaultEditingBehavior)editingBehavior).setCompoundBehavior(editingCompoundBehavior); |
|
294 | 295 |
editingBehavior.cleanBehavior(); |
295 | 296 |
} |
296 | 297 |
|
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.impl/src/main/java/org/gvsig/vectorediting/swing/impl/DefaultEditingBehavior.java | ||
---|---|---|
21 | 21 |
import org.cresques.cts.IProjection; |
22 | 22 |
import org.gvsig.andami.PluginServices; |
23 | 23 |
import org.gvsig.andami.ui.mdiFrame.MainFrame; |
24 |
import org.gvsig.app.project.documents.view.toolListeners.StatusBarListener; |
|
25 | 24 |
import org.gvsig.fmap.dal.exception.DataException; |
26 | 25 |
import org.gvsig.fmap.dal.feature.FeatureSelection; |
27 | 26 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
28 | 27 |
import org.gvsig.fmap.geom.Geometry; |
29 |
import org.gvsig.fmap.geom.Geometry.TYPES; |
|
30 | 28 |
import org.gvsig.fmap.geom.primitive.Point; |
31 | 29 |
import org.gvsig.fmap.mapcontext.MapContext; |
32 | 30 |
import org.gvsig.fmap.mapcontext.ViewPort; |
... | ... | |
88 | 86 |
|
89 | 87 |
private Point adjustedPoint; |
90 | 88 |
|
91 |
private StatusBarListener sbl = null; |
|
89 |
// private StatusBarListener sbl = null;
|
|
92 | 90 |
|
93 | 91 |
private JConsole console; |
94 | 92 |
|
... | ... | |
165 | 163 |
if (mapControl != null) { |
166 | 164 |
this.mapControl = mapControl; |
167 | 165 |
serviceRegistration = new HashMap<FLyrVect, EditingService>(); |
168 |
sbl = new StatusBarListener(mapControl); |
|
166 |
// sbl = new StatusBarListener(mapControl);
|
|
169 | 167 |
initMapControlListeners(mapControl); |
170 | 168 |
initConsolePanelListeners(getConsolePanel()); |
171 | 169 |
FLayers layers = mapControl.getMapContext().getLayers(); |
... | ... | |
397 | 395 |
public void mouseMoved(MouseEvent e) throws BehaviorException { |
398 | 396 |
ViewPort vp = mapControl.getViewPort(); |
399 | 397 |
adjustedPoint = vp.convertToMapPoint(e.getX(), e.getY()); |
400 |
showCoords(e.getPoint()); |
|
398 |
// showCoords(e.getPoint());
|
|
401 | 399 |
|
402 | 400 |
getMapControl().repaint(); |
403 | 401 |
} |
... | ... | |
468 | 466 |
} |
469 | 467 |
} |
470 | 468 |
|
471 |
/** |
|
472 |
* Show coordinates at status bar |
|
473 |
* |
|
474 |
* @param point |
|
475 |
*/ |
|
476 |
private void showCoords(Point2D point) { |
|
477 |
String[] axisText = new String[2]; |
|
478 |
axisText[0] = "X = "; |
|
479 |
axisText[1] = "Y = "; |
|
469 |
// /** |
|
470 |
// * Show coordinates at status bar |
|
471 |
// * |
|
472 |
// * @param point |
|
473 |
// */ |
|
474 |
// private void showCoords(Point2D point) { |
|
475 |
// String[] axisText = new String[2]; |
|
476 |
// axisText[0] = "X = "; |
|
477 |
// axisText[1] = "Y = "; |
|
478 |
// |
|
479 |
// ViewPort vp = mapControl.getMapContext().getViewPort(); |
|
480 |
// IProjection iProj = vp.getProjection(); |
|
481 |
// Point p = vp.convertToMapPoint(point); |
|
482 |
// Point2D p2D = new Point2D.Double(p.getX(), p.getY()); |
|
483 |
// |
|
484 |
// sbl.setFractionDigits(p2D); |
|
485 |
// axisText = sbl.setCoorDisplayText(axisText); |
|
486 |
// MainFrame mF = PluginServices.getMainFrame(); |
|
487 |
// |
|
488 |
// if (mF != null) { |
|
489 |
// mF.getStatusBar() |
|
490 |
// .setMessage( |
|
491 |
// "units", |
|
492 |
// PluginServices.getText(this, MapContext |
|
493 |
// .getDistanceNames()[vp.getDistanceUnits()])); |
|
494 |
// mF.getStatusBar().setControlValue("scale", |
|
495 |
// String.valueOf(mapControl.getMapContext().getScaleView())); |
|
496 |
// mF.getStatusBar().setMessage("projection", iProj.getAbrev()); |
|
497 |
// |
|
498 |
// String[] coords = sbl.getCoords(p2D); |
|
499 |
// mF.getStatusBar().setMessage("x", axisText[0] + coords[0]); |
|
500 |
// mF.getStatusBar().setMessage("y", axisText[1] + coords[1]); |
|
501 |
// } |
|
502 |
// |
|
503 |
// } |
|
480 | 504 |
|
481 |
ViewPort vp = mapControl.getMapContext().getViewPort(); |
|
482 |
IProjection iProj = vp.getProjection(); |
|
483 |
Point p = vp.convertToMapPoint(point); |
|
484 |
Point2D p2D = new Point2D.Double(p.getX(), p.getY()); |
|
485 |
|
|
486 |
sbl.setFractionDigits(p2D); |
|
487 |
axisText = sbl.setCoorDisplayText(axisText); |
|
488 |
MainFrame mF = PluginServices.getMainFrame(); |
|
489 |
|
|
490 |
if (mF != null) { |
|
491 |
mF.getStatusBar() |
|
492 |
.setMessage( |
|
493 |
"units", |
|
494 |
PluginServices.getText(this, MapContext |
|
495 |
.getDistanceNames()[vp.getDistanceUnits()])); |
|
496 |
mF.getStatusBar().setControlValue("scale", |
|
497 |
String.valueOf(mapControl.getMapContext().getScaleView())); |
|
498 |
mF.getStatusBar().setMessage("projection", iProj.getAbrev()); |
|
499 |
|
|
500 |
String[] coords = sbl.getCoords(p2D); |
|
501 |
mF.getStatusBar().setMessage("x", axisText[0] + coords[0]); |
|
502 |
mF.getStatusBar().setMessage("y", axisText[1] + coords[1]); |
|
503 |
} |
|
504 |
|
|
505 |
} |
|
506 |
|
|
507 | 505 |
/** |
508 | 506 |
* Processes console entries from console. Tries to process entry in each type |
509 | 507 |
* of {@link #currentParam}. If there is some error, It will continue |
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.impl/src/main/java/org/gvsig/vectorediting/swing/impl/EditingCompoundBehavior.java | ||
---|---|---|
4 | 4 |
import java.awt.event.MouseEvent; |
5 | 5 |
import java.awt.event.MouseWheelEvent; |
6 | 6 |
|
7 |
import org.gvsig.app.project.documents.view.toolListeners.PointSelectListener; |
|
8 |
import org.gvsig.app.project.documents.view.toolListeners.StatusBarListener; |
|
9 | 7 |
import org.gvsig.fmap.mapcontrol.MapControl; |
10 | 8 |
import org.gvsig.fmap.mapcontrol.MapControlDrawer; |
11 | 9 |
import org.gvsig.fmap.mapcontrol.tools.BehaviorException; |
12 | 10 |
import org.gvsig.fmap.mapcontrol.tools.CompoundBehavior; |
11 |
import org.gvsig.fmap.mapcontrol.tools.PointSelectionListener; |
|
13 | 12 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior; |
14 | 13 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.IBehavior; |
15 | 14 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseMovementBehavior; |
... | ... | |
236 | 235 |
|
237 | 236 |
if (this.selection == null){ |
238 | 237 |
if (mc !=null) { |
239 |
StatusBarListener sbl = new StatusBarListener(mc); |
|
240 |
PointSelectListener psl = new PointSelectListener(mc);
|
|
238 |
// StatusBarListener sbl = new StatusBarListener(mc);
|
|
239 |
PointSelectionListener psl = new PointSelectionListener(mc);
|
|
241 | 240 |
this.selection = new CompoundBehavior(new Behavior[] { |
242 |
new PointBehavior(psl), new MouseMovementBehavior(sbl) }); |
|
241 |
new PointBehavior(psl) }); //, new MouseMovementBehavior(sbl) });
|
|
243 | 242 |
this.selection.setMapControl(mc); |
244 | 243 |
} |
245 | 244 |
} else { |
Also available in: Unified diff