|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
|
2 |
*
|
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
|
4 |
*
|
|
5 |
* This program is free software; you can redistribute it and/or
|
|
6 |
* modify it under the terms of the GNU General Public License
|
|
7 |
* as published by the Free Software Foundation; either version 2
|
|
8 |
* of the License, or (at your option) any later version.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
|
18 |
*
|
|
19 |
* For more information, contact:
|
|
20 |
*
|
|
21 |
* Generalitat Valenciana
|
|
22 |
* Conselleria d'Infraestructures i Transport
|
|
23 |
* Av. Blasco Ib??ez, 50
|
|
24 |
* 46010 VALENCIA
|
|
25 |
* SPAIN
|
|
26 |
*
|
|
27 |
* +34 963862235
|
|
28 |
* gvsig@gva.es
|
|
29 |
* www.gvsig.gva.es
|
|
30 |
*
|
|
31 |
* or
|
|
32 |
*
|
|
33 |
* IVER T.I. S.A
|
|
34 |
* Salamanca 50
|
|
35 |
* 46005 Valencia
|
|
36 |
* Spain
|
|
37 |
*
|
|
38 |
* +34 963163400
|
|
39 |
* dac@iver.es
|
|
40 |
*/
|
|
41 |
package com.iver.cit.gvsig.fmap.tools.Behavior;
|
|
42 |
|
|
43 |
import java.awt.Color;
|
|
44 |
import java.awt.Cursor;
|
|
45 |
import java.awt.Graphics;
|
|
46 |
import java.awt.Image;
|
|
47 |
import java.awt.Point;
|
|
48 |
import java.awt.Rectangle;
|
|
49 |
import java.awt.Toolkit;
|
|
50 |
import java.awt.event.MouseEvent;
|
|
51 |
import java.awt.geom.Point2D;
|
|
52 |
import java.awt.geom.Rectangle2D;
|
|
53 |
import java.awt.image.BufferedImage;
|
|
54 |
import java.io.File;
|
|
55 |
|
|
56 |
import javax.swing.ImageIcon;
|
|
57 |
|
|
58 |
import org.cresques.io.GeoRasterFile;
|
|
59 |
import org.cresques.px.Extent;
|
|
60 |
|
|
61 |
import com.hardcode.driverManager.DriverLoadException;
|
|
62 |
import com.iver.andami.messages.NotificationManager;
|
|
63 |
import com.iver.cit.gvsig.fmap.MapControl;
|
|
64 |
import com.iver.cit.gvsig.fmap.ViewPort;
|
|
65 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
|
|
66 |
import com.iver.cit.gvsig.fmap.layers.FLyrRaster;
|
|
67 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
|
|
68 |
import com.iver.cit.gvsig.fmap.layers.RasterAdapter;
|
|
69 |
import com.iver.cit.gvsig.fmap.layers.RasterFileAdapter;
|
|
70 |
import com.iver.cit.gvsig.fmap.tools.BehaviorException;
|
|
71 |
import com.iver.cit.gvsig.fmap.tools.Listeners.RectangleListener;
|
|
72 |
import com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener;
|
|
73 |
import com.iver.cit.gvsig.gui.Panels.SelectFilePanel;
|
|
74 |
|
|
75 |
|
|
76 |
/**
|
|
77 |
* Behaviour que espera un listener de tipo RedimListener.
|
|
78 |
* Nacho Brodin (brodin_ign@gva.es)
|
|
79 |
*
|
|
80 |
*/
|
|
81 |
public class RedimBehavior extends Behavior {
|
|
82 |
private RectangleListener listener;
|
|
83 |
private Cursor cur = null;
|
|
84 |
|
|
85 |
private final Image iconHoriz = new ImageIcon(MapControl.class.getResource(
|
|
86 |
"images/FlechaHorizCursor.gif")).getImage();
|
|
87 |
private final Image iconVert = new ImageIcon(MapControl.class.getResource(
|
|
88 |
"images/FlechaVertCursor.gif")).getImage();
|
|
89 |
private final Image iconInclDer = new ImageIcon(MapControl.class.getResource(
|
|
90 |
"images/FlechaInclDerCursor.gif")).getImage();
|
|
91 |
private final Image iconInclIzq = new ImageIcon(MapControl.class.getResource(
|
|
92 |
"images/FlechaInclIzqCursor.gif")).getImage();
|
|
93 |
private final Image defaultCursor = new ImageIcon(MapControl.class.getResource(
|
|
94 |
"images/ZoomInCursor.gif")).getImage();
|
|
95 |
|
|
96 |
private final int WIDTH_BORDER = 25;
|
|
97 |
private final int LONG_CORNER = 35;
|
|
98 |
|
|
99 |
/**
|
|
100 |
* Cada elemento del vector corresponde a un tipo de icono que
|
|
101 |
* estar? a true si est? activo y a false si no lo est?.
|
|
102 |
* horizontal, vertical, inclinado derecha, inclinado izquierda
|
|
103 |
*/
|
|
104 |
private boolean[] iconActive = {false, false, false, false};
|
|
105 |
|
|
106 |
private Point2D ul = null;
|
|
107 |
private Point2D lr = null;
|
|
108 |
private Point2D tmpUl = null;
|
|
109 |
private Point2D tmpLr = null;
|
|
110 |
|
|
111 |
/**
|
|
112 |
* Cada elemento corresponde a la acivaci?n de redimensionado en una
|
|
113 |
* direcci?n que estar? activa a true.
|
|
114 |
* vertical derecha, vertical izquierda, horizontal arriba, horizontal abajo,
|
|
115 |
* inclinado
|
|
116 |
*/
|
|
117 |
private boolean[] redimActive = new boolean[5];
|
|
118 |
|
|
119 |
private Point2D pointInit = null;
|
|
120 |
private Rectangle2D rectInit = null;
|
|
121 |
|
|
122 |
private FLyrRaster lyrRaster = null;
|
|
123 |
private String pathToFile = null;
|
|
124 |
|
|
125 |
/**
|
|
126 |
* Crea un nuevo RectangleBehavior.
|
|
127 |
*
|
|
128 |
* @param zili listener.
|
|
129 |
*/
|
|
130 |
public RedimBehavior(RectangleListener zili) {
|
|
131 |
listener = zili;
|
|
132 |
for(int i=0; i<redimActive.length;i++)
|
|
133 |
redimActive[i] = false;
|
|
134 |
}
|
|
135 |
|
|
136 |
/**
|
|
137 |
* Cuando se produce un evento de pintado dibujamos el marco de la imagen para
|
|
138 |
* que el usuario pueda seleccionar y redimensionar.
|
|
139 |
*/
|
|
140 |
public void paintComponent(Graphics g) {
|
|
141 |
|
|
142 |
BufferedImage img = getMapControl().getImage();
|
|
143 |
g.drawImage(img, 0, 0, null);
|
|
144 |
g.setColor(Color.red);
|
|
145 |
ViewPort vp = getMapControl().getMapContext().getViewPort();
|
|
146 |
|
|
147 |
Rectangle r = new Rectangle();
|
|
148 |
|
|
149 |
if(tmpLr == null || tmpUl == null){
|
|
150 |
ul = vp.fromMapPoint(this.lyrRaster.getMinX(), this.lyrRaster.getMinY());
|
|
151 |
lr = vp.fromMapPoint(this.lyrRaster.getMaxX(), this.lyrRaster.getMaxY());
|
|
152 |
r.setFrameFromDiagonal(ul, lr);
|
|
153 |
}else
|
|
154 |
r.setFrameFromDiagonal(tmpUl, tmpLr);
|
|
155 |
|
|
156 |
g.drawRect(r.x, r.y, r.width, r.height);
|
|
157 |
|
|
158 |
}
|
|
159 |
|
|
160 |
/**
|
|
161 |
* Reimplementaci?n del m?todo mousePressed de Behavior. Cuando se pulsa
|
|
162 |
* estando sobre el marco de la imagen activamos la posibilidad de arrastrar
|
|
163 |
* para redimensionar la imagen.
|
|
164 |
*
|
|
165 |
* @param e MouseEvent
|
|
166 |
*/
|
|
167 |
public void mousePressed(MouseEvent e) {
|
|
168 |
if (e.getButton() == MouseEvent.BUTTON1) {
|
|
169 |
tmpUl = ul;
|
|
170 |
tmpLr = lr;
|
|
171 |
if(iconActive[0]){//Estirar en horizontal activado
|
|
172 |
if(e.getX() > (tmpLr.getX() - WIDTH_BORDER) && e.getX() < tmpLr.getX())
|
|
173 |
redimActive[0] = true;
|
|
174 |
if(e.getX() < (tmpUl.getX() + WIDTH_BORDER) && e.getX() > tmpUl.getX())
|
|
175 |
redimActive[1] = true;
|
|
176 |
}
|
|
177 |
if(iconActive[1]){//Estirar en vertical activado
|
|
178 |
if(e.getY() < (tmpLr.getY() + WIDTH_BORDER) && e.getY() > tmpLr.getY())
|
|
179 |
redimActive[3] = true;
|
|
180 |
if(e.getY() > (tmpUl.getY() - WIDTH_BORDER) && e.getY() < tmpUl.getY())
|
|
181 |
redimActive[2] = true;
|
|
182 |
}
|
|
183 |
if(iconActive[2] || iconActive[3]){ //Estirar en oblicuo activado
|
|
184 |
redimActive[4] = true;
|
|
185 |
pointInit = e.getPoint();
|
|
186 |
rectInit = new Rectangle2D.Double(tmpUl.getX(), tmpUl.getY(), tmpLr.getX() - tmpUl.getX(), tmpLr.getY() - tmpUl.getY());
|
|
187 |
}
|
|
188 |
|
|
189 |
}
|
|
190 |
|
|
191 |
if (listener.cancelDrawing()) {
|
|
192 |
getMapControl().cancelDrawing();
|
|
193 |
}
|
|
194 |
|
|
195 |
getMapControl().repaint();
|
|
196 |
}
|
|
197 |
|
|
198 |
/**
|
|
199 |
* Reimplementaci?n del m?todo mouseReleased de Behavior. Desactivamos
|
|
200 |
* los flags de redimensionado y a partir de la selecci?n del usuario
|
|
201 |
* creamos un nuevo extent para la imagen. Con este extent creamos una nueva
|
|
202 |
* capa que sustituir? a la anterior.
|
|
203 |
*
|
|
204 |
* @param e MouseEvent
|
|
205 |
*
|
|
206 |
* @throws BehaviorException Excepci?n lanzada cuando el Behavior.
|
|
207 |
*/
|
|
208 |
public void mouseReleased(MouseEvent e) throws BehaviorException {
|
|
209 |
|
|
210 |
if (e.getButton() == MouseEvent.BUTTON1) {
|
|
211 |
//Desactivamos los flags de redimensionado
|
|
212 |
for(int i=0;i<redimActive.length;i++)
|
|
213 |
redimActive[i] = false;
|
|
214 |
//Asignamos el nuevo extent a la imagen
|
|
215 |
ViewPort vp = getMapControl().getMapContext().getViewPort();
|
|
216 |
Extent ext = new Extent(vp.toMapPoint((int)tmpUl.getX(), (int)tmpUl.getY()).getX(),
|
|
217 |
vp.toMapPoint((int)tmpUl.getX(), (int)tmpUl.getY()).getY(),
|
|
218 |
vp.toMapPoint((int)tmpLr.getX(), (int)tmpLr.getY()).getX(),
|
|
219 |
vp.toMapPoint((int)tmpLr.getX(), (int)tmpLr.getY()).getY());
|
|
220 |
|
|
221 |
if(this.pathToFile != null && this.lyrRaster != null){
|
|
222 |
File fich = new File(this.pathToFile);
|
|
223 |
RasterAdapter adapter = new RasterFileAdapter(fich);
|
|
224 |
try{
|
|
225 |
adapter.setDriver(LayerFactory.getDM().getDriver("gvSIG Image Driver"));
|
|
226 |
}catch(DriverLoadException exc){
|
|
227 |
NotificationManager.addError("No se pudo acceder a los drivers", exc);
|
|
228 |
}
|
|
229 |
FLyrRaster capa = new FLyrRaster();
|
|
230 |
if (capa != null) {
|
|
231 |
capa.setName(lyrRaster.getName());
|
|
232 |
capa.setSource(adapter);
|
|
233 |
capa.setProjection(lyrRaster.getProjection());
|
|
234 |
capa.setTempExtent(ext);
|
|
235 |
capa.setExtentFlag(GeoRasterFile.ASSIGNED_EXTENT);
|
|
236 |
try {
|
|
237 |
capa.load();
|
|
238 |
} catch (DriverIOException exc) {
|
|
239 |
|
|
240 |
}
|
|
241 |
capa.setVisible(true);
|
|
242 |
}
|
|
243 |
|
|
244 |
getMapControl().getMapContext().getLayers().removeLayer(lyrRaster.getName());
|
|
245 |
lyrRaster = null;
|
|
246 |
getMapControl().getMapContext().getLayers().addLayer(capa);
|
|
247 |
this.setLyrRaster(capa);
|
|
248 |
getMapControl().repaint();
|
|
249 |
tmpUl = null;
|
|
250 |
tmpLr = null;
|
|
251 |
}
|
|
252 |
}
|
|
253 |
|
|
254 |
|
|
255 |
}
|
|
256 |
|
|
257 |
/**
|
|
258 |
* Al arrastrar cuando se ha pulsado sobre el marco de la imagen recalculamos
|
|
259 |
* el marco de la imagen
|
|
260 |
*
|
|
261 |
* @param e MouseEvent
|
|
262 |
*/
|
|
263 |
public void mouseDragged(MouseEvent e) {
|
|
264 |
double longLadoLargo = Math.abs(tmpLr.getX() - tmpUl.getX());
|
|
265 |
double longLadoCorto = Math.abs(tmpLr.getY() - tmpUl.getY());
|
|
266 |
|
|
267 |
if(redimActive[0]){//vertical derecha
|
|
268 |
double newLadoLargo = (e.getX() - tmpUl.getX());
|
|
269 |
double newLadoCorto = (newLadoLargo * longLadoCorto) / longLadoLargo;
|
|
270 |
double coordCentro = tmpLr.getY() + (Math.abs(tmpLr.getY() - tmpUl.getY()) / 2);
|
|
271 |
tmpUl = new Point2D.Double(tmpUl.getX(), coordCentro + (newLadoCorto/2));
|
|
272 |
tmpLr = new Point2D.Double(e.getX(), coordCentro - (newLadoCorto/2));
|
|
273 |
}
|
|
274 |
if(redimActive[1]){//vertical izquierda
|
|
275 |
double newLadoLargo = (e.getX() - tmpLr.getX());
|
|
276 |
double newLadoCorto = (newLadoLargo * longLadoCorto) / longLadoLargo;
|
|
277 |
double coordCentro = tmpLr.getY() + (Math.abs(tmpLr.getY() - tmpUl.getY()) / 2);
|
|
278 |
tmpLr = new Point2D.Double(tmpLr.getX(), coordCentro + (newLadoCorto/2));
|
|
279 |
tmpUl = new Point2D.Double(e.getX(), coordCentro - (newLadoCorto/2));
|
|
280 |
}
|
|
281 |
if(redimActive[2]){//horizontal abajo
|
|
282 |
double newLadoCorto = (e.getY() - tmpLr.getY());
|
|
283 |
double newLadoLargo = (newLadoCorto * longLadoLargo) / longLadoCorto;
|
|
284 |
double coordCentro = tmpLr.getX() - (Math.abs(tmpLr.getX() - tmpUl.getX()) / 2);
|
|
285 |
tmpLr = new Point2D.Double(coordCentro + (newLadoLargo/2), tmpLr.getY());
|
|
286 |
tmpUl = new Point2D.Double(coordCentro - (newLadoLargo/2), e.getY());
|
|
287 |
}
|
|
288 |
if(redimActive[3]){//horizontal arriba
|
|
289 |
double newLadoCorto = (e.getY() - tmpUl.getY());
|
|
290 |
double newLadoLargo = (newLadoCorto * longLadoLargo) / longLadoCorto;
|
|
291 |
double coordCentro = tmpLr.getX() - (Math.abs(tmpLr.getX() - tmpUl.getX()) / 2);
|
|
292 |
tmpUl = new Point2D.Double(coordCentro + (newLadoLargo/2), tmpUl.getY());
|
|
293 |
tmpLr = new Point2D.Double(coordCentro - (newLadoLargo/2), e.getY());
|
|
294 |
}
|
|
295 |
if(redimActive[4]){//inclinado
|
|
296 |
double distX = (e.getX() - pointInit.getX());
|
|
297 |
double distY = (e.getY() - pointInit.getY());
|
|
298 |
double incrLadoLargo = 0D, incrLadoCorto = 0D;
|
|
299 |
incrLadoLargo = distX;
|
|
300 |
//Calculamos la distancia que incrementaremos al lado corto
|
|
301 |
boolean ejeXLargo = true;
|
|
302 |
if(longLadoCorto > longLadoLargo){
|
|
303 |
double tmp = longLadoLargo;
|
|
304 |
longLadoLargo = longLadoCorto;
|
|
305 |
longLadoCorto = tmp;
|
|
306 |
ejeXLargo = false;
|
|
307 |
}
|
|
308 |
|
|
309 |
incrLadoCorto = (incrLadoLargo * longLadoCorto) / longLadoLargo;
|
|
310 |
Point2D antUl = tmpUl;
|
|
311 |
Point2D antLr = tmpLr;
|
|
312 |
if(distX > 0 && e.getX() > lr.getX()){
|
|
313 |
tmpUl = new Point2D.Double(rectInit.getMinX() - Math.abs(incrLadoLargo), rectInit.getMinY() + Math.abs(incrLadoCorto));
|
|
314 |
tmpLr = new Point2D.Double(rectInit.getMaxX() + Math.abs(incrLadoLargo), rectInit.getMaxY() - Math.abs(incrLadoCorto));
|
|
315 |
}else if(distX < 0 && e.getX() < ul.getX()){
|
|
316 |
tmpUl = new Point2D.Double(rectInit.getMinX() - Math.abs(incrLadoLargo), rectInit.getMinY() + Math.abs(incrLadoCorto));
|
|
317 |
tmpLr = new Point2D.Double(rectInit.getMaxX() + Math.abs(incrLadoLargo), rectInit.getMaxY() - Math.abs(incrLadoCorto));
|
|
318 |
}else if(distX > 0 && e.getX() < lr.getX() && e.getX() > ul.getX()){
|
|
319 |
tmpUl = new Point2D.Double(rectInit.getMinX() + Math.abs(incrLadoLargo), rectInit.getMinY() - Math.abs(incrLadoCorto));
|
|
320 |
tmpLr = new Point2D.Double(rectInit.getMaxX() - Math.abs(incrLadoLargo), rectInit.getMaxY() + Math.abs(incrLadoCorto));
|
|
321 |
}else if(distX < 0 && e.getX() < lr.getX() && e.getX() > ul.getX()){
|
|
322 |
tmpUl = new Point2D.Double(rectInit.getMinX() + Math.abs(incrLadoLargo), rectInit.getMinY() - Math.abs(incrLadoCorto));
|
|
323 |
tmpLr = new Point2D.Double(rectInit.getMaxX() - Math.abs(incrLadoLargo), rectInit.getMaxY() + Math.abs(incrLadoCorto));
|
|
324 |
}
|
|
325 |
//A partir de un tama?o m?nimo no reducimos m?s
|
|
326 |
if((tmpLr.getX() - tmpUl.getX()) < 100 || (tmpUl.getY() - tmpLr.getY()) < 100){
|
|
327 |
tmpUl = antUl;
|
|
328 |
tmpLr = antLr;
|
|
329 |
}
|
|
330 |
|
|
331 |
}
|
|
332 |
|
|
333 |
getMapControl().repaint();
|
|
334 |
}
|
|
335 |
|
|
336 |
/**
|
|
337 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#setListener(com.iver.cit.gvsig.fmap.tools.ToolListener)
|
|
338 |
*/
|
|
339 |
public void setListener(ToolListener listener) {
|
|
340 |
this.listener = (RectangleListener) listener;
|
|
341 |
}
|
|
342 |
|
|
343 |
/**
|
|
344 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#getListener()
|
|
345 |
*/
|
|
346 |
public ToolListener getListener() {
|
|
347 |
return listener;
|
|
348 |
}
|
|
349 |
|
|
350 |
/**
|
|
351 |
* Cuando movemos el rat?n detecta si estamos en el marco de la
|
|
352 |
* imagen y pone el icono del cursor del rat?n adecuado.
|
|
353 |
*/
|
|
354 |
public void mouseMoved(MouseEvent e) throws BehaviorException {
|
|
355 |
ViewPort vp = getMapControl().getMapContext().getViewPort();
|
|
356 |
double wcX = vp.toMapPoint(e.getX(), e.getY()).getX();
|
|
357 |
double wcY = vp.toMapPoint(e.getX(), e.getY()).getY();
|
|
358 |
int iconPosActive = -1;
|
|
359 |
|
|
360 |
//Flecha horizontal
|
|
361 |
if( ((wcX > lyrRaster.getMinX() && wcX < lyrRaster.getMinX() + WIDTH_BORDER) ||
|
|
362 |
(wcX < lyrRaster.getMaxX() && wcX > lyrRaster.getMaxX() - WIDTH_BORDER )) &&
|
|
363 |
(wcY < (lyrRaster.getMaxY() - LONG_CORNER)) &&
|
|
364 |
(wcY > (lyrRaster.getMinY() + LONG_CORNER))){
|
|
365 |
getMapControl().setCursor(Toolkit.getDefaultToolkit().createCustomCursor(iconHoriz,
|
|
366 |
new Point(16, 16), ""));
|
|
367 |
iconPosActive = 0;
|
|
368 |
|
|
369 |
}else{
|
|
370 |
//Flecha Vertical
|
|
371 |
if( ((wcY > lyrRaster.getMinY() && wcY < lyrRaster.getMinY() + WIDTH_BORDER) ||
|
|
372 |
(wcY < lyrRaster.getMaxY() && wcY > lyrRaster.getMaxY() - WIDTH_BORDER )) &&
|
|
373 |
(wcX < (lyrRaster.getMaxX() - LONG_CORNER)) &&
|
|
374 |
(wcX > (lyrRaster.getMinX() + LONG_CORNER))){
|
|
375 |
getMapControl().setCursor(Toolkit.getDefaultToolkit().createCustomCursor(iconVert,
|
|
376 |
new Point(16, 16), ""));
|
|
377 |
iconPosActive = 1;
|
|
378 |
}else{
|
|
379 |
//Flecha oblicua derecha
|
|
380 |
if((wcX > (lyrRaster.getMaxX() - LONG_CORNER) && wcX < lyrRaster.getMaxX() &&
|
|
381 |
wcY < (lyrRaster.getMinY() + LONG_CORNER) && wcY > lyrRaster.getMinY()) ||
|
|
382 |
(wcX > lyrRaster.getMinX() && wcX < (lyrRaster.getMinX() + LONG_CORNER) &&
|
|
383 |
wcY < lyrRaster.getMaxY() && wcY > (lyrRaster.getMaxY() - LONG_CORNER))){
|
|
384 |
getMapControl().setCursor(Toolkit.getDefaultToolkit().createCustomCursor(iconInclIzq,
|
|
385 |
new Point(16, 16), ""));
|
|
386 |
iconPosActive = 2;
|
|
387 |
}else{
|
|
388 |
//Flecha oblicua izquierda
|
|
389 |
if((wcX > lyrRaster.getMinX() && wcX < (lyrRaster.getMinX() + LONG_CORNER) &&
|
|
390 |
wcY < (lyrRaster.getMinY() + LONG_CORNER) && wcY > lyrRaster.getMinY()) ||
|
|
391 |
(wcX > (lyrRaster.getMaxX() - LONG_CORNER) && wcX < lyrRaster.getMaxX() &&
|
|
392 |
wcY > (lyrRaster.getMaxY() - LONG_CORNER) && wcY < lyrRaster.getMaxY())){
|
|
393 |
getMapControl().setCursor(Toolkit.getDefaultToolkit().createCustomCursor(iconInclDer,
|
|
394 |
new Point(16, 16), ""));
|
|
395 |
iconPosActive = 3;
|
|
396 |
}else{
|
|
397 |
getMapControl().setCursor(Toolkit.getDefaultToolkit().createCustomCursor(defaultCursor,
|
|
398 |
new Point(16, 16), ""));
|
|
399 |
iconPosActive = -1;
|
|
400 |
}
|
|
401 |
}
|
|
402 |
}
|
|
403 |
}
|
|
404 |
|
|
405 |
//Ponemos a true el incono activado y a false el resto
|
|
406 |
for(int i=0;i<iconActive.length;i++){
|
|
407 |
if(i==iconPosActive)
|
|
408 |
iconActive[i] = true;
|
|
409 |
else
|
|
410 |
iconActive[i] = false;
|
|
411 |
}
|
|
412 |
getMapControl().repaint();
|
|
413 |
}
|
|
414 |
|
|
415 |
/**
|
|
416 |
* @return Returns the lyrRaster.
|
|
417 |
*/
|
|
418 |
public FLyrRaster getLyrRaster() {
|
|
419 |
return lyrRaster;
|
|
420 |
}
|
|
421 |
|
|
422 |
/**
|
|
423 |
* @param lyrRaster The lyrRaster to set.
|
|
424 |
*/
|
|
425 |
public void setLyrRaster(FLyrRaster lyrRaster) {
|
|
426 |
this.lyrRaster = lyrRaster;
|
|
427 |
}
|
|
428 |
|
|
429 |
/**
|
|
430 |
* @return Returns the pathToFile.
|
|
431 |
*/
|
|
432 |
public String getPathToFile() {
|
|
433 |
return pathToFile;
|
|
434 |
}
|
|
435 |
|
|
436 |
/**
|
|
437 |
* @param pathToFile The pathToFile to set.
|
|
438 |
*/
|
|
439 |
public void setPathToFile(String pathToFile) {
|
|
440 |
this.pathToFile = pathToFile;
|
|
441 |
}
|
|
442 |
}
|
0 |
443 |
|