Revision 9956 trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/CADToolAdapter.java
CADToolAdapter.java | ||
---|---|---|
22 | 22 |
import java.util.prefs.Preferences; |
23 | 23 |
|
24 | 24 |
import org.cresques.cts.IProjection; |
25 |
import org.gvsig.gui.beans.controls.combolabel.ComboCoords; |
|
25 | 26 |
|
26 | 27 |
import com.iver.andami.PluginServices; |
27 | 28 |
import com.iver.andami.ui.mdiFrame.MainFrame; |
... | ... | |
54 | 55 |
import com.iver.cit.gvsig.project.documents.view.snapping.ISnapperRaster; |
55 | 56 |
import com.iver.cit.gvsig.project.documents.view.snapping.ISnapperVectorial; |
56 | 57 |
import com.iver.cit.gvsig.project.documents.view.snapping.SnappingVisitor; |
58 |
import com.iver.cit.gvsig.project.documents.view.toolListeners.StatusBarListener; |
|
57 | 59 |
import com.iver.utiles.console.JConsole; |
58 | 60 |
import com.vividsolutions.jts.geom.Envelope; |
59 | 61 |
|
... | ... | |
105 | 107 |
|
106 | 108 |
private static boolean flatnessInitialized=false; |
107 | 109 |
private static Preferences prefs = Preferences.userRoot().node( "cadtooladapter" ); |
108 |
|
|
110 |
private StatusBarListener sbl=null; |
|
111 |
/* (non-Javadoc) |
|
112 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.IBehavior#setMapControl(com.iver.cit.gvsig.fmap.MapControl) |
|
113 |
*/ |
|
114 |
public void setMapControl(MapControl mc) { |
|
115 |
super.setMapControl(mc); |
|
116 |
sbl=new StatusBarListener(getMapControl()); |
|
117 |
} |
|
109 | 118 |
/** |
110 | 119 |
* Pinta de alguna manera especial las geometrias seleccionadas para la |
111 | 120 |
* edici?n. En caso de que el snapping est? activado, pintar? el efecto del |
... | ... | |
310 | 319 |
private void showCoords(Point2D pPix) |
311 | 320 |
{ |
312 | 321 |
String[] axisText = new String[2]; |
313 |
NumberFormat nf = NumberFormat.getInstance(); |
|
322 |
axisText[0] = "X = "; |
|
323 |
axisText[1] = "Y = "; |
|
324 |
// NumberFormat nf = NumberFormat.getInstance(); |
|
314 | 325 |
MapControl mapControl = getMapControl(); |
315 | 326 |
ViewPort vp = mapControl.getMapContext().getViewPort(); |
316 | 327 |
IProjection iProj = vp.getProjection(); |
317 |
if (iProj.getAbrev().equals("EPSG:4326") || iProj.getAbrev().equals("EPSG:4230")) { |
|
318 |
axisText[0] = "Lon = "; |
|
319 |
axisText[1] = "Lat = "; |
|
320 |
nf.setMaximumFractionDigits(8); |
|
321 |
} else { |
|
322 |
axisText[0] = "X = "; |
|
323 |
axisText[1] = "Y = "; |
|
324 |
nf.setMaximumFractionDigits(2); |
|
325 |
} |
|
328 |
|
|
329 |
// if (iProj.getAbrev().equals("EPSG:4326") || iProj.getAbrev().equals("EPSG:4230")) { |
|
330 |
// axisText[0] = "Lon = "; |
|
331 |
// axisText[1] = "Lat = "; |
|
332 |
// nf.setMaximumFractionDigits(8); |
|
333 |
// } else { |
|
334 |
// axisText[0] = "X = "; |
|
335 |
// axisText[1] = "Y = "; |
|
336 |
// nf.setMaximumFractionDigits(2); |
|
337 |
// } |
|
326 | 338 |
Point2D p; |
327 | 339 |
if (mapAdjustedPoint == null) |
328 | 340 |
{ |
... | ... | |
332 | 344 |
{ |
333 | 345 |
p = mapAdjustedPoint; |
334 | 346 |
} |
347 |
sbl.setFractionDigits(p); |
|
348 |
axisText = sbl.setCoorDisplayText(axisText); |
|
335 | 349 |
MainFrame mF = PluginServices.getMainFrame(); |
336 | 350 |
|
337 | 351 |
if (mF != null) |
... | ... | |
341 | 355 |
mF.getStatusBar().setControlValue("scale",String.valueOf(mapControl.getMapContext().getScaleView())); |
342 | 356 |
mF.getStatusBar().setMessage("projection", iProj.getAbrev()); |
343 | 357 |
|
344 |
mF.getStatusBar().setMessage("x", |
|
345 |
axisText[0] + String.valueOf(nf.format(p.getX()/MapContext.CHANGEM[vp.getDistanceUnits()]))); |
|
346 |
mF.getStatusBar().setMessage("y", |
|
347 |
axisText[1] + String.valueOf(nf.format(p.getY()/MapContext.CHANGEM[vp.getDistanceUnits()]))); |
|
358 |
// mF.getStatusBar().setMessage("x", |
|
359 |
// axisText[0] + String.valueOf(nf.format(p.getX()/MapContext.CHANGEM[vp.getDistanceUnits()]))); |
|
360 |
// mF.getStatusBar().setMessage("y", |
|
361 |
// axisText[1] + String.valueOf(nf.format(p.getY()/MapContext.CHANGEM[vp.getDistanceUnits()]))); |
|
362 |
String[] coords=sbl.getCoords(p); |
|
363 |
ComboCoords combocoords=(ComboCoords)PluginServices.getMainFrame().getComponentByName("coords"); |
|
364 |
combocoords.setLabelX(axisText[0]); |
|
365 |
combocoords.setLabelY(axisText[1]); |
|
366 |
combocoords.setValueX(coords[0]); |
|
367 |
combocoords.setValueY(coords[1]); |
|
348 | 368 |
} |
349 | 369 |
} |
350 | 370 |
|
Also available in: Unified diff