Revision 353
2.0/trunk/org.gvsig.gvsig3d.app/org.gvsig.gvsig3d.app.extension/package.info | ||
---|---|---|
1 | 1 |
# |
2 |
#Fri Mar 23 14:05:05 CET 2012
|
|
2 |
#Mon Apr 02 09:37:20 CEST 2012
|
|
3 | 3 |
owner=gvSIG Association |
4 | 4 |
code=org.gvsig.gvsig3d.app.extension |
5 | 5 |
java-version=j1_5 |
2.0/trunk/org.gvsig.gvsig3d.app/org.gvsig.gvsig3d.app.extension/src/main/java/org/gvsig/gvsig3d/app/gui/panels/ExtrusionLegendPanel.java | ||
---|---|---|
1 |
package org.gvsig.gvsig3d.app.gui.panels; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.awt.FlowLayout; |
|
5 |
import java.awt.event.ActionEvent; |
|
6 |
import java.awt.event.ActionListener; |
|
7 |
import java.awt.event.ItemEvent; |
|
8 |
import java.awt.event.ItemListener; |
|
9 |
import java.awt.event.KeyEvent; |
|
10 |
import java.awt.event.KeyListener; |
|
11 |
|
|
12 |
import javax.swing.ImageIcon; |
|
13 |
import javax.swing.JButton; |
|
14 |
import javax.swing.JCheckBox; |
|
15 |
import javax.swing.JComboBox; |
|
16 |
import javax.swing.JLabel; |
|
17 |
import javax.swing.JPanel; |
|
18 |
import javax.swing.JTextField; |
|
19 |
|
|
20 |
import org.gvsig.andami.PluginServices; |
|
21 |
import org.gvsig.app.gui.styling.JComboBoxColorScheme; |
|
22 |
import org.gvsig.app.project.documents.view.legend.gui.ILegendPanel; |
|
23 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
24 |
import org.gvsig.fmap.mapcontext.layers.operations.ClassifiableVectorial; |
|
25 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
|
26 |
import org.gvsig.fmap.mapcontext.rendering.legend.ZSort; |
|
27 |
import org.gvsig.gvsig3d.map3d.Layer3DProps; |
|
28 |
import org.gvsig.gvsig3d.map3d.MapContext3D; |
|
29 |
|
|
30 |
public class ExtrusionLegendPanel extends JPanel implements ILegendPanel, |
|
31 |
ItemListener, ActionListener, KeyListener { |
|
32 |
/** |
|
33 |
* |
|
34 |
*/ |
|
35 |
private static final long serialVersionUID = 6470946030927461473L; |
|
36 |
|
|
37 |
|
|
38 |
// private ExtrusionLegend theLegend; |
|
39 |
private ClassifiableVectorial layer; |
|
40 |
// private SymbolTableExtrusion symbolTable; |
|
41 |
private JComboBox cmbFields; |
|
42 |
private JButton btnRemoveAll; |
|
43 |
private JButton btnRemove; |
|
44 |
private JCheckBox chbUseDefault = null; |
|
45 |
// private ExtrusionLegend auxLegend; |
|
46 |
private JPanel pnlCenter; |
|
47 |
private ZSort zSort; |
|
48 |
private JButton btnOpenSymbolLevelsEditor; |
|
49 |
private JTextField jtvariable; |
|
50 |
private JComboBoxColorScheme cmbColorScheme; |
|
51 |
private double extrusionValue = 1; |
|
52 |
private JTextField jtfija; |
|
53 |
private JCheckBox fixedOption; |
|
54 |
private double extrusionFixedValue = 1; |
|
55 |
|
|
56 |
// private Value aux; |
|
57 |
|
|
58 |
/** |
|
59 |
* |
|
60 |
*/ |
|
61 |
public ExtrusionLegendPanel() { |
|
62 |
super(); |
|
63 |
initialize(); |
|
64 |
} |
|
65 |
|
|
66 |
/** |
|
67 |
* DOCUMENT ME! |
|
68 |
*/ |
|
69 |
protected void initialize() { |
|
70 |
|
|
71 |
JPanel pnlButtons = new JPanel(); |
|
72 |
|
|
73 |
JButton btnAddAll = new JButton(PluginServices.getText(this, |
|
74 |
"Anadir_todos")); |
|
75 |
btnAddAll.setActionCommand("ADD_ALL_VALUES"); |
|
76 |
btnAddAll.addActionListener(this); |
|
77 |
pnlButtons.add(btnAddAll); |
|
78 |
|
|
79 |
JButton btnAdd = new JButton(PluginServices.getText(this, "Anadir")); |
|
80 |
btnAdd.setActionCommand("ADD_VALUE"); |
|
81 |
btnAdd.addActionListener(this); |
|
82 |
pnlButtons.add(btnAdd); |
|
83 |
|
|
84 |
btnRemoveAll = new JButton(PluginServices.getText(this, "Quitar_todos")); |
|
85 |
btnRemoveAll.setActionCommand("REMOVE_ALL"); |
|
86 |
btnRemoveAll.addActionListener(this); |
|
87 |
pnlButtons.add(btnRemoveAll); |
|
88 |
|
|
89 |
btnRemove = new JButton(PluginServices.getText(this, "Quitar")); |
|
90 |
btnRemove.setActionCommand("REMOVE"); |
|
91 |
btnRemove.addActionListener(this); |
|
92 |
pnlButtons.add(btnRemove); |
|
93 |
|
|
94 |
// btnOpenSymbolLevelsEditor = new JButton(PluginServices.getText(this, |
|
95 |
// "symbol_levels")); |
|
96 |
// btnOpenSymbolLevelsEditor.addActionListener(this); |
|
97 |
// btnOpenSymbolLevelsEditor.setActionCommand("OPEN_SYMBOL_LEVEL_EDITOR") |
|
98 |
// ; |
|
99 |
// pnlButtons.add(btnOpenSymbolLevelsEditor); |
|
100 |
|
|
101 |
pnlCenter = new JPanel(); |
|
102 |
pnlCenter.setLayout(new BorderLayout()); |
|
103 |
|
|
104 |
cmbFields = new JComboBox(); |
|
105 |
cmbFields.setActionCommand("FIELD_SELECTED"); |
|
106 |
cmbFields.addActionListener(this); |
|
107 |
cmbFields.setVisible(true); |
|
108 |
|
|
109 |
JPanel pnlNorth = new JPanel(new FlowLayout(FlowLayout.LEFT, 20, 0)); |
|
110 |
JPanel pAux1 = new JPanel(); |
|
111 |
|
|
112 |
JLabel lblFieldClassification = new JLabel(PluginServices.getText(this, |
|
113 |
"Campo_de_clasificacion")); |
|
114 |
pAux1.add(lblFieldClassification); |
|
115 |
pAux1.add(cmbFields); |
|
116 |
pAux1.add(getChbUseDefault(), null); |
|
117 |
pnlNorth.add(pAux1); |
|
118 |
|
|
119 |
pAux1 = new JPanel(); |
|
120 |
pAux1.add(new JLabel(PluginServices.getText(this, "Nivel_de_extrusion") |
|
121 |
+ ":")); |
|
122 |
jtvariable = new JTextField(PluginServices.getText(this, "" |
|
123 |
+ this.extrusionValue), 3); |
|
124 |
jtvariable.setColumns(3); |
|
125 |
jtvariable.setHorizontalAlignment(JTextField.RIGHT); |
|
126 |
jtvariable.setToolTipText(PluginServices.getText(this, "Valor_inicial") |
|
127 |
+ " * " + PluginServices.getText(this, "Nivel_de_extrusion")); |
|
128 |
jtvariable.addKeyListener(this); |
|
129 |
pAux1.add(jtvariable); |
|
130 |
|
|
131 |
pnlNorth.add(pAux1); |
|
132 |
|
|
133 |
pAux1 = new JPanel(); |
|
134 |
fixedOption = new JCheckBox(PluginServices.getText(this, "Altura_fija") |
|
135 |
+ ":", false); |
|
136 |
fixedOption.setHorizontalAlignment(JTextField.RIGHT); |
|
137 |
fixedOption.setEnabled(true); |
|
138 |
fixedOption.setSelected(false); |
|
139 |
pAux1.add(fixedOption); |
|
140 |
|
|
141 |
jtfija = new JTextField(PluginServices.getText(this, "1"), 3); |
|
142 |
jtfija.setColumns(10); |
|
143 |
jtfija.setHorizontalAlignment(JTextField.RIGHT); |
|
144 |
jtfija.addKeyListener(this); |
|
145 |
jtfija.setToolTipText(PluginServices.getText(this, "Valor_inicial") |
|
146 |
+ " = " + PluginServices.getText(this, "Altura_fija")); |
|
147 |
jtfija.setEnabled(false); |
|
148 |
pAux1.add(jtfija); |
|
149 |
|
|
150 |
pnlNorth.add(pAux1); |
|
151 |
|
|
152 |
pAux1 = new JPanel(); |
|
153 |
pAux1.add(new JLabel(PluginServices.getText(this, "color_scheme") + ":")); |
|
154 |
cmbColorScheme = new JComboBoxColorScheme(false); |
|
155 |
|
|
156 |
// pAux1.add(cmbColorScheme); |
|
157 |
// pnlNorth.add(pAux1); |
|
158 |
|
|
159 |
fixedOption.addItemListener(this); |
|
160 |
this.setLayout(new BorderLayout()); |
|
161 |
this.add(pnlNorth, BorderLayout.NORTH); |
|
162 |
this.add(pnlCenter, BorderLayout.CENTER); |
|
163 |
this.add(pnlButtons, BorderLayout.SOUTH); |
|
164 |
|
|
165 |
} |
|
166 |
|
|
167 |
private void fillTableValues() { |
|
168 |
// DataSource elRs; |
|
169 |
// |
|
170 |
// try { |
|
171 |
// elRs = ((FLyrVect) layer).getRecordset(); |
|
172 |
// // logger.debug("elRs.start()"); |
|
173 |
// elRs.start(); |
|
174 |
// |
|
175 |
// int idField = -1; |
|
176 |
// String fieldName = (String) cmbFields.getSelectedItem(); |
|
177 |
// if (fieldName == null) { |
|
178 |
// JOptionPane.showMessageDialog((Component) PluginServices |
|
179 |
// .getMainFrame(), PluginServices.getText(this, |
|
180 |
// "no_hay_campo_seleccionado")); |
|
181 |
// return; |
|
182 |
// } |
|
183 |
// |
|
184 |
// idField = elRs.getFieldIndexByName(fieldName); |
|
185 |
// theLegend.setClassifyingFieldNames(new String[] { fieldName }); |
|
186 |
// |
|
187 |
// // long numReg = elRs.getRowCount(); |
|
188 |
// if (idField == -1) { |
|
189 |
// NotificationManager.addWarning( |
|
190 |
// PluginServices.getText(this, "unrecognized_field_name") |
|
191 |
// + " " + fieldName, null); |
|
192 |
// |
|
193 |
// return; |
|
194 |
// } |
|
195 |
// |
|
196 |
// symbolTable.removeAllItems(); |
|
197 |
// |
|
198 |
// int numSymbols = 0; |
|
199 |
// ISymbol theSymbol = null; |
|
200 |
// |
|
201 |
// // auxLegend=(VectorialUniqueValueLegend)m_lyr.getLegend(); |
|
202 |
// // auxLegend = |
|
203 |
// // LegendFactory.createVectorialUniqueValueLegend(layer.getShapeType |
|
204 |
// // ()); |
|
205 |
// auxLegend = new ExtrusionLegend(layer.getShapeType()); |
|
206 |
// auxLegend.setExtrusionFactor(this.extrusionValue); |
|
207 |
// |
|
208 |
// // Object resul; |
|
209 |
// if (chbUseDefault.isSelected()) { |
|
210 |
// auxLegend.getDefaultSymbol().setDescription("Default"); |
|
211 |
// auxLegend.addSymbol(new NullUniqueValue(), |
|
212 |
// auxLegend.getDefaultSymbol()); |
|
213 |
// } |
|
214 |
// |
|
215 |
// int r; |
|
216 |
// int g; |
|
217 |
// int b; |
|
218 |
// int stepR; |
|
219 |
// int stepG; |
|
220 |
// int stepB; |
|
221 |
// |
|
222 |
// int interval = 0; |
|
223 |
// HashMap<Value, Object> auxMap = new HashMap<Value, Object>(); |
|
224 |
// for (int j = 0; j < elRs.getRowCount(); j++) { |
|
225 |
// Value clave = elRs.getFieldValue(j, idField); |
|
226 |
// |
|
227 |
// if (clave instanceof NullValue) { |
|
228 |
// continue; |
|
229 |
// } |
|
230 |
// if (auxLegend.getSymbolByValue(clave) == null) { |
|
231 |
// auxMap.put((Value) clave, null); |
|
232 |
// } |
|
233 |
// } |
|
234 |
// interval = auxMap.size() - 1; |
|
235 |
// Color startColor = Color.blue; |
|
236 |
// |
|
237 |
// Color endColor = Color.red; |
|
238 |
// |
|
239 |
// r = startColor.getRed(); |
|
240 |
// g = startColor.getGreen(); |
|
241 |
// b = startColor.getBlue(); |
|
242 |
// stepR = (endColor.getRed() - r) / interval; |
|
243 |
// stepG = (endColor.getGreen() - g) / interval; |
|
244 |
// stepB = (endColor.getBlue() - b) / interval; |
|
245 |
// HashMap<Value, Color> colorPalete = new HashMap<Value, Color>(); |
|
246 |
// int cont = 0; |
|
247 |
// |
|
248 |
// for (int j = 0; j < elRs.getRowCount(); j++) { |
|
249 |
// Value clave = elRs.getFieldValue(j, idField); |
|
250 |
// |
|
251 |
// if (clave instanceof NullValue) { |
|
252 |
// continue; |
|
253 |
// } |
|
254 |
// |
|
255 |
// // Comprobar que no esta repetido y no hace falta introducir en |
|
256 |
// // el hashtable el campo junto con el simbolo. |
|
257 |
// if (auxLegend.getSymbolByValue(clave) == null) { |
|
258 |
// // si no esta creado el simbolo se crea |
|
259 |
// // jaume (moved to ISymbol); theSymbol = new |
|
260 |
// // FSymbol(layer.getShapeType()); |
|
261 |
// // theSymbol = SymbologyFactory. |
|
262 |
// // createDefaultSymbolByShapeType(layer.getShapeType(), |
|
263 |
// // colorScheme[rand.nextInt(colorScheme.length)].getColor()); |
|
264 |
// |
|
265 |
// Color co = null; |
|
266 |
// if (!(colorPalete.containsKey(clave))) { |
|
267 |
// int red, green, blue; |
|
268 |
// red = r + (stepR * cont); |
|
269 |
// green = g + (stepG * cont); |
|
270 |
// blue = b + (stepB * cont); |
|
271 |
// co = new Color(red, green, blue); |
|
272 |
// colorPalete.put((Value) clave, co); |
|
273 |
// cont++; |
|
274 |
// } else { |
|
275 |
// co = colorPalete.get(clave); |
|
276 |
// } |
|
277 |
// |
|
278 |
// theSymbol = SymbologyFactory |
|
279 |
// .createDefaultSymbolByShapeType( |
|
280 |
// layer.getShapeType(), co); |
|
281 |
// |
|
282 |
// aux = clave.producto(ValueFactory |
|
283 |
// .createValue(extrusionValue)); |
|
284 |
// theSymbol.setDescription(aux.toString()); |
|
285 |
// auxLegend.addSymbol(clave, theSymbol); |
|
286 |
// |
|
287 |
// numSymbols++; |
|
288 |
// |
|
289 |
// if (numSymbols == 100) { |
|
290 |
// int resp = JOptionPane.showConfirmDialog(this, |
|
291 |
// PluginServices.getText(this, |
|
292 |
// "mas_de_100_simbolos"), PluginServices |
|
293 |
// .getText(this, "quiere_continuar"), |
|
294 |
// JOptionPane.YES_NO_OPTION, |
|
295 |
// JOptionPane.WARNING_MESSAGE); |
|
296 |
// |
|
297 |
// if ((resp == JOptionPane.NO_OPTION) |
|
298 |
// || (resp == JOptionPane.DEFAULT_OPTION)) { |
|
299 |
// return; |
|
300 |
// } |
|
301 |
// } |
|
302 |
// } |
|
303 |
// |
|
304 |
// } // for |
|
305 |
// |
|
306 |
// Object[] extrudedValue = auxLegend.getValues(); |
|
307 |
// |
|
308 |
// double defaultValue = 1; |
|
309 |
// |
|
310 |
// for (int i = 0; i < extrudedValue.length; i++) { |
|
311 |
// if (jtvariable.isEnabled()) { |
|
312 |
// try { |
|
313 |
// extrudedValue[i] = ((Value) auxLegend.getValues()[i]) |
|
314 |
// .producto(ValueFactory |
|
315 |
// .createValue(extrusionValue)); |
|
316 |
// theSymbol.setDescription(extrudedValue[i].toString()); |
|
317 |
// |
|
318 |
// } catch (IncompatibleTypesException e) { |
|
319 |
// extrudedValue[i] = ValueFactory |
|
320 |
// .createValue(defaultValue); |
|
321 |
// } |
|
322 |
// } else |
|
323 |
// extrudedValue[i] = ValueFactory |
|
324 |
// .createValue(extrusionFixedValue); |
|
325 |
// |
|
326 |
// } |
|
327 |
// // symbolTable.fillTableFromSymbolList(auxLegend.getSymbols(), |
|
328 |
// // auxLegend.getValues(), auxLegend.getDescriptions()); |
|
329 |
// |
|
330 |
// symbolTable.fillTableFromSymbolList(auxLegend.getSymbols(), |
|
331 |
// auxLegend.getValues(), extrudedValue); |
|
332 |
// elRs.stop(); |
|
333 |
// } catch (ReadDriverException e) { |
|
334 |
// NotificationManager.addError( |
|
335 |
// PluginServices.getText(this, "recovering_recordset"), e); |
|
336 |
// } catch (IncompatibleTypesException e) { |
|
337 |
// // TODO Auto-generated catch block |
|
338 |
// e.printStackTrace(); |
|
339 |
// } |
|
340 |
// |
|
341 |
// btnRemoveAll.setEnabled(true); |
|
342 |
// btnRemove.setEnabled(true); |
|
343 |
// |
|
344 |
// // m_bCacheDirty = false; |
|
345 |
} |
|
346 |
|
|
347 |
/** |
|
348 |
* A partir de los registros de la tabla, regenera el FRenderer. (No solo el |
|
349 |
* symbolList, si no tambien el arrayKeys y el defaultRenderer |
|
350 |
*/ |
|
351 |
private void fillSymbolListFromTable() { |
|
352 |
// Value clave; |
|
353 |
// ISymbol theSymbol; |
|
354 |
// |
|
355 |
// // Borramos las anteriores listas: |
|
356 |
// |
|
357 |
// boolean bRestoValores = false; // PONERLO EN UN CHECKBOX |
|
358 |
// int hasta; |
|
359 |
// String fieldName = (String) cmbFields.getSelectedItem(); |
|
360 |
// theLegend.setClassifyingFieldNames(new String[] { fieldName }); |
|
361 |
// // ///////////////////////////////////////PEPE |
|
362 |
// FLyrVect m = (FLyrVect) layer; |
|
363 |
// try { |
|
364 |
// int fieldType = m.getSource().getRecordset() |
|
365 |
// .getFieldType((int) cmbFields.getSelectedIndex()); |
|
366 |
// theLegend.setClassifyingFieldTypes(new int[] { fieldType }); |
|
367 |
// } catch (ReadDriverException e) { |
|
368 |
// NotificationManager.addError( |
|
369 |
// PluginServices.getText(this, "could_not_setup_legend"), e); |
|
370 |
// } |
|
371 |
// // ///////////////////////////////////////PEPE |
|
372 |
// if (bRestoValores) { |
|
373 |
// hasta = symbolTable.getRowCount() - 1; |
|
374 |
// } else { |
|
375 |
// hasta = symbolTable.getRowCount(); |
|
376 |
// } |
|
377 |
// |
|
378 |
// for (int row = 0; row < symbolTable.getRowCount(); row++) { |
|
379 |
// clave = (Value) symbolTable.getFieldValue(row, 0); |
|
380 |
// DoubleValue extrusion = null; |
|
381 |
// try { |
|
382 |
// extrusion = (DoubleValue) symbolTable.getFieldValue(row, 1); |
|
383 |
// theSymbol = new BaseExtrusionSymbol(extrusion.getValue()); |
|
384 |
// theSymbol.setDescription(extrusion.toString()); |
|
385 |
// } catch (Exception e) { |
|
386 |
// theSymbol = new BaseExtrusionSymbol(1); |
|
387 |
// theSymbol.setDescription("1"); |
|
388 |
// } |
|
389 |
// |
|
390 |
// theLegend.addSymbol(clave, theSymbol); |
|
391 |
// } |
|
392 |
// |
|
393 |
// if (bRestoValores) { |
|
394 |
// theSymbol = (ISymbol) symbolTable.getFieldValue(hasta, 0); |
|
395 |
// theLegend.setDefaultSymbol(theSymbol); |
|
396 |
// } |
|
397 |
} |
|
398 |
|
|
399 |
/** |
|
400 |
* DOCUMENT ME! |
|
401 |
*/ |
|
402 |
protected void fillFieldNames() { |
|
403 |
// DataSource rs = null; |
|
404 |
// ArrayList nomFields = null; |
|
405 |
// |
|
406 |
// try { |
|
407 |
// rs = ((AlphanumericData) layer).getRecordset(); |
|
408 |
// rs.start(); |
|
409 |
// |
|
410 |
// nomFields = new ArrayList(); |
|
411 |
// |
|
412 |
// int type; |
|
413 |
// for (int i = 0; i < rs.getFieldCount(); i++) { |
|
414 |
// type = rs.getFieldType(i); |
|
415 |
// |
|
416 |
// if (type == Types.NULL) { |
|
417 |
// continue; |
|
418 |
// } |
|
419 |
// |
|
420 |
// if ((type == Types.INTEGER) || (type == Types.DOUBLE) |
|
421 |
// || (type == Types.FLOAT) || (type == Types.BIGINT)) { |
|
422 |
// nomFields.add(rs.getFieldName(i).trim()); |
|
423 |
// } |
|
424 |
// } |
|
425 |
// |
|
426 |
// rs.stop(); |
|
427 |
// } catch (ReadDriverException e) { |
|
428 |
// NotificationManager.addError( |
|
429 |
// PluginServices.getText(this, "recovering_recordset"), e); |
|
430 |
// } |
|
431 |
// |
|
432 |
// DefaultComboBoxModel cM = new |
|
433 |
// DefaultComboBoxModel(nomFields.toArray()); |
|
434 |
// cmbFields.setModel(cM); |
|
435 |
// |
|
436 |
// symbolTable.removeAllItems(); |
|
437 |
} |
|
438 |
|
|
439 |
public void setData(FLayer layer, ILegend legend) { |
|
440 |
// this.layer = (ClassifiableVectorial) layer; |
|
441 |
// int shapeType = 0; |
|
442 |
// try { |
|
443 |
// shapeType = this.layer.getShapeType(); |
|
444 |
// } catch (ReadDriverException e) { |
|
445 |
// NotificationManager.addError( |
|
446 |
// PluginServices.getText(this, "generating_intervals"), e); |
|
447 |
// } |
|
448 |
// |
|
449 |
// if (symbolTable != null) |
|
450 |
// pnlCenter.remove(symbolTable); |
|
451 |
// symbolTable = new SymbolTableExtrusion(this, SymbolTable.VALUES_TYPE, |
|
452 |
// shapeType); |
|
453 |
// pnlCenter.add(symbolTable, BorderLayout.CENTER); |
|
454 |
// |
|
455 |
// fillFieldNames(); |
|
456 |
// |
|
457 |
// symbolTable.removeAllItems(); |
|
458 |
// |
|
459 |
// if (legend instanceof ExtrusionLegend) { |
|
460 |
// theLegend = (ExtrusionLegend) legend; |
|
461 |
// getChbUseDefault().setSelected(theLegend.isUseDefaultSymbol()); |
|
462 |
// cmbFields.getModel().setSelectedItem( |
|
463 |
// theLegend.getClassifyingFieldNames()[0]); |
|
464 |
// symbolTable.fillTableFromSymbolList(theLegend.getSymbols(), |
|
465 |
// theLegend.getValues(), theLegend.getDescriptions()); |
|
466 |
// zSort = theLegend.getZSort(); |
|
467 |
// } else { |
|
468 |
// theLegend = new ExtrusionLegend(shapeType); |
|
469 |
// } |
|
470 |
// if (theLegend != null) { |
|
471 |
// this.extrusionValue = ((ExtrusionLegend) this.theLegend) |
|
472 |
// .getExtrusionFactor(); |
|
473 |
// jtvariable.setText(Double.toString(this.extrusionValue)); |
|
474 |
// } |
|
475 |
} |
|
476 |
|
|
477 |
/* |
|
478 |
* (non-Javadoc) |
|
479 |
* |
|
480 |
* @see com.iver.cit.gvsig.gui.legendmanager.panels.ILegendPanel#getLegend() |
|
481 |
*/ |
|
482 |
public ILegend getLegend() { |
|
483 |
// fillSymbolListFromTable(); |
|
484 |
// fillTableValues(); |
|
485 |
// if (auxLegend != null) { |
|
486 |
// // your settings that are not the set of symbols must be located |
|
487 |
// // here |
|
488 |
// auxLegend |
|
489 |
// .setClassifyingFieldNames(new String[] { (String) cmbFields |
|
490 |
// .getSelectedItem() }); |
|
491 |
// auxLegend.setClassifyingFieldTypes(theLegend |
|
492 |
// .getClassifyingFieldTypes()); |
|
493 |
// |
|
494 |
// LegendContentsChangedListener[] l = theLegend.getListeners(); |
|
495 |
// for (int i = 0; i < l.length; i++) { |
|
496 |
// auxLegend.addLegendListener(l[i]); |
|
497 |
// } |
|
498 |
// ; |
|
499 |
// |
|
500 |
// theLegend = auxLegend; |
|
501 |
// } |
|
502 |
// theLegend.setZSort(zSort); |
|
503 |
// |
|
504 |
// return theLegend; |
|
505 |
|
|
506 |
return null; |
|
507 |
} |
|
508 |
|
|
509 |
private JCheckBox getChbUseDefault() { |
|
510 |
if (chbUseDefault == null) { |
|
511 |
chbUseDefault = new JCheckBox(); |
|
512 |
chbUseDefault.setSelected(true); |
|
513 |
chbUseDefault |
|
514 |
.addActionListener(new java.awt.event.ActionListener() { |
|
515 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
516 |
// if (auxLegend == null) |
|
517 |
// auxLegend = theLegend; |
|
518 |
// if (chbUseDefault.isSelected()) { |
|
519 |
// addDefault(); |
|
520 |
// } else { |
|
521 |
// delDefault(); |
|
522 |
// } |
|
523 |
} |
|
524 |
}); |
|
525 |
chbUseDefault |
|
526 |
.setText(PluginServices.getText(this, "resto_valores")); |
|
527 |
} |
|
528 |
|
|
529 |
return chbUseDefault; |
|
530 |
} |
|
531 |
|
|
532 |
/** |
|
533 |
* A?ade el resto de valores. |
|
534 |
*/ |
|
535 |
private void addDefault() { |
|
536 |
// auxLegend.getDefaultSymbol().setDescription("Default"); |
|
537 |
// auxLegend |
|
538 |
// .addSymbol(new NullUniqueValue(), auxLegend.getDefaultSymbol()); |
|
539 |
// symbolTable.addTableRecord(auxLegend.getDefaultSymbol(), |
|
540 |
// new NullUniqueValue(), auxLegend.getDefaultSymbol() |
|
541 |
// .getDescription()); |
|
542 |
// symbolTable.repaint(); |
|
543 |
} |
|
544 |
|
|
545 |
/** |
|
546 |
* Elimina el resto de valores que no estan representados por ningun otro |
|
547 |
* simbolo.. |
|
548 |
*/ |
|
549 |
private void delDefault() { |
|
550 |
// auxLegend.delSymbol(new NullUniqueValue()); |
|
551 |
// symbolTable.removeRow(new NullUniqueValue()); |
|
552 |
// symbolTable.repaint(); |
|
553 |
} |
|
554 |
|
|
555 |
public void actionPerformed(ActionEvent e) { |
|
556 |
|
|
557 |
// // modificar el combobox de valor |
|
558 |
// if (e.getActionCommand() == "FIELD_SELECTED") { |
|
559 |
// // JComboBox cb = (JComboBox) e.getSource(); |
|
560 |
// // String fieldName = (String) cb.getSelectedItem(); |
|
561 |
// // symbolTable.removeAllItems(); |
|
562 |
// |
|
563 |
// } |
|
564 |
// |
|
565 |
// // add all elements by value |
|
566 |
// if (e.getActionCommand() == "ADD_ALL_VALUES") { |
|
567 |
// fillTableValues(); |
|
568 |
// } |
|
569 |
// |
|
570 |
// // add only one value |
|
571 |
// if (e.getActionCommand() == "ADD_VALUE") { |
|
572 |
// try { |
|
573 |
// symbolTable.addTableRecord(SymbologyFactory |
|
574 |
// .createDefaultSymbolByShapeType(layer.getShapeType()), |
|
575 |
// ValueFactory.createValue(0.0), "0 - 0"); |
|
576 |
// } catch (ReadDriverException ex) { |
|
577 |
// NotificationManager.addError( |
|
578 |
// PluginServices.getText(this, "getting_shape_type"), ex); |
|
579 |
// } |
|
580 |
// } |
|
581 |
// |
|
582 |
// // Vacia la tabla |
|
583 |
// if (e.getActionCommand() == "REMOVE_ALL") { |
|
584 |
// symbolTable.removeAllItems(); |
|
585 |
// theLegend.setZSort(null); |
|
586 |
// zSort = null; |
|
587 |
// } |
|
588 |
// |
|
589 |
// // Quitar solo el elemento seleccionado |
|
590 |
// if (e.getActionCommand() == "REMOVE") { |
|
591 |
// symbolTable.removeSelectedRows(); |
|
592 |
// } |
|
593 |
// |
|
594 |
// if (e.getActionCommand() == "OPEN_SYMBOL_LEVEL_EDITOR") { |
|
595 |
// |
|
596 |
// if (theLegend != null) { |
|
597 |
// ZSort myZSort = ((AbstractClassifiedVectorLegend) getLegend()) |
|
598 |
// .getZSort(); |
|
599 |
// if (myZSort == null) { |
|
600 |
// myZSort = new ZSort(theLegend); |
|
601 |
// } |
|
602 |
// SymbolLevelsWindow sl = new SymbolLevelsWindow(myZSort); |
|
603 |
// PluginServices.getMDIManager().addWindow(sl); |
|
604 |
// zSort = sl.getZSort(); |
|
605 |
// if (auxLegend != null) |
|
606 |
// auxLegend.setZSort(zSort); |
|
607 |
// } |
|
608 |
// |
|
609 |
// } |
|
610 |
} |
|
611 |
|
|
612 |
public String getDescription() { |
|
613 |
return PluginServices.getText(this, |
|
614 |
PluginServices.getText(this, "info_extrusion")); |
|
615 |
} |
|
616 |
|
|
617 |
public ImageIcon getIcon() { |
|
618 |
return null; |
|
619 |
} |
|
620 |
|
|
621 |
public Class getParentClass() { |
|
622 |
return null; |
|
623 |
} |
|
624 |
|
|
625 |
public String getTitle() { |
|
626 |
return ("<html><b>" + PluginServices.getText(this, "Extrusion") + "</b></html>"); |
|
627 |
} |
|
628 |
|
|
629 |
public JPanel getPanel() { |
|
630 |
return this; |
|
631 |
} |
|
632 |
|
|
633 |
public Class getLegendClass() { |
|
634 |
// return ExtrusionLegend.class; |
|
635 |
return null; |
|
636 |
} |
|
637 |
|
|
638 |
public boolean isSuitableFor(FLayer layer) { |
|
639 |
|
|
640 |
Layer3DProps props3D = ((MapContext3D) layer.getMapContext()) |
|
641 |
.getLayer3DProps(layer); |
|
642 |
return ((props3D != null) && (props3D.getType() == Layer3DProps.layer3DVector)); |
|
643 |
} |
|
644 |
|
|
645 |
public void keyPressed(KeyEvent e) { |
|
646 |
// TODO Auto-generated method stub |
|
647 |
|
|
648 |
} |
|
649 |
|
|
650 |
public void keyReleased(KeyEvent e) { |
|
651 |
|
|
652 |
try { |
|
653 |
extrusionValue = new Double(this.jtvariable.getText()) |
|
654 |
.doubleValue(); |
|
655 |
extrusionFixedValue = new Double(this.jtfija.getText()) |
|
656 |
.doubleValue(); |
|
657 |
} catch (Exception e2) { |
|
658 |
// String s = " "; |
|
659 |
// if(!this.jtvariable.getText().equals(s)) { |
|
660 |
// JOptionPane.showMessageDialog(null, PluginServices.getText(this, |
|
661 |
// "Introduce un dato numerico"), |
|
662 |
// PluginServices.getText(this, "Dato incorrecto"), |
|
663 |
// JOptionPane.WARNING_MESSAGE); |
|
664 |
// |
|
665 |
// jtvariable.setText(Double.toString(extrusionValue)); |
|
666 |
// jtfija.setText(Double.toString(extrusionFixedValue)); |
|
667 |
// } |
|
668 |
} |
|
669 |
} |
|
670 |
|
|
671 |
public void keyTyped(KeyEvent e) { |
|
672 |
// TODO Auto-generated method stub |
|
673 |
|
|
674 |
} |
|
675 |
|
|
676 |
public void itemStateChanged(ItemEvent e) { |
|
677 |
jtfija.setEnabled(fixedOption.isSelected()); |
|
678 |
jtvariable.setEnabled(!fixedOption.isSelected()); |
|
679 |
|
|
680 |
} |
|
681 |
|
|
682 |
} |
2.0/trunk/org.gvsig.gvsig3d.app/org.gvsig.gvsig3d.app.extension/src/main/java/org/gvsig/gvsig3d/app/gui/styling/Object3DSymbolTab.java | ||
---|---|---|
29 | 29 |
import org.gvsig.gvsig3d.symbology3d.I3DSymbol; |
30 | 30 |
import org.gvsig.gvsig3d.symbology3d.marker.ISimpleMarker3DSymbol; |
31 | 31 |
import org.gvsig.osgvp.core.osg.Group; |
32 |
import org.gvsig.osgvp.core.osg.Matrix.Perspective; |
|
32 | 33 |
import org.gvsig.osgvp.core.osg.Node; |
34 |
import org.gvsig.osgvp.core.osg.PositionAttitudeTransform; |
|
35 |
import org.gvsig.osgvp.core.osg.Vec3; |
|
33 | 36 |
import org.gvsig.osgvp.core.osgdb.osgDB; |
34 | 37 |
import org.gvsig.osgvp.exceptions.node.LoadNodeException; |
38 |
import org.gvsig.osgvp.exceptions.node.NodeException; |
|
39 |
import org.gvsig.osgvp.viewer.Camera; |
|
35 | 40 |
import org.gvsig.osgvp.viewer.IViewerContainer; |
36 | 41 |
import org.gvsig.osgvp.viewer.ViewerFactory; |
37 | 42 |
|
... | ... | |
40 | 45 |
private JTextField textField; |
41 | 46 |
|
42 | 47 |
private IViewerContainer _canvas3d; |
43 |
private IViewerContainer _alternateCanvas3d; |
|
48 |
private IViewerContainer _particleCanvas3d; |
|
49 |
private IViewerContainer _instanceCanvas3d; |
|
44 | 50 |
|
45 | 51 |
private ISimpleMarker3DSymbol _symbol; |
46 | 52 |
private String _nodeURL = ""; |
... | ... | |
53 | 59 |
|
54 | 60 |
private String _textureURL; |
55 | 61 |
|
62 |
private JTabbedPane tabbedPane; |
|
63 |
|
|
64 |
private JPanel panel_4; |
|
65 |
|
|
66 |
private JPanel panel_5; |
|
67 |
|
|
56 | 68 |
/** |
57 | 69 |
* Create the panel. |
58 | 70 |
*/ |
59 | 71 |
public Object3DSymbolTab(Component parent) { |
60 | 72 |
setLayout(new BorderLayout(0, 0)); |
61 | 73 |
|
62 |
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
|
74 |
tabbedPane = new JTabbedPane(JTabbedPane.TOP); |
|
63 | 75 |
tabbedPane.setPreferredSize(new Dimension(180, 300)); |
64 | 76 |
add(tabbedPane, BorderLayout.CENTER); |
65 | 77 |
|
66 | 78 |
JPanel panel = new JPanel(); |
67 |
tabbedPane.addTab("Marker", null, panel, null);
|
|
79 |
tabbedPane.addTab("File", null, panel, null);
|
|
68 | 80 |
GridBagLayout gbl_panel = new GridBagLayout(); |
69 | 81 |
gbl_panel.columnWidths = new int[] { 175 }; |
70 | 82 |
gbl_panel.rowHeights = new int[] { 180, 70 }; |
... | ... | |
109 | 121 |
propertiesPanel.add(textField); |
110 | 122 |
textField.setColumns(10); |
111 | 123 |
|
112 |
JButton btnBrowse = new JButton("Browse");
|
|
124 |
JButton btnBrowse = new JButton("...");
|
|
113 | 125 |
btnBrowse.addActionListener(new ActionListener() { |
114 | 126 |
public void actionPerformed(ActionEvent e) { |
115 | 127 |
|
... | ... | |
126 | 138 |
Node node = osgDB.readNodeFile(_nodeURL); |
127 | 139 |
_canvas3d.getOSGViewer().setSceneData(node); |
128 | 140 |
} catch (LoadNodeException e1) { |
129 |
// TODO Auto-generated catch block |
|
130 | 141 |
e1.printStackTrace(); |
131 | 142 |
} catch (FileNotFoundException e1) { |
132 |
// TODO Auto-generated catch block |
|
133 | 143 |
e1.printStackTrace(); |
134 | 144 |
} |
135 | 145 |
textField.setText(_nodeURL); |
... | ... | |
161 | 171 |
|
162 | 172 |
propertiesPanel.setPreferredSize(new Dimension(80, 80)); |
163 | 173 |
|
164 |
JPanel panel_4 = new JPanel(); |
|
165 |
tabbedPane.addTab("Collection", null, panel_4, null); |
|
174 |
addParticlesTab(); |
|
175 |
addGeometriesTab(); |
|
176 |
|
|
177 |
} |
|
178 |
|
|
179 |
private void addParticlesTab() { |
|
180 |
|
|
181 |
panel_4 = new JPanel(); |
|
182 |
tabbedPane.addTab("Particle", null, panel_4, null); |
|
166 | 183 |
GridBagLayout gbl_panel_4 = new GridBagLayout(); |
167 | 184 |
gbl_panel_4.columnWidths = new int[] { 175 }; |
168 | 185 |
gbl_panel_4.rowHeights = new int[] { 180, 18, 18, 18, 18 }; |
... | ... | |
181 | 198 |
panel_4.add(panel_1, gbc_panel_1); |
182 | 199 |
panel_1.setLayout(new BorderLayout(0, 0)); |
183 | 200 |
|
184 |
panel_1.add(getAlternateOsgPanel());
|
|
201 |
panel_1.add(getParticleOsgPanel());
|
|
185 | 202 |
|
186 | 203 |
_particleComboBox = new JComboBox(); |
187 | 204 |
_particleComboBox.addActionListener(new ActionListener() { |
188 | 205 |
public void actionPerformed(ActionEvent arg0) { |
189 | 206 |
|
207 |
double translationY = 0.0; |
|
208 |
double translationZ = 0.0; |
|
209 |
|
|
190 | 210 |
if (arg0.getSource() instanceof JComboBox) { |
191 | 211 |
switch (_particleComboBox.getSelectedIndex()) { |
192 | 212 |
|
193 | 213 |
case 0: |
194 | 214 |
_nodeURL = Object3DSymbolTab.class.getResource( |
195 | 215 |
"/particle/fire.osgb").getPath(); |
216 |
translationZ = 0; |
|
196 | 217 |
break; |
197 | 218 |
case 1: |
198 | 219 |
_nodeURL = Object3DSymbolTab.class.getResource( |
199 | 220 |
"/particle/radial.osgb").getPath(); |
221 |
translationZ = 45; |
|
200 | 222 |
break; |
201 | 223 |
case 2: |
202 | 224 |
_nodeURL = Object3DSymbolTab.class.getResource( |
203 | 225 |
"/particle/space.osgb").getPath(); |
226 |
translationY = -110.0; |
|
227 |
translationZ = 60; |
|
204 | 228 |
break; |
205 | 229 |
case 3: |
206 | 230 |
_nodeURL = Object3DSymbolTab.class.getResource( |
207 | 231 |
"/particle/trisistema.osgb").getPath(); |
232 |
translationZ = 40; |
|
208 | 233 |
break; |
209 | 234 |
|
210 | 235 |
default: |
... | ... | |
213 | 238 |
} |
214 | 239 |
|
215 | 240 |
try { |
241 |
Group scene = new Group(); |
|
216 | 242 |
Node node = osgDB.readNodeFile(_nodeURL); |
217 |
_alternateCanvas3d.getOSGViewer().setSceneData(node);
|
|
243 |
scene.addChild(node);
|
|
218 | 244 |
|
245 |
PositionAttitudeTransform pat = new PositionAttitudeTransform(); |
|
246 |
pat.setPosition(new Vec3(0.0, translationY, |
|
247 |
translationZ)); |
|
248 |
pat.setScale(new Vec3(0.06, 0.06, 0.06)); |
|
249 |
|
|
250 |
Node dummy = osgDB.readNodeFile(Object3DSymbolTab.class |
|
251 |
.getResource("/geometries/cow.ive").getPath()); |
|
252 |
|
|
253 |
pat.addChild(dummy); |
|
254 |
scene.addChild(pat); |
|
255 |
|
|
256 |
_particleCanvas3d.getOSGViewer().setSceneData(scene); |
|
257 |
|
|
219 | 258 |
} catch (LoadNodeException e) { |
220 |
// TODO Auto-generated catch block |
|
221 | 259 |
e.printStackTrace(); |
222 | 260 |
} catch (FileNotFoundException e) { |
261 |
e.printStackTrace(); |
|
262 |
} catch (NodeException e) { |
|
223 | 263 |
// TODO Auto-generated catch block |
224 | 264 |
e.printStackTrace(); |
225 | 265 |
} |
... | ... | |
244 | 284 |
gbc_comboBox.gridy = 2; |
245 | 285 |
panel_4.add(_particleComboBox, gbc_comboBox); |
246 | 286 |
|
287 |
} |
|
288 |
|
|
289 |
private void addGeometriesTab() { |
|
290 |
|
|
291 |
panel_5 = new JPanel(); |
|
292 |
tabbedPane.addTab("Instance", null, panel_5, null); |
|
293 |
GridBagLayout gbl_panel_5 = new GridBagLayout(); |
|
294 |
gbl_panel_5.columnWidths = new int[] { 175 }; |
|
295 |
gbl_panel_5.rowHeights = new int[] { 180, 18, 18, 18, 18 }; |
|
296 |
gbl_panel_5.columnWeights = new double[] { 0.0 }; |
|
297 |
gbl_panel_5.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0 }; |
|
298 |
panel_5.setLayout(gbl_panel_5); |
|
299 |
|
|
300 |
JPanel panel_1 = new JPanel(); |
|
301 |
panel_1.setBorder(new TitledBorder(null, "Preview", |
|
302 |
TitledBorder.LEADING, TitledBorder.TOP, null, null)); |
|
303 |
GridBagConstraints gbc_panel_1 = new GridBagConstraints(); |
|
304 |
gbc_panel_1.insets = new Insets(0, 0, 5, 0); |
|
305 |
gbc_panel_1.fill = GridBagConstraints.BOTH; |
|
306 |
gbc_panel_1.gridx = 0; |
|
307 |
gbc_panel_1.gridy = 0; |
|
308 |
panel_5.add(panel_1, gbc_panel_1); |
|
309 |
panel_1.setLayout(new BorderLayout(0, 0)); |
|
310 |
|
|
311 |
panel_1.add(getGeometryOsgPanel()); |
|
312 |
|
|
247 | 313 |
JPanel panelComboInstances = new JPanel(); |
248 | 314 |
|
249 | 315 |
GridBagConstraints gbc_panelI = new GridBagConstraints(); |
250 | 316 |
gbc_panelI.fill = GridBagConstraints.HORIZONTAL; |
251 | 317 |
gbc_panelI.gridx = 0; |
252 |
gbc_panelI.gridy = 4;
|
|
253 |
panel_4.add(panelComboInstances, gbc_panelI);
|
|
318 |
gbc_panelI.gridy = 1;
|
|
319 |
panel_5.add(panelComboInstances, gbc_panelI);
|
|
254 | 320 |
GridBagLayout gbl_panelComboInstances = new GridBagLayout(); |
255 | 321 |
gbl_panelComboInstances.columnWidths = new int[] { 0, 0, 0 }; |
256 | 322 |
gbl_panelComboInstances.rowHeights = new int[] { 0 }; |
... | ... | |
290 | 356 |
|
291 | 357 |
try { |
292 | 358 |
Node node = osgDB.readNodeFile(_nodeURL); |
293 |
_alternateCanvas3d.getOSGViewer().setSceneData(node); |
|
359 |
_instanceCanvas3d.getOSGViewer().setSceneData(node); |
|
360 |
// Put the camera manually to fix the objects |
|
361 |
// dissapearing |
|
362 |
Camera cam = _canvas3d.getOSGViewer().getCamera(); |
|
363 |
System.out.println(cam.getCenter()); |
|
364 |
// _canvas3d.getOSGViewer().setCamera(cam); |
|
294 | 365 |
|
295 | 366 |
} catch (LoadNodeException e) { |
296 | 367 |
// TODO Auto-generated catch block |
... | ... | |
309 | 380 |
gbc_lblObjects.anchor = GridBagConstraints.WEST; |
310 | 381 |
gbc_lblObjects.insets = new Insets(0, 0, 5, 0); |
311 | 382 |
gbc_lblObjects.gridx = 0; |
312 |
gbc_lblObjects.gridy = 3;
|
|
313 |
panel_4.add(lblObjects, gbc_lblObjects);
|
|
383 |
gbc_lblObjects.gridy = 1;
|
|
384 |
panel_5.add(lblObjects, gbc_lblObjects);
|
|
314 | 385 |
_instancesComboBox.setModel(new DefaultComboBoxModel( |
315 | 386 |
new String[] { "Cube" })); |
316 | 387 |
GridBagConstraints gbc_icomboBox = new GridBagConstraints(); |
... | ... | |
382 | 453 |
return aux3; |
383 | 454 |
} |
384 | 455 |
|
385 |
private JPanel getAlternateOsgPanel() {
|
|
456 |
private JPanel getParticleOsgPanel() {
|
|
386 | 457 |
|
387 | 458 |
int size = 140; |
388 | 459 |
JPanel aux3 = new JPanel(); |
389 | 460 |
aux3.setPreferredSize(new Dimension(size, size)); |
390 | 461 |
|
391 |
if (_alternateCanvas3d == null) {
|
|
392 |
_alternateCanvas3d = ViewerFactory.getInstance().createViewer(
|
|
462 |
if (_particleCanvas3d == null) {
|
|
463 |
_particleCanvas3d = ViewerFactory.getInstance().createViewer(
|
|
393 | 464 |
ViewerFactory.VIEWER_TYPE.CANVAS_VIEWER, null); |
394 |
_alternateCanvas3d.setSize(size, size);
|
|
465 |
_particleCanvas3d.setSize(size, size);
|
|
395 | 466 |
// _canvas3d.getOSGViewer().setClearColor(1.0, 1.0, 1.0, 0.0); |
396 | 467 |
ViewerFactory.getInstance().startAnimator(); |
397 | 468 |
} |
398 | 469 |
|
399 | 470 |
loadFile(); |
400 | 471 |
|
401 |
aux3.add((Component) _alternateCanvas3d);
|
|
472 |
aux3.add((Component) _particleCanvas3d);
|
|
402 | 473 |
|
403 | 474 |
return aux3; |
404 | 475 |
} |
405 | 476 |
|
477 |
private JPanel getGeometryOsgPanel() { |
|
478 |
|
|
479 |
int size = 140; |
|
480 |
JPanel aux3 = new JPanel(); |
|
481 |
aux3.setPreferredSize(new Dimension(size, size)); |
|
482 |
|
|
483 |
if (_instanceCanvas3d == null) { |
|
484 |
_instanceCanvas3d = ViewerFactory.getInstance().createViewer( |
|
485 |
ViewerFactory.VIEWER_TYPE.CANVAS_VIEWER, null); |
|
486 |
_instanceCanvas3d.setSize(size, size); |
|
487 |
// _canvas3d.getOSGViewer().setClearColor(1.0, 1.0, 1.0, 0.0); |
|
488 |
ViewerFactory.getInstance().startAnimator(); |
|
489 |
} |
|
490 |
|
|
491 |
loadFile(); |
|
492 |
|
|
493 |
aux3.add((Component) _instanceCanvas3d); |
|
494 |
|
|
495 |
return aux3; |
|
496 |
} |
|
497 |
|
|
406 | 498 |
private void loadFile() { |
407 | 499 |
Node node = null; |
408 | 500 |
if (_nodeURL == "") { |
... | ... | |
412 | 504 |
node = osgDB.readNodeFile(_nodeURL); |
413 | 505 |
_canvas3d.getOSGViewer().setSceneData(node); |
414 | 506 |
} catch (LoadNodeException e) { |
415 |
// TODO Auto-generated catch block |
|
416 | 507 |
e.printStackTrace(); |
417 | 508 |
} catch (FileNotFoundException e) { |
418 |
// TODO Auto-generated catch block |
|
419 | 509 |
e.printStackTrace(); |
420 | 510 |
} |
421 | 511 |
} |
... | ... | |
424 | 514 |
} |
425 | 515 |
|
426 | 516 |
public I3DSymbol getNewSymbol() { |
427 |
// TODO Auto-generated method stub |
|
428 | 517 |
_symbol = new NodeMarker3DSymbol(); |
429 | 518 |
((NodeMarker3DSymbol) _symbol).setNodeFileURL(_nodeURL); |
430 | 519 |
((NodeMarker3DSymbol) _symbol).setSize((Double) sizeSpinner.getValue()); |
... | ... | |
433 | 522 |
} |
434 | 523 |
|
435 | 524 |
public void updatePanel(I3DSymbol symbol) { |
436 |
// TODO Auto-generated method stub |
|
437 | 525 |
_nodeURL = ((NodeMarker3DSymbol) symbol).getNodeFileURL(); |
438 | 526 |
textField.setText(_nodeURL); |
439 | 527 |
sizeSpinner.setValue(((NodeMarker3DSymbol) symbol).getSize()); |
... | ... | |
441 | 529 |
} |
442 | 530 |
|
443 | 531 |
public void saveParameters() { |
444 |
// TODO Auto-generated method stub |
|
445 | 532 |
|
446 | 533 |
} |
447 | 534 |
|
... | ... | |
462 | 549 |
|
463 | 550 |
@Override |
464 | 551 |
public String getDescription() { |
465 |
// TODO Auto-generated method stub |
|
466 | 552 |
return "OSG File Types"; |
467 | 553 |
} |
468 | 554 |
} |
469 |
|
|
555 |
|
|
470 | 556 |
public class ImageTypeFileFilter extends FileFilter { |
471 | 557 |
private final String[] okFileExtensions = new String[] { "bmp", "png", |
472 | 558 |
"jpg", "jpeg", "gif" }; |
... | ... | |
484 | 570 |
|
485 | 571 |
@Override |
486 | 572 |
public String getDescription() { |
487 |
// TODO Auto-generated method stub |
|
488 | 573 |
return "Image File Types"; |
489 | 574 |
} |
490 | 575 |
} |
2.0/trunk/org.gvsig.gvsig3d.app/org.gvsig.gvsig3d.app.extension/src/main/java/org/gvsig/gvsig3d/app/gui/styling/SymbolSelector3D.java | ||
---|---|---|
115 | 115 |
setBorder(new TitledBorder(null, "Marker Symbols", |
116 | 116 |
TitledBorder.LEADING, TitledBorder.TOP, null, null)); |
117 | 117 |
GridBagLayout gridBagLayout = new GridBagLayout(); |
118 |
gridBagLayout.columnWidths = new int[] { 0, 0 };
|
|
118 |
gridBagLayout.columnWidths = new int[] { 0 }; |
|
119 | 119 |
gridBagLayout.rowHeights = new int[] { 0, 0, 0, 0 }; |
120 |
gridBagLayout.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
|
|
120 |
gridBagLayout.columnWeights = new double[] { 1.0 }; |
|
121 | 121 |
gridBagLayout.rowWeights = new double[] { 0.2, 0.6, 0.2, |
122 | 122 |
Double.MIN_VALUE }; |
123 | 123 |
setLayout(gridBagLayout); |
2.0/trunk/org.gvsig.gvsig3d.app/org.gvsig.gvsig3d.app.extension/src/main/java/org/gvsig/gvsig3d/app/gui/styling/SimpleSymbolTab.java | ||
---|---|---|
59 | 59 |
.getSymbol(); |
60 | 60 |
|
61 | 61 |
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); |
62 |
tabbedPane.setPreferredSize(new Dimension(180,300)); |
|
62 |
//tabbedPane.setPreferredSize(new Dimension(180,300));
|
|
63 | 63 |
add(tabbedPane, BorderLayout.CENTER); |
64 | 64 |
|
65 | 65 |
JPanel panel = new JPanel(); |
... | ... | |
67 | 67 |
GridBagLayout gbl_panel = new GridBagLayout(); |
68 | 68 |
gbl_panel.columnWidths = new int[] { 175 }; |
69 | 69 |
gbl_panel.rowHeights = new int[] { 180, 70 }; |
70 |
gbl_panel.columnWeights = new double[] { 0.0 };
|
|
71 |
gbl_panel.rowWeights = new double[] { 0.0, 0.0 };
|
|
70 |
gbl_panel.columnWeights = new double[] { 1.0 };
|
|
71 |
gbl_panel.rowWeights = new double[] { 1.0, 1.0 };
|
|
72 | 72 |
//panel.setPreferredSize(new Dimension(120,130)); |
73 | 73 |
panel.setLayout(gbl_panel); |
74 | 74 |
|
... | ... | |
81 | 81 |
gbc_previewPanel.gridy = 0; |
82 | 82 |
panel.add(symbolPreviewPanel, gbc_previewPanel); |
83 | 83 |
symbolPreviewPanel.setLayout(new BorderLayout(0, 0)); |
84 |
//symbolPreviewPanel.setPreferredSize(new Dimension(80,80));
|
|
84 |
symbolPreviewPanel.setPreferredSize(new Dimension(120,130));
|
|
85 | 85 |
|
86 | 86 |
JPanel _simplePanel = new JPanel(); |
87 | 87 |
symbolPreviewPanel.add(_simplePanel, BorderLayout.CENTER); |
2.0/trunk/org.gvsig.gvsig3d.app/org.gvsig.gvsig3d.app.extension/src/main/java/org/gvsig/gvsig3d/app/extension/Gvsig3DExtension.java | ||
---|---|---|
24 | 24 |
import org.gvsig.andami.plugins.Extension; |
25 | 25 |
import org.gvsig.app.gui.styling.SymbolSelector; |
26 | 26 |
import org.gvsig.app.project.documents.view.legend.gui.ISymbolSelector; |
27 |
import org.gvsig.app.project.documents.view.legend.gui.LegendManager; |
|
27 | 28 |
import org.gvsig.app.project.documents.view.legend.gui.ThemeManagerWindow; |
28 | 29 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
29 | 30 |
import org.gvsig.fmap.mapcontext.layers.FLyrDefault; |
... | ... | |
31 | 32 |
import org.gvsig.gui.beans.panelGroup.PanelGroupManager; |
32 | 33 |
import org.gvsig.gvsig3d.Gvsig3DManager; |
33 | 34 |
import org.gvsig.gvsig3d.app.camera.ProjectCamera; |
35 |
import org.gvsig.gvsig3d.app.gui.panels.ExtrusionLegendPanel; |
|
34 | 36 |
import org.gvsig.gvsig3d.app.gui.panels.Raster3DPanel; |
35 | 37 |
import org.gvsig.gvsig3d.app.gui.panels.Vectorial3DPanel; |
36 | 38 |
import org.gvsig.gvsig3d.app.gui.styling.SymbolSelector3D; |
... | ... | |
69 | 71 |
exPoint.append("Layer_Refresh", "", new TocRefreshLayer()); |
70 | 72 |
exPoint.append("Layer_Transparency", " ", new TocTransparencyPanel()); |
71 | 73 |
|
72 |
//Register Symbol Selector3D |
|
73 |
SymbolSelector.registerSymbolSelector("project.document.view3d", SymbolSelector3D.class); |
|
74 |
|
|
74 |
// Register Symbol Selector3D |
|
75 |
SymbolSelector.registerSymbolSelector("project.document.view3d", |
|
76 |
SymbolSelector3D.class); |
|
77 |
|
|
75 | 78 |
// Register other classes persistence with the Caller |
76 | 79 |
Caller caller = new DefaultCaller(); |
77 | 80 |
|
... | ... | |
91 | 94 |
// Register the type of layer enabled |
92 | 95 |
ThemeManagerWindow.setTabEnabledForLayer(Properties3DManager.class, |
93 | 96 |
FLyrVect.class, true); |
94 |
|
|
95 |
PanelGroupManager.getManager().registerPanelGroup(Vectorial3DPanel.class); |
|
97 |
|
|
98 |
PanelGroupManager.getManager().registerPanelGroup( |
|
99 |
Vectorial3DPanel.class); |
|
96 | 100 |
PanelGroupManager.getManager().setDefaultType(Vectorial3DPanel.class); |
97 |
|
|
101 |
|
|
102 |
// Add ExtrusionLegendPanel |
|
103 |
LegendManager.addLegendPage(ExtrusionLegendPanel.class); |
|
104 |
|
|
98 | 105 |
// Add 3D Properties panel to Raster Properties dialog |
99 |
ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager(); |
|
106 |
ExtensionPointManager extensionPoints = ToolsLocator |
|
107 |
.getExtensionPointManager(); |
|
100 | 108 |
ExtensionPoint point = extensionPoints.add("RasterSEPropertiesDialog"); |
101 | 109 |
point.append("3D", "Raster 3D Properties", Raster3DPanel.class); |
102 | 110 |
|
2.0/trunk/org.gvsig.gvsig3d.app/org.gvsig.gvsig3d.app.extension/src/main/java/org/gvsig/gvsig3d/app/extension/DefaultView3DPanel.java | ||
---|---|---|
203 | 203 |
if (modelo.getMapOverViewContext() != null) { |
204 | 204 |
m_MapLoc.setModel(modelo.getMapOverViewContext()); |
205 | 205 |
} |
206 |
|
|
206 |
|
|
207 | 207 |
EditionListener editionListener = new EditionListener(); |
208 |
|
|
208 |
|
|
209 | 209 |
_canvas3d.addKeyListener(editionListener); |
210 |
|
|
210 |
|
|
211 | 211 |
model.addPropertyChangeListener(new PropertyChangeListener() { |
212 | 212 |
|
213 | 213 |
public void propertyChange(PropertyChangeEvent evt) { |
... | ... | |
224 | 224 |
}); |
225 | 225 |
if (m_MapControl.getViewPort() != null) { |
226 | 226 |
m_MapControl.getViewPort().addViewPortListener( |
227 |
|
|
228 |
new ViewPortListener() { |
|
229 |
|
|
230 |
public void extentChanged(ExtentEvent e) { |
|
231 |
// Esto viene de la version anterior, pero en principio no |
|
232 |
// es necesario hacerlo |
|
233 |
// ademas hace que al hacer zoom con la rueda del rat?n se |
|
234 |
// redibuje la capa vectorial |
|
235 |
|
|
236 |
// m_MapControl.getMapContext().callLegendChanged(); |
|
237 |
// |
|
227 | 238 |
|
228 |
new ViewPortListener() { |
|
239 |
|
|
240 |
if (PluginServices.getMainFrame() != null) { |
|
241 |
PluginServices |
|
242 |
.getMainFrame() |
|
243 |
.getStatusBar() |
|
244 |
.setControlValue( |
|
245 |
"scale", |
|
246 |
String.valueOf(m_MapControl |
|
247 |
.getMapContext().getScaleView())); |
|
229 | 248 |
|
230 |
public void extentChanged(ExtentEvent e) { |
|
231 |
m_MapControl.getMapContext().callLegendChanged(); |
|
232 |
/* |
|
233 |
* if (PluginServices.getMainFrame() != null){ |
|
234 |
* PluginServices.getMainFrame().getStatusBar(). |
|
235 |
* setControlValue |
|
236 |
* ("scale",String.valueOf(m_MapControl |
|
237 |
* .getMapContext ().getScaleView())); |
|
238 |
* |
|
239 |
* |
|
240 |
* |
|
241 |
* PluginServices.getMainFrame().getStatusBar(). |
|
242 |
* setMessage ("projection", |
|
243 |
* |
|
244 |
* |
|
245 |
* |
|
246 |
* getMapControl().getViewPort().getProjection(). |
|
247 |
* getAbrev ()); } |
|
248 |
*/ |
|
249 |
} |
|
249 |
PluginServices |
|
250 |
.getMainFrame() |
|
251 |
.getStatusBar() |
|
252 |
.setMessage( |
|
253 |
"projection", |
|
250 | 254 |
|
251 |
public void backColorChanged(ColorEvent e) { |
|
252 |
} |
|
255 |
getMapControl().getViewPort() |
|
256 |
.getProjection().getAbrev()); |
|
257 |
} |
|
253 | 258 |
|
254 |
public void projectionChanged(ProjectionEvent e) { |
|
255 |
m_MapLoc.setProjection(e.getNewProjection()); |
|
256 |
} |
|
257 |
}); |
|
259 |
} |
|
260 |
|
|
261 |
public void backColorChanged(ColorEvent e) { |
|
262 |
} |
|
263 |
|
|
264 |
public void projectionChanged(ProjectionEvent e) { |
|
265 |
m_MapLoc.setProjection(e.getNewProjection()); |
|
266 |
} |
|
267 |
}); |
|
258 | 268 |
} |
259 | 269 |
|
260 | 270 |
} |
Also available in: Unified diff