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