Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / lib3DMap-share / src / main / java / com / iver / ai2 / gvsig3d / legend / extrusion / ExtrusionLegend.java @ 25860

History | View | Annotate | Download (2.75 KB)

1 25860 jcampos
package com.iver.ai2.gvsig3d.legend.extrusion;
2 24707 jcampos
3 24905 jcampos
import java.awt.Color;
4
5 24842 afraile
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 24905 jcampos
import com.iver.cit.gvsig.fmap.core.symbols.IFillSymbol;
9 25226 afraile
import com.iver.cit.gvsig.fmap.core.symbols.ILineSymbol;
10
import com.iver.cit.gvsig.fmap.core.symbols.IMarkerSymbol;
11 24842 afraile
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
12 24905 jcampos
import com.iver.cit.gvsig.fmap.core.symbols.SimpleFillSymbol;
13 25226 afraile
import com.iver.cit.gvsig.fmap.core.symbols.SimpleLineSymbol;
14
import com.iver.cit.gvsig.fmap.core.symbols.SimpleMarkerSymbol;
15 24842 afraile
import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend;
16
import com.iver.utiles.XMLEntity;
17 24707 jcampos
18 24842 afraile
public class ExtrusionLegend extends VectorialUniqueValueLegend {
19
20
        private BaseExtrusionSymbol defaultSimbolExtrusion;
21 25260 jcampos
        private double extrusionFactor;
22 24842 afraile
23 25260 jcampos
24 25304 afraile
        public ExtrusionLegend() {
25
        }
26 24842 afraile
        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 25260 jcampos
                double extrusion = Double.parseDouble(theSymbol.getDescription());
39 24905 jcampos
40
41 24842 afraile
42 25260 jcampos
                defaultSimbolExtrusion = new BaseExtrusionSymbol(extrusion);
43 25226 afraile
                if (theSymbol.getClass().equals(SimpleFillSymbol.class)) {// Nuevo s?mbolo pol?gono
44 24905 jcampos
                        Color color = ((IFillSymbol)theSymbol).getFillColor();
45
                        defaultSimbolExtrusion.setFillColor(color);
46
                }
47 25226 afraile
                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 24842 afraile
56
//                defaultSimbolExtrusion.setExtrusion(factorExtrusion);
57
58
                return defaultSimbolExtrusion;
59
        }
60
61 25260 jcampos
        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 24842 afraile
74
        public XMLEntity getXMLEntity() {
75 25304 afraile
                XMLEntity xml = super.getXMLEntity();
76 25260 jcampos
                xml.putProperty("extrusionFactor", this.extrusionFactor);
77
                return xml;
78
79 24842 afraile
        }
80
81
        public void setXMLEntity(XMLEntity xml) {
82 25260 jcampos
                // TODO: It is necessary to insert here all the properties to load with the extrusion legend.
83 25304 afraile
                super.setXMLEntity(xml);
84 25260 jcampos
                if (xml.contains("extrusionFactor"))
85 25304 afraile
                        extrusionFactor = xml.getDoubleProperty("extrusionFactor");
86 24842 afraile
        }
87
88 24707 jcampos
}