svn-gvsig-desktop / trunk / libraries / lib3DMap-share / src / main / java / com / iver / ai2 / gvsig3d / legend / ExtrusionLegendPanel.java @ 25260
History | View | Annotate | Download (22 KB)
1 |
package com.iver.ai2.gvsig3d.legend; |
---|---|
2 |
|
3 |
import java.awt.BorderLayout; |
4 |
import java.awt.Component; |
5 |
import java.awt.FlowLayout; |
6 |
import java.awt.event.ActionEvent; |
7 |
import java.awt.event.ActionListener; |
8 |
import java.awt.event.ItemEvent; |
9 |
import java.awt.event.ItemListener; |
10 |
import java.awt.event.KeyEvent; |
11 |
import java.awt.event.KeyListener; |
12 |
import java.sql.Types; |
13 |
import java.util.ArrayList; |
14 |
import java.util.Random; |
15 |
|
16 |
import javax.swing.DefaultComboBoxModel; |
17 |
import javax.swing.ImageIcon; |
18 |
import javax.swing.JCheckBox; |
19 |
import javax.swing.JComboBox; |
20 |
import javax.swing.JLabel; |
21 |
import javax.swing.JOptionPane; |
22 |
import javax.swing.JPanel; |
23 |
import javax.swing.JTextField; |
24 |
|
25 |
import org.gvsig.gui.beans.swing.JButton; |
26 |
import org.gvsig.raster.datastruct.ColorItem; |
27 |
|
28 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
29 |
import com.hardcode.gdbms.engine.data.DataSource; |
30 |
import com.hardcode.gdbms.engine.instruction.IncompatibleTypesException; |
31 |
import com.hardcode.gdbms.engine.values.DoubleValue; |
32 |
import com.hardcode.gdbms.engine.values.NullValue; |
33 |
import com.hardcode.gdbms.engine.values.Value; |
34 |
import com.hardcode.gdbms.engine.values.ValueFactory; |
35 |
import com.iver.ai2.gvsig3d.legend.symbols.BaseExtrusionSymbol; |
36 |
import com.iver.ai2.gvsig3d.map3d.layers.Layer3DProps; |
37 |
import com.iver.andami.PluginServices; |
38 |
import com.iver.andami.messages.NotificationManager; |
39 |
import com.iver.cit.gvsig.fmap.core.SymbologyFactory; |
40 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
41 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
42 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
43 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData; |
44 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.ClassifiableVectorial; |
45 |
import com.iver.cit.gvsig.fmap.rendering.AbstractClassifiedVectorLegend; |
46 |
import com.iver.cit.gvsig.fmap.rendering.ILegend; |
47 |
import com.iver.cit.gvsig.fmap.rendering.LegendContentsChangedListener; |
48 |
import com.iver.cit.gvsig.fmap.rendering.LegendFactory; |
49 |
import com.iver.cit.gvsig.fmap.rendering.NullUniqueValue; |
50 |
import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend; |
51 |
import com.iver.cit.gvsig.fmap.rendering.ZSort; |
52 |
import com.iver.cit.gvsig.gui.styling.JComboBoxColorScheme; |
53 |
import com.iver.cit.gvsig.gui.styling.SymbolLevelsWindow; |
54 |
import com.iver.cit.gvsig.project.documents.view.legend.gui.ILegendPanel; |
55 |
import com.iver.cit.gvsig.project.documents.view.legend.gui.SymbolTable; |
56 |
|
57 |
|
58 |
/**
|
59 |
* DOCUMENT ME!
|
60 |
*
|
61 |
* @author fjp To change the template for this generated type comment go to
|
62 |
* Window>Preferences>Java>Code Generation>Code and
|
63 |
* Comments
|
64 |
*/
|
65 |
public class ExtrusionLegendPanel extends JPanel implements ILegendPanel,ActionListener,KeyListener,ItemListener { |
66 |
/**
|
67 |
*
|
68 |
*/
|
69 |
private static final long serialVersionUID = 6470946030927461473L; |
70 |
|
71 |
//private static Logger logger = Logger.getLogger(VectorialUniqueValue.class.getName());
|
72 |
|
73 |
private ExtrusionLegend theLegend;
|
74 |
private ClassifiableVectorial layer;
|
75 |
private SymbolTableExtrusion symbolTable;
|
76 |
private JComboBox cmbFields; |
77 |
private JButton btnRemoveAll; |
78 |
private JButton btnRemove; |
79 |
private JCheckBox chbUseDefault = null; |
80 |
private ExtrusionLegend auxLegend;
|
81 |
private JPanel pnlCenter; |
82 |
private ZSort zSort;
|
83 |
private JButton btnOpenSymbolLevelsEditor; |
84 |
private JTextField jtvariable; |
85 |
private JComboBoxColorScheme cmbColorScheme;
|
86 |
private double extrusionValue = 1; |
87 |
private JTextField jtfija; |
88 |
private JCheckBox fixedOption; |
89 |
private double extrusionFixedValue = 1; |
90 |
|
91 |
private Value aux;
|
92 |
|
93 |
|
94 |
/**
|
95 |
*
|
96 |
*/
|
97 |
public ExtrusionLegendPanel() {
|
98 |
super();
|
99 |
if (theLegend!=null) |
100 |
this.extrusionValue = ((ExtrusionLegend)this.theLegend).getExtrusionFactor(); |
101 |
initialize(); |
102 |
} |
103 |
|
104 |
/**
|
105 |
* DOCUMENT ME!
|
106 |
*/
|
107 |
protected void initialize() { |
108 |
/* JLabel label = new JLabel();
|
109 |
label.setIcon(new javax.swing.ImageIcon(Abrir.class.getClassLoader().getResource("images/ValoresUnicos.png")));
|
110 |
limagen[1] = new JLabel();
|
111 |
limagen[1] = label; */
|
112 |
JPanel pnlButtons = new JPanel(); |
113 |
|
114 |
JButton btnAddAll = new JButton(PluginServices.getText(this, |
115 |
"Anadir_todos"));
|
116 |
btnAddAll.setActionCommand("ADD_ALL_VALUES");
|
117 |
btnAddAll.addActionListener(this);
|
118 |
pnlButtons.add(btnAddAll); |
119 |
|
120 |
JButton btnAdd = new JButton(PluginServices.getText(this, "Anadir")); |
121 |
btnAdd.setActionCommand("ADD_VALUE");
|
122 |
btnAdd.addActionListener(this);
|
123 |
pnlButtons.add(btnAdd); |
124 |
|
125 |
btnRemoveAll = new JButton(PluginServices.getText(this, "Quitar_todos")); |
126 |
btnRemoveAll.setActionCommand("REMOVE_ALL");
|
127 |
btnRemoveAll.addActionListener(this);
|
128 |
pnlButtons.add(btnRemoveAll); |
129 |
|
130 |
btnRemove = new JButton(PluginServices.getText(this, "Quitar")); |
131 |
btnRemove.setActionCommand("REMOVE");
|
132 |
btnRemove.addActionListener(this);
|
133 |
pnlButtons.add(btnRemove); |
134 |
|
135 |
// btnOpenSymbolLevelsEditor = new JButton(PluginServices.getText(this, "symbol_levels"));
|
136 |
// btnOpenSymbolLevelsEditor.addActionListener(this);
|
137 |
// btnOpenSymbolLevelsEditor.setActionCommand("OPEN_SYMBOL_LEVEL_EDITOR");
|
138 |
// pnlButtons.add(btnOpenSymbolLevelsEditor);
|
139 |
|
140 |
pnlCenter = new JPanel(); |
141 |
pnlCenter.setLayout(new BorderLayout()); |
142 |
|
143 |
cmbFields = new JComboBox(); |
144 |
cmbFields.setActionCommand("FIELD_SELECTED");
|
145 |
cmbFields.addActionListener(this);
|
146 |
cmbFields.setVisible(true);
|
147 |
|
148 |
JPanel pnlNorth = new JPanel(new FlowLayout(FlowLayout.LEFT, 20, 0)); |
149 |
JPanel pAux1 = new JPanel(); |
150 |
|
151 |
JLabel lblFieldClassification = new JLabel(PluginServices.getText( |
152 |
this, "Campo_de_clasificacion")); |
153 |
pAux1.add(lblFieldClassification); |
154 |
pAux1.add(cmbFields); |
155 |
pAux1.add(getChbUseDefault(), null);
|
156 |
pnlNorth.add(pAux1); |
157 |
|
158 |
pAux1 = new JPanel(); |
159 |
pAux1.add(new JLabel(PluginServices.getText(this, "Nivel_de_extrusion")+":")); |
160 |
jtvariable = new JTextField(PluginServices.getText(this, ""+this.extrusionValue),3); |
161 |
jtvariable.setColumns(3);
|
162 |
jtvariable.setHorizontalAlignment(JTextField.RIGHT);
|
163 |
jtvariable.setToolTipText(PluginServices.getText(this, "Valor_inicial") + " * " + PluginServices.getText(this, "Nivel_de_extrusion")); |
164 |
jtvariable.addKeyListener(this);
|
165 |
pAux1.add(jtvariable); |
166 |
|
167 |
pnlNorth.add(pAux1); |
168 |
|
169 |
pAux1 = new JPanel(); |
170 |
fixedOption = new JCheckBox(PluginServices.getText(this, "Altura_fija")+":",false); |
171 |
fixedOption.setHorizontalAlignment(JTextField.RIGHT);
|
172 |
fixedOption.setEnabled(true);
|
173 |
fixedOption.setSelected(false);
|
174 |
pAux1.add(fixedOption); |
175 |
|
176 |
jtfija = new JTextField(PluginServices.getText(this, "1"),3); |
177 |
jtfija.setColumns(10);
|
178 |
jtfija.setHorizontalAlignment(JTextField.RIGHT);
|
179 |
jtfija.addKeyListener(this);
|
180 |
jtfija.setToolTipText(PluginServices.getText(this, "Valor_inicial")+ " = "+ PluginServices.getText(this, "Altura_fija")); |
181 |
jtfija.setEnabled(false);
|
182 |
pAux1.add(jtfija); |
183 |
|
184 |
pnlNorth.add(pAux1); |
185 |
|
186 |
pAux1 = new JPanel(); |
187 |
pAux1.add(new JLabel(PluginServices.getText(this, "color_scheme")+":")); |
188 |
cmbColorScheme = new JComboBoxColorScheme(false); |
189 |
|
190 |
// pAux1.add(cmbColorScheme);
|
191 |
// pnlNorth.add(pAux1);
|
192 |
|
193 |
fixedOption.addItemListener(this);
|
194 |
this.setLayout(new BorderLayout()); |
195 |
this.add(pnlNorth, BorderLayout.NORTH); |
196 |
this.add(pnlCenter, BorderLayout.CENTER); |
197 |
this.add(pnlButtons, BorderLayout.SOUTH); |
198 |
|
199 |
} |
200 |
|
201 |
/**
|
202 |
* DOCUMENT ME!
|
203 |
*/
|
204 |
private void fillTableValues() { |
205 |
DataSource elRs;
|
206 |
|
207 |
try {
|
208 |
elRs = ((FLyrVect) layer).getRecordset(); |
209 |
// logger.debug("elRs.start()");
|
210 |
elRs.start(); |
211 |
|
212 |
int idField = -1; |
213 |
String fieldName = (String) cmbFields.getSelectedItem(); |
214 |
if (fieldName==null) { |
215 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),PluginServices.getText(this,"no_hay_campo_seleccionado")); |
216 |
return;
|
217 |
} |
218 |
|
219 |
idField = elRs.getFieldIndexByName(fieldName); |
220 |
theLegend.setClassifyingFieldNames(new String[] {fieldName}); |
221 |
|
222 |
//long numReg = elRs.getRowCount();
|
223 |
if (idField == -1) { |
224 |
NotificationManager.addWarning( |
225 |
PluginServices.getText(this, "unrecognized_field_name")+" " + fieldName, null); |
226 |
|
227 |
return;
|
228 |
} |
229 |
|
230 |
symbolTable.removeAllItems(); |
231 |
|
232 |
int numSymbols = 0; |
233 |
ISymbol theSymbol = null;
|
234 |
|
235 |
//auxLegend=(VectorialUniqueValueLegend)m_lyr.getLegend();
|
236 |
// auxLegend = LegendFactory.createVectorialUniqueValueLegend(layer.getShapeType());
|
237 |
auxLegend = new ExtrusionLegend(layer.getShapeType());
|
238 |
auxLegend.setExtrusionFactor(this.extrusionValue);
|
239 |
|
240 |
//Object resul;
|
241 |
if (chbUseDefault.isSelected()) {
|
242 |
auxLegend.getDefaultSymbol().setDescription("Default");
|
243 |
auxLegend.addSymbol(new NullUniqueValue(),
|
244 |
auxLegend.getDefaultSymbol()); |
245 |
} |
246 |
|
247 |
ColorItem[] colorScheme = cmbColorScheme.getSelectedColors();
|
248 |
Random rand = new Random(System.currentTimeMillis()); |
249 |
|
250 |
for (int j = 0; j < elRs.getRowCount(); j++) { |
251 |
Value clave = elRs.getFieldValue(j, idField); |
252 |
|
253 |
if (clave instanceof NullValue) { |
254 |
continue;
|
255 |
} |
256 |
|
257 |
//Comprobar que no esta repetido y no hace falta introducir en el hashtable el campo junto con el simbolo.
|
258 |
if (auxLegend.getSymbolByValue(clave) == null) { |
259 |
//si no esta creado el simbolo se crea
|
260 |
// jaume (moved to ISymbol); theSymbol = new FSymbol(layer.getShapeType());
|
261 |
theSymbol = SymbologyFactory. |
262 |
createDefaultSymbolByShapeType(layer.getShapeType(), |
263 |
colorScheme[rand.nextInt(colorScheme.length)].getColor()); |
264 |
aux = clave.producto(ValueFactory.createValue(extrusionValue)); |
265 |
theSymbol.setDescription(aux.toString()); |
266 |
auxLegend.addSymbol(clave, theSymbol); |
267 |
|
268 |
numSymbols++; |
269 |
|
270 |
if (numSymbols == 100) { |
271 |
int resp = JOptionPane.showConfirmDialog(this, |
272 |
PluginServices.getText(this,
|
273 |
"mas_de_100_simbolos"),
|
274 |
PluginServices.getText(this, "quiere_continuar"), |
275 |
JOptionPane.YES_NO_OPTION,
|
276 |
JOptionPane.WARNING_MESSAGE);
|
277 |
|
278 |
if ((resp == JOptionPane.NO_OPTION) || |
279 |
(resp == JOptionPane.DEFAULT_OPTION)) {
|
280 |
return;
|
281 |
} |
282 |
} |
283 |
} |
284 |
} // for
|
285 |
|
286 |
|
287 |
Object[] extrudedValue = auxLegend.getValues(); |
288 |
double defaultValue = 1; |
289 |
|
290 |
for (int i = 0; i < extrudedValue.length; i++) { |
291 |
if(jtvariable.isEnabled()){
|
292 |
try {
|
293 |
extrudedValue[i] = ((Value)auxLegend.getValues()[i]).producto(ValueFactory.createValue(extrusionValue)); |
294 |
theSymbol.setDescription(extrudedValue[i].toString()); |
295 |
|
296 |
}catch (IncompatibleTypesException e) {
|
297 |
extrudedValue[i] = ValueFactory.createValue(defaultValue); |
298 |
} |
299 |
}else
|
300 |
extrudedValue[i] = ValueFactory.createValue(extrusionFixedValue); |
301 |
|
302 |
|
303 |
} |
304 |
// symbolTable.fillTableFromSymbolList(auxLegend.getSymbols(),
|
305 |
// auxLegend.getValues(), auxLegend.getDescriptions());
|
306 |
|
307 |
symbolTable.fillTableFromSymbolList(auxLegend.getSymbols(), |
308 |
auxLegend.getValues(), extrudedValue); |
309 |
elRs.stop(); |
310 |
} catch (ReadDriverException e) {
|
311 |
NotificationManager.addError(PluginServices.getText(this, "recovering_recordset"), e); |
312 |
} catch (IncompatibleTypesException e) {
|
313 |
// TODO Auto-generated catch block
|
314 |
e.printStackTrace(); |
315 |
} |
316 |
|
317 |
btnRemoveAll.setEnabled(true);
|
318 |
btnRemove.setEnabled(true);
|
319 |
|
320 |
//m_bCacheDirty = false;
|
321 |
} |
322 |
|
323 |
/**
|
324 |
* A partir de los registros de la tabla, regenera el FRenderer. (No solo
|
325 |
* el symbolList, si no tambi�n el arrayKeys y el defaultRenderer
|
326 |
*/
|
327 |
private void fillSymbolListFromTable() { |
328 |
Value clave; |
329 |
ISymbol theSymbol; |
330 |
|
331 |
// Borramos las anteriores listas:
|
332 |
|
333 |
boolean bRestoValores = false; // PONERLO EN UN CHECKBOX |
334 |
int hasta;
|
335 |
String fieldName = (String) cmbFields.getSelectedItem(); |
336 |
theLegend.setClassifyingFieldNames(new String[] {fieldName} ); |
337 |
/////////////////////////////////////////PEPE
|
338 |
FLyrVect m = (FLyrVect) layer; |
339 |
try {
|
340 |
int fieldType = m.getSource().getRecordset().getFieldType((int)cmbFields.getSelectedIndex()); |
341 |
theLegend.setClassifyingFieldTypes(new int[] {fieldType}); |
342 |
} catch (ReadDriverException e) {
|
343 |
NotificationManager.addError(PluginServices.getText(this, "could_not_setup_legend"), e); |
344 |
} |
345 |
/////////////////////////////////////////PEPE
|
346 |
if (bRestoValores) {
|
347 |
hasta = symbolTable.getRowCount() - 1;
|
348 |
} else {
|
349 |
hasta = symbolTable.getRowCount(); |
350 |
} |
351 |
|
352 |
for (int row = 0; row < symbolTable.getRowCount(); row++) { |
353 |
clave = (Value) symbolTable.getFieldValue(row, 0);
|
354 |
DoubleValue extrusion = null;
|
355 |
try{
|
356 |
extrusion = (DoubleValue) symbolTable.getFieldValue(row, 1);
|
357 |
theSymbol = new BaseExtrusionSymbol(extrusion.getValue());
|
358 |
theSymbol.setDescription(extrusion.toString()); |
359 |
} |
360 |
catch (Exception e) { |
361 |
theSymbol = new BaseExtrusionSymbol(1); |
362 |
theSymbol.setDescription("1");
|
363 |
} |
364 |
|
365 |
theLegend.addSymbol(clave,theSymbol); |
366 |
} |
367 |
|
368 |
if (bRestoValores) {
|
369 |
theSymbol = (ISymbol) symbolTable.getFieldValue(hasta, 0);
|
370 |
theLegend.setDefaultSymbol(theSymbol); |
371 |
} |
372 |
} |
373 |
|
374 |
/**
|
375 |
* DOCUMENT ME!
|
376 |
*/
|
377 |
protected void fillFieldNames() { |
378 |
DataSource rs = null; |
379 |
ArrayList nomFields = null; |
380 |
|
381 |
try {
|
382 |
rs = ((AlphanumericData) layer).getRecordset(); |
383 |
rs.start(); |
384 |
|
385 |
nomFields = new ArrayList(); |
386 |
|
387 |
int type;
|
388 |
for (int i = 0; i < rs.getFieldCount(); i++) { |
389 |
type = rs.getFieldType(i); |
390 |
|
391 |
if (type == Types.NULL) { |
392 |
continue;
|
393 |
} |
394 |
|
395 |
if ((type == Types.INTEGER) || |
396 |
(type == Types.DOUBLE) ||
|
397 |
(type == Types.FLOAT) ||
|
398 |
(type == Types.BIGINT)) {
|
399 |
nomFields.add(rs.getFieldName(i).trim()); |
400 |
} |
401 |
} |
402 |
|
403 |
rs.stop(); |
404 |
} catch (ReadDriverException e) {
|
405 |
NotificationManager.addError(PluginServices.getText(this, "recovering_recordset"), e); |
406 |
} |
407 |
|
408 |
DefaultComboBoxModel cM = new DefaultComboBoxModel(nomFields.toArray()); |
409 |
cmbFields.setModel(cM); |
410 |
|
411 |
symbolTable.removeAllItems(); |
412 |
} |
413 |
|
414 |
public void setData(FLayer layer, ILegend legend) { |
415 |
this.layer = (ClassifiableVectorial) layer;
|
416 |
int shapeType = 0; |
417 |
try {
|
418 |
shapeType = this.layer.getShapeType();
|
419 |
} catch (ReadDriverException e) {
|
420 |
NotificationManager.addError(PluginServices.getText(this, "generating_intervals"), e); |
421 |
} |
422 |
|
423 |
if (symbolTable != null) |
424 |
pnlCenter.remove(symbolTable); |
425 |
symbolTable = new SymbolTableExtrusion(this, SymbolTable.VALUES_TYPE, shapeType); |
426 |
pnlCenter.add(symbolTable, BorderLayout.CENTER);
|
427 |
|
428 |
fillFieldNames(); |
429 |
|
430 |
symbolTable.removeAllItems(); |
431 |
|
432 |
if (legend instanceof VectorialUniqueValueLegend) { |
433 |
theLegend = (ExtrusionLegend) legend; |
434 |
getChbUseDefault().setSelected(theLegend.isUseDefaultSymbol()); |
435 |
cmbFields.getModel().setSelectedItem(theLegend.getClassifyingFieldNames()[0]);
|
436 |
symbolTable.fillTableFromSymbolList(theLegend.getSymbols(), |
437 |
theLegend.getValues(), |
438 |
theLegend.getDescriptions()); |
439 |
zSort = theLegend.getZSort(); |
440 |
} else {
|
441 |
theLegend = new ExtrusionLegend(shapeType);
|
442 |
} |
443 |
} |
444 |
|
445 |
/* (non-Javadoc)
|
446 |
* @see com.iver.cit.gvsig.gui.legendmanager.panels.ILegendPanel#getLegend()
|
447 |
*/
|
448 |
public ILegend getLegend() {
|
449 |
fillSymbolListFromTable(); |
450 |
|
451 |
if (auxLegend != null) { |
452 |
// your settings that are not the set of symbols must be located here
|
453 |
auxLegend.setClassifyingFieldNames( |
454 |
new String[] {(String) cmbFields.getSelectedItem()}); |
455 |
auxLegend.setClassifyingFieldTypes(theLegend.getClassifyingFieldTypes()); |
456 |
|
457 |
LegendContentsChangedListener[] l = theLegend.getListeners();
|
458 |
for (int i = 0; i < l.length; i++) { |
459 |
auxLegend.addLegendListener(l[i]); |
460 |
}; |
461 |
|
462 |
theLegend = auxLegend; |
463 |
} |
464 |
theLegend.setZSort(zSort); |
465 |
|
466 |
return theLegend;
|
467 |
} |
468 |
|
469 |
private JCheckBox getChbUseDefault() { |
470 |
if (chbUseDefault == null) { |
471 |
chbUseDefault = new JCheckBox(); |
472 |
chbUseDefault.setSelected(true);
|
473 |
chbUseDefault.addActionListener(new java.awt.event.ActionListener() {
|
474 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
475 |
if (auxLegend==null)auxLegend=theLegend; |
476 |
if (chbUseDefault.isSelected()) {
|
477 |
addDefault(); |
478 |
} else {
|
479 |
delDefault(); |
480 |
} |
481 |
} |
482 |
}); |
483 |
chbUseDefault.setText(PluginServices.getText(this, "resto_valores")); |
484 |
} |
485 |
|
486 |
return chbUseDefault;
|
487 |
} |
488 |
|
489 |
/**
|
490 |
* A�ade el resto de valores.
|
491 |
*/
|
492 |
private void addDefault() { |
493 |
auxLegend.getDefaultSymbol().setDescription("Default");
|
494 |
auxLegend.addSymbol(new NullUniqueValue(), auxLegend.getDefaultSymbol());
|
495 |
symbolTable.addTableRecord(auxLegend.getDefaultSymbol(), |
496 |
new NullUniqueValue(), auxLegend.getDefaultSymbol().getDescription());
|
497 |
symbolTable.repaint(); |
498 |
} |
499 |
|
500 |
/**
|
501 |
* Elimina el resto de valores que no estan representados por ning�n otro s�mbolo..
|
502 |
*/
|
503 |
private void delDefault() { |
504 |
auxLegend.delSymbol(new NullUniqueValue());
|
505 |
symbolTable.removeRow(new NullUniqueValue());
|
506 |
symbolTable.repaint(); |
507 |
} |
508 |
|
509 |
|
510 |
public void actionPerformed(ActionEvent e) { |
511 |
|
512 |
//modificar el combobox de valor
|
513 |
if (e.getActionCommand() == "FIELD_SELECTED") { |
514 |
JComboBox cb = (JComboBox) e.getSource(); |
515 |
String fieldName = (String) cb.getSelectedItem(); |
516 |
symbolTable.removeAllItems(); |
517 |
|
518 |
} |
519 |
|
520 |
// add all elements by value
|
521 |
if (e.getActionCommand() == "ADD_ALL_VALUES") { |
522 |
fillTableValues(); |
523 |
} |
524 |
|
525 |
// add only one value
|
526 |
if (e.getActionCommand() == "ADD_VALUE") { |
527 |
try {
|
528 |
symbolTable.addTableRecord(SymbologyFactory. |
529 |
createDefaultSymbolByShapeType(layer.getShapeType()), |
530 |
ValueFactory.createValue(0.0), "0 - 0"); |
531 |
} catch (ReadDriverException ex) {
|
532 |
NotificationManager.addError(PluginServices.getText(this, "getting_shape_type"), ex); |
533 |
} |
534 |
} |
535 |
|
536 |
//Vacia la tabla
|
537 |
if (e.getActionCommand() == "REMOVE_ALL") { |
538 |
symbolTable.removeAllItems(); |
539 |
theLegend.setZSort(null);
|
540 |
zSort = null;
|
541 |
} |
542 |
|
543 |
//Quitar solo el elemento seleccionado
|
544 |
if (e.getActionCommand() == "REMOVE") { |
545 |
symbolTable.removeSelectedRows(); |
546 |
} |
547 |
|
548 |
if (e.getActionCommand() == "OPEN_SYMBOL_LEVEL_EDITOR") { |
549 |
|
550 |
if (theLegend != null) { |
551 |
ZSort myZSort = ((AbstractClassifiedVectorLegend) getLegend()).getZSort(); |
552 |
if (myZSort == null) { |
553 |
myZSort = new ZSort(theLegend);
|
554 |
} |
555 |
SymbolLevelsWindow sl = new SymbolLevelsWindow(myZSort);
|
556 |
PluginServices.getMDIManager().addWindow(sl); |
557 |
zSort = sl.getZSort(); |
558 |
if (auxLegend != null) |
559 |
auxLegend.setZSort(zSort); |
560 |
} |
561 |
|
562 |
} |
563 |
} |
564 |
|
565 |
public String getDescription() { |
566 |
return PluginServices.getText(this,PluginServices.getText(this,"info_extrusion")); |
567 |
} |
568 |
|
569 |
public ImageIcon getIcon() { |
570 |
return null; |
571 |
} |
572 |
|
573 |
public Class getParentClass() { |
574 |
return null; |
575 |
} |
576 |
|
577 |
public String getTitle() { |
578 |
return ("<html><b>"+ PluginServices.getText(this,"Extrusion")+ "</b></html>"); |
579 |
} |
580 |
|
581 |
public JPanel getPanel() { |
582 |
return this; |
583 |
} |
584 |
|
585 |
public Class getLegendClass() { |
586 |
return ExtrusionLegend.class;
|
587 |
} |
588 |
|
589 |
|
590 |
public boolean isSuitableFor(FLayer layer) { |
591 |
|
592 |
Layer3DProps props3D = Layer3DProps.getLayer3DProps(layer); |
593 |
return ((props3D != null) && (props3D.getType() == Layer3DProps.layer3DVector)); |
594 |
} |
595 |
|
596 |
public void keyPressed(KeyEvent e) { |
597 |
// TODO Auto-generated method stub
|
598 |
|
599 |
} |
600 |
|
601 |
public void keyReleased(KeyEvent e) { |
602 |
|
603 |
try {
|
604 |
extrusionValue = new Double(this.jtvariable.getText()).doubleValue(); |
605 |
extrusionFixedValue = new Double(this.jtfija.getText()).doubleValue(); |
606 |
} |
607 |
catch (Exception e2) { |
608 |
// String s = " ";
|
609 |
// if(!this.jtvariable.getText().equals(s)) {
|
610 |
// JOptionPane.showMessageDialog(null, PluginServices.getText(this, "Introduce un dato numerico"),
|
611 |
// PluginServices.getText(this, "Dato incorrecto"), JOptionPane.WARNING_MESSAGE);
|
612 |
//
|
613 |
// jtvariable.setText(Double.toString(extrusionValue));
|
614 |
// jtfija.setText(Double.toString(extrusionFixedValue));
|
615 |
// }
|
616 |
} |
617 |
} |
618 |
|
619 |
public void keyTyped(KeyEvent e) { |
620 |
// TODO Auto-generated method stub
|
621 |
|
622 |
} |
623 |
|
624 |
public void itemStateChanged(ItemEvent e) { |
625 |
jtfija.setEnabled(fixedOption.isSelected()); |
626 |
jtvariable.setEnabled(!fixedOption.isSelected()); |
627 |
|
628 |
} |
629 |
|
630 |
} |