root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / rendering / LegendFactory.java @ 680
History | View | Annotate | Download (4.3 KB)
1 |
/* Generated by Together */
|
---|---|
2 |
package com.iver.cit.gvsig.fmap.rendering; |
3 |
|
4 |
import com.hardcode.gdbms.engine.data.DriverException; |
5 |
import com.iver.cit.gvsig.fmap.core.FShape; |
6 |
import com.iver.cit.gvsig.fmap.core.v02.FConstant; |
7 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
8 |
import com.iver.cit.gvsig.fmap.layers.XMLException; |
9 |
import com.iver.utiles.XMLEntity; |
10 |
|
11 |
|
12 |
/**
|
13 |
* DOCUMENT ME!
|
14 |
*
|
15 |
* @author Fernando Gonz?lez Cort?s
|
16 |
*/
|
17 |
public class LegendFactory { |
18 |
public static FSymbol DEFAULT_POINT_SYMBOL = new FSymbol(FConstant.SYMBOL_TYPE_POINT); |
19 |
public static FSymbol DEFAULT_LINE_SYMBOL = new FSymbol(FConstant.SYMBOL_TYPE_LINE);; |
20 |
public static FSymbol DEFAULT_POLYGON_SYMBOL = new FSymbol(FConstant.SYMBOL_TYPE_FILL); |
21 |
|
22 |
// TODO Descomentar esto cuando se tenga la interfaz de datos
|
23 |
|
24 |
/*
|
25 |
* 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
|
26 |
*
|
27 |
public static Legend createIntervalLegend(FRecordset data, int valueField, int labelField ) {
|
28 |
}
|
29 |
/*
|
30 |
* 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
|
31 |
*
|
32 |
public static Legend createUniqueValueLegend(FRecordset data, int valueField, int labelField ) {
|
33 |
}
|
34 |
*/
|
35 |
|
36 |
/**
|
37 |
* Crea un objeto renderer de s?mbolo ?nico con las caracter?sticas que se
|
38 |
* pasan como par?metro
|
39 |
*
|
40 |
* @return DOCUMENT ME!
|
41 |
*/
|
42 |
public static VectorialLegend createSingleSymbolLegend(int shapeType) { |
43 |
switch (shapeType)
|
44 |
{ |
45 |
case FShape.POINT:
|
46 |
return new SingleSymbolLegend(new FSymbol(FConstant.SYMBOL_TYPE_POINT)); |
47 |
case FShape.LINE:
|
48 |
return new SingleSymbolLegend(new FSymbol(FConstant.SYMBOL_TYPE_LINE)); |
49 |
case FShape.POLYGON:
|
50 |
return new SingleSymbolLegend(new FSymbol(FConstant.SYMBOL_TYPE_FILL)); |
51 |
|
52 |
} |
53 |
return null; |
54 |
|
55 |
} |
56 |
/**
|
57 |
* Crea un objeto VectorialUniqueValueLegend vac?o, dispuesto para cargar s?mbolos
|
58 |
*
|
59 |
* @return DOCUMENT ME!
|
60 |
*/
|
61 |
public static VectorialUniqueValueLegend createVectorialUniqueValueLegend(int shapeType) { |
62 |
return new VectorialUniqueValueLegend(shapeType); |
63 |
} |
64 |
public static VectorialIntervalLegend createVectorialIntervalLegend(int shapeType) { |
65 |
return new VectorialIntervalLegend(shapeType); |
66 |
} |
67 |
/**
|
68 |
* Obtiene un objeto con las propiedades del renderer. Este m?todo se
|
69 |
* invocar? con el fin de guardar el s?mbolo en disco.
|
70 |
*
|
71 |
* @param r DOCUMENT ME!
|
72 |
*
|
73 |
* @return DOCUMENT ME!
|
74 |
* @throws DriverException
|
75 |
*/
|
76 |
public static XMLEntity getXMLEntity(VectorialLegend r) throws DriverException { |
77 |
XMLEntity xml=r.getXMLEntity(); |
78 |
return xml;
|
79 |
} |
80 |
|
81 |
/**
|
82 |
* Crea un renderer con la informaci?n contenida en el objeto XMLEntity
|
83 |
*
|
84 |
* @param info DOCUMENT ME!
|
85 |
*
|
86 |
* @return DOCUMENT ME!
|
87 |
* @throws ClassNotFoundException
|
88 |
* @throws IllegalAccessException
|
89 |
* @throws InstantiationException
|
90 |
*/
|
91 |
public static VectorialLegend createFromXML(XMLEntity xml) throws XMLException{ |
92 |
//TODO Implementar bien
|
93 |
try{
|
94 |
VectorialLegend vl=null;
|
95 |
Class clase = Class.forName(xml.getStringProperty("nameClass")); |
96 |
vl = (VectorialLegend) clase.newInstance(); |
97 |
vl.setXMLEntity(xml); |
98 |
|
99 |
return vl;
|
100 |
} catch (ClassNotFoundException e) { |
101 |
throw new XMLException(e); |
102 |
} catch (InstantiationException e) { |
103 |
throw new XMLException(e); |
104 |
} catch (IllegalAccessException e) { |
105 |
throw new XMLException(e); |
106 |
} |
107 |
|
108 |
} |
109 |
|
110 |
/**
|
111 |
* DOCUMENT ME!
|
112 |
*
|
113 |
* @param l DOCUMENT ME!
|
114 |
*
|
115 |
* @return DOCUMENT ME!
|
116 |
* @throws XMLException
|
117 |
* @throws DriverException
|
118 |
* @throws IllegalAccessException
|
119 |
* @throws InstantiationException
|
120 |
* @throws ClassNotFoundException
|
121 |
*/
|
122 |
public static VectorialLegend cloneLegend(VectorialLegend l) throws XMLException, DriverException { |
123 |
return createFromXML(getXMLEntity(l));
|
124 |
} |
125 |
} |