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