Revision 10552 branches/v10/extensions/extGeoProcessing/src/com/iver/cit/gvsig/geoprocess/core/util/UnitUtils.java
UnitUtils.java | ||
---|---|---|
45 | 45 |
* |
46 | 46 |
* $Id$ |
47 | 47 |
* $Log$ |
48 |
* Revision 1.3.2.4 2007-01-12 13:25:53 caballero |
|
48 |
* Revision 1.3.2.5 2007-02-28 12:26:01 azabala |
|
49 |
* solved bug when view has a geodetic projection |
|
50 |
* |
|
51 |
* Revision 1.3.2.4 2007/01/12 13:25:53 caballero |
|
49 | 52 |
* unidades de mapa y medida |
50 | 53 |
* |
51 | 54 |
* Revision 1.3.2.3 2006/12/22 10:15:07 caballero |
... | ... | |
120 | 123 |
* |
121 | 124 |
* */ |
122 | 125 |
public static double getInInternalUnits(double userEntryDistance){ |
123 |
// VCN he modificado esto a como creo que deber?a de estar, as? tiene en cuenta para calcular la distancia tanto las unidades |
|
124 |
//en las que se encuentra la cartograf?a como las unidades de medida seleccionadas por el usuario. |
|
126 |
// VCN he modificado esto a como creo que deber?a de estar, |
|
127 |
//as? tiene en cuenta para calcular la distancia tanto las unidades |
|
128 |
//en las que se encuentra la cartograf?a como las unidades de medida |
|
129 |
//seleccionadas por el usuario. |
|
130 |
IProjection proj = ((View)PluginServices. |
|
131 |
getMDIManager(). |
|
132 |
getActiveWindow()). |
|
133 |
getMapControl(). |
|
134 |
getViewPort(). |
|
135 |
getProjection(); |
|
136 |
|
|
125 | 137 |
int distanceUnits = ((View)PluginServices. |
126 | 138 |
getMDIManager(). |
127 | 139 |
getActiveWindow()).getMapControl().getViewPort().getDistanceUnits(); |
128 |
int mapUnits = ((View)PluginServices. |
|
140 |
|
|
141 |
boolean isProjected = proj.isProjected(); |
|
142 |
int mapUnits = -1; |
|
143 |
if(isProjected){ |
|
144 |
mapUnits = ((View)PluginServices. |
|
129 | 145 |
getMDIManager(). |
130 | 146 |
getActiveWindow()).getMapControl().getViewPort().getMapUnits(); |
131 |
double distInInternalUnits = (userEntryDistance/MapContext.CHANGEM[mapUnits]) * MapContext.CHANGEM[distanceUnits]; |
|
147 |
}else{ |
|
148 |
mapUnits = 1; |
|
149 |
} |
|
150 |
|
|
151 |
double distInInternalUnits = (userEntryDistance/MapContext.CHANGEM[mapUnits]) * |
|
152 |
MapContext.CHANGEM[distanceUnits]; |
|
153 |
|
|
132 | 154 |
/* |
133 | 155 |
* if layer's projections is in geographics |
134 | 156 |
coords, pass distance to a angular measure |
135 | 157 |
*/ |
136 |
IProjection proj = ((View)PluginServices. |
|
137 |
getMDIManager(). |
|
138 |
getActiveWindow()). |
|
139 |
getMapControl(). |
|
140 |
getViewPort(). |
|
141 |
getProjection(); |
|
142 |
if( (proj != null) && !(proj instanceof CSUTM)){ |
|
158 |
|
|
159 |
if( (proj != null) && !(isProjected)){ |
|
143 | 160 |
distInInternalUnits = |
144 | 161 |
UnitUtils.toSexaAngularMeasure(distInInternalUnits); |
145 | 162 |
} |
Also available in: Unified diff