svn-gvsig-desktop / trunk / libraries / lib3DMap-share / src / main / java / com / iver / ai2 / gvsig3d / legend / ExtrusionLegend.java @ 25304
History | View | Annotate | Download (2.74 KB)
1 |
package com.iver.ai2.gvsig3d.legend; |
---|---|
2 |
|
3 |
import java.awt.Color; |
4 |
|
5 |
import com.hardcode.gdbms.engine.values.Value; |
6 |
import com.iver.ai2.gvsig3d.legend.symbols.BaseExtrusionSymbol; |
7 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
8 |
import com.iver.cit.gvsig.fmap.core.symbols.IFillSymbol; |
9 |
import com.iver.cit.gvsig.fmap.core.symbols.ILineSymbol; |
10 |
import com.iver.cit.gvsig.fmap.core.symbols.IMarkerSymbol; |
11 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
12 |
import com.iver.cit.gvsig.fmap.core.symbols.SimpleFillSymbol; |
13 |
import com.iver.cit.gvsig.fmap.core.symbols.SimpleLineSymbol; |
14 |
import com.iver.cit.gvsig.fmap.core.symbols.SimpleMarkerSymbol; |
15 |
import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend; |
16 |
import com.iver.utiles.XMLEntity; |
17 |
|
18 |
public class ExtrusionLegend extends VectorialUniqueValueLegend { |
19 |
|
20 |
private BaseExtrusionSymbol defaultSimbolExtrusion;
|
21 |
private double extrusionFactor; |
22 |
|
23 |
|
24 |
public ExtrusionLegend() {
|
25 |
} |
26 |
public ExtrusionLegend(int shapeType) { |
27 |
super(shapeType);
|
28 |
} |
29 |
public ISymbol getSymbolByFeature(IFeature feat) {
|
30 |
return super.getSymbolByFeature(feat); |
31 |
} |
32 |
|
33 |
public ISymbol getSymbolByValue(Value key) {
|
34 |
ISymbol theSymbol = super.getSymbolByValue(key);
|
35 |
|
36 |
if (theSymbol== null) |
37 |
return null; |
38 |
double extrusion = Double.parseDouble(theSymbol.getDescription()); |
39 |
|
40 |
|
41 |
|
42 |
defaultSimbolExtrusion = new BaseExtrusionSymbol(extrusion);
|
43 |
if (theSymbol.getClass().equals(SimpleFillSymbol.class)) {// Nuevo s?mbolo pol?gono |
44 |
Color color = ((IFillSymbol)theSymbol).getFillColor();
|
45 |
defaultSimbolExtrusion.setFillColor(color); |
46 |
} |
47 |
else if (theSymbol.getClass().equals(SimpleLineSymbol.class)) {// Nuevo s?mbolo l?nea |
48 |
Color color = ((ILineSymbol)theSymbol).getColor();
|
49 |
defaultSimbolExtrusion.setFillColor(color); |
50 |
} |
51 |
else if (theSymbol.getClass().equals(SimpleMarkerSymbol.class)) {// Nuevo s?mbolo punto |
52 |
Color color = ((IMarkerSymbol)theSymbol).getColor();
|
53 |
defaultSimbolExtrusion.setFillColor(color); |
54 |
} |
55 |
|
56 |
// defaultSimbolExtrusion.setExtrusion(factorExtrusion);
|
57 |
|
58 |
return defaultSimbolExtrusion;
|
59 |
} |
60 |
|
61 |
public String getClassName() { |
62 |
return getClass().getName();
|
63 |
} |
64 |
|
65 |
public double getExtrusionFactor() { |
66 |
return extrusionFactor;
|
67 |
} |
68 |
|
69 |
public void setExtrusionFactor(double extrusionFactor) { |
70 |
this.extrusionFactor = extrusionFactor;
|
71 |
} |
72 |
|
73 |
|
74 |
public XMLEntity getXMLEntity() {
|
75 |
XMLEntity xml = super.getXMLEntity();
|
76 |
xml.putProperty("extrusionFactor", this.extrusionFactor); |
77 |
return xml;
|
78 |
|
79 |
} |
80 |
|
81 |
public void setXMLEntity(XMLEntity xml) { |
82 |
// TODO: It is necessary to insert here all the properties to load with the extrusion legend.
|
83 |
super.setXMLEntity(xml);
|
84 |
if (xml.contains("extrusionFactor")) |
85 |
extrusionFactor = xml.getDoubleProperty("extrusionFactor");
|
86 |
} |
87 |
|
88 |
} |