Statistics
| Revision:

root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / rendering / LegendFactory.java @ 470

History | View | Annotate | Download (3.81 KB)

1
/* Generated by Together */
2
package com.iver.cit.gvsig.fmap.rendering;
3

    
4
import com.iver.cit.gvsig.fmap.core.FShape;
5
import com.iver.cit.gvsig.fmap.core.v02.FConstant;
6
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
7
import com.iver.utiles.XMLEntity;
8

    
9

    
10
/**
11
 * DOCUMENT ME!
12
 *
13
 * @author Fernando Gonz?lez Cort?s
14
 */
15
public class LegendFactory {
16
    public static FSymbol DEFAULT_POINT_SYMBOL = new FSymbol(FConstant.SYMBOL_TYPE_POINT);
17
    public static FSymbol DEFAULT_LINE_SYMBOL = new FSymbol(FConstant.SYMBOL_TYPE_LINE);;    
18
    public static FSymbol DEFAULT_POLYGON_SYMBOL = new FSymbol(FConstant.SYMBOL_TYPE_FILL);
19

    
20
    // TODO Descomentar esto cuando se tenga la interfaz de datos
21

    
22
    /*
23
     * Crea un objeto renderer de valor ?nico con las caracter?sticas que se pasan como par?metro y con los s?mbolos por defecto. En funci?n de la carga del sistema se podr? crear un FRenderer que almacene la referencia al FRecordset, o un FRenderer que haga cach? de los valores necesarios
24
     *
25
       public static Legend createIntervalLegend(FRecordset data, int valueField, int labelField ) {
26
       }
27
       /*
28
     * Crea un objeto renderer de valor ?nico con las caracter?sticas que se pasan como par?metro y con los s?mbolos por defecto. En funci?n de la carga del sistema se podr? crear un FRenderer que almacene la referencia al FRecordset, o un FRenderer que haga cach? de los valores necesarios
29
     *
30
       public static Legend createUniqueValueLegend(FRecordset data, int valueField, int labelField ) {
31
       }
32
     */
33

    
34
    /**
35
     * Crea un objeto renderer de s?mbolo ?nico con las caracter?sticas que se
36
     * pasan como par?metro
37
     *
38
     * @return DOCUMENT ME!
39
     */
40
    public static VectorialLegend createSingleSymbolLegend(int shapeType) {
41
            switch (shapeType)
42
                {
43
                    case FShape.POINT:
44
                            return new SingleSymbolLegend(new FSymbol(FConstant.SYMBOL_TYPE_POINT));
45
                    case FShape.LINE:
46
                            return new SingleSymbolLegend(new FSymbol(FConstant.SYMBOL_TYPE_LINE));
47
                    case FShape.POLYGON:
48
                            return new SingleSymbolLegend(new FSymbol(FConstant.SYMBOL_TYPE_FILL));
49
                    
50
                }
51
            return null;
52
        
53
    }
54
    /**
55
     * Crea un objeto VectorialUniqueValueLegend vac?o, dispuesto para cargar s?mbolos
56
     *
57
     * @return DOCUMENT ME!
58
     */
59
    public static VectorialUniqueValueLegend createVectorialUniqueValueLegend(int shapeType) {
60
                   return new VectorialUniqueValueLegend(shapeType);        
61
    }
62

    
63
    /**
64
     * Obtiene un objeto con las propiedades del renderer. Este m?todo se
65
     * invocar? con el fin de guardar el s?mbolo en disco.
66
     *
67
     * @param r DOCUMENT ME!
68
     *
69
     * @return DOCUMENT ME!
70
     */
71
    public static XMLEntity getXMLEntity(VectorialLegend r) {
72
            XMLEntity xml=r.getXMLEntity();
73
        return xml;
74
    }
75

    
76
    /**
77
     * Crea un renderer con la informaci?n contenida en el objeto XMLEntity
78
     *
79
     * @param info DOCUMENT ME!
80
     *
81
     * @return DOCUMENT ME!
82
     * @throws ClassNotFoundException
83
     * @throws IllegalAccessException
84
     * @throws InstantiationException
85
     */
86
    public static VectorialLegend createFromXML(XMLEntity xml) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
87
        //TODO Implementar bien
88
            VectorialLegend vl=null;
89
                Class clase = Class.forName(xml.getStringProperty("nameClass"));
90
            vl = (VectorialLegend) clase.newInstance();
91
        vl.setXMLEntity(xml);
92
            
93
            return vl;
94
    
95
    }
96

    
97
    /**
98
     * DOCUMENT ME!
99
     *
100
     * @param l DOCUMENT ME!
101
     *
102
     * @return DOCUMENT ME!
103
     * @throws IllegalAccessException
104
     * @throws InstantiationException
105
     * @throws ClassNotFoundException
106
     */
107
    public static VectorialLegend cloneLegend(VectorialLegend l) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
108
        return createFromXML(getXMLEntity(l));
109
    }
110
}