Revision 344 2.0/trunk/org.gvsig.gvsig3d.app/org.gvsig.gvsig3d.app.extension/src/main/java/org/gvsig/gvsig3d/app/gui/styling/PictureSymbolTab.java
PictureSymbolTab.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
import org.gvsig.gvsig3d.impl.symbology3d.marker.impl.NodeMarker3DSymbol; |
32 | 32 |
import org.gvsig.gvsig3d.impl.symbology3d.marker.impl.PictureMarker3DSymbol; |
33 |
import org.gvsig.gvsig3d.resources.ResourcesFactory; |
|
33 | 34 |
import org.gvsig.gvsig3d.symbology3d.I3DSymbol; |
34 | 35 |
import org.gvsig.gvsig3d.symbology3d.marker.ISimpleMarker3DSymbol; |
35 | 36 |
import org.gvsig.osgvp.core.osg.Group; |
... | ... | |
65 | 66 |
setLayout(new BorderLayout(0, 0)); |
66 | 67 |
|
67 | 68 |
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); |
68 |
tabbedPane.setPreferredSize(new Dimension(180,300)); |
|
69 |
tabbedPane.setPreferredSize(new Dimension(180, 300));
|
|
69 | 70 |
add(tabbedPane, BorderLayout.CENTER); |
70 | 71 |
|
71 | 72 |
panel = new JPanel(); |
72 |
tabbedPane.addTab("Picture Marker", null, panel, null);
|
|
73 |
tabbedPane.addTab("Marker", null, panel, null); |
|
73 | 74 |
GridBagLayout gbl_panel = new GridBagLayout(); |
74 | 75 |
gbl_panel.columnWidths = new int[] { 175 }; |
75 | 76 |
gbl_panel.rowHeights = new int[] { 180, 70 }; |
... | ... | |
91 | 92 |
icon = new ImageIcon(""); |
92 | 93 |
background = new JLabel(icon); |
93 | 94 |
previewPanel.add(background, BorderLayout.CENTER); |
94 |
|
|
95 |
|
|
95 | 96 |
_picturePanel = new JPanel(); |
96 | 97 |
previewPanel.add(_picturePanel, BorderLayout.CENTER); |
97 | 98 |
_picturePanel.setLayout(new BorderLayout(0, 0)); |
98 |
_picturePanel.add(new JLabel(scale(icon.getImage())), BorderLayout.CENTER); |
|
99 |
_picturePanel.add(new JLabel(scale(icon.getImage())), |
|
100 |
BorderLayout.CENTER); |
|
99 | 101 |
|
100 | 102 |
JPanel propertiesPanel = new JPanel(); |
101 | 103 |
propertiesPanel.setBorder(new TitledBorder(null, "Properties", |
... | ... | |
138 | 140 |
icon = new ImageIcon(_pictureURL); |
139 | 141 |
background = new JLabel(icon); |
140 | 142 |
_picturePanel.removeAll(); |
141 |
_picturePanel.add(new JLabel(scale(icon.getImage())),BorderLayout.CENTER); |
|
143 |
_picturePanel.add(new JLabel(scale(icon.getImage())), |
|
144 |
BorderLayout.CENTER); |
|
142 | 145 |
PictureSymbolTab.this.repaint(); |
143 | 146 |
|
144 | 147 |
} else { |
... | ... | |
150 | 153 |
// _colorPanel.repaint(); |
151 | 154 |
// symbolPreviewPanel.repaint(); |
152 | 155 |
// ((SymbolSelector3D) _parent).setSymbol(_symbol); |
153 |
|
|
156 |
|
|
154 | 157 |
} |
155 | 158 |
}); |
156 | 159 |
propertiesPanel.add(btnBrowse); |
... | ... | |
165 | 168 |
sizeSpinner = new JSpinner(); |
166 | 169 |
sizeSpinner.setModel(new SpinnerNumberModel(32.0, 1.0, 1000.0, 1.0)); |
167 | 170 |
panel_3.add(sizeSpinner); |
168 |
|
|
169 |
propertiesPanel.setPreferredSize(new Dimension(80,80)); |
|
170 | 171 |
|
172 |
propertiesPanel.setPreferredSize(new Dimension(80, 80)); |
|
173 |
|
|
171 | 174 |
JPanel panel_4 = new JPanel(); |
172 | 175 |
tabbedPane.addTab("Collection", null, panel_4, null); |
173 | 176 |
GridBagLayout gbl_panel_4 = new GridBagLayout(); |
174 |
gbl_panel_4.columnWidths = new int[] { 220, 220, 0 };
|
|
177 |
gbl_panel_4.columnWidths = new int[] { 15, 60, 15, 60 };
|
|
175 | 178 |
gbl_panel_4.rowHeights = new int[] { 33, 33, 33, 0 }; |
176 |
gbl_panel_4.columnWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
|
|
177 |
gbl_panel_4.rowWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE };
|
|
179 |
gbl_panel_4.columnWeights = new double[] { 0.0, 0.0 }; |
|
180 |
gbl_panel_4.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0 };
|
|
178 | 181 |
panel_4.setLayout(gbl_panel_4); |
179 | 182 |
|
180 | 183 |
JRadioButton rdbtnNewRadioButton = new JRadioButton(""); |
... | ... | |
188 | 191 |
JPanel panel_5 = new JPanel(); |
189 | 192 |
GridBagConstraints gbc_panel_5 = new GridBagConstraints(); |
190 | 193 |
gbc_panel_5.fill = GridBagConstraints.BOTH; |
191 |
gbc_panel_5.insets = new Insets(0, 0, 5, 0);
|
|
194 |
gbc_panel_5.insets = new Insets(0, 0, 5, 5);
|
|
192 | 195 |
gbc_panel_5.gridx = 1; |
193 | 196 |
gbc_panel_5.gridy = 0; |
197 |
|
|
198 |
panel_5.setLayout(new BorderLayout(0, 0)); |
|
199 |
panel_5.add(new JLabel(new ImageIcon(PictureSymbolTab.class |
|
200 |
.getResource("/markers/fire.png")))); |
|
194 | 201 |
panel_4.add(panel_5, gbc_panel_5); |
195 | 202 |
|
196 | 203 |
JRadioButton rdbtnNewRadioButton_1 = new JRadioButton(""); |
197 | 204 |
GridBagConstraints gbc_rdbtnNewRadioButton_1 = new GridBagConstraints(); |
198 | 205 |
gbc_rdbtnNewRadioButton_1.fill = GridBagConstraints.BOTH; |
199 | 206 |
gbc_rdbtnNewRadioButton_1.insets = new Insets(0, 0, 5, 5); |
200 |
gbc_rdbtnNewRadioButton_1.gridx = 0;
|
|
201 |
gbc_rdbtnNewRadioButton_1.gridy = 1;
|
|
207 |
gbc_rdbtnNewRadioButton_1.gridx = 2;
|
|
208 |
gbc_rdbtnNewRadioButton_1.gridy = 0;
|
|
202 | 209 |
panel_4.add(rdbtnNewRadioButton_1, gbc_rdbtnNewRadioButton_1); |
203 | 210 |
|
204 | 211 |
JPanel panel_6 = new JPanel(); |
205 | 212 |
GridBagConstraints gbc_panel_6 = new GridBagConstraints(); |
206 | 213 |
gbc_panel_6.fill = GridBagConstraints.BOTH; |
207 | 214 |
gbc_panel_6.insets = new Insets(0, 0, 5, 0); |
208 |
gbc_panel_6.gridx = 1;
|
|
209 |
gbc_panel_6.gridy = 1;
|
|
215 |
gbc_panel_6.gridx = 3;
|
|
216 |
gbc_panel_6.gridy = 0;
|
|
210 | 217 |
panel_4.add(panel_6, gbc_panel_6); |
218 |
panel_6.setLayout(new BorderLayout(0, 0)); |
|
219 |
panel_6.add(new JLabel(new ImageIcon(PictureSymbolTab.class |
|
220 |
.getResource("/markers/artgallery.png")))); |
|
211 | 221 |
|
212 | 222 |
JRadioButton rdbtnNewRadioButton_2 = new JRadioButton(""); |
213 | 223 |
GridBagConstraints gbc_rdbtnNewRadioButton_2 = new GridBagConstraints(); |
214 | 224 |
gbc_rdbtnNewRadioButton_2.fill = GridBagConstraints.BOTH; |
215 |
gbc_rdbtnNewRadioButton_2.insets = new Insets(0, 0, 0, 5);
|
|
225 |
gbc_rdbtnNewRadioButton_2.insets = new Insets(0, 0, 5, 5);
|
|
216 | 226 |
gbc_rdbtnNewRadioButton_2.gridx = 0; |
217 |
gbc_rdbtnNewRadioButton_2.gridy = 2;
|
|
227 |
gbc_rdbtnNewRadioButton_2.gridy = 1;
|
|
218 | 228 |
panel_4.add(rdbtnNewRadioButton_2, gbc_rdbtnNewRadioButton_2); |
219 | 229 |
|
220 | 230 |
JPanel panel_7 = new JPanel(); |
221 | 231 |
GridBagConstraints gbc_panel_7 = new GridBagConstraints(); |
232 |
gbc_panel_7.insets = new Insets(0, 0, 5, 5); |
|
222 | 233 |
gbc_panel_7.fill = GridBagConstraints.BOTH; |
223 | 234 |
gbc_panel_7.gridx = 1; |
224 |
gbc_panel_7.gridy = 2;
|
|
235 |
gbc_panel_7.gridy = 1;
|
|
225 | 236 |
panel_4.add(panel_7, gbc_panel_7); |
237 |
panel_7.setLayout(new BorderLayout(0, 0)); |
|
238 |
panel_7.add(new JLabel(new ImageIcon(PictureSymbolTab.class |
|
239 |
.getResource("/markers/taxi.png")))); |
|
226 | 240 |
|
227 |
} |
|
241 |
JRadioButton radioButton = new JRadioButton(""); |
|
242 |
GridBagConstraints gbc_radioButton = new GridBagConstraints(); |
|
243 |
gbc_radioButton.insets = new Insets(0, 0, 5, 5); |
|
244 |
gbc_radioButton.gridx = 2; |
|
245 |
gbc_radioButton.gridy = 1; |
|
246 |
panel_4.add(radioButton, gbc_radioButton); |
|
247 |
|
|
248 |
JPanel panel_8 = new JPanel(); |
|
249 |
GridBagConstraints gbc_panel_8 = new GridBagConstraints(); |
|
250 |
gbc_panel_8.insets = new Insets(0, 0, 5, 5); |
|
251 |
gbc_panel_8.fill = GridBagConstraints.BOTH; |
|
252 |
gbc_panel_8.gridx = 3; |
|
253 |
gbc_panel_8.gridy = 1; |
|
254 |
panel_4.add(panel_8, gbc_panel_8); |
|
255 |
panel_8.setLayout(new BorderLayout(0, 0)); |
|
256 |
panel_8.add(new JLabel(new ImageIcon(PictureSymbolTab.class |
|
257 |
.getResource("/markers/airport_runway.png")))); |
|
228 | 258 |
|
259 |
JRadioButton radioButton2 = new JRadioButton(""); |
|
260 |
GridBagConstraints gbc_radioButton2 = new GridBagConstraints(); |
|
261 |
gbc_radioButton2.insets = new Insets(0, 0, 5, 5); |
|
262 |
gbc_radioButton2.gridx = 0; |
|
263 |
gbc_radioButton2.gridy = 2; |
|
264 |
panel_4.add(radioButton2, gbc_radioButton2); |
|
229 | 265 |
|
266 |
JPanel panel_9 = new JPanel(); |
|
267 |
GridBagConstraints gbc_panel_9 = new GridBagConstraints(); |
|
268 |
gbc_panel_9.insets = new Insets(0, 0, 5, 5); |
|
269 |
gbc_panel_9.fill = GridBagConstraints.BOTH; |
|
270 |
gbc_panel_9.gridx = 1; |
|
271 |
gbc_panel_9.gridy = 2; |
|
272 |
panel_4.add(panel_9, gbc_panel_9); |
|
273 |
panel_9.setLayout(new BorderLayout(0, 0)); |
|
274 |
panel_9.add(new JLabel(new ImageIcon(PictureSymbolTab.class |
|
275 |
.getResource("/markers/mall.png")))); |
|
230 | 276 |
|
277 |
JRadioButton radioButton3 = new JRadioButton(""); |
|
278 |
GridBagConstraints gbc_radioButton3 = new GridBagConstraints(); |
|
279 |
gbc_radioButton3.insets = new Insets(0, 0, 5, 5); |
|
280 |
gbc_radioButton3.gridx = 2; |
|
281 |
gbc_radioButton3.gridy = 2; |
|
282 |
panel_4.add(radioButton3, gbc_radioButton3); |
|
283 |
|
|
284 |
JPanel panel_10 = new JPanel(); |
|
285 |
GridBagConstraints gbc_panel_10 = new GridBagConstraints(); |
|
286 |
gbc_panel_10.insets = new Insets(0, 0, 5, 5); |
|
287 |
gbc_panel_10.fill = GridBagConstraints.BOTH; |
|
288 |
gbc_panel_10.gridx = 3; |
|
289 |
gbc_panel_10.gridy = 2; |
|
290 |
panel_4.add(panel_10, gbc_panel_10); |
|
291 |
panel_10.setLayout(new BorderLayout(0, 0)); |
|
292 |
panel_10.add(new JLabel(new ImageIcon(PictureSymbolTab.class |
|
293 |
.getResource("/markers/rodent.png")))); |
|
294 |
|
|
295 |
JRadioButton radioButton4 = new JRadioButton(""); |
|
296 |
GridBagConstraints gbc_radioButton4 = new GridBagConstraints(); |
|
297 |
gbc_radioButton4.insets = new Insets(0, 0, 5, 5); |
|
298 |
gbc_radioButton4.gridx = 0; |
|
299 |
gbc_radioButton4.gridy = 3; |
|
300 |
panel_4.add(radioButton4, gbc_radioButton4); |
|
301 |
|
|
302 |
JPanel panel_11 = new JPanel(); |
|
303 |
GridBagConstraints gbc_panel_11 = new GridBagConstraints(); |
|
304 |
gbc_panel_11.insets = new Insets(0, 0, 5, 5); |
|
305 |
gbc_panel_11.fill = GridBagConstraints.BOTH; |
|
306 |
gbc_panel_11.gridx = 1; |
|
307 |
gbc_panel_11.gridy = 3; |
|
308 |
panel_4.add(panel_11, gbc_panel_11); |
|
309 |
panel_11.setLayout(new BorderLayout(0, 0)); |
|
310 |
panel_11.add(new JLabel(new ImageIcon(PictureSymbolTab.class |
|
311 |
.getResource("/markers/wrestling-2.png")))); |
|
312 |
|
|
313 |
JRadioButton radioButton5 = new JRadioButton(""); |
|
314 |
GridBagConstraints gbc_radioButton5 = new GridBagConstraints(); |
|
315 |
gbc_radioButton5.insets = new Insets(0, 0, 5, 5); |
|
316 |
gbc_radioButton5.gridx = 2; |
|
317 |
gbc_radioButton5.gridy = 3; |
|
318 |
panel_4.add(radioButton5, gbc_radioButton5); |
|
319 |
|
|
320 |
JPanel panel_12 = new JPanel(); |
|
321 |
GridBagConstraints gbc_panel_12 = new GridBagConstraints(); |
|
322 |
gbc_panel_12.insets = new Insets(0, 0, 5, 5); |
|
323 |
gbc_panel_12.fill = GridBagConstraints.BOTH; |
|
324 |
gbc_panel_12.gridx = 3; |
|
325 |
gbc_panel_12.gridy = 3; |
|
326 |
panel_4.add(panel_12, gbc_panel_12); |
|
327 |
panel_12.setLayout(new BorderLayout(0, 0)); |
|
328 |
panel_12.add(new JLabel(new ImageIcon(PictureSymbolTab.class |
|
329 |
.getResource("/markers/zoo.png")))); |
|
330 |
|
|
331 |
} |
|
332 |
|
|
231 | 333 |
public I3DSymbol getNewSymbol() { |
232 | 334 |
// TODO Auto-generated method stub |
233 | 335 |
_symbol = new PictureMarker3DSymbol(); |
234 |
((PictureMarker3DSymbol) _symbol).setPictureFileURL(_pictureURL); |
|
235 |
((PictureMarker3DSymbol) _symbol).setSize((Double) sizeSpinner.getValue()); |
|
336 |
|
|
337 |
if (panel.isVisible()) { |
|
338 |
((PictureMarker3DSymbol) _symbol).setPictureFileURL(_pictureURL); |
|
339 |
((PictureMarker3DSymbol) _symbol).setSize((Double) sizeSpinner |
|
340 |
.getValue()); |
|
341 |
} else { |
|
342 |
|
|
343 |
((PictureMarker3DSymbol) _symbol).setPictureFileURL(PictureSymbolTab.class |
|
344 |
.getResource("/markers/taxi.png").getPath()); |
|
345 |
((PictureMarker3DSymbol) _symbol).setSize((Double) sizeSpinner |
|
346 |
.getValue()); |
|
347 |
|
|
348 |
} |
|
236 | 349 |
return _symbol; |
237 | 350 |
} |
238 | 351 |
|
... | ... | |
242 | 355 |
icon = new ImageIcon(_pictureURL); |
243 | 356 |
background = new JLabel(icon); |
244 | 357 |
_picturePanel.removeAll(); |
245 |
_picturePanel.add(new JLabel(scale(icon.getImage())),BorderLayout.CENTER); |
|
358 |
_picturePanel.add(new JLabel(scale(icon.getImage())), |
|
359 |
BorderLayout.CENTER); |
|
246 | 360 |
background.repaint(); |
247 | 361 |
panel.repaint(); |
248 |
sizeSpinner.setValue( ((PictureMarker3DSymbol) symbol).getSize());
|
|
362 |
sizeSpinner.setValue(((PictureMarker3DSymbol) symbol).getSize()); |
|
249 | 363 |
// System.out.println("Setting text" + _pictureURL); |
250 | 364 |
textField.setText(_pictureURL); |
251 | 365 |
// loadFile(); |
... | ... | |
277 | 391 |
return "Supported Image Types"; |
278 | 392 |
} |
279 | 393 |
} |
280 |
|
|
394 |
|
|
281 | 395 |
private ImageIcon scale(Image src) { |
282 | 396 |
int w = 115; |
283 | 397 |
int h = 115; |
Also available in: Unified diff