Revision 1149
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/test/java/org/gvsig/raster/app/extension/TestInfoByPointPanel.java | ||
---|---|---|
1 | 1 |
package org.gvsig.raster.app.extension; |
2 | 2 |
|
3 |
import java.util.ArrayList; |
|
4 |
import java.util.List; |
|
5 |
|
|
3 | 6 |
import javax.swing.JFrame; |
4 |
import javax.swing.event.ChangeEvent; |
|
5 |
import javax.swing.event.ChangeListener; |
|
6 | 7 |
|
7 | 8 |
import org.gvsig.raster.tools.app.basic.tool.infobypoint.gui.InfoByPointDataModel; |
8 | 9 |
import org.gvsig.raster.tools.app.basic.tool.infobypoint.gui.MainInfoByPointPanel; |
9 | 10 |
|
10 |
public class TestInfoByPointPanel implements ChangeListener {
|
|
11 |
public class TestInfoByPointPanel { |
|
11 | 12 |
private int w = 280; |
12 | 13 |
private int h = 410; |
13 | 14 |
private JFrame frame = new JFrame(); |
... | ... | |
15 | 16 |
|
16 | 17 |
public TestInfoByPointPanel() { |
17 | 18 |
desc = new MainInfoByPointPanel(null); |
18 |
desc.getTabs().addChangeListener(this); |
|
19 | 19 |
InfoByPointDataModel model = desc.getInfoByPointDataModel(); |
20 |
model.setARGB(0, 255, 125, 110); |
|
20 |
model.addObserver(desc); |
|
21 |
model.setARGB(255, 125, 110); |
|
21 | 22 |
model.setCMYK(new double[]{54, 254, 121, 190}); |
22 | 23 |
model.setHSL(234.3, 125.5, 110.3); |
23 | 24 |
model.setBandValues(new double[]{4.53, 2.24, 67.7, 67.87}); |
... | ... | |
25 | 26 |
model.setPixelPoint(100, 105); |
26 | 27 |
model.setViewPoint(305, 405); |
27 | 28 |
model.setWorldPoint(20554523.32, 19362125.23); |
28 |
model.setLayerList(new String[]{ |
|
29 |
"Esta_es_la_capa_numero_uno_de_la_lista_de_capas.jpg", |
|
30 |
"Esta_es_la_capa_segunda_de_la_lista_de_capas_del_info_by_point.jpg"}); |
|
31 |
desc.updateDataModel(); |
|
29 |
List<String> list = new ArrayList<String>(); |
|
30 |
list.add("Esta_es_la_capa_numero_uno_de_la_lista_de_capas.jpg"); |
|
31 |
list.add("Esta_es_la_capa_segunda_de_la_lista_de_capas_del_info_by_point.jpg"); |
|
32 |
model.setLayerList(list); |
|
33 |
model.notifyObservers(); |
|
32 | 34 |
frame.getContentPane().add(desc); |
33 | 35 |
frame.setSize(w, h); |
34 | 36 |
frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); |
... | ... | |
39 | 41 |
new TestInfoByPointPanel(); |
40 | 42 |
} |
41 | 43 |
|
42 |
public void stateChanged(ChangeEvent e) { |
|
43 |
if(e.getSource() == desc.getTabs()) { |
|
44 |
if(desc.getTabs().getSelectedIndex() == 2) { |
|
45 |
frame.setSize(w, 600); |
|
46 |
} else { |
|
47 |
frame.setSize(w, h); |
|
48 |
} |
|
49 |
} |
|
50 |
} |
|
44 |
// public void stateChanged(ChangeEvent e) {
|
|
45 |
// if(e.getSource() == desc.getTabs()) {
|
|
46 |
// if(desc.getTabs().getSelectedIndex() == 2) {
|
|
47 |
// frame.setSize(w, 600);
|
|
48 |
// } else {
|
|
49 |
// frame.setSize(w, h);
|
|
50 |
// }
|
|
51 |
// }
|
|
52 |
// }
|
|
51 | 53 |
} |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/resources/config.xml | ||
---|---|---|
22 | 22 |
description="Extensi?n encargada de exportar una vista al formato de imagen que se seleccione." |
23 | 23 |
active="true"> |
24 | 24 |
<menu text="Vista/export/imagen"/> |
25 |
</extension> |
|
25 |
</extension> |
|
26 |
<!--<extension class-name="org.gvsig.raster.tools.app.basic.tool.infobypoint.InfoByRasterPointExtension" |
|
27 |
description="Informaci?n por p?xel" |
|
28 |
active="true" |
|
29 |
priority="1"> |
|
30 |
<tool-bar name="Info_By_Pixel" position="3"> |
|
31 |
<selectable-tool icon="info-by-pixel" action-command="INFO_BY_PIXEL" tooltip="info_by_pixel" position="7"/> |
|
32 |
</tool-bar> |
|
33 |
</extension> |
|
34 |
<extension class-name="org.gvsig.raster.tools.app.basic.SystemGCExtension" |
|
35 |
description="" |
|
36 |
active="true"> |
|
37 |
<menu text="Test/System GC"/> |
|
38 |
</extension>--> |
|
26 | 39 |
</extensions> |
27 | 40 |
</plugin-config> |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/resources/text.properties | ||
---|---|---|
547 | 547 |
tiled_layer=?Deseas usar la cach? de tiles con las capas seleccionadas? |
548 | 548 |
yes_dont_ask_more=Si a todas |
549 | 549 |
no_dont_ask_more=No a todas |
550 |
open_window=Ya existe un inspector de p?xeles abierto.\n Cierre la ventana antes de continuar |
|
551 |
info=Informaci?n |
|
552 |
view=Vista |
|
553 |
layer_list=Lista de capas |
|
554 |
band_values=Valores por banda |
|
555 |
pixel_point=Pixel |
|
556 |
view_point=Vista |
|
557 |
world_point=Mapa |
|
558 |
bands=Bandas |
|
559 |
colors=Colores |
|
560 |
coords=Coordenadas |
|
561 |
lat=Latitud |
|
562 |
long=Longitud |
|
563 |
red=Rojo |
|
564 |
green=Verde |
|
565 |
blue=Azul |
|
566 |
infobypoint=Informaci?n por punto |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/resources/text_en.properties | ||
---|---|---|
531 | 531 |
round_pixels=Round off pixels |
532 | 532 |
tiled_layer=Would you like to use tile cache with the selected layers? |
533 | 533 |
yes_dont_ask_more=Yes for all |
534 |
no_dont_ask_more=Not for all |
|
534 |
no_dont_ask_more=Not for all |
|
535 |
open_window=Exits an open pixel inspector.\n Close the window before continue |
|
536 |
info=Information |
|
537 |
view=View |
|
538 |
layer_list=Layer list |
|
539 |
band_values=Values by band |
|
540 |
pixel_point=Pixel |
|
541 |
view_point=View |
|
542 |
world_point=Map |
|
543 |
bands=Bands |
|
544 |
colors=Colors |
|
545 |
coords=Coordinates |
|
546 |
lat=Latitude |
|
547 |
long=Longitude |
|
548 |
red=Red |
|
549 |
green=Green |
|
550 |
blue=Blue |
|
551 |
infobypoint=Info by point |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/GenericToolBarModule.java | ||
---|---|---|
43 | 43 |
import org.gvsig.raster.tools.app.basic.tool.generictoolbar.GenericToolBarPanel; |
44 | 44 |
import org.gvsig.raster.tools.app.basic.tool.geolocation.GeoLocationTocMenuEntry; |
45 | 45 |
import org.gvsig.raster.tools.app.basic.tool.histogram.HistogramTocMenuEntry; |
46 |
import org.gvsig.raster.tools.app.basic.tool.infobypoint.InfoByRasterPointTocMenuEntry; |
|
46 | 47 |
import org.gvsig.raster.tools.app.basic.tool.overview.OverviewsTocMenuEntry; |
47 | 48 |
import org.gvsig.raster.tools.app.basic.tool.properties.RasterPropertiesTocMenuEntry; |
48 | 49 |
import org.gvsig.raster.tools.app.basic.tool.reproject.ReprojectTocMenuEntry; |
... | ... | |
145 | 146 |
point.append("FilterPanel", "", FilterTocMenuEntry.getSingleton()); |
146 | 147 |
point.append("EnhancedPanel", "", EnhancedTocMenuEntry.getSingleton()); |
147 | 148 |
point.append("GeoLocation", "", GeoLocationTocMenuEntry.getSingleton()); |
149 |
point.append("InfoByPoint", "", InfoByRasterPointTocMenuEntry.getSingleton()); |
|
148 | 150 |
//point.append("Vectorization", "", VectorizationTocMenuEntry.getSingleton()); |
149 | 151 |
ReprojectTocMenuEntry menuEntry = ReprojectTocMenuEntry.getSingleton(); |
150 | 152 |
point.append(menuEntry.getText(), "", menuEntry); |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/pixelincrease/PixelInspector.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.tools.app.basic.tool.pixelincrease; |
|
23 |
|
|
24 |
import java.awt.image.BufferedImage; |
|
25 |
|
|
26 |
/** |
|
27 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
28 |
*/ |
|
29 |
public interface PixelInspector { |
|
30 |
|
|
31 |
public void setClear(boolean clear); |
|
32 |
|
|
33 |
/** |
|
34 |
* Gets the with of the control |
|
35 |
* @return |
|
36 |
*/ |
|
37 |
public int getWidth(); |
|
38 |
|
|
39 |
/** |
|
40 |
* Gets the height of the control |
|
41 |
* @return |
|
42 |
*/ |
|
43 |
public int getHeight(); |
|
44 |
|
|
45 |
/** |
|
46 |
* Gets the scale factor |
|
47 |
* @return |
|
48 |
*/ |
|
49 |
public int getScale(); |
|
50 |
|
|
51 |
/** |
|
52 |
* Assigns view coordinates |
|
53 |
* @param pixX |
|
54 |
* @param pixY |
|
55 |
*/ |
|
56 |
public void setViewCoordinates(int pixX, int pixY); |
|
57 |
|
|
58 |
public void setDataBuffer(BufferedImage view); |
|
59 |
|
|
60 |
public BufferedImage getDataBuffer(); |
|
61 |
|
|
62 |
/** |
|
63 |
* Sets the X position of the control where the painted starts |
|
64 |
* |
|
65 |
* @param posX |
|
66 |
*/ |
|
67 |
public void setPosX(int posX); |
|
68 |
|
|
69 |
/** |
|
70 |
* Sets the Y position of the control where the painted starts |
|
71 |
* |
|
72 |
* @param posY |
|
73 |
*/ |
|
74 |
public void setPosY(int posY); |
|
75 |
|
|
76 |
/** |
|
77 |
* Repaints the control |
|
78 |
*/ |
|
79 |
public void repaint(); |
|
80 |
} |
|
0 | 81 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/pixelincrease/PixelIncreaseBehavior.java | ||
---|---|---|
25 | 25 |
|
26 | 26 |
import org.gvsig.andami.PluginServices; |
27 | 27 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
28 |
import org.gvsig.app.project.documents.view.gui.IView;
|
|
28 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
|
|
29 | 29 |
import org.gvsig.fmap.mapcontrol.tools.BehaviorException; |
30 | 30 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior; |
31 | 31 |
import org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener; |
... | ... | |
40 | 40 |
*/ |
41 | 41 |
public class PixelIncreaseBehavior extends Behavior { |
42 | 42 |
|
43 |
private PixelIncreaseDialog dialog = null;
|
|
43 |
private PixelInspector observer = null;
|
|
44 | 44 |
|
45 | 45 |
/** |
46 | 46 |
* Constructor. Asigna el dialogo |
47 | 47 |
* @param dialog |
48 | 48 |
*/ |
49 |
public PixelIncreaseBehavior(PixelIncreaseDialog dialog) {
|
|
50 |
this.dialog = dialog;
|
|
49 |
public PixelIncreaseBehavior(PixelInspector observer) {
|
|
50 |
this.observer = observer;
|
|
51 | 51 |
} |
52 | 52 |
|
53 | 53 |
/* |
... | ... | |
63 | 63 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.IBehavior#mouseMoved(java.awt.event.MouseEvent) |
64 | 64 |
*/ |
65 | 65 |
public void mouseMoved(MouseEvent e) throws BehaviorException { |
66 |
IView view = null; |
|
67 | 66 |
IWindow active = PluginServices.getMDIManager().getActiveWindow(); |
68 |
if(active instanceof IView) {
|
|
67 |
if(active instanceof AbstractViewPanel) {
|
|
69 | 68 |
//System.out.println(((IView)active).getMapControl().getX() + " " + ((IView)active).getMapControl().getWidth()); |
70 | 69 |
//System.out.println(((IView)active).getMapControl().getY() + " " + ((IView)active).getMapControl().getHeight()); |
71 |
//((IView)active).getMapControl().getCurrentMapTool().ge |
|
72 |
dialog.setClear(false); |
|
73 |
view = (IView)active; |
|
74 |
if(!dialog.getView().equals(view)) |
|
75 |
dialog.setView(view); |
|
70 |
observer.setClear(false); |
|
71 |
observer.setDataBuffer(((AbstractViewPanel)active).getMapControl().getImage()); |
|
76 | 72 |
//Calcula la posici?n donde se empezar? a dibujar en el componente. Para ello en ancho y el alto del componente |
77 | 73 |
//se ponen en la misma escala que la vista (w / scale), se calcula el punto medio del componente y se le resta el punto seleccionado |
78 | 74 |
//en la vista |
79 |
int pX = ((dialog.getWidth() / dialog.getScale()) >> 1) - e.getX(); |
|
80 |
int pY = ((dialog.getHeight() / dialog.getScale()) >> 1) - e.getY(); |
|
81 |
dialog.pixX = (int)e.getPoint().getX(); |
|
82 |
dialog.pixY = (int)e.getPoint().getY(); |
|
83 |
dialog.setPosX(pX); |
|
84 |
dialog.setPosY(pY); |
|
85 |
dialog.repaint(); |
|
75 |
int pX = ((observer.getWidth() / observer.getScale()) >> 1) - e.getX(); |
|
76 |
int pY = ((observer.getHeight() / observer.getScale()) >> 1) - e.getY(); |
|
77 |
observer.setViewCoordinates((int)e.getPoint().getX(), (int)e.getPoint().getY()); |
|
78 |
observer.setPosX(pX); |
|
79 |
observer.setPosY(pY); |
|
80 |
observer.repaint(); |
|
86 | 81 |
} |
87 | 82 |
} |
88 | 83 |
|
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/pixelincrease/PixelIncreaseDialog.java | ||
---|---|---|
42 | 42 |
import org.gvsig.andami.PluginServices; |
43 | 43 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
44 | 44 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
45 |
import org.gvsig.app.project.documents.view.gui.IView;
|
|
45 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
|
|
46 | 46 |
import org.gvsig.fmap.mapcontrol.tools.CompoundBehavior; |
47 | 47 |
|
48 | 48 |
|
... | ... | |
52 | 52 |
* |
53 | 53 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
54 | 54 |
*/ |
55 |
public class PixelIncreaseDialog extends JPanel implements IWindow, MouseListener { |
|
55 |
public class PixelIncreaseDialog extends JPanel implements IWindow, MouseListener, PixelInspector {
|
|
56 | 56 |
final private static long serialVersionUID = -3370601314380922368L; |
57 | 57 |
private JPopupMenu menu = null; |
58 | 58 |
/** |
... | ... | |
77 | 77 |
/** |
78 | 78 |
* Vista asociada al inspector de pixels |
79 | 79 |
*/ |
80 |
public IView view = null;
|
|
80 |
public BufferedImage img = null;
|
|
81 | 81 |
/** |
82 | 82 |
* Posici?n en X e Y donde se comienza a dibujar dentro del inspector de pixeles |
83 | 83 |
*/ |
... | ... | |
107 | 107 |
addMouseListener(this); |
108 | 108 |
|
109 | 109 |
IWindow active = PluginServices.getMDIManager().getActiveWindow(); |
110 |
if(active instanceof IView) {
|
|
111 |
view = (IView)active;
|
|
110 |
if(active instanceof AbstractViewPanel) {
|
|
111 |
img = ((AbstractViewPanel)active).getImage();
|
|
112 | 112 |
WindowInfo wInfo = PluginServices.getMDIManager().getWindowInfo(active); |
113 | 113 |
posWindowX = wInfo.getX() + wInfo.getWidth() - width; |
114 | 114 |
posWindowY = wInfo.getY(); |
... | ... | |
119 | 119 |
|
120 | 120 |
} |
121 | 121 |
|
122 |
/* |
|
123 |
* (non-Javadoc) |
|
124 |
* @see org.gvsig.raster.tools.app.basic.tool.pixelincrease.PixelInspector#setViewCoordinates(int, int) |
|
125 |
*/ |
|
126 |
public void setViewCoordinates(int pixX, int pixY) { |
|
127 |
this.pixX = pixX; |
|
128 |
this.pixY = pixY; |
|
129 |
} |
|
130 |
|
|
122 | 131 |
/** |
123 | 132 |
* |
124 | 133 |
* @param clear |
... | ... | |
225 | 234 |
return; |
226 | 235 |
} |
227 | 236 |
|
228 |
if(view != null) {
|
|
237 |
if(img != null) {
|
|
229 | 238 |
int sizeCrux = 10; |
230 | 239 |
|
231 | 240 |
//Obtenemos valores RGB del Image |
232 |
BufferedImage img = view.getMapControl().getImage(); |
|
233 | 241 |
int value = 0; |
234 | 242 |
try { |
235 | 243 |
value = img.getRGB(pixX, pixY); |
... | ... | |
319 | 327 |
* Obtiene la vista asociada al inspector de pixeles |
320 | 328 |
* @return IView |
321 | 329 |
*/ |
322 |
public IView getView() {
|
|
323 |
return view;
|
|
330 |
public BufferedImage getDataBuffer() {
|
|
331 |
return img;
|
|
324 | 332 |
} |
325 | 333 |
|
326 | 334 |
/** |
327 | 335 |
* Asigna la vista asociada al inspector de pixeles |
328 | 336 |
* @param IView |
329 | 337 |
*/ |
330 |
public void setView(IView view) {
|
|
331 |
this.view = view;
|
|
338 |
public void setDataBuffer(BufferedImage view) {
|
|
339 |
this.img = view;
|
|
332 | 340 |
} |
333 | 341 |
|
334 | 342 |
/* |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/infobypoint/gui/ViewAndInfoPanel.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.tools.app.basic.tool.infobypoint.gui; |
|
23 |
|
|
24 |
import java.awt.GridBagConstraints; |
|
25 |
import java.awt.GridBagLayout; |
|
26 |
|
|
27 |
import javax.swing.JPanel; |
|
28 |
|
|
29 |
public class ViewAndInfoPanel extends JPanel { |
|
30 |
private static final long serialVersionUID = 1L; |
|
31 |
private PixelViewPanel pixelViewPanel = null; |
|
32 |
private InfoByPointPanel infoByPointPanel = null; |
|
33 |
|
|
34 |
public ViewAndInfoPanel(PixelViewPanel pixelViewPanel, InfoByPointPanel infoByPointPanel) { |
|
35 |
this.pixelViewPanel = pixelViewPanel; |
|
36 |
this.infoByPointPanel = infoByPointPanel; |
|
37 |
init(); |
|
38 |
} |
|
39 |
|
|
40 |
public void init() { |
|
41 |
setLayout(new GridBagLayout()); |
|
42 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
43 |
gbc.gridx = 0; |
|
44 |
gbc.gridy = 0; |
|
45 |
gbc.anchor = GridBagConstraints.WEST; |
|
46 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
47 |
gbc.weightx = 1; |
|
48 |
gbc.insets = new java.awt.Insets(1, 2, 1, 2); |
|
49 |
add(pixelViewPanel, gbc); |
|
50 |
|
|
51 |
gbc.gridy = 1; |
|
52 |
add(infoByPointPanel, gbc); |
|
53 |
} |
|
54 |
|
|
55 |
public void updateDataModel() { |
|
56 |
pixelViewPanel.updateDataModel(); |
|
57 |
infoByPointPanel.updateDataModel(); |
|
58 |
} |
|
59 |
} |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/infobypoint/gui/InfoByPointPanel.java | ||
---|---|---|
117 | 117 |
gbc.insets = new java.awt.Insets(1, 2, 2, 2); |
118 | 118 |
|
119 | 119 |
jPanelLayerNames.add(getJComboListLayer(), gbc); |
120 |
gbc.gridy = 1; |
|
121 |
jPanelLayerNames.add(getJTextBoxLayerSelected(), gbc); |
|
120 |
//gbc.gridy = 1;
|
|
121 |
//jPanelLayerNames.add(getJTextBoxLayerSelected(), gbc);
|
|
122 | 122 |
} |
123 | 123 |
return jPanelLayerNames; |
124 | 124 |
} |
... | ... | |
249 | 249 |
return jLabelNumberOfBands; |
250 | 250 |
} |
251 | 251 |
|
252 |
@SuppressWarnings("unused") |
|
252 | 253 |
private JTextField getJTextBoxLayerSelected() { |
253 | 254 |
if(jTextBoxLayerSelected == null) |
254 | 255 |
jTextBoxLayerSelected = new JTextField(); |
... | ... | |
264 | 265 |
} |
265 | 266 |
|
266 | 267 |
public void updateDataModel() { |
267 |
DecimalFormat df = new DecimalFormat("#.##"); |
|
268 |
Double nanObj = new Double(Double.NaN); |
|
269 |
DecimalFormat df2 = new DecimalFormat("#.##"); |
|
270 |
DecimalFormat df4 = new DecimalFormat("#.####"); |
|
268 | 271 |
getJLabelNumberOfBands().setText(tr.get("bands") + ": " + dataModel.bands); |
269 | 272 |
|
270 |
getJLabelLatitudePoint().setText(tr.get("lat") + ": " +
|
|
271 |
df.format(dataModel.worldPoint.getY()));
|
|
273 |
String y = (!new Double(dataModel.worldPoint.getY()).equals(nanObj)) ? df2.format(dataModel.worldPoint.getY()) : "NaN";
|
|
274 |
getJLabelLatitudePoint().setText(tr.get("lat") + ": " + y);
|
|
272 | 275 |
|
273 |
getJLabelLongitudPoint().setText(tr.get("long") + ": " +
|
|
274 |
df.format(dataModel.worldPoint.getX()));
|
|
276 |
String x = (!new Double(dataModel.worldPoint.getY()).equals(nanObj)) ? df2.format(dataModel.worldPoint.getX()) : "NaN";
|
|
277 |
getJLabelLongitudPoint().setText(tr.get("long") + ": " + x);
|
|
275 | 278 |
|
276 |
getJLabelViewPoint().setText(tr.get("view_point") + ": (" +
|
|
277 |
df.format(dataModel.viewPoint.getX()) + ", " +
|
|
278 |
df.format(dataModel.viewPoint.getY() )+ ")");
|
|
279 |
y = (!new Double(dataModel.viewPoint.getY()).equals(nanObj)) ? df2.format(dataModel.viewPoint.getY()) : "NaN";
|
|
280 |
x = (!new Double(dataModel.viewPoint.getY()).equals(nanObj)) ? df2.format(dataModel.viewPoint.getX()) : "NaN";
|
|
281 |
getJLabelViewPoint().setText(tr.get("view_point") + ": (" + x + ", " + y + ")");
|
|
279 | 282 |
|
280 |
getJLabelPixelPoint().setText(tr.get("pixel_point") + ": (" +
|
|
281 |
df.format(dataModel.pixelPoint.getX()) + ", " +
|
|
282 |
df.format(dataModel.pixelPoint.getY() )+ ")");
|
|
283 |
y = (!new Double(dataModel.pixelPoint.getY()).equals(nanObj)) ? df2.format(dataModel.pixelPoint.getY()) : "NaN";
|
|
284 |
x = (!new Double(dataModel.pixelPoint.getY()).equals(nanObj)) ? df2.format(dataModel.pixelPoint.getX()) : "NaN";
|
|
285 |
getJLabelPixelPoint().setText(tr.get("pixel_point") + ": (" + x + ", " + y + ")");
|
|
283 | 286 |
|
284 |
getJLabelRGBPoint().setText("ARGB: " + dataModel.argb[0] + ", " +
|
|
285 |
dataModel.argb[1] + ", " +
|
|
286 |
dataModel.argb[2] + ", " +
|
|
287 |
dataModel.argb[3]);
|
|
288 |
getJLabelHSLPoint().setText("HSL: " + dataModel.hsl[0] + ", " +
|
|
289 |
dataModel.hsl[1] + ", " +
|
|
290 |
dataModel.hsl[2]);
|
|
291 |
getJLabelCMKYPoint().setText("CMYK: " + dataModel.cmyk[0] + ", " +
|
|
292 |
dataModel.cmyk[1] + ", " +
|
|
293 |
dataModel.cmyk[2]);
|
|
287 |
getJLabelRGBPoint().setText("RGB: " + dataModel.rgb[0] + ", " +
|
|
288 |
dataModel.rgb[1] + ", " + |
|
289 |
dataModel.rgb[2]);
|
|
290 |
getJLabelHSLPoint().setText("HSL: " + df4.format(dataModel.hsl[0]) + ", " +
|
|
291 |
df4.format(dataModel.hsl[1]) + ", " +
|
|
292 |
df4.format(dataModel.hsl[2]));
|
|
293 |
getJLabelCMKYPoint().setText("CMYK: " + df4.format(dataModel.cmyk[0]) + ", " +
|
|
294 |
df4.format(dataModel.cmyk[1]) + ", " +
|
|
295 |
df4.format(dataModel.cmyk[2]) + ", " +
|
|
296 |
df4.format(dataModel.cmyk[3]));
|
|
294 | 297 |
|
295 | 298 |
getJComboListLayer().removeAllItems(); |
296 | 299 |
for (int i = 0; i < dataModel.layers.size(); i++) { |
297 | 300 |
getJComboListLayer().addItem(dataModel.getFormatedLayerName(i)); |
298 | 301 |
} |
299 | 302 |
|
300 |
if(dataModel.layers.size() > 0) |
|
303 |
/*if(dataModel.layers.size() > 0)
|
|
301 | 304 |
getJTextBoxLayerSelected().setText(dataModel.layers.get(0)); |
302 |
|
|
305 |
*/ |
|
303 | 306 |
DefaultListModel listModel = null; |
304 | 307 |
if(getJListValues().getModel() == null || !(getJListValues().getModel() instanceof DefaultListModel)) |
305 | 308 |
listModel = new DefaultListModel(); |
... | ... | |
314 | 317 |
} |
315 | 318 |
|
316 | 319 |
public void actionPerformed(ActionEvent e) { |
317 |
if(e.getSource() == getJComboListLayer()) { |
|
318 |
getJTextBoxLayerSelected().setText(dataModel.layers.get(getJComboListLayer().getSelectedIndex())); |
|
319 |
} |
|
320 |
/*if(e.getSource() == getJComboListLayer()) { |
|
321 |
if(getJComboListLayer().getSelectedIndex() != -1) |
|
322 |
getJTextBoxLayerSelected().setText(dataModel.layers.get(getJComboListLayer().getSelectedIndex())); |
|
323 |
}*/ |
|
320 | 324 |
} |
321 | 325 |
|
322 | 326 |
} |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/infobypoint/gui/MainInfoByPointPanel.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
import java.awt.BorderLayout; |
25 | 25 |
import java.util.HashMap; |
26 |
import java.util.Observable; |
|
27 |
import java.util.Observer; |
|
26 | 28 |
|
27 | 29 |
import javax.swing.JPanel; |
28 |
import javax.swing.JTabbedPane; |
|
29 | 30 |
|
30 |
public class MainInfoByPointPanel extends JPanel { |
|
31 |
public class MainInfoByPointPanel extends JPanel implements Observer {
|
|
31 | 32 |
private static final long serialVersionUID = 1L; |
32 |
private JTabbedPane tabs = null; |
|
33 | 33 |
private HashMap<String, String> tr = null; |
34 | 34 |
private PixelViewPanel viewPanel = null; |
35 |
private InfoByPointPanel infoByPointPanel = null; |
|
36 |
private ViewAndInfoPanel viewAndInfoPanel = null; |
|
37 | 35 |
private InfoByPointDataModel dataModel = null; |
38 | 36 |
|
39 | 37 |
public MainInfoByPointPanel(HashMap<String, String> translations) { |
40 | 38 |
tr = translations; |
41 | 39 |
if(tr == null) { |
42 | 40 |
tr = new HashMap<String, String>(); |
43 |
tr.put("info", "info"); |
|
44 |
tr.put("view", "view"); |
|
45 |
tr.put("view_and_info", "view_and_info"); |
|
46 | 41 |
} |
47 | 42 |
init(); |
48 | 43 |
} |
49 | 44 |
|
50 | 45 |
private void init() { |
51 | 46 |
setLayout(new BorderLayout()); |
52 |
add(getTabs(), BorderLayout.CENTER);
|
|
47 |
add(getViewPanel(), BorderLayout.CENTER);
|
|
53 | 48 |
} |
54 | 49 |
|
55 |
public JTabbedPane getTabs() { |
|
56 |
if(tabs == null) { |
|
57 |
tabs = new JTabbedPane(); |
|
58 |
tabs.addTab(tr.get("info"), getInfoByPointPanel()); |
|
59 |
tabs.addTab(tr.get("view"), getViewPanel()); |
|
60 |
tabs.addTab(tr.get("view_and_info"), getViewAndInfoPanel()); |
|
61 |
} |
|
62 |
return tabs; |
|
63 |
} |
|
64 |
|
|
65 |
private ViewAndInfoPanel getViewAndInfoPanel() { |
|
66 |
if(viewAndInfoPanel == null) { |
|
67 |
InfoByPointPanel infoByPointPanel = new InfoByPointPanel(tr, getInfoByPointDataModel()); |
|
68 |
PixelViewPanel viewPanel = new PixelViewPanel(tr, getInfoByPointDataModel()); |
|
69 |
viewAndInfoPanel = new ViewAndInfoPanel(viewPanel, infoByPointPanel); |
|
70 |
} |
|
71 |
return viewAndInfoPanel; |
|
72 |
} |
|
73 |
|
|
74 |
private PixelViewPanel getViewPanel() { |
|
75 |
if(viewPanel == null) |
|
50 |
public PixelViewPanel getViewPanel() { |
|
51 |
if(viewPanel == null) { |
|
76 | 52 |
viewPanel = new PixelViewPanel(tr, getInfoByPointDataModel()); |
53 |
} |
|
77 | 54 |
return viewPanel; |
78 | 55 |
} |
79 |
|
|
80 |
private InfoByPointPanel getInfoByPointPanel() { |
|
81 |
if(infoByPointPanel == null) |
|
82 |
infoByPointPanel = new InfoByPointPanel(tr, getInfoByPointDataModel()); |
|
83 |
return infoByPointPanel; |
|
84 |
} |
|
85 | 56 |
|
86 | 57 |
public InfoByPointDataModel getInfoByPointDataModel() { |
87 | 58 |
if(dataModel == null) |
88 | 59 |
dataModel = new InfoByPointDataModel(); |
89 | 60 |
return dataModel; |
90 | 61 |
} |
91 |
|
|
92 |
public void updateDataModel() { |
|
93 |
getInfoByPointPanel().updateDataModel(); |
|
62 |
|
|
63 |
public void update(Observable o, Object arg) { |
|
94 | 64 |
getViewPanel().updateDataModel(); |
95 |
getViewAndInfoPanel().updateDataModel(); |
|
96 | 65 |
} |
97 | 66 |
|
98 | 67 |
} |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/infobypoint/gui/PixelInspectorPanel.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.tools.app.basic.tool.infobypoint.gui; |
|
23 |
|
|
24 |
import java.awt.Color; |
|
25 |
import java.awt.Graphics; |
|
26 |
import java.awt.Graphics2D; |
|
27 |
import java.awt.event.ActionEvent; |
|
28 |
import java.awt.event.ActionListener; |
|
29 |
import java.awt.event.MouseEvent; |
|
30 |
import java.awt.event.MouseListener; |
|
31 |
import java.awt.geom.AffineTransform; |
|
32 |
import java.awt.image.BufferedImage; |
|
33 |
import java.util.HashMap; |
|
34 |
|
|
35 |
import javax.swing.JCheckBoxMenuItem; |
|
36 |
import javax.swing.JMenuItem; |
|
37 |
import javax.swing.JPanel; |
|
38 |
import javax.swing.JPopupMenu; |
|
39 |
import javax.swing.event.PopupMenuEvent; |
|
40 |
import javax.swing.event.PopupMenuListener; |
|
41 |
|
|
42 |
import org.gvsig.raster.tools.app.basic.tool.pixelincrease.PixelInspector; |
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
/** |
|
47 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
48 |
*/ |
|
49 |
public class PixelInspectorPanel extends JPanel implements MouseListener, PixelInspector { |
|
50 |
final private static long serialVersionUID = -3370601314380922368L; |
|
51 |
private JPopupMenu menu = null; |
|
52 |
/** |
|
53 |
* Ancho y alto de la ventana |
|
54 |
*/ |
|
55 |
private int w = 0; |
|
56 |
private int h = 0; |
|
57 |
/** |
|
58 |
* Posici?n de la ventana en X y en Y |
|
59 |
*/ |
|
60 |
//private int posWindowX = 0; |
|
61 |
//private int posWindowY = 0; |
|
62 |
/** |
|
63 |
* Escala del zoom |
|
64 |
*/ |
|
65 |
private int scale = 8; |
|
66 |
/** |
|
67 |
* Vista asociada al inspector de pixels |
|
68 |
*/ |
|
69 |
public BufferedImage img = null; |
|
70 |
/** |
|
71 |
* Posici?n en X e Y donde se comienza a dibujar dentro del inspector de pixeles |
|
72 |
*/ |
|
73 |
private int posX = 0; |
|
74 |
private int posY = 0; |
|
75 |
/** |
|
76 |
* Posici?n del pixel en X e Y en relaci?n a las coordenadas del buffer de la vista |
|
77 |
*/ |
|
78 |
public int pixX = 0; |
|
79 |
public int pixY = 0; |
|
80 |
/** |
|
81 |
* Valores RGB del pixel seleccionado |
|
82 |
*/ |
|
83 |
int red = 0, green = 0, blue = 0; |
|
84 |
private boolean clear = false; |
|
85 |
private Color color = Color.red; |
|
86 |
private JCheckBoxMenuItem[] entry = new JCheckBoxMenuItem[6]; |
|
87 |
private HashMap<String, String> |
|
88 |
tr = null; |
|
89 |
/** |
|
90 |
* Constructor de la ventana de dialogo para gvSIG. |
|
91 |
*/ |
|
92 |
public PixelInspectorPanel(HashMap<String, String> translations) { |
|
93 |
tr = translations; |
|
94 |
if(tr == null || tr.get("layer_list") == null) { |
|
95 |
tr = new HashMap<String, String>(); |
|
96 |
tr.put("green", "green"); |
|
97 |
tr.put("red", "red"); |
|
98 |
tr.put("blue", "blue"); |
|
99 |
} |
|
100 |
|
|
101 |
addMouseListener(this); |
|
102 |
|
|
103 |
initMenu(); |
|
104 |
} |
|
105 |
|
|
106 |
/* |
|
107 |
* (non-Javadoc) |
|
108 |
* @see org.gvsig.raster.tools.app.basic.tool.pixelincrease.PixelInspector#setViewCoordinates(int, int) |
|
109 |
*/ |
|
110 |
public void setViewCoordinates(int pixX, int pixY) { |
|
111 |
this.pixX = pixX; |
|
112 |
this.pixY = pixY; |
|
113 |
} |
|
114 |
|
|
115 |
/** |
|
116 |
* |
|
117 |
* @param clear |
|
118 |
*/ |
|
119 |
public void setClear(boolean clear) { |
|
120 |
this.clear = clear; |
|
121 |
} |
|
122 |
|
|
123 |
/** |
|
124 |
* Inicializa el men? contextual con las opciones de selecci?n del |
|
125 |
* zoom. |
|
126 |
*/ |
|
127 |
private void initMenu() { |
|
128 |
menu = new JPopupMenu(); |
|
129 |
PopupMenuListener lis = new PopupMenuListener() { |
|
130 |
public void popupMenuCanceled( PopupMenuEvent evt ) { |
|
131 |
clear = true; |
|
132 |
repaint(); |
|
133 |
} |
|
134 |
|
|
135 |
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { |
|
136 |
} |
|
137 |
|
|
138 |
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { |
|
139 |
} |
|
140 |
}; |
|
141 |
menu.addPopupMenuListener(lis); |
|
142 |
|
|
143 |
ActionListener al = new ActionListener() { |
|
144 |
public void actionPerformed( ActionEvent evt ){ |
|
145 |
String txt = ((JMenuItem)evt.getSource()).getText(); |
|
146 |
if(txt.compareTo("X4") == 0) { |
|
147 |
scale = 4; |
|
148 |
for (int i = 1; i <= 3; i++) |
|
149 |
entry[i].setSelected(false); |
|
150 |
entry[0].setSelected(true); |
|
151 |
} |
|
152 |
if(txt.compareTo("X8") == 0) { |
|
153 |
scale = 8; |
|
154 |
entry[0].setSelected(false); |
|
155 |
entry[1].setSelected(true); |
|
156 |
entry[2].setSelected(false); |
|
157 |
entry[3].setSelected(false); |
|
158 |
} |
|
159 |
if(txt.compareTo("X16") == 0) { |
|
160 |
scale = 16; |
|
161 |
entry[0].setSelected(false); |
|
162 |
entry[1].setSelected(false); |
|
163 |
entry[2].setSelected(true); |
|
164 |
entry[3].setSelected(false); |
|
165 |
} |
|
166 |
if(txt.compareTo("X32") == 0) { |
|
167 |
scale = 32; |
|
168 |
for (int i = 0; i < 3; i++) |
|
169 |
entry[i].setSelected(false); |
|
170 |
entry[3].setSelected(true); |
|
171 |
} |
|
172 |
if(txt.compareTo(tr.get("green")) == 0) { |
|
173 |
color = Color.GREEN; |
|
174 |
entry[4].setSelected(false); |
|
175 |
entry[5].setSelected(true); |
|
176 |
} |
|
177 |
if(txt.compareTo(tr.get("red")) == 0) { |
|
178 |
color = Color.RED; |
|
179 |
entry[4].setSelected(true); |
|
180 |
entry[5].setSelected(false); |
|
181 |
} |
|
182 |
} |
|
183 |
}; |
|
184 |
|
|
185 |
entry[0] = new JCheckBoxMenuItem( "X4" ); |
|
186 |
entry[0].addActionListener( al ); |
|
187 |
menu.add(entry[0]); |
|
188 |
entry[1] = new JCheckBoxMenuItem( "X8" ); |
|
189 |
entry[1].setSelected(true); |
|
190 |
entry[1].addActionListener( al ); |
|
191 |
menu.add(entry[1]); |
|
192 |
entry[2] = new JCheckBoxMenuItem( "X16" ); |
|
193 |
entry[2].addActionListener( al ); |
|
194 |
menu.add(entry[2]); |
|
195 |
entry[3] = new JCheckBoxMenuItem( "X32" ); |
|
196 |
entry[3].addActionListener( al ); |
|
197 |
menu.add(entry[3]); |
|
198 |
entry[4] = new JCheckBoxMenuItem(tr.get("red") ); |
|
199 |
entry[4].addActionListener( al ); |
|
200 |
entry[4].setSelected(true); |
|
201 |
menu.add(entry[4]); |
|
202 |
entry[5] = new JCheckBoxMenuItem(tr.get("green") ); |
|
203 |
entry[5].addActionListener( al ); |
|
204 |
menu.add(entry[5]); |
|
205 |
} |
|
206 |
|
|
207 |
/** |
|
208 |
* Obtiene el buffer de la vista activa y lo dibuja sobre el panel |
|
209 |
* con los datos de escala y desplazamiento seleccionados. |
|
210 |
*/ |
|
211 |
protected void paintComponent(Graphics g) { |
|
212 |
w = getVisibleRect().width; |
|
213 |
h = getVisibleRect().height; |
|
214 |
|
|
215 |
if(clear) { |
|
216 |
g.setColor(Color.BLACK); |
|
217 |
g.fillRect(0, 0, w, h); |
|
218 |
return; |
|
219 |
} |
|
220 |
|
|
221 |
if(img != null) { |
|
222 |
int sizeCrux = 10; |
|
223 |
|
|
224 |
//Obtenemos valores RGB del Image |
|
225 |
int value = 0; |
|
226 |
try { |
|
227 |
value = img.getRGB(pixX, pixY); |
|
228 |
} catch (ArrayIndexOutOfBoundsException e) { |
|
229 |
|
|
230 |
} |
|
231 |
red = ((value & 0x00ff0000) >> 16); |
|
232 |
green = ((value & 0x0000ff00) >> 8); |
|
233 |
blue = (value & 0x000000ff); |
|
234 |
|
|
235 |
//Dibujamos el graphics con el zoom |
|
236 |
g.setColor(Color.BLACK); |
|
237 |
g.fillRect(0, 0, w, h); |
|
238 |
((Graphics2D)g).scale(scale, scale); |
|
239 |
g.drawImage(img, posX, posY , this); |
|
240 |
((Graphics2D)g).setTransform(new AffineTransform()); |
|
241 |
|
|
242 |
//Dibujamos la informaci?n RGB y la cruz |
|
243 |
g.setXORMode(Color.WHITE); |
|
244 |
g.setColor(color); |
|
245 |
int middleW = w >> 1; |
|
246 |
int middleH = h >> 1; |
|
247 |
g.drawLine(middleW - sizeCrux, middleH, middleW + sizeCrux, middleH); |
|
248 |
g.drawLine(middleW, middleH - sizeCrux, middleW , middleH + sizeCrux); |
|
249 |
//g.drawString(red + "," + green + "," + blue, w - 85, h - 3); |
|
250 |
} |
|
251 |
} |
|
252 |
|
|
253 |
/** |
|
254 |
* Asigna el zoom de la vista sobre el inspector de pixels |
|
255 |
* @param scale Escala |
|
256 |
*/ |
|
257 |
public void setScale(int scale) { |
|
258 |
this.scale = scale; |
|
259 |
} |
|
260 |
|
|
261 |
/** |
|
262 |
* Asigna la posici?n en X del control donde se empieza a dibujar |
|
263 |
* @param posX posici?n X del Graphics donde se empieza a dibujar |
|
264 |
*/ |
|
265 |
public void setPosX(int posX) { |
|
266 |
this.posX = posX; |
|
267 |
} |
|
268 |
|
|
269 |
/** |
|
270 |
* Asigna la posici?n en Y del control donde se empieza a dibujar |
|
271 |
* @param posY posici?n Y del Graphics donde se empieza a dibujar |
|
272 |
*/ |
|
273 |
public void setPosY(int posY) { |
|
274 |
this.posY = posY; |
|
275 |
} |
|
276 |
|
|
277 |
/** |
|
278 |
* Obtiene el factor de escala |
|
279 |
* @return |
|
280 |
*/ |
|
281 |
public int getScale() { |
|
282 |
return scale; |
|
283 |
} |
|
284 |
|
|
285 |
/** |
|
286 |
* Obtiene la vista asociada al inspector de pixeles |
|
287 |
* @return IView |
|
288 |
*/ |
|
289 |
public BufferedImage getDataBuffer() { |
|
290 |
return img; |
|
291 |
} |
|
292 |
|
|
293 |
/** |
|
294 |
* Asigna la vista asociada al inspector de pixeles |
|
295 |
* @param IView |
|
296 |
*/ |
|
297 |
public void setDataBuffer(BufferedImage img) { |
|
298 |
this.img = img; |
|
299 |
} |
|
300 |
|
|
301 |
/* |
|
302 |
* (non-Javadoc) |
|
303 |
* @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent) |
|
304 |
*/ |
|
305 |
public void mouseClicked(MouseEvent e) { |
|
306 |
clear = true; |
|
307 |
repaint(); |
|
308 |
} |
|
309 |
|
|
310 |
/* |
|
311 |
* (non-Javadoc) |
|
312 |
* @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent) |
|
313 |
*/ |
|
314 |
public void mouseEntered(MouseEvent e) { |
|
315 |
clear = true; |
|
316 |
repaint(); |
|
317 |
} |
|
318 |
|
|
319 |
/* |
|
320 |
* (non-Javadoc) |
|
321 |
* @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent) |
|
322 |
*/ |
|
323 |
public void mouseExited(MouseEvent e) { |
|
324 |
clear = true; |
|
325 |
repaint(); |
|
326 |
} |
|
327 |
|
|
328 |
/* |
|
329 |
* (non-Javadoc) |
|
330 |
* @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent) |
|
331 |
*/ |
|
332 |
public void mousePressed(MouseEvent e) { |
|
333 |
if(e.getButton() == MouseEvent.BUTTON3) { |
|
334 |
menu.show( e.getComponent(), e.getX(), e.getY() ); |
|
335 |
clear = true; |
|
336 |
repaint(); |
|
337 |
} |
|
338 |
} |
|
339 |
|
|
340 |
/* |
|
341 |
* (non-Javadoc) |
|
342 |
* @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent) |
|
343 |
*/ |
|
344 |
public void mouseReleased(MouseEvent e) { |
|
345 |
} |
|
346 |
|
|
347 |
} |
|
0 | 348 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/infobypoint/gui/PixelViewInfoPanel.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.tools.app.basic.tool.infobypoint.gui; |
|
23 |
|
|
24 |
import java.awt.GridBagConstraints; |
|
25 |
import java.awt.GridBagLayout; |
|
26 |
import java.text.DecimalFormat; |
|
27 |
import java.util.HashMap; |
|
28 |
|
|
29 |
import javax.swing.BorderFactory; |
|
30 |
import javax.swing.DefaultListModel; |
|
31 |
import javax.swing.JLabel; |
|
32 |
import javax.swing.JList; |
|
33 |
import javax.swing.JPanel; |
|
34 |
import javax.swing.JScrollPane; |
|
35 |
|
|
36 |
public class PixelViewInfoPanel extends JPanel { |
|
37 |
private static final long serialVersionUID = 1L; |
|
38 |
private HashMap<String, String> |
|
39 |
tr = null; |
|
40 |
private JList jListBandValues = null; |
|
41 |
private JLabel jLabelHSLPoint = null; |
|
42 |
private JLabel jLabelCMKYPoint = null; |
|
43 |
private JLabel jLabelRGBPoint = null; |
|
44 |
private JLabel jLabelPixelPoint = null; |
|
45 |
private JLabel jLabelViewPoint = null; |
|
46 |
private JLabel jLabelLatitudePoint = null; |
|
47 |
private JLabel jLabelLongitudPoint = null; |
|
48 |
private JLabel jLabelNumberOfBands = null; |
|
49 |
|
|
50 |
private JPanel jPanelCoordinates = null; |
|
51 |
private JPanel jPanelColors = null; |
|
52 |
private JPanel jPanelBands = null; |
|
53 |
private InfoByPointDataModel dataModel = null; |
|
54 |
|
|
55 |
public PixelViewInfoPanel(HashMap<String, String> translations, InfoByPointDataModel dataModel) { |
|
56 |
tr = translations; |
|
57 |
if(tr == null || tr.get("layer_list") == null) { |
|
58 |
tr = new HashMap<String, String>(); |
|
59 |
tr.put("layer_list", "layer_list"); |
|
60 |
tr.put("band_values", "band_values"); |
|
61 |
tr.put("pixel_point", "pixel_point"); |
|
62 |
tr.put("view_point", "view_point"); |
|
63 |
tr.put("world_point", "world_point"); |
|
64 |
tr.put("bands", "bands"); |
|
65 |
tr.put("colors", "colors"); |
|
66 |
tr.put("coords", "coords"); |
|
67 |
tr.put("lat", "lat"); |
|
68 |
tr.put("long", "long"); |
|
69 |
} |
|
70 |
this.dataModel = dataModel; |
|
71 |
init(); |
|
72 |
} |
|
73 |
|
|
74 |
private void init() { |
|
75 |
setLayout(new GridBagLayout()); |
|
76 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
77 |
gbc.gridx = 0; |
|
78 |
gbc.gridy = 0; |
|
79 |
gbc.anchor = GridBagConstraints.WEST; |
|
80 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
81 |
gbc.weightx = 1; |
|
82 |
gbc.insets = new java.awt.Insets(1, 2, 1, 2); |
|
83 |
add(getJPanelCoordinates(), gbc); |
|
84 |
|
|
85 |
gbc.gridy = 1; |
|
86 |
gbc.fill = GridBagConstraints.BOTH; |
|
87 |
gbc.weighty = 1; |
|
88 |
add(getJPanelBands(), gbc); |
|
89 |
|
|
90 |
gbc.gridy = 2; |
|
91 |
gbc.weighty = 0; |
|
92 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
93 |
add(getJPanelColors(), gbc); |
|
94 |
} |
|
95 |
|
|
96 |
public JPanel getJPanelBands() { |
|
97 |
if(jPanelBands == null) { |
|
98 |
jPanelBands = new JPanel(); |
|
99 |
jPanelBands.setBorder(BorderFactory.createTitledBorder(tr.get("bands"))); |
|
100 |
jPanelBands.setLayout(new GridBagLayout()); |
|
101 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
102 |
gbc.gridx = 0; |
|
103 |
gbc.gridy = 0; |
|
104 |
gbc.anchor = GridBagConstraints.WEST; |
|
105 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
106 |
gbc.weightx = 1; |
|
107 |
gbc.insets = new java.awt.Insets(1, 2, 1, 2); |
|
108 |
|
|
109 |
jPanelBands.add(getJLabelNumberOfBands(), gbc); |
|
110 |
gbc.gridy = 1; |
|
111 |
gbc.gridheight = 2; |
|
112 |
gbc.fill = GridBagConstraints.BOTH; |
|
113 |
gbc.weighty = 1; |
|
114 |
JScrollPane listScroller = new JScrollPane(getJListValues()); |
|
115 |
jPanelBands.add(listScroller, gbc); |
|
116 |
} |
|
117 |
return jPanelBands; |
|
118 |
} |
|
119 |
|
|
120 |
public JPanel getJPanelColors() { |
|
121 |
if(jPanelColors == null) { |
|
122 |
jPanelColors = new JPanel(); |
|
123 |
jPanelColors.setBorder(BorderFactory.createTitledBorder(tr.get("colors"))); |
|
124 |
jPanelColors.setLayout(new GridBagLayout()); |
|
125 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
126 |
gbc.gridx = 0; |
|
127 |
gbc.gridy = 0; |
|
128 |
gbc.anchor = GridBagConstraints.WEST; |
|
129 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
130 |
gbc.weightx = 1; |
|
131 |
gbc.insets = new java.awt.Insets(1, 2, 2, 2); |
|
132 |
|
|
133 |
jPanelColors.add(getJLabelRGBPoint(), gbc); |
|
134 |
gbc.gridy = 1; |
|
135 |
jPanelColors.add(getJLabelCMKYPoint(), gbc); |
|
136 |
gbc.gridy = 2; |
|
137 |
jPanelColors.add(getJLabelHSLPoint(), gbc); |
|
138 |
} |
|
139 |
return jPanelColors; |
|
140 |
} |
|
141 |
|
|
142 |
public JPanel getJPanelCoordinates() { |
|
143 |
if(jPanelCoordinates == null) { |
|
144 |
jPanelCoordinates = new JPanel(); |
|
145 |
jPanelCoordinates.setLayout(new GridBagLayout()); |
|
146 |
jPanelCoordinates.setBorder(BorderFactory.createTitledBorder(tr.get("coords"))); |
|
147 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
148 |
gbc.gridx = 0; |
|
149 |
gbc.gridy = 0; |
|
150 |
gbc.anchor = GridBagConstraints.WEST; |
|
151 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
152 |
gbc.weightx = 1; |
|
153 |
gbc.insets = new java.awt.Insets(1, 2, 2, 2); |
|
154 |
|
|
155 |
gbc.gridy = 1; |
|
156 |
jPanelCoordinates.add(getJLabelLatitudePoint(), gbc); |
|
157 |
gbc.gridy = 2; |
|
158 |
jPanelCoordinates.add(getJLabelLongitudPoint(), gbc); |
|
159 |
gbc.gridy = 3; |
|
160 |
jPanelCoordinates.add(getJLabelViewPoint(), gbc); |
|
161 |
gbc.gridy = 4; |
|
162 |
jPanelCoordinates.add(getJLabelPixelPoint(), gbc); |
|
163 |
} |
|
164 |
return jPanelCoordinates; |
|
165 |
} |
|
166 |
|
|
167 |
private JList getJListValues() { |
|
168 |
if(jListBandValues == null) { |
|
169 |
jListBandValues = new JList(); |
|
170 |
} |
|
171 |
return jListBandValues; |
|
172 |
} |
|
173 |
|
|
174 |
private JLabel getJLabelHSLPoint() { |
|
175 |
if(jLabelHSLPoint == null) |
|
176 |
jLabelHSLPoint = new JLabel("HSL: "); |
|
177 |
return jLabelHSLPoint; |
|
178 |
} |
|
179 |
|
|
180 |
private JLabel getJLabelCMKYPoint() { |
|
181 |
if(jLabelCMKYPoint == null) |
|
182 |
jLabelCMKYPoint = new JLabel("CMYK: "); |
|
183 |
return jLabelCMKYPoint; |
|
184 |
} |
|
185 |
|
|
186 |
private JLabel getJLabelRGBPoint() { |
|
187 |
if(jLabelRGBPoint == null) |
|
188 |
jLabelRGBPoint = new JLabel("RGB: " ); |
|
189 |
return jLabelRGBPoint; |
|
190 |
} |
|
191 |
|
|
192 |
private JLabel getJLabelPixelPoint() { |
|
193 |
if(jLabelPixelPoint == null) |
|
194 |
jLabelPixelPoint = new JLabel(); |
|
195 |
return jLabelPixelPoint; |
|
196 |
} |
|
197 |
|
|
198 |
private JLabel getJLabelViewPoint() { |
|
199 |
if(jLabelViewPoint == null) |
|
200 |
jLabelViewPoint = new JLabel(); |
|
201 |
return jLabelViewPoint; |
|
202 |
} |
|
203 |
|
|
204 |
private JLabel getJLabelLatitudePoint() { |
|
205 |
if(jLabelLatitudePoint == null) |
|
206 |
jLabelLatitudePoint = new JLabel(); |
|
207 |
return jLabelLatitudePoint; |
|
208 |
} |
|
209 |
|
|
210 |
private JLabel getJLabelLongitudPoint() { |
|
211 |
if(jLabelLongitudPoint == null) |
|
212 |
jLabelLongitudPoint = new JLabel(); |
|
213 |
return jLabelLongitudPoint; |
|
214 |
} |
|
215 |
|
|
216 |
private JLabel getJLabelNumberOfBands() { |
|
217 |
if(jLabelNumberOfBands == null) |
|
218 |
jLabelNumberOfBands = new JLabel(); |
|
219 |
return jLabelNumberOfBands; |
|
220 |
} |
|
221 |
|
|
222 |
public void updateDataModel() { |
|
223 |
Double nanObj = new Double(Double.NaN); |
|
224 |
DecimalFormat df2 = new DecimalFormat("#.##"); |
|
225 |
DecimalFormat df4 = new DecimalFormat("#.####"); |
|
226 |
getJLabelNumberOfBands().setText(tr.get("bands") + ": " + dataModel.bands); |
|
227 |
|
|
228 |
String y = (!new Double(dataModel.worldPoint.getY()).equals(nanObj)) ? df2.format(dataModel.worldPoint.getY()) : "NaN"; |
|
229 |
getJLabelLatitudePoint().setText(tr.get("lat") + ": " + y); |
|
230 |
|
|
231 |
String x = (!new Double(dataModel.worldPoint.getY()).equals(nanObj)) ? df2.format(dataModel.worldPoint.getX()) : "NaN"; |
|
232 |
getJLabelLongitudPoint().setText(tr.get("long") + ": " + x); |
|
233 |
|
|
234 |
y = (!new Double(dataModel.viewPoint.getY()).equals(nanObj)) ? df2.format(dataModel.viewPoint.getY()) : "NaN"; |
|
235 |
x = (!new Double(dataModel.viewPoint.getY()).equals(nanObj)) ? df2.format(dataModel.viewPoint.getX()) : "NaN"; |
|
236 |
getJLabelViewPoint().setText(tr.get("view_point") + ": (" + x + ", " + y + ")"); |
|
237 |
|
|
238 |
y = (!new Double(dataModel.pixelPoint.getY()).equals(nanObj)) ? df2.format(dataModel.pixelPoint.getY()) : "NaN"; |
|
239 |
x = (!new Double(dataModel.pixelPoint.getY()).equals(nanObj)) ? df2.format(dataModel.pixelPoint.getX()) : "NaN"; |
|
240 |
getJLabelPixelPoint().setText(tr.get("pixel_point") + ": (" + x + ", " + y + ")"); |
|
241 |
|
|
242 |
getJLabelRGBPoint().setText("RGB: " + dataModel.rgb[0] + ", " + |
|
243 |
dataModel.rgb[1] + ", " + |
|
244 |
dataModel.rgb[2]); |
|
245 |
getJLabelHSLPoint().setText("HSL: " + df4.format(dataModel.hsl[0]) + ", " + |
|
246 |
df4.format(dataModel.hsl[1]) + ", " + |
|
247 |
df4.format(dataModel.hsl[2])); |
|
248 |
getJLabelCMKYPoint().setText("CMYK: " + df4.format(dataModel.cmyk[0]) + ", " + |
|
249 |
df4.format(dataModel.cmyk[1]) + ", " + |
|
250 |
df4.format(dataModel.cmyk[2]) + ", " + |
|
251 |
df4.format(dataModel.cmyk[3])); |
|
252 |
|
|
253 |
DefaultListModel listModel = null; |
|
254 |
if(getJListValues().getModel() == null || !(getJListValues().getModel() instanceof DefaultListModel)) |
|
255 |
listModel = new DefaultListModel(); |
|
256 |
else |
|
257 |
listModel = (DefaultListModel)getJListValues().getModel(); |
|
258 |
listModel.clear(); |
|
259 |
for (int i = 0; i < dataModel.bandsValues.size(); i++) { |
|
260 |
listModel.addElement("B" + i + ": " + dataModel.bandsValues.get(i)); |
|
261 |
} |
|
262 |
if(getJListValues().getModel() == null || !(getJListValues().getModel() instanceof DefaultListModel)) |
|
263 |
getJListValues().setModel(listModel); |
|
264 |
} |
|
265 |
} |
|
0 | 266 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/infobypoint/gui/InfoByPointDataModel.java | ||
---|---|---|
24 | 24 |
import java.awt.geom.Point2D; |
25 | 25 |
import java.util.ArrayList; |
26 | 26 |
import java.util.List; |
27 |
import java.util.Observable; |
|
27 | 28 |
|
28 |
public class InfoByPointDataModel { |
|
29 |
private static final int LONG_STRING = 22;
|
|
29 |
public class InfoByPointDataModel extends Observable {
|
|
30 |
private static final int LONG_STRING = 26;
|
|
30 | 31 |
public int bands = 0; |
31 | 32 |
public List<Double> bandsValues = new ArrayList<Double>(); |
32 | 33 |
public Point2D pixelPoint = new Point2D.Double(); |
33 | 34 |
public Point2D worldPoint = new Point2D.Double(); |
34 | 35 |
public Point2D viewPoint = new Point2D.Double(); |
35 |
public int[] argb = new int[4];
|
|
36 |
public int[] rgb = new int[3];
|
|
36 | 37 |
public double[] cmyk = new double[4]; |
37 | 38 |
public double[] hsl = new double[3]; |
38 |
public List<String> layers = new ArrayList<String>();
|
|
39 |
public List<String> layers = null;
|
|
39 | 40 |
|
41 |
public InfoByPointDataModel() { |
|
42 |
setARGB(0, 0, 0); |
|
43 |
setCMYK(new double[]{0, 0, 0, 0}); |
|
44 |
setHSL(0, 0, 0); |
|
45 |
setBandValues(new double[]{Double.NaN}); |
|
46 |
setNumberOfBands(0); |
|
47 |
setPixelPoint(-1, -1); |
|
48 |
setViewPoint(Double.NaN, Double.NaN); |
|
49 |
setWorldPoint(Double.NaN, Double.NaN); |
|
50 |
List<String> list = new ArrayList<String>(); |
|
51 |
list.add("..."); |
|
52 |
setLayerList(list); |
|
53 |
} |
|
54 |
|
|
40 | 55 |
public void setBandValues(double[] list) { |
41 | 56 |
bandsValues.clear(); |
42 | 57 |
for (int i = 0; i < list.length; i++) { |
... | ... | |
48 | 63 |
this.bands = n; |
49 | 64 |
} |
50 | 65 |
|
51 |
public void setLayerList(String[] list) { |
|
52 |
layers.clear(); |
|
53 |
for (int i = 0; i < list.length; i++) { |
|
54 |
layers.add(list[i]); |
|
55 |
} |
|
66 |
public void setLayerList(List<String> list) { |
|
67 |
layers = list; |
|
56 | 68 |
} |
57 | 69 |
|
58 |
public void setARGB(int a, int r, int g, int b) { |
|
59 |
argb[0] = a; |
|
60 |
argb[1] = r; |
|
61 |
argb[2] = g; |
|
62 |
argb[3] = b; |
|
70 |
public void setARGB(int r, int g, int b) { |
|
71 |
rgb[0] = r; |
|
72 |
rgb[1] = g; |
|
73 |
rgb[2] = b; |
|
63 | 74 |
} |
64 | 75 |
|
65 | 76 |
public void setCMYK(double[] cmyk) { |
... | ... | |
85 | 96 |
} |
86 | 97 |
|
87 | 98 |
public String getFormatedLayerName(int i) { |
88 |
return "..." + layers.get(i).substring(layers.get(i).length() - LONG_STRING, layers.get(i).length()); |
|
99 |
if(LONG_STRING < layers.get(i).length()) |
|
100 |
return "..." + layers.get(i).substring(layers.get(i).length() - LONG_STRING, layers.get(i).length()); |
|
101 |
return layers.get(i); |
|
89 | 102 |
} |
103 |
|
|
104 |
public void notifyObservers() { |
|
105 |
setChanged(); |
|
106 |
super.notifyObservers(); |
|
107 |
} |
|
90 | 108 |
} |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/infobypoint/gui/PixelViewPanel.java | ||
---|---|---|
21 | 21 |
*/ |
22 | 22 |
package org.gvsig.raster.tools.app.basic.tool.infobypoint.gui; |
23 | 23 |
|
24 |
import java.awt.GridBagConstraints; |
|
25 |
import java.awt.GridBagLayout; |
|
24 | 26 |
import java.util.HashMap; |
25 | 27 |
|
26 | 28 |
import javax.swing.JPanel; |
27 | 29 |
|
30 |
/** |
|
31 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
32 |
*/ |
|
28 | 33 |
public class PixelViewPanel extends JPanel { |
29 | 34 |
private static final long serialVersionUID = 1L; |
30 | 35 |
private HashMap<String, String> tr = null; |
31 | 36 |
private InfoByPointDataModel dataModel = null; |
37 |
private PixelInspectorPanel pixelInspectorPanel = null; |
|
38 |
private InfoByPointPanel infoByPointPanel = null; |
|
32 | 39 |
|
33 | 40 |
public PixelViewPanel(HashMap<String, String> translations, InfoByPointDataModel dataModel) { |
34 | 41 |
tr = translations; |
... | ... | |
50 | 57 |
} |
51 | 58 |
|
52 | 59 |
private void init() { |
60 |
setLayout(new GridBagLayout()); |
|
61 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
62 |
gbc.gridx = 0; |
|
63 |
gbc.gridy = 0; |
|
64 |
gbc.fill = GridBagConstraints.BOTH; |
|
65 |
gbc.weightx = 1; |
|
66 |
gbc.weighty = 1; |
|
67 |
gbc.insets = new java.awt.Insets(2, 2, 2, 2); |
|
68 |
add(getPixelInspectorPanel(), gbc); |
|
53 | 69 |
|
70 |
gbc.gridy = 1; |
|
71 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
72 |
gbc.weightx = 1; |
|
73 |
gbc.weighty = 0; |
|
74 |
add(getinfoByPointPanel(), gbc); |
|
54 | 75 |
} |
55 | 76 |
|
56 | 77 |
public void updateDataModel() { |
57 |
|
|
78 |
getinfoByPointPanel().updateDataModel(); |
|
58 | 79 |
} |
80 |
|
|
81 |
public PixelInspectorPanel getPixelInspectorPanel() { |
|
82 |
if(pixelInspectorPanel == null) |
|
83 |
pixelInspectorPanel = new PixelInspectorPanel(tr); |
|
84 |
return pixelInspectorPanel; |
|
85 |
} |
|
86 |
|
|
87 |
public InfoByPointPanel getinfoByPointPanel() { |
|
88 |
if(infoByPointPanel == null) |
|
89 |
infoByPointPanel = new InfoByPointPanel(tr, dataModel); |
|
90 |
return infoByPointPanel; |
|
91 |
} |
|
59 | 92 |
} |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/infobypoint/MainInfoByPointDialog.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
1 | 22 |
package org.gvsig.raster.tools.app.basic.tool.infobypoint; |
2 | 23 |
|
3 | 24 |
import java.awt.BorderLayout; |
4 | 25 |
import java.util.HashMap; |
5 | 26 |
|
6 | 27 |
import javax.swing.JPanel; |
7 |
import javax.swing.event.ChangeEvent; |
|
8 |
import javax.swing.event.ChangeListener; |
|
9 | 28 |
|
10 | 29 |
import org.gvsig.andami.PluginServices; |
11 | 30 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
Also available in: Unified diff