Revision 9956 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/toolListeners/StatusBarListener.java
StatusBarListener.java | ||
---|---|---|
45 | 45 |
import java.text.NumberFormat; |
46 | 46 |
|
47 | 47 |
import org.cresques.cts.IProjection; |
48 |
import org.gvsig.gui.beans.controls.combolabel.ComboCoords; |
|
48 | 49 |
|
49 | 50 |
import com.iver.andami.PluginServices; |
50 | 51 |
import com.iver.andami.ui.mdiFrame.MainFrame; |
... | ... | |
54 | 55 |
import com.iver.cit.gvsig.fmap.tools.BehaviorException; |
55 | 56 |
import com.iver.cit.gvsig.fmap.tools.Events.PointEvent; |
56 | 57 |
import com.iver.cit.gvsig.fmap.tools.Listeners.PointListener; |
58 |
import com.iver.cit.gvsig.project.documents.layout.Attributes; |
|
57 | 59 |
|
58 | 60 |
|
59 | 61 |
/** |
... | ... | |
105 | 107 |
axisText = setCoorDisplayText(axisText); |
106 | 108 |
MainFrame mF = PluginServices.getMainFrame(); |
107 | 109 |
|
108 |
if (mF != null) |
|
109 |
{ |
|
110 |
mF.getStatusBar().setMessage("units",
|
|
110 |
if (mF != null){
|
|
111 |
|
|
112 |
mF.getStatusBar().setMessage("units",
|
|
111 | 113 |
PluginServices.getText(this, FConstant.NAMES[mapControl.getMapContext().getViewPort().getDistanceUnits()])); |
112 | 114 |
// FJP: No se debe llamar a setControlValue desde aqu?, porque |
113 | 115 |
// cambia la escala, y con ella el viewPort (adem?s, de |
... | ... | |
117 | 119 |
mF.getStatusBar().setMessage("projection", mapControl.getViewPort().getProjection().getAbrev()); |
118 | 120 |
|
119 | 121 |
String[] coords=getCoords(p); |
120 |
mF.getStatusBar().setMessage("x", |
|
121 |
axisText[0] + coords[0]); |
|
122 |
mF.getStatusBar().setMessage("y", |
|
123 |
axisText[1] + coords[1]); |
|
122 |
// mF.getStatusBar().setMessage("x", |
|
123 |
// axisText[0] + coords[0]); |
|
124 |
// mF.getStatusBar().setMessage("y", |
|
125 |
// axisText[1] + coords[1]); |
|
126 |
ComboCoords combocoords=(ComboCoords)PluginServices.getMainFrame().getComponentByName("coords"); |
|
127 |
combocoords.setLabelX(axisText[0]); |
|
128 |
combocoords.setLabelY(axisText[1]); |
|
129 |
combocoords.setValueX(coords[0]); |
|
130 |
combocoords.setValueY(coords[1]); |
|
124 | 131 |
} |
125 | 132 |
} |
126 | 133 |
|
... | ... | |
131 | 138 |
* 050211, jmorell. |
132 | 139 |
* @param p |
133 | 140 |
*/ |
134 |
private void setFractionDigits(Point2D p) {
|
|
141 |
public void setFractionDigits(Point2D p) {
|
|
135 | 142 |
IProjection iProj = mapControl.getMapContext().getProjection(); |
136 | 143 |
if (!iProj.isProjected()) { |
137 | 144 |
nf.setMaximumFractionDigits(8); |
... | ... | |
146 | 153 |
* 050211, jmorell. |
147 | 154 |
* @param p |
148 | 155 |
*/ |
149 |
private String[] setCoorDisplayText(String[] axisText) {
|
|
156 |
public String[] setCoorDisplayText(String[] axisText) {
|
|
150 | 157 |
IProjection iProj = mapControl.getMapContext().getProjection(); |
151 |
if (!iProj.isProjected()) { |
|
158 |
if (!iProj.isProjected() || mapControl.getViewPort().getDistanceUnits()==Attributes.NAMES.length-1) {
|
|
152 | 159 |
axisText[0] = "Lon = "; |
153 | 160 |
axisText[1] = "Lat = "; |
154 | 161 |
} else { |
... | ... | |
172 | 179 |
// System.out.println("Segundos: " + segundo); |
173 | 180 |
return signo+grado+"? "+(long) minuto+"' "+(long)segundo+"''"; |
174 | 181 |
} |
175 |
private String[] getCoords(Point2D p) {
|
|
182 |
public String[] getCoords(Point2D p) {
|
|
176 | 183 |
String[] coords=new String[2]; |
177 | 184 |
IProjection iProj = mapControl.getMapContext().getProjection(); |
178 | 185 |
if (!iProj.isProjected()) { |
179 | 186 |
coords[0]=String.valueOf(formatDegrees(p.getX())); |
180 | 187 |
coords[1]=String.valueOf(formatDegrees(p.getY())); |
181 | 188 |
} else { |
182 |
coords[0]=String.valueOf(nf.format((p.getX()/MapContext.CHANGEM[mapControl.getViewPort().getDistanceUnits()])*MapContext.CHANGEM[mapControl.getViewPort().getMapUnits()])); |
|
183 |
coords[1]=String.valueOf(nf.format((p.getY()/MapContext.CHANGEM[mapControl.getViewPort().getDistanceUnits()])*MapContext.CHANGEM[mapControl.getViewPort().getMapUnits()])); |
|
189 |
if (mapControl.getViewPort().getDistanceUnits()==Attributes.NAMES.length-1) { |
|
190 |
Point2D pgeo=iProj.toGeo(p); |
|
191 |
coords[0]=String.valueOf(formatDegrees(pgeo.getX())); |
|
192 |
coords[1]=String.valueOf(formatDegrees(pgeo.getY())); |
|
193 |
}else { |
|
194 |
coords[0]=String.valueOf(nf.format((p.getX()/MapContext.CHANGEM[mapControl.getViewPort().getDistanceUnits()])*MapContext.CHANGEM[mapControl.getViewPort().getMapUnits()])); |
|
195 |
coords[1]=String.valueOf(nf.format((p.getY()/MapContext.CHANGEM[mapControl.getViewPort().getDistanceUnits()])*MapContext.CHANGEM[mapControl.getViewPort().getMapUnits()])); |
|
196 |
} |
|
184 | 197 |
} |
185 | 198 |
return coords; |
186 | 199 |
} |
Also available in: Unified diff