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