Revision 25260
trunk/libraries/lib3DMap-share/src/main/java/com/iver/ai2/gvsig3d/legend/ExtrusionLegend.java | ||
---|---|---|
18 | 18 |
public class ExtrusionLegend extends VectorialUniqueValueLegend { |
19 | 19 |
|
20 | 20 |
private BaseExtrusionSymbol defaultSimbolExtrusion; |
21 |
private double factorExtrusion;
|
|
21 |
private double extrusionFactor;
|
|
22 | 22 |
|
23 |
|
|
23 | 24 |
public ExtrusionLegend(int shapeType) { |
24 | 25 |
super(shapeType); |
25 | 26 |
} |
... | ... | |
32 | 33 |
|
33 | 34 |
if (theSymbol== null) |
34 | 35 |
return null; |
35 |
factorExtrusion = Double.parseDouble(theSymbol.getDescription());
|
|
36 |
double extrusion = Double.parseDouble(theSymbol.getDescription());
|
|
36 | 37 |
|
37 | 38 |
|
38 | 39 |
|
39 |
defaultSimbolExtrusion = new BaseExtrusionSymbol(factorExtrusion);
|
|
40 |
defaultSimbolExtrusion = new BaseExtrusionSymbol(extrusion);
|
|
40 | 41 |
if (theSymbol.getClass().equals(SimpleFillSymbol.class)) {// Nuevo s?mbolo pol?gono |
41 | 42 |
Color color = ((IFillSymbol)theSymbol).getFillColor(); |
42 | 43 |
defaultSimbolExtrusion.setFillColor(color); |
... | ... | |
55 | 56 |
return defaultSimbolExtrusion; |
56 | 57 |
} |
57 | 58 |
|
59 |
public String getClassName() { |
|
60 |
return getClass().getName(); |
|
61 |
} |
|
62 |
|
|
63 |
public double getExtrusionFactor() { |
|
64 |
return extrusionFactor; |
|
65 |
} |
|
66 |
|
|
67 |
public void setExtrusionFactor(double extrusionFactor) { |
|
68 |
this.extrusionFactor = extrusionFactor; |
|
69 |
} |
|
70 |
|
|
58 | 71 |
|
59 |
// @Override |
|
60 |
// public String[] getDescriptions() { |
|
61 |
// |
|
62 |
// String[] descriptions = new String[this.getSymbols().length]; |
|
63 |
// ISymbol[] auxSym = getSymbols(); |
|
64 |
// |
|
65 |
// |
|
66 |
// for (int i = 0; i < descriptions.length; i++) { |
|
67 |
// descriptions[i] = auxSym[i].getgetDescription(); |
|
68 |
// descriptions[i] = ((Value) auxLegend.getValues()[i]) |
|
69 |
// .producto(ValueFactory.createValue(extrusionValue)); |
|
70 |
// } |
|
71 |
// |
|
72 |
// Object[] extrudedValue = auxLegend.getValues(); |
|
73 |
// |
|
74 |
// for (int i = 0; i < extrudedValue.length; i++) { |
|
75 |
// |
|
76 |
// try { |
|
77 |
// if(jtvariable.isEnabled()) |
|
78 |
// extrudedValue[i] = ((Value)auxLegend.getValues()[i]).producto(ValueFactory.createValue(extrusionValue)); |
|
79 |
// else |
|
80 |
// extrudedValue[i] = ValueFactory.createValue(extrusionFixedValue); |
|
81 |
// }catch (IncompatibleTypesException e) { |
|
82 |
// // TODO Auto-generated catch block |
|
83 |
// |
|
84 |
// e.printStackTrace(); |
|
85 |
// } |
|
86 |
// |
|
87 |
// } |
|
88 |
// |
|
89 |
// |
|
90 |
// String[] descriptions = new String[symbols.size()]; |
|
91 |
// ISymbol[] auxSym = getSymbols(); |
|
92 |
// |
|
93 |
// for (int i = 0; i < descriptions.length; i++) |
|
94 |
// descriptions[i] = auxSym[i].getDescription(); |
|
95 |
// |
|
96 |
// return descriptions; |
|
97 |
// |
|
98 |
// |
|
99 |
// |
|
100 |
// // TODO Auto-generated method stub |
|
101 |
// return super.getDescriptions(); |
|
102 |
// } |
|
103 |
// @Override |
|
104 |
// public ISymbol getDefaultSymbol() { |
|
105 |
// // TODO Auto-generated method stub |
|
106 |
// return new BaseExtrusionSymbol(0.0); |
|
107 |
// } |
|
108 |
// @Override |
|
109 |
// public void setDefaultSymbol(ISymbol s) { |
|
110 |
// // TODO Auto-generated method stub |
|
111 |
// super.setDefaultSymbol(s); |
|
112 |
// } |
|
113 | 72 |
public XMLEntity getXMLEntity() { |
114 |
return super.getXMLEntity(); |
|
73 |
// XMLEntity xml = super.getXMLEntity(); |
|
74 |
XMLEntity xml = new XMLEntity(); |
|
75 |
xml.putProperty("className", this.getClassName()); |
|
76 |
xml.putProperty("fieldNames", getClassifyingFieldNames()[0]); |
|
77 |
xml.putProperty("fieldTypes", getClassifyingFieldTypes()[0]); |
|
78 |
xml.putProperty("extrusionFactor", this.extrusionFactor); |
|
79 |
return xml; |
|
80 |
|
|
115 | 81 |
} |
116 | 82 |
|
117 | 83 |
public void setXMLEntity(XMLEntity xml) { |
118 |
super.setXMLEntity(xml); |
|
84 |
// TODO: It is necessary to insert here all the properties to load with the extrusion legend. |
|
85 |
// super.setXMLEntity(xml); |
|
86 |
clear(); |
|
87 |
if (xml.contains("fieldName")) |
|
88 |
setClassifyingFieldNames(new String[] {xml.getStringProperty("fieldName")}); |
|
89 |
else |
|
90 |
setClassifyingFieldNames(xml.getStringArrayProperty("fieldNames")); |
|
91 |
|
|
92 |
if (xml.contains("fieldTypes")) |
|
93 |
setClassifyingFieldTypes(new int[] {xml.getIntProperty("fieldTypes")}); |
|
94 |
if (xml.contains("extrusionFactor")) |
|
95 |
extrusionFactor = xml.getDoubleProperty("extrusionFactor"); |
|
96 |
|
|
119 | 97 |
} |
120 | 98 |
|
121 | 99 |
} |
trunk/libraries/lib3DMap-share/src/main/java/com/iver/ai2/gvsig3d/legend/ExtrusionLegendPanel.java | ||
---|---|---|
70 | 70 |
|
71 | 71 |
//private static Logger logger = Logger.getLogger(VectorialUniqueValue.class.getName()); |
72 | 72 |
|
73 |
private VectorialUniqueValueLegend theLegend;
|
|
73 |
private ExtrusionLegend theLegend;
|
|
74 | 74 |
private ClassifiableVectorial layer; |
75 | 75 |
private SymbolTableExtrusion symbolTable; |
76 | 76 |
private JComboBox cmbFields; |
77 | 77 |
private JButton btnRemoveAll; |
78 | 78 |
private JButton btnRemove; |
79 | 79 |
private JCheckBox chbUseDefault = null; |
80 |
private VectorialUniqueValueLegend auxLegend;
|
|
80 |
private ExtrusionLegend auxLegend;
|
|
81 | 81 |
private JPanel pnlCenter; |
82 | 82 |
private ZSort zSort; |
83 | 83 |
private JButton btnOpenSymbolLevelsEditor; |
... | ... | |
88 | 88 |
private JCheckBox fixedOption; |
89 | 89 |
private double extrusionFixedValue = 1; |
90 | 90 |
|
91 |
private Value aux;
|
|
91 |
private Value aux; |
|
92 | 92 |
|
93 |
|
|
93 | 94 |
/** |
94 | 95 |
* |
95 | 96 |
*/ |
96 | 97 |
public ExtrusionLegendPanel() { |
97 | 98 |
super(); |
99 |
if (theLegend!=null) |
|
100 |
this.extrusionValue = ((ExtrusionLegend)this.theLegend).getExtrusionFactor(); |
|
98 | 101 |
initialize(); |
99 | 102 |
} |
100 | 103 |
|
... | ... | |
154 | 157 |
|
155 | 158 |
pAux1 = new JPanel(); |
156 | 159 |
pAux1.add(new JLabel(PluginServices.getText(this, "Nivel_de_extrusion")+":")); |
157 |
jtvariable = new JTextField(PluginServices.getText(this, "1"),3);
|
|
160 |
jtvariable = new JTextField(PluginServices.getText(this, ""+this.extrusionValue),3);
|
|
158 | 161 |
jtvariable.setColumns(3); |
159 | 162 |
jtvariable.setHorizontalAlignment(JTextField.RIGHT); |
160 | 163 |
jtvariable.setToolTipText(PluginServices.getText(this, "Valor_inicial") + " * " + PluginServices.getText(this, "Nivel_de_extrusion")); |
... | ... | |
232 | 235 |
//auxLegend=(VectorialUniqueValueLegend)m_lyr.getLegend(); |
233 | 236 |
// auxLegend = LegendFactory.createVectorialUniqueValueLegend(layer.getShapeType()); |
234 | 237 |
auxLegend = new ExtrusionLegend(layer.getShapeType()); |
238 |
auxLegend.setExtrusionFactor(this.extrusionValue); |
|
235 | 239 |
|
236 |
|
|
237 | 240 |
//Object resul; |
238 | 241 |
if (chbUseDefault.isSelected()) { |
239 | 242 |
auxLegend.getDefaultSymbol().setDescription("Default"); |
... | ... | |
427 | 430 |
symbolTable.removeAllItems(); |
428 | 431 |
|
429 | 432 |
if (legend instanceof VectorialUniqueValueLegend) { |
430 |
theLegend = (VectorialUniqueValueLegend) legend;
|
|
433 |
theLegend = (ExtrusionLegend) legend;
|
|
431 | 434 |
getChbUseDefault().setSelected(theLegend.isUseDefaultSymbol()); |
432 | 435 |
cmbFields.getModel().setSelectedItem(theLegend.getClassifyingFieldNames()[0]); |
433 | 436 |
symbolTable.fillTableFromSymbolList(theLegend.getSymbols(), |
... | ... | |
435 | 438 |
theLegend.getDescriptions()); |
436 | 439 |
zSort = theLegend.getZSort(); |
437 | 440 |
} else { |
438 |
theLegend = new VectorialUniqueValueLegend(shapeType);
|
|
441 |
theLegend = new ExtrusionLegend(shapeType);
|
|
439 | 442 |
} |
440 | 443 |
} |
441 | 444 |
|
trunk/libraries/lib3DMap-share/src/main/java/com/iver/ai2/gvsig3d/legend/symbols/BaseExtrusionSymbol.java | ||
---|---|---|
1 | 1 |
package com.iver.ai2.gvsig3d.legend.symbols; |
2 | 2 |
|
3 | 3 |
import com.iver.cit.gvsig.fmap.core.symbols.SimpleFillSymbol; |
4 |
import com.iver.utiles.XMLEntity; |
|
4 | 5 |
|
5 | 6 |
public class BaseExtrusionSymbol extends SimpleFillSymbol implements |
6 | 7 |
IExtrusionSymbol { |
... | ... | |
19 | 20 |
super(); |
20 | 21 |
this.extrusion = extrusion; |
21 | 22 |
} |
23 |
|
|
22 | 24 |
|
25 |
public String getClassName() { |
|
26 |
return getClass().getName(); |
|
27 |
} |
|
28 |
|
|
29 |
public XMLEntity getXMLEntity() { |
|
30 |
XMLEntity xml = super.getXMLEntity(); |
|
31 |
xml.putProperty("extrusion", this.extrusion); |
|
32 |
return xml; |
|
33 |
} |
|
34 |
|
|
35 |
public void setXMLEntity(XMLEntity xml) { |
|
36 |
super.setXMLEntity(xml); |
|
37 |
if (xml.contains("extrusion")) |
|
38 |
extrusion = xml.getDoubleProperty("extrusion"); |
|
39 |
} |
|
40 |
|
|
41 |
|
|
23 | 42 |
} |
Also available in: Unified diff