gvsig-raster / 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 @ 1172
History | View | Annotate | Download (4.24 KB)
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.Dimension; |
26 |
import java.awt.GridBagConstraints; |
27 |
import java.awt.GridBagLayout; |
28 |
import java.util.HashMap; |
29 |
import java.util.Observable; |
30 |
import java.util.Observer; |
31 |
|
32 |
import javax.swing.BorderFactory; |
33 |
import javax.swing.JPanel; |
34 |
|
35 |
/**
|
36 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
37 |
*/
|
38 |
public class MainInfoByPointPanel extends JPanel implements Observer { |
39 |
private static final long serialVersionUID = 1L; |
40 |
private HashMap<String, String> tr = null; |
41 |
private InfoByPointDataModel dataModel = null; |
42 |
private PixelInspectorPanel pixelInspectorPanel = null; |
43 |
private InfoByPointPanel infoByPointPanel = null; |
44 |
private ButtonsPanel buttonsPanel = null; |
45 |
private boolean extended = false; |
46 |
|
47 |
public MainInfoByPointPanel(HashMap<String, String> translations, boolean extended) { |
48 |
tr = translations; |
49 |
if(tr == null || tr.get("layer_list") == null) { |
50 |
tr = new HashMap<String, String>(); |
51 |
tr.put("layer_list", "layer_list"); |
52 |
tr.put("band_values", "band_values"); |
53 |
tr.put("pixel_point", "pixel_point"); |
54 |
tr.put("view_point", "view_point"); |
55 |
tr.put("world_point", "world_point"); |
56 |
tr.put("bands", "bands"); |
57 |
tr.put("colors", "colors"); |
58 |
tr.put("coords", "coords"); |
59 |
tr.put("lat", "lat"); |
60 |
tr.put("long", "long"); |
61 |
} |
62 |
this.extended = extended;
|
63 |
init(); |
64 |
} |
65 |
|
66 |
private void init() { |
67 |
setLayout(new GridBagLayout()); |
68 |
GridBagConstraints gbc = new GridBagConstraints(); |
69 |
gbc.gridx = 0;
|
70 |
gbc.gridy = 0;
|
71 |
gbc.gridwidth = 1;
|
72 |
gbc.gridheight = 1;
|
73 |
if(!extended) {
|
74 |
gbc.fill = GridBagConstraints.BOTH;
|
75 |
gbc.weightx = 1;
|
76 |
gbc.weighty = 1;
|
77 |
} else {
|
78 |
gbc.anchor = GridBagConstraints.WEST;
|
79 |
gbc.fill = GridBagConstraints.VERTICAL;
|
80 |
gbc.weighty = 1;
|
81 |
} |
82 |
gbc.insets = new java.awt.Insets(2, 2, 2, 2); |
83 |
add(getPixelInspectorPanel(), gbc); |
84 |
|
85 |
if(!extended) {
|
86 |
gbc.fill = GridBagConstraints.HORIZONTAL;
|
87 |
gbc.weightx = 1;
|
88 |
gbc.weighty = 0;
|
89 |
} else {
|
90 |
gbc.fill = GridBagConstraints.NONE;
|
91 |
gbc.weighty = 0;
|
92 |
} |
93 |
|
94 |
gbc.gridx = 0;
|
95 |
gbc.gridy = 1;
|
96 |
add(getinfoByPointPanel(), gbc); |
97 |
|
98 |
if(extended) {
|
99 |
gbc.fill = GridBagConstraints.HORIZONTAL;
|
100 |
gbc.gridx = 0;
|
101 |
gbc.gridy = 2;
|
102 |
add(getButtonsPanel(), gbc); |
103 |
|
104 |
gbc.gridx = 1;
|
105 |
gbc.gridy = 0;
|
106 |
gbc.gridheight = 3;
|
107 |
gbc.fill = GridBagConstraints.BOTH;
|
108 |
gbc.weightx = 1;
|
109 |
gbc.weighty = 1;
|
110 |
JPanel p = new JPanel(); |
111 |
p.setPreferredSize(new Dimension(500, 400)); |
112 |
p.setBorder(BorderFactory.createLineBorder(Color.red)); |
113 |
add(p, gbc); |
114 |
} |
115 |
} |
116 |
|
117 |
public InfoByPointDataModel getInfoByPointDataModel() {
|
118 |
if(dataModel == null) |
119 |
dataModel = new InfoByPointDataModel();
|
120 |
return dataModel;
|
121 |
} |
122 |
|
123 |
public PixelInspectorPanel getPixelInspectorPanel() {
|
124 |
if(pixelInspectorPanel == null) |
125 |
pixelInspectorPanel = new PixelInspectorPanel(tr);
|
126 |
return pixelInspectorPanel;
|
127 |
} |
128 |
|
129 |
public InfoByPointPanel getinfoByPointPanel() {
|
130 |
if(infoByPointPanel == null) |
131 |
infoByPointPanel = new InfoByPointPanel(tr, getInfoByPointDataModel());
|
132 |
return infoByPointPanel;
|
133 |
} |
134 |
|
135 |
public ButtonsPanel getButtonsPanel() {
|
136 |
if(buttonsPanel == null) |
137 |
buttonsPanel = new ButtonsPanel();
|
138 |
return buttonsPanel;
|
139 |
} |
140 |
|
141 |
public void update(Observable o, Object arg) { |
142 |
getinfoByPointPanel().updateDataModel(); |
143 |
} |
144 |
} |