root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / rendering / LegendFactory.java @ 680
History | View | Annotate | Download (4.3 KB)
1 | 214 | fernando | /* Generated by Together */
|
---|---|---|---|
2 | package com.iver.cit.gvsig.fmap.rendering; |
||
3 | |||
4 | 531 | vcaballero | import com.hardcode.gdbms.engine.data.DriverException; |
5 | 458 | fjp | 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 | 490 | fernando | import com.iver.cit.gvsig.fmap.layers.XMLException; |
9 | 413 | vcaballero | import com.iver.utiles.XMLEntity; |
10 | 214 | fernando | |
11 | |||
12 | 326 | fernando | /**
|
13 | * DOCUMENT ME!
|
||
14 | *
|
||
15 | * @author Fernando Gonz?lez Cort?s
|
||
16 | */
|
||
17 | 214 | fernando | public class LegendFactory { |
18 | 458 | fjp | 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 | 326 | fernando | |
22 | // TODO Descomentar esto cuando se tenga la interfaz de datos
|
||
23 | |||
24 | 214 | fernando | /*
|
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 | 326 | fernando | 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 | 458 | fjp | 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 | 214 | fernando | } |
56 | 470 | fjp | /**
|
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 | 531 | vcaballero | public static VectorialIntervalLegend createVectorialIntervalLegend(int shapeType) { |
65 | return new VectorialIntervalLegend(shapeType); |
||
66 | } |
||
67 | 214 | fernando | /**
|
68 | 326 | fernando | * 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 | 531 | vcaballero | * @throws DriverException
|
75 | 214 | fernando | */
|
76 | 531 | vcaballero | public static XMLEntity getXMLEntity(VectorialLegend r) throws DriverException { |
77 | 435 | vcaballero | XMLEntity xml=r.getXMLEntity(); |
78 | return xml;
|
||
79 | 214 | fernando | } |
80 | |||
81 | /**
|
||
82 | * Crea un renderer con la informaci?n contenida en el objeto XMLEntity
|
||
83 | 326 | fernando | *
|
84 | * @param info DOCUMENT ME!
|
||
85 | *
|
||
86 | * @return DOCUMENT ME!
|
||
87 | 435 | vcaballero | * @throws ClassNotFoundException
|
88 | * @throws IllegalAccessException
|
||
89 | * @throws InstantiationException
|
||
90 | 214 | fernando | */
|
91 | 490 | fernando | public static VectorialLegend createFromXML(XMLEntity xml) throws XMLException{ |
92 | 326 | fernando | //TODO Implementar bien
|
93 | 490 | fernando | try{
|
94 | 435 | vcaballero | 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 | 490 | fernando | } 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 | 435 | vcaballero | |
108 | 214 | fernando | } |
109 | |||
110 | 326 | fernando | /**
|
111 | * DOCUMENT ME!
|
||
112 | *
|
||
113 | * @param l DOCUMENT ME!
|
||
114 | *
|
||
115 | * @return DOCUMENT ME!
|
||
116 | 531 | vcaballero | * @throws XMLException
|
117 | * @throws DriverException
|
||
118 | 435 | vcaballero | * @throws IllegalAccessException
|
119 | * @throws InstantiationException
|
||
120 | * @throws ClassNotFoundException
|
||
121 | 326 | fernando | */
|
122 | 531 | vcaballero | public static VectorialLegend cloneLegend(VectorialLegend l) throws XMLException, DriverException { |
123 | 435 | vcaballero | return createFromXML(getXMLEntity(l));
|
124 | 214 | fernando | } |
125 | } |