Revision 2972 trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/fmap/tools/Behavior/GeoRedimBehavior.java
GeoRedimBehavior.java | ||
---|---|---|
132 | 132 |
} |
133 | 133 |
|
134 | 134 |
/** |
135 |
* Funci?n que carga la capa si todav?a no lo est?. |
|
136 |
*/ |
|
137 |
private void loadLayer(){ |
|
138 |
//Cargamos la capa si esta es null |
|
139 |
if(this.lyrGeoRaster == null){ |
|
140 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
141 |
for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){ |
|
142 |
FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i); |
|
143 |
if(lyr instanceof FLyrGeoRaster) |
|
144 |
this.lyrGeoRaster = (FLyrGeoRaster)lyr; |
|
145 |
} |
|
146 |
} |
|
147 |
} |
|
148 |
|
|
149 |
/** |
|
135 | 150 |
* Cuando se produce un evento de pintado dibujamos el marco de la imagen para |
136 | 151 |
* que el usuario pueda seleccionar y redimensionar. |
137 | 152 |
*/ |
... | ... | |
141 | 156 |
g.drawImage(img, 0, 0, null); |
142 | 157 |
g.setColor(Color.red); |
143 | 158 |
ViewPort vp = getMapControl().getMapContext().getViewPort(); |
144 |
|
|
159 |
loadLayer(); |
|
145 | 160 |
Rectangle r = new Rectangle(); |
146 | 161 |
|
147 | 162 |
if(tmpLr == null || tmpUl == null){ |
... | ... | |
151 | 166 |
}else |
152 | 167 |
r.setFrameFromDiagonal(tmpUl, tmpLr); |
153 | 168 |
|
154 |
g.drawRect(r.x, r.y, r.width, r.height); |
|
155 | 169 |
|
170 |
|
|
171 |
g.drawRect(r.x, r.y, r.width, r.height); |
|
172 |
|
|
156 | 173 |
} |
157 | 174 |
|
158 | 175 |
/** |
... | ... | |
165 | 182 |
public void mousePressed(MouseEvent e) { |
166 | 183 |
if (e.getButton() == MouseEvent.BUTTON1) { |
167 | 184 |
|
168 |
//Cargamos la capa si esta es null |
|
169 |
if(this.lyrGeoRaster == null){ |
|
170 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
171 |
for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){ |
|
172 |
FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i); |
|
173 |
if(lyr instanceof FLyrGeoRaster) |
|
174 |
this.lyrGeoRaster = (FLyrGeoRaster)lyr; |
|
175 |
} |
|
176 |
} |
|
185 |
loadLayer(); |
|
177 | 186 |
|
178 | 187 |
tmpUl = ul; |
179 | 188 |
tmpLr = lr; |
... | ... | |
250 | 259 |
double coordCentro = tmpLr.getY() + (Math.abs(tmpLr.getY() - tmpUl.getY()) / 2); |
251 | 260 |
tmpUl = new Point2D.Double(tmpUl.getX(), coordCentro + (newLadoCorto/2)); |
252 | 261 |
tmpLr = new Point2D.Double(e.getX(), coordCentro - (newLadoCorto/2)); |
253 |
//System.out.println("Vertical derecha "+e.getPoint()+" ladoLargo="+newLadoLargo+" ladoCorto="+newLadoCorto+" centro="+coordCentro); |
|
262 |
System.out.println("Vertical derecha "+e.getPoint()+" newladoLargo="+newLadoLargo+" newladoCorto="+newLadoCorto+" centro="+coordCentro); |
|
263 |
System.out.println("................ longLadoLargo="+longLadoLargo+" longLadoCorto="+longLadoCorto); |
|
254 | 264 |
} |
255 | 265 |
if(redimActive[1]){//vertical izquierda |
256 | 266 |
double newLadoLargo = (e.getX() - tmpLr.getX()); |
... | ... | |
335 | 345 |
public void mouseMoved(MouseEvent e) throws BehaviorException { |
336 | 346 |
ViewPort vp = getMapControl().getMapContext().getViewPort(); |
337 | 347 |
|
338 |
//Cargamos la capa si esta es null |
|
339 |
if(this.lyrGeoRaster == null){ |
|
340 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
341 |
for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){ |
|
342 |
FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i); |
|
343 |
if(lyr instanceof FLyrGeoRaster) |
|
344 |
this.lyrGeoRaster = (FLyrGeoRaster)lyr; |
|
345 |
} |
|
346 |
} |
|
348 |
loadLayer(); |
|
347 | 349 |
|
348 | 350 |
double wcX = vp.toMapPoint(e.getX(), e.getY()).getX(); |
349 | 351 |
double wcY = vp.toMapPoint(e.getX(), e.getY()).getY(); |
Also available in: Unified diff