Revision 2987
trunk/extensions/extGeoreferencing/text.properties | ||
---|---|---|
15 | 15 |
eliminar_punto=Eliminar punto |
16 | 16 |
borrar_todos=Borrar todos |
17 | 17 |
coordenadas_vacias=Coordenadas vacias |
18 |
asignar_coordenadas=Asignar Coordenadas |
|
19 |
fuera_de_extent=El punto seleccionado est? fuera del extent de la imagen |
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/georeferencing/GeoreferencingModule.java | ||
---|---|---|
143 | 143 |
|
144 | 144 |
} |
145 | 145 |
|
146 |
|
|
146 | 147 |
/** |
147 | 148 |
* Cuando cerramos la ventana de georreferenciaci?n se elimina la barra de herramientas |
148 | 149 |
* y se destruye la capa de puntos. |
... | ... | |
153 | 154 |
FLyrPoints lyrPoints = null; |
154 | 155 |
for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){ |
155 | 156 |
FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i); |
156 |
if(lyr instanceof FLyrPoints) |
|
157 |
if(lyr instanceof FLyrPoints && lyr.getName().startsWith("*"))
|
|
157 | 158 |
theView.getMapControl().getMapContext().getLayers().removeLayer(i); |
158 | 159 |
} |
159 | 160 |
GeoreferencingToolsModule.visible = false; |
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/georeferencing/GeoreferencingToolsModule.java | ||
---|---|---|
109 | 109 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
110 | 110 |
for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){ |
111 | 111 |
FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i); |
112 |
if(lyr instanceof FLyrGeoRaster) |
|
112 |
if(lyr instanceof FLyrGeoRaster && lyr.getName().startsWith("*"))
|
|
113 | 113 |
lyrGeoRaster = (FLyrGeoRaster)lyr; |
114 | 114 |
} |
115 | 115 |
|
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/fmap/layers/FLyrPoints.java | ||
---|---|---|
94 | 94 |
|
95 | 95 |
for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){ |
96 | 96 |
FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i); |
97 |
if(lyr instanceof FLyrGeoRaster)
|
|
97 |
if(lyr instanceof FLyrGeoRaster && lyr.getName().startsWith("*"));
|
|
98 | 98 |
lyrGeoRaster = (FLyrGeoRaster)lyr; |
99 | 99 |
} |
100 | 100 |
|
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/fmap/tools/Behavior/GeoRedimBehavior.java | ||
---|---|---|
135 | 135 |
* Funci?n que carga la capa si todav?a no lo est?. |
136 | 136 |
*/ |
137 | 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 |
} |
|
138 |
//Cargamos la capa |
|
139 |
|
|
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 && lyr.getName().startsWith("*")) |
|
144 |
this.lyrGeoRaster = (FLyrGeoRaster)lyr; |
|
146 | 145 |
} |
147 | 146 |
} |
148 | 147 |
|
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/fmap/tools/Behavior/GeoMoveBehavior.java | ||
---|---|---|
115 | 115 |
} |
116 | 116 |
|
117 | 117 |
/** |
118 |
* Funci?n que carga la capa si todav?a no lo est?. |
|
119 |
*/ |
|
120 |
private void loadLayer(){ |
|
121 |
//Cargamos la capa |
|
122 |
|
|
123 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
124 |
for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){ |
|
125 |
FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i); |
|
126 |
if(lyr instanceof FLyrGeoRaster && lyr.getName().startsWith("*")) |
|
127 |
this.lyrGeoRaster = (FLyrGeoRaster)lyr; |
|
128 |
} |
|
129 |
} |
|
130 |
|
|
131 |
/** |
|
118 | 132 |
* Coloca el cursor del rat?n con el icono adecuado cuando entra dentro de la |
119 | 133 |
* imagen. |
120 | 134 |
*/ |
... | ... | |
122 | 136 |
|
123 | 137 |
ViewPort vp = getMapControl().getMapContext().getViewPort(); |
124 | 138 |
|
125 |
//Cargamos la capa si esta es null |
|
126 |
if(this.lyrGeoRaster == null){ |
|
127 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
128 |
|
|
129 |
for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){ |
|
130 |
FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i); |
|
131 |
if(lyr instanceof FLyrGeoRaster) |
|
132 |
this.lyrGeoRaster = (FLyrGeoRaster)lyr; |
|
133 |
} |
|
134 |
} |
|
139 |
loadLayer(); |
|
135 | 140 |
|
136 | 141 |
Point2D pto = vp.toMapPoint(e.getX(), e.getY()); |
137 | 142 |
|
... | ... | |
168 | 173 |
public void mousePressed(MouseEvent e) throws BehaviorException { |
169 | 174 |
if(e.getButton() == MouseEvent.BUTTON1 && !defaultCursorActive){ |
170 | 175 |
|
171 |
//Cargamos la capa |
|
172 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
173 |
for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){ |
|
174 |
FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i); |
|
175 |
if(lyr instanceof FLyrGeoRaster) |
|
176 |
this.lyrGeoRaster = (FLyrGeoRaster)lyr; |
|
177 |
} |
|
176 |
loadLayer(); |
|
178 | 177 |
|
179 | 178 |
ViewPort vp = getMapControl().getMapContext().getViewPort(); |
180 | 179 |
ptoIni = vp.toMapPoint(e.getPoint()); |
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/toolListeners/GeorefPointerListener.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.cit.gvsig.gui.toolListeners; |
42 | 42 |
|
43 |
import java.awt.Component; |
|
43 | 44 |
import java.awt.geom.Point2D; |
44 | 45 |
|
46 |
import javax.swing.JOptionPane; |
|
47 |
|
|
45 | 48 |
import com.iver.andami.PluginServices; |
46 | 49 |
import com.iver.cit.gvsig.fmap.DriverException; |
47 | 50 |
import com.iver.cit.gvsig.fmap.ViewPort; |
... | ... | |
54 | 57 |
import com.iver.cit.gvsig.gui.View; |
55 | 58 |
import com.iver.cit.gvsig.gui.Dialogs.GeoreferencingDialog; |
56 | 59 |
import com.iver.cit.gvsig.gui.Panels.SelectFilePanel; |
60 |
import com.iver.cit.gvsig.gui.Panels.SelectPointsPanel; |
|
57 | 61 |
|
58 | 62 |
|
59 | 63 |
/** |
... | ... | |
66 | 70 |
public class GeorefPointerListener extends GeorefPointerListenerImpl { |
67 | 71 |
|
68 | 72 |
private GeoreferencingDialog dialog = null; |
69 |
private boolean firstPoint = true; |
|
70 | 73 |
private View theView = null; |
71 | 74 |
private FLyrPoints lyrPoints = null; |
72 | 75 |
private FLyrGeoRaster lyrGeoRaster = null; |
73 | 76 |
|
77 |
/** |
|
78 |
* true si se va a seleccionar el primer punto y false si se selecciona el segundo. |
|
79 |
* |
|
80 |
*/ |
|
81 |
public static boolean firstPoint = true; |
|
74 | 82 |
|
83 |
|
|
75 | 84 |
/** |
76 | 85 |
* Posici?n del punto a ser seleccionado. |
77 | 86 |
*/ |
... | ... | |
104 | 113 |
FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i); |
105 | 114 |
if(lyr instanceof FLyrPoints) |
106 | 115 |
lyrPoints = (FLyrPoints)lyr; |
107 |
if(lyr instanceof FLyrGeoRaster) |
|
116 |
if(lyr instanceof FLyrGeoRaster && lyr.getName().startsWith("*"))
|
|
108 | 117 |
lyrGeoRaster = (FLyrGeoRaster)lyr; |
109 | 118 |
} |
110 | 119 |
|
111 | 120 |
ViewPort viewPort = theView.getMapControl().getMapContext().getViewPort(); |
112 | 121 |
Point2D wcPoint = viewPort.toMapPoint(event.getPoint()); |
113 |
|
|
122 |
|
|
114 | 123 |
if(firstPoint){ |
115 | 124 |
if(lyrPoints != null){ |
116 |
|
|
125 |
|
|
126 |
//Si el punto cae fuera de la imagen mostramos un mensaje y salimos |
|
127 |
while( wcPoint.getX() < lyrGeoRaster.getMinX() || |
|
128 |
wcPoint.getX() > lyrGeoRaster.getMaxX() || |
|
129 |
wcPoint.getY() < lyrGeoRaster.getMinY() || |
|
130 |
wcPoint.getY() > lyrGeoRaster.getMaxY()){ |
|
131 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
|
132 |
PluginServices.getText(this, "fuera_de_extent")); |
|
133 |
return; |
|
134 |
} |
|
135 |
|
|
117 | 136 |
//Hallamos pixelImg q son las coordenadas en pixeles de la imagen que corresponden |
118 | 137 |
//con el punto seleccionado |
119 | 138 |
double wcWidth = 0.0, wcHeight = 0.0, ptoWCX = 0.0, ptoWCY = 0.0; |
... | ... | |
141 | 160 |
lyrPoints.getPoint(GeorefPointerListener.posPoint).mapPoint = new Point2D.Double(); |
142 | 161 |
lyrPoints.getPoint(GeorefPointerListener.posPoint).mapPoint.setLocation(wcPoint); |
143 | 162 |
//Cargamos en la ventana el nuevo punto |
144 |
dialog.getSelectPointsPanel().getLongitud().setText(String.valueOf(wcPoint.getX()));
|
|
145 |
dialog.getSelectPointsPanel().getLatitud().setText(String.valueOf(wcPoint.getY()));
|
|
163 |
dialog.getSelectPointsPanel().getLongitud().setText(SelectPointsPanel.tailDecimal(String.valueOf(wcPoint.getX())));
|
|
164 |
dialog.getSelectPointsPanel().getLatitud().setText(SelectPointsPanel.tailDecimal(String.valueOf(wcPoint.getY())));
|
|
146 | 165 |
|
147 | 166 |
//Deseleccionamos la herramienta de marcado de puntos |
148 | 167 |
theView.getMapControl().setTool(lyrPoints.getLastTool()); |
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/Dialogs/GeoreferencingDialog.java | ||
---|---|---|
19 | 19 |
import com.iver.cit.gvsig.fmap.MapControl; |
20 | 20 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
21 | 21 |
import com.iver.cit.gvsig.fmap.layers.FLyrGeoRaster; |
22 |
import com.iver.cit.gvsig.fmap.layers.FLyrPoints; |
|
22 | 23 |
import com.iver.cit.gvsig.fmap.tools.ZoomOutRightButtonListener; |
23 | 24 |
import com.iver.cit.gvsig.fmap.tools.Behavior.Behavior; |
24 | 25 |
import com.iver.cit.gvsig.fmap.tools.Behavior.GeoMoveBehavior; |
... | ... | |
59 | 60 |
private SelectFilePanel selectFilePanel = null; |
60 | 61 |
private SelectPointsPanel selectPointsPanel = null; |
61 | 62 |
|
63 |
private JButton bAceptar = null; |
|
62 | 64 |
/** |
63 | 65 |
* Constructor. |
64 | 66 |
*/ |
... | ... | |
108 | 110 |
this.addTab(PluginServices.getText(this, "seleccionar_puntos"), selectPointsPanel); |
109 | 111 |
|
110 | 112 |
} |
113 |
|
|
111 | 114 |
|
112 | 115 |
/** |
113 | 116 |
* This method initializes tabPanel |
... | ... | |
156 | 159 |
FlowLayout flowLayout1 = new FlowLayout(); |
157 | 160 |
pBotones = new JPanel(); |
158 | 161 |
pBotones.setLayout(flowLayout1); |
159 |
flowLayout1.setHgap(30);
|
|
162 |
flowLayout1.setHgap(10);
|
|
160 | 163 |
pBotones.add(getBProcesar(), null); |
161 | 164 |
pBotones.add(getBSave(), null); |
165 |
pBotones.add(getBAceptar(), null); |
|
162 | 166 |
pBotones.add(getBCancelar(), null); |
163 | 167 |
} |
164 | 168 |
return pBotones; |
... | ... | |
174 | 178 |
bProcesar = new JButton(); |
175 | 179 |
bProcesar.setText(PluginServices.getText(this,"procesar")); |
176 | 180 |
bProcesar.setEnabled(false); |
181 |
bProcesar.setPreferredSize(new java.awt.Dimension(87,25)); |
|
177 | 182 |
bProcesar.addActionListener(new java.awt.event.ActionListener() { |
178 | 183 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
179 | 184 |
/*if (PluginServices.getMainFrame() == null) { |
... | ... | |
199 | 204 |
bCancelar.setText(PluginServices.getText(this,"cancelar")); |
200 | 205 |
bCancelar.addActionListener(new java.awt.event.ActionListener() { |
201 | 206 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
202 |
/*if (PluginServices.getMainFrame() != null) { |
|
203 |
PluginServices.getMDIManager().closeView((View) GeoreferencingDialog.this); |
|
204 |
} else { |
|
205 |
((JDialog) (getParent().getParent().getParent() |
|
206 |
.getParent())).dispose(); |
|
207 |
}*/ |
|
208 | 207 |
|
209 | 208 |
//Anulamos todos los cambios cargando el extent de origen a la capa |
210 | 209 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
211 | 210 |
|
212 | 211 |
for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){ |
213 | 212 |
FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i); |
214 |
if(lyr instanceof FLyrGeoRaster){ |
|
213 |
if(lyr instanceof FLyrGeoRaster && lyr.getName().startsWith("*")){
|
|
215 | 214 |
Extent initExtent = ((FLyrGeoRaster)lyr).getStackZoom().getInitExtent(); |
216 | 215 |
if(initExtent != null){ |
217 | 216 |
((FLyrGeoRaster)theView.getMapControl().getMapContext().getLayers().getLayer(lyr.getName())).setAssignExtent(initExtent); |
... | ... | |
344 | 343 |
public void setSelectPointsPanel(SelectPointsPanel selectPointsPanel) { |
345 | 344 |
this.selectPointsPanel = selectPointsPanel; |
346 | 345 |
} |
346 |
/** |
|
347 |
* This method initializes jButton |
|
348 |
* |
|
349 |
* @return javax.swing.JButton |
|
350 |
*/ |
|
351 |
private JButton getBAceptar() { |
|
352 |
if (bAceptar == null) { |
|
353 |
bAceptar = new JButton(); |
|
354 |
bAceptar.setText("aceptar"); |
|
355 |
bAceptar.addActionListener(new java.awt.event.ActionListener() { |
|
356 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
357 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
358 |
|
|
359 |
//Obtenemos la capa de puntos y la capa de georaster |
|
360 |
FLyrGeoRaster lyrGeoRaster = null; |
|
361 |
for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){ |
|
362 |
FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i); |
|
363 |
if(lyr instanceof FLyrGeoRaster && lyr.getName().startsWith("*")){ |
|
364 |
lyrGeoRaster = (FLyrGeoRaster)lyr; |
|
365 |
lyrGeoRaster.setName(lyrGeoRaster.getName().substring(1, lyrGeoRaster.getName().length())); |
|
366 |
} |
|
367 |
} |
|
368 |
|
|
369 |
//Cerramos la ventana |
|
370 |
try{ |
|
371 |
frame.setClosed(true); |
|
372 |
}catch(PropertyVetoException exc){} |
|
373 |
} |
|
374 |
}); |
|
375 |
} |
|
376 |
return bAceptar; |
|
377 |
} |
|
347 | 378 |
} // @jve:decl-index=0:visual-constraint="10,10" |
348 | 379 |
// @jve:visual-info decl-index=0 visual-constraint="10,10" |
349 | 380 |
// @jve:visual-info decl-index=0 visual-constraint="10,10" |
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/Panels/SelectPointsPanel.java | ||
---|---|---|
156 | 156 |
} |
157 | 157 |
|
158 | 158 |
/** |
159 |
* Recorta los decimales para el visualizado en la selecci?n de puntos |
|
160 |
* @param s Cadena de entrada |
|
161 |
* @return Cadena de salida con decimales recortados |
|
162 |
*/ |
|
163 |
public static String tailDecimal(String s){ |
|
164 |
int len = 2; |
|
165 |
int index = s.indexOf("."); |
|
166 |
if( index == -1) |
|
167 |
return s; |
|
168 |
else{ |
|
169 |
if((index + len) >= s.length()) |
|
170 |
return s; |
|
171 |
return s.substring(0, index + len + 1); |
|
172 |
} |
|
173 |
} |
|
174 |
|
|
175 |
/** |
|
159 | 176 |
* Busca el punto en la capa FLyrPoint que corresponde con la posicion pos |
160 | 177 |
* y carga la informaci?n de este en el panel de informaci?n. |
161 | 178 |
* @param pos |
... | ... | |
167 | 184 |
getTY().setText(""+pto.pixelPoint.getY()); |
168 | 185 |
} |
169 | 186 |
if(pto.mapPoint != null){ |
170 |
getLatitud().setText(""+pto.mapPoint.getY());
|
|
171 |
getLongitud().setText(""+pto.mapPoint.getX());
|
|
187 |
getLatitud().setText(tailDecimal(""+pto.mapPoint.getY()));
|
|
188 |
getLongitud().setText(tailDecimal(""+pto.mapPoint.getX()));
|
|
172 | 189 |
} |
173 | 190 |
} |
174 | 191 |
|
... | ... | |
482 | 499 |
public JButton getBSelectFromView() { |
483 | 500 |
if (bSelectFromView == null) { |
484 | 501 |
bSelectFromView = new JButton(); |
485 |
bSelectFromView.setText(PluginServices.getText(this, PluginServices.getText(this, "seleccionar")));
|
|
502 |
bSelectFromView.setText(PluginServices.getText(this, PluginServices.getText(this, "asignar_coordenadas")));
|
|
486 | 503 |
bSelectFromView.setPreferredSize(new java.awt.Dimension(125,25)); |
487 | 504 |
bSelectFromView.setEnabled(false); |
488 | 505 |
bSelectFromView.addActionListener(new java.awt.event.ActionListener() { |
... | ... | |
491 | 508 |
loadLyrPoint(); |
492 | 509 |
lyrPoints.setLastTool(theView.getMapControl().getTool()); |
493 | 510 |
GeorefPointerListener.posPoint = getCPoint().getSelectedIndex(); |
511 |
GeorefPointerListener.firstPoint = true; |
|
494 | 512 |
theView.getMapControl().setTool("pointLyrSelection"); |
495 | 513 |
} |
496 | 514 |
}); |
... | ... | |
622 | 640 |
* lista no salvar? ning?n valor. |
623 | 641 |
*/ |
624 | 642 |
public void checkTextField(JTextField tf, boolean xValue, boolean pixelValue, int code){ |
625 |
System.out.println("--->"+code); |
|
626 |
|
|
643 |
|
|
627 | 644 |
//Ignoramos las teclas Del, Spr, Mayusculas, Alt, Ctrl, Enter |
628 | 645 |
if(code == 8 || code == 127 || code == 16 || code == 20 || |
629 | 646 |
code == 18 || code == 17 || code == 10 ) |
... | ... | |
746 | 763 |
if (tLongitud == null) { |
747 | 764 |
tLongitud = new JTextField(); |
748 | 765 |
tLongitud.setPreferredSize(new java.awt.Dimension(111,19)); |
749 |
tLongitud.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
|
|
766 |
tLongitud.setHorizontalAlignment(javax.swing.JTextField.LEFT);
|
|
750 | 767 |
tLongitud.addKeyListener(new java.awt.event.KeyListener() { |
751 | 768 |
public void keyPressed(java.awt.event.KeyEvent e) {} |
752 | 769 |
public void keyReleased(java.awt.event.KeyEvent e) { |
Also available in: Unified diff