Revision 326 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/LegendFactory.java
LegendFactory.java | ||
---|---|---|
1 | 1 |
/* Generated by Together */ |
2 |
|
|
3 | 2 |
package com.iver.cit.gvsig.fmap.rendering; |
4 | 3 |
|
5 |
import java.awt.AlphaComposite; |
|
6 |
import java.awt.BasicStroke; |
|
7 |
import java.awt.Color; |
|
4 |
import com.iver.cit.gvsig.fmap.XMLEntity; |
|
5 |
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D; |
|
8 | 6 |
|
9 | 7 |
import org.geotools.renderer.style.LineStyle2D; |
10 | 8 |
import org.geotools.renderer.style.Style2D; |
11 | 9 |
|
12 |
import com.iver.cit.gvsig.fmap.XMLEntity; |
|
10 |
import java.awt.BasicStroke; |
|
11 |
import java.awt.Color; |
|
13 | 12 |
|
14 | 13 |
|
14 |
/** |
|
15 |
* DOCUMENT ME! |
|
16 |
* |
|
17 |
* @author Fernando Gonz?lez Cort?s |
|
18 |
*/ |
|
15 | 19 |
public class LegendFactory { |
16 |
|
|
17 |
public static LineStyle2D DEFAULT_LINE_SYMBOL = new LineStyle2D(); |
|
18 |
|
|
19 |
static{ |
|
20 |
DEFAULT_LINE_SYMBOL.setContour(Color.BLUE); |
|
21 |
DEFAULT_LINE_SYMBOL.setContourComposite(null); |
|
22 |
BasicStroke stroke = new BasicStroke(1); |
|
23 |
DEFAULT_LINE_SYMBOL.setStroke(stroke); |
|
24 |
} |
|
25 |
|
|
26 |
// TODO Descomentar esto cuando se tenga la interfaz de datos |
|
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 createIntervalLegend(FRecordset data, int valueField, int labelField ) { |
|
20 |
public static FStyle2D DEFAULT_SYMBOL; |
|
21 |
private static LineStyle2D DEFAULT_LINE_SYMBOL = new LineStyle2D(); |
|
22 |
|
|
23 |
static { |
|
24 |
DEFAULT_LINE_SYMBOL.setContour(Color.BLUE); |
|
25 |
DEFAULT_LINE_SYMBOL.setContourComposite(null); |
|
26 |
|
|
27 |
BasicStroke stroke = new BasicStroke(1); |
|
28 |
DEFAULT_LINE_SYMBOL.setStroke(stroke); |
|
29 |
|
|
30 |
/* |
|
31 |
* TODO Falta definir los Style2D's de punto, de pol?gono |
|
32 |
* y de texto por defecto |
|
33 |
*/ |
|
34 |
|
|
35 |
DEFAULT_SYMBOL = new FStyle2D(); |
|
36 |
DEFAULT_SYMBOL.setLineStyle2D(DEFAULT_LINE_SYMBOL); |
|
31 | 37 |
} |
32 | 38 |
|
39 |
// TODO Descomentar esto cuando se tenga la interfaz de datos |
|
40 |
|
|
33 | 41 |
/* |
34 | 42 |
* 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 |
35 | 43 |
* |
36 |
public static Legend createUniqueValueLegend(FRecordset data, int valueField, int labelField ) { |
|
44 |
public static Legend createIntervalLegend(FRecordset data, int valueField, int labelField ) { |
|
45 |
} |
|
46 |
/* |
|
47 |
* 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 |
|
48 |
* |
|
49 |
public static Legend createUniqueValueLegend(FRecordset data, int valueField, int labelField ) { |
|
50 |
} |
|
51 |
*/ |
|
52 |
|
|
53 |
/** |
|
54 |
* Crea un objeto renderer de s?mbolo ?nico con las caracter?sticas que se |
|
55 |
* pasan como par?metro |
|
56 |
* |
|
57 |
* @param pointStyle DOCUMENT ME! |
|
58 |
* @param lineStyle DOCUMENT ME! |
|
59 |
* @param polygonStyle DOCUMENT ME! |
|
60 |
* @param textStyle DOCUMENT ME! |
|
61 |
* |
|
62 |
* @return DOCUMENT ME! |
|
63 |
*/ |
|
64 |
public static VectorialLegend createUniqueSymbolLegend(Style2D pointStyle, |
|
65 |
Style2D lineStyle, Style2D polygonStyle, Style2D textStyle) { |
|
66 |
FStyle2D style = new FStyle2D(); |
|
67 |
|
|
68 |
if (pointStyle != null) { |
|
69 |
style.setPointStyle2D(pointStyle); |
|
70 |
} |
|
71 |
|
|
72 |
if (lineStyle != null) { |
|
73 |
style.setLineStyle2D(lineStyle); |
|
74 |
} |
|
75 |
|
|
76 |
if (polygonStyle != null) { |
|
77 |
style.setPolygonStyle2D(polygonStyle); |
|
78 |
} |
|
79 |
|
|
80 |
if (textStyle != null) { |
|
81 |
style.setTextStyle2D(textStyle); |
|
82 |
} |
|
83 |
|
|
84 |
return new UniqueSymbolLegend(style); |
|
37 | 85 |
} |
38 |
*/ |
|
86 |
|
|
39 | 87 |
/** |
40 |
* Crea un objeto renderer de s?mbolo ?nico con las caracter?sticas que se pasan como par?metro |
|
88 |
* Crea un objeto renderer de s?mbolo ?nico con las caracter?sticas que se |
|
89 |
* pasan como par?metro |
|
90 |
* |
|
91 |
* @return DOCUMENT ME! |
|
41 | 92 |
*/ |
42 |
public static VectorialLegend createUniqueSymbolLegend(Style2D style) {
|
|
43 |
return new UniqueSymbolLegend(style);
|
|
93 |
public static VectorialLegend createUniqueSymbolLegend() { |
|
94 |
return new UniqueSymbolLegend(DEFAULT_SYMBOL);
|
|
44 | 95 |
} |
45 | 96 |
|
46 | 97 |
/** |
47 |
* Obtiene un objeto con las propiedades del renderer. Este m?todo se invocar? con el fin de guardar el s?mbolo en disco. |
|
98 |
* Obtiene un objeto con las propiedades del renderer. Este m?todo se |
|
99 |
* invocar? con el fin de guardar el s?mbolo en disco. |
|
100 |
* |
|
101 |
* @param r DOCUMENT ME! |
|
102 |
* |
|
103 |
* @return DOCUMENT ME! |
|
48 | 104 |
*/ |
49 | 105 |
public static XMLEntity getLegendProperties(VectorialLegend r) { |
50 |
//TODO Implementar bien
|
|
51 |
return null;
|
|
106 |
//TODO Implementar bien
|
|
107 |
return null;
|
|
52 | 108 |
} |
53 | 109 |
|
54 | 110 |
/** |
55 | 111 |
* Crea un renderer con la informaci?n contenida en el objeto XMLEntity |
112 |
* |
|
113 |
* @param info DOCUMENT ME! |
|
114 |
* |
|
115 |
* @return DOCUMENT ME! |
|
56 | 116 |
*/ |
57 | 117 |
public static VectorialLegend createLegend(XMLEntity info) { |
58 |
//TODO Implementar bien
|
|
59 |
return null;
|
|
118 |
//TODO Implementar bien
|
|
119 |
return null;
|
|
60 | 120 |
} |
61 | 121 |
|
122 |
/** |
|
123 |
* DOCUMENT ME! |
|
124 |
* |
|
125 |
* @param l DOCUMENT ME! |
|
126 |
* |
|
127 |
* @return DOCUMENT ME! |
|
128 |
*/ |
|
62 | 129 |
public static VectorialLegend cloneLegend(VectorialLegend l) { |
63 |
return createLegend(getLegendProperties(l));
|
|
130 |
return createLegend(getLegendProperties(l));
|
|
64 | 131 |
} |
65 | 132 |
} |
Also available in: Unified diff