Revision 2796 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/VectorialUniqueValueLegend.java
VectorialUniqueValueLegend.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.cit.gvsig.fmap.rendering; |
42 | 42 |
|
43 |
import java.sql.Types; |
|
44 |
import java.text.ParseException; |
|
45 |
import java.util.ArrayList; |
|
46 |
import java.util.Comparator; |
|
47 |
import java.util.TreeMap; |
|
48 |
|
|
49 | 43 |
import com.hardcode.gdbms.engine.data.DataSource; |
50 | 44 |
import com.hardcode.gdbms.engine.instruction.FieldNotFoundException; |
51 | 45 |
import com.hardcode.gdbms.engine.instruction.IncompatibleTypesException; |
... | ... | |
55 | 49 |
import com.hardcode.gdbms.engine.values.StringValue; |
56 | 50 |
import com.hardcode.gdbms.engine.values.Value; |
57 | 51 |
import com.hardcode.gdbms.engine.values.ValueFactory; |
52 |
|
|
58 | 53 |
import com.iver.cit.gvsig.fmap.DriverException; |
59 | 54 |
import com.iver.cit.gvsig.fmap.core.FShape; |
60 | 55 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
61 | 56 |
import com.iver.cit.gvsig.fmap.core.v02.FConstant; |
62 | 57 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
63 | 58 |
import com.iver.cit.gvsig.fmap.layers.XMLException; |
59 |
|
|
64 | 60 |
import com.iver.utiles.XMLEntity; |
65 | 61 |
|
62 |
import java.sql.Types; |
|
66 | 63 |
|
64 |
import java.text.ParseException; |
|
65 |
|
|
66 |
import java.util.ArrayList; |
|
67 |
import java.util.Comparator; |
|
68 |
import java.util.TreeMap; |
|
69 |
|
|
70 |
|
|
67 | 71 |
/** |
68 | 72 |
* Leyenda vectorial por valores ?nicos. |
69 | 73 |
* |
70 | 74 |
* @author Vicente Caballero Navarro |
71 | 75 |
*/ |
72 | 76 |
public class VectorialUniqueValueLegend implements UniqueValueLegend, |
73 |
VectorialLegend { |
|
74 |
private TreeMap symbols = new TreeMap(new Comparator() { |
|
75 |
public int compare(Object o1, Object o2) { |
|
76 |
|
|
77 |
if ((o1 != null) && (o2 != null)) { |
|
78 |
Value v2 = (Value) o2; |
|
79 |
Value v1 = (Value) o1; |
|
80 |
BooleanValue boolVal; |
|
81 |
// TODO estas dos comprobaciones son por evitar un bug en el gdbms, cuando se solucione se puede eliminar. |
|
82 |
if (v1 instanceof NullValue && v2 instanceof NullValue)return 0; |
|
83 |
if (v1 instanceof NullValue)return -1; |
|
84 |
if (v2 instanceof NullValue)return 1; |
|
85 |
|
|
86 |
|
|
87 |
try { |
|
88 |
boolVal = (BooleanValue) (v1.greater(v2)); |
|
77 |
VectorialLegend { |
|
78 |
private TreeMap symbols = new TreeMap(new Comparator() { |
|
79 |
public int compare(Object o1, Object o2) { |
|
80 |
if ((o1 != null) && (o2 != null)) { |
|
81 |
Value v2 = (Value) o2; |
|
82 |
Value v1 = (Value) o1; |
|
83 |
BooleanValue boolVal; |
|
89 | 84 |
|
90 |
|
|
91 |
|
|
92 |
if (boolVal.getValue()) { |
|
93 |
return 1; |
|
94 |
} |
|
85 |
// TODO estas dos comprobaciones son por evitar un bug en el gdbms, cuando se solucione se puede eliminar. |
|
86 |
if (v1 instanceof NullValue && v2 instanceof NullValue) { |
|
87 |
return 0; |
|
88 |
} |
|
95 | 89 |
|
96 |
boolVal = (BooleanValue) (v1.less(v2)); |
|
90 |
if (v1 instanceof NullValue) { |
|
91 |
return -1; |
|
92 |
} |
|
97 | 93 |
|
98 |
if (boolVal.getValue()) { |
|
99 |
return -1; |
|
100 |
} |
|
101 |
} catch (IncompatibleTypesException e) { |
|
102 |
// TODO Auto-generated catch block |
|
103 |
//e.printStackTrace(); |
|
104 |
} |
|
105 |
try { |
|
106 |
if (((BooleanValue)v1.equals(v2)).getValue())return 0; |
|
107 |
} catch (IncompatibleTypesException e) { |
|
108 |
// TODO Auto-generated catch block |
|
109 |
//e.printStackTrace(); |
|
110 |
} |
|
111 |
if (v1 instanceof StringValue)return -1; |
|
112 |
if (v2 instanceof StringValue)return 1; |
|
113 |
} |
|
114 |
|
|
115 |
return 0; |
|
116 |
} |
|
117 |
}); // Para poder ordenar |
|
118 |
private ArrayList keys = new ArrayList(); // En lugar de un HashSet, para tener acceso por ?ndice |
|
119 |
private String fieldName; |
|
120 |
private int fieldId = -1; |
|
121 |
private String labelFieldName; |
|
122 |
private String labelFieldHeight; |
|
123 |
private String labelFieldRotation; |
|
124 |
private FSymbol defaultSymbol; |
|
125 |
private DataSource dataSource; |
|
126 |
private int shapeType; |
|
127 |
private String valueType=NullValue.class.getName(); |
|
128 |
private boolean useDefaultSymbol=false; |
|
129 |
private boolean bWithHeightText = false; |
|
130 |
/** |
|
131 |
* Crea un nuevo VectorialUniqueValueLegend. |
|
132 |
*/ |
|
133 |
public VectorialUniqueValueLegend() { |
|
134 |
// defaultSymbol = LegendFactory.DEFAULT_POLYGON_SYMBOL; |
|
135 |
} |
|
94 |
if (v2 instanceof NullValue) { |
|
95 |
return 1; |
|
96 |
} |
|
136 | 97 |
|
137 |
/** |
|
138 |
* Crea un nuevo VectorialUniqueValueLegend. |
|
139 |
* |
|
140 |
* @param shapeType Tipo de shape. |
|
141 |
*/ |
|
142 |
public VectorialUniqueValueLegend(int shapeType) { |
|
143 |
setShapeType(shapeType); |
|
144 |
} |
|
98 |
try { |
|
99 |
boolVal = (BooleanValue) (v1.greater(v2)); |
|
145 | 100 |
|
146 |
/** |
|
147 |
* Inserta el tipo de shape. |
|
148 |
* |
|
149 |
* @param shapeType Tipo de shape. |
|
150 |
*/ |
|
151 |
public void setShapeType(int shapeType) { |
|
152 |
if (this.shapeType != shapeType) { |
|
153 |
switch (shapeType) { |
|
154 |
case FShape.POINT: |
|
155 |
defaultSymbol = new FSymbol(FConstant.SYMBOL_TYPE_POINT); |
|
101 |
if (boolVal.getValue()) { |
|
102 |
return 1; |
|
103 |
} |
|
156 | 104 |
|
157 |
break;
|
|
105 |
boolVal = (BooleanValue) (v1.less(v2));
|
|
158 | 106 |
|
159 |
case FShape.LINE: |
|
160 |
defaultSymbol = new FSymbol(FConstant.SYMBOL_TYPE_LINE); |
|
107 |
if (boolVal.getValue()) { |
|
108 |
return -1; |
|
109 |
} |
|
110 |
} catch (IncompatibleTypesException e) { |
|
111 |
// TODO Auto-generated catch block |
|
112 |
//e.printStackTrace(); |
|
113 |
} |
|
161 | 114 |
|
162 |
break; |
|
115 |
try { |
|
116 |
if (((BooleanValue) v1.equals(v2)).getValue()) { |
|
117 |
return 0; |
|
118 |
} |
|
119 |
} catch (IncompatibleTypesException e) { |
|
120 |
// TODO Auto-generated catch block |
|
121 |
//e.printStackTrace(); |
|
122 |
} |
|
163 | 123 |
|
164 |
case FShape.POLYGON: |
|
165 |
defaultSymbol = new FSymbol(FConstant.SYMBOL_TYPE_FILL); |
|
124 |
if (v1 instanceof StringValue) { |
|
125 |
return -1; |
|
126 |
} |
|
166 | 127 |
|
167 |
break; |
|
168 |
default: |
|
169 |
defaultSymbol = new FSymbol(shapeType); |
|
170 |
} |
|
171 |
this.shapeType = shapeType; |
|
172 |
} |
|
173 |
} |
|
128 |
if (v2 instanceof StringValue) { |
|
129 |
return 1; |
|
130 |
} |
|
131 |
} |
|
174 | 132 |
|
175 |
/** |
|
176 |
* @see com.iver.cit.gvsig.fmap.rendering.UniqueValueLegend#setValueSymbolByID(int, |
|
177 |
* FSymbol) |
|
178 |
*/ |
|
179 |
public void setValueSymbolByID(int id, FSymbol symbol) { |
|
180 |
symbols.put(keys.get(id), symbol); |
|
181 |
} |
|
133 |
return 0; |
|
134 |
} |
|
135 |
}); // Para poder ordenar |
|
136 |
private ArrayList keys = new ArrayList(); // En lugar de un HashSet, para tener acceso por ?ndice |
|
137 |
private String fieldName; |
|
138 |
private int fieldId = -1; |
|
139 |
private String labelFieldName; |
|
140 |
private String labelFieldHeight; |
|
141 |
private String labelFieldRotation; |
|
142 |
private FSymbol defaultSymbol; |
|
143 |
private DataSource dataSource; |
|
144 |
private int shapeType; |
|
145 |
private String valueType = NullValue.class.getName(); |
|
146 |
private boolean useDefaultSymbol = false; |
|
147 |
private boolean bWithHeightText = false; |
|
182 | 148 |
|
183 |
/** |
|
184 |
* Devuelve un s?mbolo a partir del ID. Mira en el m_ArrayKeys el elemento |
|
185 |
* ID, y con esa clave recupera el FSymbol por valor |
|
186 |
* |
|
187 |
* @param id ID. |
|
188 |
* @param symbol DOCUMENT ME! |
|
189 |
*/ |
|
149 |
/** |
|
150 |
* Crea un nuevo VectorialUniqueValueLegend. |
|
151 |
*/ |
|
152 |
public VectorialUniqueValueLegend() { |
|
153 |
// defaultSymbol = LegendFactory.DEFAULT_POLYGON_SYMBOL; |
|
154 |
} |
|
190 | 155 |
|
191 |
/* |
|
192 |
public FSymbol getSymbolByID(int ID) { |
|
193 |
return (FSymbol) symbols.get(keys.get(ID)); |
|
194 |
} |
|
195 |
*/ |
|
156 |
/** |
|
157 |
* Crea un nuevo VectorialUniqueValueLegend. |
|
158 |
* |
|
159 |
* @param shapeType Tipo de shape. |
|
160 |
*/ |
|
161 |
public VectorialUniqueValueLegend(int shapeType) { |
|
162 |
setShapeType(shapeType); |
|
163 |
} |
|
196 | 164 |
|
197 |
/** |
|
198 |
* Se usa en la tabla que muestra una leyenda. |
|
199 |
* |
|
200 |
* @param id |
|
201 |
* @param symbol |
|
202 |
*/ |
|
203 |
public void setValueSymbol(int id, FSymbol symbol) { |
|
204 |
symbols.put(keys.get(id), symbol); |
|
205 |
} |
|
165 |
/** |
|
166 |
* Inserta el tipo de shape. |
|
167 |
* |
|
168 |
* @param shapeType Tipo de shape. |
|
169 |
*/ |
|
170 |
public void setShapeType(int shapeType) { |
|
171 |
if (this.shapeType != shapeType) { |
|
172 |
switch (shapeType) { |
|
173 |
case FShape.POINT: |
|
174 |
defaultSymbol = new FSymbol(FConstant.SYMBOL_TYPE_POINT); |
|
206 | 175 |
|
207 |
/** |
|
208 |
* @see com.iver.cit.gvsig.fmap.rendering.UniqueValueLegend#getValues() |
|
209 |
*/ |
|
210 |
public Object[] getValues() { |
|
211 |
return symbols.keySet().toArray(new Object[0]); |
|
212 |
} |
|
176 |
break; |
|
213 | 177 |
|
214 |
/** |
|
215 |
* @see com.iver.cit.gvsig.fmap.rendering.UniqueValueLegend#addSymbol(java.lang.Object, |
|
216 |
* FSymbol) |
|
217 |
*/ |
|
218 |
public void addSymbol(Object key, FSymbol symbol) { |
|
219 |
Object resul; |
|
220 |
resul = symbols.put(key, symbol); |
|
221 |
if (resul != null) { |
|
222 |
System.err.println("Error: la clave " + key + |
|
223 |
" ya exist?a. Resul = " + resul); |
|
224 |
System.err.println("symbol nuevo:" + symbol.getDescription() + |
|
225 |
" Sviejo= " + ((FSymbol) resul).getDescription()); |
|
226 |
} else { |
|
227 |
keys.add(key); |
|
228 |
if (!key.getClass().equals(NullValue.class)){ |
|
229 |
valueType=key.getClass().getName(); |
|
230 |
} |
|
231 |
} |
|
232 |
} |
|
178 |
case FShape.LINE: |
|
179 |
defaultSymbol = new FSymbol(FConstant.SYMBOL_TYPE_LINE); |
|
233 | 180 |
|
234 |
/** |
|
235 |
* @see com.iver.cit.gvsig.fmap.rendering.ClassifiedLegend#clear() |
|
236 |
*/ |
|
237 |
public void clear() { |
|
238 |
keys.clear(); |
|
239 |
symbols.clear(); |
|
240 |
} |
|
181 |
break; |
|
241 | 182 |
|
242 |
/** |
|
243 |
* @see com.iver.cit.gvsig.fmap.rendering.ClassifiedLegend#getDescriptions() |
|
244 |
*/ |
|
245 |
public String[] getDescriptions() { |
|
246 |
String[] descriptions = new String[symbols.size()]; |
|
247 |
FSymbol[] auxSym = getSymbols(); |
|
183 |
case FShape.POLYGON: |
|
184 |
defaultSymbol = new FSymbol(FConstant.SYMBOL_TYPE_FILL); |
|
248 | 185 |
|
249 |
for (int i = 0; i < descriptions.length; i++) |
|
250 |
descriptions[i] = auxSym[i].getDescription(); |
|
186 |
break; |
|
251 | 187 |
|
252 |
return descriptions; |
|
253 |
} |
|
188 |
default: |
|
189 |
defaultSymbol = new FSymbol(shapeType); |
|
190 |
} |
|
254 | 191 |
|
255 |
/** |
|
256 |
* @see com.iver.cit.gvsig.fmap.rendering.ClassifiedLegend#getSymbols() |
|
257 |
*/ |
|
258 |
public FSymbol[] getSymbols() { |
|
259 |
return (FSymbol[]) symbols.values().toArray(new FSymbol[0]); |
|
260 |
} |
|
192 |
this.shapeType = shapeType; |
|
193 |
} |
|
194 |
} |
|
261 | 195 |
|
262 |
/** |
|
263 |
* @see com.iver.cit.gvsig.fmap.rendering.ClassifiedLegend#getFieldName() |
|
264 |
*/ |
|
265 |
public String getFieldName() { |
|
266 |
return fieldName; |
|
267 |
} |
|
196 |
/** |
|
197 |
* @see com.iver.cit.gvsig.fmap.rendering.UniqueValueLegend#setValueSymbolByID(int, |
|
198 |
* FSymbol) |
|
199 |
*/ |
|
200 |
public void setValueSymbolByID(int id, FSymbol symbol) { |
|
201 |
symbols.put(keys.get(id), symbol); |
|
202 |
} |
|
268 | 203 |
|
269 |
/** |
|
270 |
* @see com.iver.cit.gvsig.fmap.rendering.VectorialLegend#setDefaultSymbol(com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D) |
|
271 |
*/ |
|
272 |
public void setDefaultSymbol(FSymbol s) { |
|
273 |
defaultSymbol = s; |
|
274 |
} |
|
204 |
/** |
|
205 |
* Devuelve un s?mbolo a partir del ID. Mira en el m_ArrayKeys el elemento |
|
206 |
* ID, y con esa clave recupera el FSymbol por valor |
|
207 |
* |
|
208 |
* @param id ID. |
|
209 |
* @param symbol DOCUMENT ME! |
|
210 |
*/ |
|
275 | 211 |
|
276 |
/* (non-Javadoc) |
|
277 |
* @see com.iver.cit.gvsig.fmap.rendering.VectorialLegend#getLabelField() |
|
278 |
*/ |
|
279 |
public String getLabelField() { |
|
280 |
return labelFieldName; |
|
281 |
} |
|
212 |
/* |
|
213 |
public FSymbol getSymbolByID(int ID) { |
|
214 |
return (FSymbol) symbols.get(keys.get(ID)); |
|
215 |
} |
|
216 |
*/ |
|
282 | 217 |
|
283 |
/** |
|
284 |
* @see com.iver.cit.gvsig.fmap.rendering.Legend#setLabelField(int) |
|
285 |
*/ |
|
286 |
public void setLabelField(String fieldName) { |
|
287 |
labelFieldName = fieldName; |
|
288 |
} |
|
218 |
/** |
|
219 |
* Se usa en la tabla que muestra una leyenda. |
|
220 |
* |
|
221 |
* @param id |
|
222 |
* @param symbol |
|
223 |
*/ |
|
224 |
public void setValueSymbol(int id, FSymbol symbol) { |
|
225 |
symbols.put(keys.get(id), symbol); |
|
226 |
} |
|
289 | 227 |
|
290 |
/**
|
|
291 |
* @see com.iver.cit.gvsig.fmap.rendering.ClassifiedLegend#setField()
|
|
292 |
*/
|
|
293 |
public void setFieldName(String str) {
|
|
294 |
fieldName = str;
|
|
295 |
}
|
|
228 |
/**
|
|
229 |
* @see com.iver.cit.gvsig.fmap.rendering.UniqueValueLegend#getValues()
|
|
230 |
*/
|
|
231 |
public Object[] getValues() {
|
|
232 |
return symbols.keySet().toArray(new Object[0]);
|
|
233 |
}
|
|
296 | 234 |
|
297 |
/**
|
|
298 |
* @see com.iver.cit.gvsig.fmap.rendering.VectorialLegend#getSymbol(int)
|
|
299 |
*/
|
|
300 |
public FSymbol getSymbol(int recordIndex) throws DriverException {
|
|
301 |
try {
|
|
302 |
Value val = dataSource.getFieldValue(recordIndex, fieldId);
|
|
303 |
FSymbol theSymbol = getSymbolByValue(val);
|
|
235 |
/**
|
|
236 |
* @see com.iver.cit.gvsig.fmap.rendering.UniqueValueLegend#addSymbol(java.lang.Object,
|
|
237 |
* FSymbol)
|
|
238 |
*/
|
|
239 |
public void addSymbol(Object key, FSymbol symbol) {
|
|
240 |
Object resul;
|
|
241 |
resul = symbols.put(key, symbol);
|
|
304 | 242 |
|
305 |
//if (theSymbol != null) { |
|
306 |
return theSymbol; |
|
307 |
//} else { |
|
308 |
// return getDefaultSymbol(); |
|
309 |
//} |
|
310 |
} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) { |
|
311 |
throw new DriverException(e); |
|
312 |
} |
|
313 |
} |
|
243 |
if (resul != null) { |
|
244 |
System.err.println("Error: la clave " + key + |
|
245 |
" ya exist?a. Resul = " + resul); |
|
246 |
System.err.println("symbol nuevo:" + symbol.getDescription() + |
|
247 |
" Sviejo= " + ((FSymbol) resul).getDescription()); |
|
248 |
} else { |
|
249 |
keys.add(key); |
|
314 | 250 |
|
251 |
if (!key.getClass().equals(NullValue.class)) { |
|
252 |
valueType = key.getClass().getName(); |
|
253 |
} |
|
254 |
} |
|
255 |
} |
|
256 |
|
|
257 |
/** |
|
258 |
* @see com.iver.cit.gvsig.fmap.rendering.ClassifiedLegend#clear() |
|
259 |
*/ |
|
260 |
public void clear() { |
|
261 |
keys.clear(); |
|
262 |
symbols.clear(); |
|
263 |
} |
|
264 |
|
|
265 |
/** |
|
266 |
* @see com.iver.cit.gvsig.fmap.rendering.ClassifiedLegend#getDescriptions() |
|
267 |
*/ |
|
268 |
public String[] getDescriptions() { |
|
269 |
String[] descriptions = new String[symbols.size()]; |
|
270 |
FSymbol[] auxSym = getSymbols(); |
|
271 |
|
|
272 |
for (int i = 0; i < descriptions.length; i++) |
|
273 |
descriptions[i] = auxSym[i].getDescription(); |
|
274 |
|
|
275 |
return descriptions; |
|
276 |
} |
|
277 |
|
|
278 |
/** |
|
279 |
* @see com.iver.cit.gvsig.fmap.rendering.ClassifiedLegend#getSymbols() |
|
280 |
*/ |
|
281 |
public FSymbol[] getSymbols() { |
|
282 |
return (FSymbol[]) symbols.values().toArray(new FSymbol[0]); |
|
283 |
} |
|
284 |
|
|
285 |
/** |
|
286 |
* @see com.iver.cit.gvsig.fmap.rendering.ClassifiedLegend#getFieldName() |
|
287 |
*/ |
|
288 |
public String getFieldName() { |
|
289 |
return fieldName; |
|
290 |
} |
|
291 |
|
|
292 |
/** |
|
293 |
* @see com.iver.cit.gvsig.fmap.rendering.VectorialLegend#setDefaultSymbol(com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D) |
|
294 |
*/ |
|
295 |
public void setDefaultSymbol(FSymbol s) { |
|
296 |
defaultSymbol = s; |
|
297 |
} |
|
298 |
|
|
299 |
/* (non-Javadoc) |
|
300 |
* @see com.iver.cit.gvsig.fmap.rendering.VectorialLegend#getLabelField() |
|
301 |
*/ |
|
302 |
public String getLabelField() { |
|
303 |
return labelFieldName; |
|
304 |
} |
|
305 |
|
|
306 |
/** |
|
307 |
* @see com.iver.cit.gvsig.fmap.rendering.Legend#setLabelField(int) |
|
308 |
*/ |
|
309 |
public void setLabelField(String fieldName) { |
|
310 |
labelFieldName = fieldName; |
|
311 |
} |
|
312 |
|
|
313 |
/** |
|
314 |
* @see com.iver.cit.gvsig.fmap.rendering.ClassifiedLegend#setField() |
|
315 |
*/ |
|
316 |
public void setFieldName(String str) { |
|
317 |
fieldName = str; |
|
318 |
} |
|
319 |
|
|
320 |
/** |
|
321 |
* @see com.iver.cit.gvsig.fmap.rendering.VectorialLegend#getSymbol(int) |
|
322 |
*/ |
|
323 |
public FSymbol getSymbol(int recordIndex) throws DriverException { |
|
324 |
try { |
|
325 |
Value val = dataSource.getFieldValue(recordIndex, fieldId); |
|
326 |
FSymbol theSymbol = getSymbolByValue(val); |
|
327 |
|
|
328 |
//if (theSymbol != null) { |
|
329 |
return theSymbol; |
|
330 |
|
|
331 |
//} else { |
|
332 |
// return getDefaultSymbol(); |
|
333 |
//} |
|
334 |
} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) { |
|
335 |
throw new DriverException(e); |
|
336 |
} |
|
337 |
} |
|
338 |
|
|
339 |
/** |
|
340 |
* Devuelve un s?mbolo a partir de una IFeature. |
|
341 |
* |
|
342 |
* @param feat IFeature |
|
343 |
* |
|
344 |
* @return S?mbolo. |
|
345 |
*/ |
|
315 | 346 |
public FSymbol getSymbolByFeature(IFeature feat) { |
316 | 347 |
Value val = feat.getAttribute(fieldId); |
317 | 348 |
FSymbol theSymbol = getSymbolByValue(val); |
318 | 349 |
|
319 | 350 |
//if (theSymbol != null) { |
320 |
return theSymbol; |
|
351 |
return theSymbol; |
|
352 |
|
|
321 | 353 |
//} else { |
322 | 354 |
// return getDefaultSymbol(); |
323 | 355 |
//} |
324 |
|
|
325 | 356 |
} |
326 |
/** |
|
327 |
* @see com.iver.cit.gvsig.fmap.rendering.Legend#getDefaultSymbol() |
|
328 |
*/ |
|
329 |
public FSymbol getDefaultSymbol() { |
|
330 |
return defaultSymbol; |
|
331 |
} |
|
332 | 357 |
|
333 |
/** |
|
334 |
* @see com.iver.cit.gvsig.fmap.rendering.Legend#getXMLEntity() |
|
335 |
*/ |
|
336 |
public XMLEntity getXMLEntity() { |
|
337 |
XMLEntity xml = new XMLEntity(); |
|
338 |
xml.putProperty("className",this.getClass().getName()); |
|
339 |
xml.putProperty("fieldName", fieldName); |
|
340 |
xml.putProperty("labelfield", labelFieldName); |
|
341 |
xml.putProperty("labelFieldHeight",labelFieldHeight); |
|
342 |
xml.putProperty("labelFieldRotation",labelFieldRotation); |
|
358 |
/** |
|
359 |
* @see com.iver.cit.gvsig.fmap.rendering.Legend#getDefaultSymbol() |
|
360 |
*/ |
|
361 |
public FSymbol getDefaultSymbol() { |
|
362 |
return defaultSymbol; |
|
363 |
} |
|
343 | 364 |
|
344 |
xml.putProperty("useDefaultSymbol", useDefaultSymbol); |
|
345 |
xml.addChild(getDefaultSymbol().getXMLEntity()); |
|
346 |
xml.putProperty("isBWithHeightText",isBWithHeightText()); |
|
347 |
xml.putProperty("numKeys", keys.size()); |
|
365 |
/** |
|
366 |
* @see com.iver.cit.gvsig.fmap.rendering.Legend#getXMLEntity() |
|
367 |
*/ |
|
368 |
public XMLEntity getXMLEntity() { |
|
369 |
XMLEntity xml = new XMLEntity(); |
|
370 |
xml.putProperty("className", this.getClass().getName()); |
|
371 |
xml.putProperty("fieldName", fieldName); |
|
372 |
xml.putProperty("labelfield", labelFieldName); |
|
373 |
xml.putProperty("labelFieldHeight", labelFieldHeight); |
|
374 |
xml.putProperty("labelFieldRotation", labelFieldRotation); |
|
348 | 375 |
|
349 |
if (keys.size() > 0) { |
|
350 |
xml.putProperty("tipoValueKeys", valueType); |
|
376 |
xml.putProperty("useDefaultSymbol", useDefaultSymbol); |
|
377 |
xml.addChild(getDefaultSymbol().getXMLEntity()); |
|
378 |
xml.putProperty("isBWithHeightText", isBWithHeightText()); |
|
379 |
xml.putProperty("numKeys", keys.size()); |
|
351 | 380 |
|
352 |
String[] sk = new String[keys.size()];
|
|
353 |
String[] sv = new String[keys.size()];
|
|
381 |
if (keys.size() > 0) {
|
|
382 |
xml.putProperty("tipoValueKeys", valueType);
|
|
354 | 383 |
|
355 |
FSymbol[] fsymbols = getSymbols();
|
|
356 |
Object[] values = (Object[]) getValues();
|
|
384 |
String[] sk = new String[keys.size()];
|
|
385 |
String[] sv = new String[keys.size()];
|
|
357 | 386 |
|
358 |
for (int i = 0; i < keys.size(); i++) { |
|
359 |
sk[i] = ((Value) keys.get(i)).toString(); |
|
360 |
sv[i] = ((Value) values[i]).toString(); |
|
361 |
xml.addChild(fsymbols[i].getXMLEntity()); |
|
387 |
FSymbol[] fsymbols = getSymbols(); |
|
388 |
Object[] values = (Object[]) getValues(); |
|
362 | 389 |
|
363 |
///System.out.println("get-----------"+sk[i]+"--"+fsymbols[i].getDescription()+"---"+fsymbols[i].getColor()); |
|
364 |
} |
|
390 |
for (int i = 0; i < keys.size(); i++) { |
|
391 |
sk[i] = ((Value) keys.get(i)).toString(); |
|
392 |
sv[i] = ((Value) values[i]).toString(); |
|
393 |
xml.addChild(fsymbols[i].getXMLEntity()); |
|
365 | 394 |
|
366 |
xml.putProperty("keys", sk); |
|
367 |
xml.putProperty("values", sv); |
|
368 |
} |
|
395 |
///System.out.println("get-----------"+sk[i]+"--"+fsymbols[i].getDescription()+"---"+fsymbols[i].getColor()); |
|
396 |
} |
|
369 | 397 |
|
370 |
return xml; |
|
371 |
} |
|
398 |
xml.putProperty("keys", sk); |
|
399 |
xml.putProperty("values", sv); |
|
400 |
} |
|
372 | 401 |
|
402 |
return xml; |
|
403 |
} |
|
373 | 404 |
|
374 |
/**
|
|
375 |
* Inserta el XMLEntity.
|
|
376 |
*
|
|
377 |
* @param xml XMLEntity.
|
|
378 |
*/
|
|
379 |
public void setXMLEntity03(XMLEntity xml) {
|
|
380 |
clear();
|
|
381 |
setFieldName(xml.getStringProperty("fieldName"));
|
|
382 |
setLabelField(xml.getStringProperty("labelfield"));
|
|
405 |
/**
|
|
406 |
* Inserta el XMLEntity.
|
|
407 |
*
|
|
408 |
* @param xml XMLEntity.
|
|
409 |
*/
|
|
410 |
public void setXMLEntity03(XMLEntity xml) {
|
|
411 |
clear();
|
|
412 |
setFieldName(xml.getStringProperty("fieldName"));
|
|
413 |
setLabelField(xml.getStringProperty("labelfield"));
|
|
383 | 414 |
|
384 |
int useDefaultSymbol = xml.getIntProperty("useDefaultSymbol");
|
|
415 |
int useDefaultSymbol = xml.getIntProperty("useDefaultSymbol");
|
|
385 | 416 |
|
386 |
if (useDefaultSymbol == 1) {
|
|
387 |
setDefaultSymbol(FSymbol.createFromXML03(xml.getChild(0)));
|
|
388 |
} else {
|
|
389 |
setDefaultSymbol(null);
|
|
390 |
}
|
|
417 |
if (useDefaultSymbol == 1) {
|
|
418 |
setDefaultSymbol(FSymbol.createFromXML03(xml.getChild(0)));
|
|
419 |
} else {
|
|
420 |
setDefaultSymbol(null);
|
|
421 |
}
|
|
391 | 422 |
|
392 |
int numKeys = xml.getIntProperty("numKeys");
|
|
423 |
int numKeys = xml.getIntProperty("numKeys");
|
|
393 | 424 |
|
394 |
if (numKeys > 0) {
|
|
395 |
String className = xml.getStringProperty("tipoValueKeys");
|
|
396 |
String[] sk = xml.getStringArrayProperty("keys");
|
|
397 |
String[] sv = xml.getStringArrayProperty("values");
|
|
398 |
Value auxValue;
|
|
399 |
Value auxValue2;
|
|
425 |
if (numKeys > 0) {
|
|
426 |
String className = xml.getStringProperty("tipoValueKeys");
|
|
427 |
String[] sk = xml.getStringArrayProperty("keys");
|
|
428 |
String[] sv = xml.getStringArrayProperty("values");
|
|
429 |
Value auxValue;
|
|
430 |
Value auxValue2;
|
|
400 | 431 |
|
401 |
for (int i = 0; i < numKeys; i++) {
|
|
402 |
try {
|
|
403 |
auxValue = ValueFactory.createValue(sk[i], className);
|
|
404 |
auxValue2 = ValueFactory.createValue(sv[i], className);
|
|
432 |
for (int i = 0; i < numKeys; i++) {
|
|
433 |
try {
|
|
434 |
auxValue = ValueFactory.createValue(sk[i], className);
|
|
435 |
auxValue2 = ValueFactory.createValue(sv[i], className);
|
|
405 | 436 |
|
406 |
FSymbol sym = FSymbol.createFromXML03(xml.getChild(i +
|
|
407 |
useDefaultSymbol));
|
|
437 |
FSymbol sym = FSymbol.createFromXML03(xml.getChild(i +
|
|
438 |
useDefaultSymbol));
|
|
408 | 439 |
|
409 |
///addSymbol(auxValue, sym);
|
|
410 |
symbols.put(auxValue2, sym);
|
|
411 |
keys.add(auxValue);
|
|
440 |
///addSymbol(auxValue, sym);
|
|
441 |
symbols.put(auxValue2, sym);
|
|
442 |
keys.add(auxValue);
|
|
412 | 443 |
|
413 |
///System.out.println("---set------"+auxValue.toString());
|
|
414 |
/// System.out.println("set-----------"+sk[i]+"--"+sym.getDescription()+"---"+sym.getColor());
|
|
415 |
} catch (SemanticException e) {
|
|
416 |
// TODO Auto-generated catch block
|
|
417 |
e.printStackTrace();
|
|
418 |
}
|
|
419 |
}
|
|
420 |
}
|
|
421 |
}
|
|
444 |
///System.out.println("---set------"+auxValue.toString());
|
|
445 |
/// System.out.println("set-----------"+sk[i]+"--"+sym.getDescription()+"---"+sym.getColor());
|
|
446 |
} catch (SemanticException e) {
|
|
447 |
// TODO Auto-generated catch block
|
|
448 |
e.printStackTrace();
|
|
449 |
}
|
|
450 |
}
|
|
451 |
}
|
|
452 |
}
|
|
422 | 453 |
|
423 |
/** |
|
424 |
* Inserta el XMLEntity. |
|
425 |
* |
|
426 |
* @param xml XMLEntity. |
|
427 |
*/ |
|
428 |
public void setXMLEntity(XMLEntity xml) { |
|
429 |
clear(); |
|
430 |
setFieldName(xml.getStringProperty("fieldName")); |
|
431 |
setLabelField(xml.getStringProperty("labelfield")); |
|
432 |
if (xml.contains("labelFieldHeight")) |
|
454 |
/** |
|
455 |
* Inserta el XMLEntity. |
|
456 |
* |
|
457 |
* @param xml XMLEntity. |
|
458 |
*/ |
|
459 |
public void setXMLEntity(XMLEntity xml) { |
|
460 |
clear(); |
|
461 |
setFieldName(xml.getStringProperty("fieldName")); |
|
462 |
setLabelField(xml.getStringProperty("labelfield")); |
|
463 |
|
|
464 |
if (xml.contains("labelFieldHeight")) { |
|
433 | 465 |
setLabelHeightField(xml.getStringProperty("labelFieldHeight")); |
434 |
if (xml.contains("labelFieldRotation")) |
|
466 |
} |
|
467 |
|
|
468 |
if (xml.contains("labelFieldRotation")) { |
|
435 | 469 |
setLabelRotationField(xml.getStringProperty("labelFieldRotation")); |
436 |
useDefaultSymbol = xml.getBooleanProperty("useDefaultSymbol"); |
|
437 |
setDefaultSymbol(FSymbol.createFromXML(xml.getChild(0))); |
|
438 |
if (xml.contains("isBWithHeightText")) |
|
470 |
} |
|
471 |
|
|
472 |
useDefaultSymbol = xml.getBooleanProperty("useDefaultSymbol"); |
|
473 |
setDefaultSymbol(FSymbol.createFromXML(xml.getChild(0))); |
|
474 |
|
|
475 |
if (xml.contains("isBWithHeightText")) { |
|
439 | 476 |
setBWithHeightText(xml.getBooleanProperty("isBWithHeightText")); |
440 |
|
|
441 |
//addSymbol(new NullUniqueValue(),getDefaultSymbol()); |
|
442 |
int numKeys = xml.getIntProperty("numKeys"); |
|
477 |
} |
|
443 | 478 |
|
444 |
if (numKeys > 0) { |
|
445 |
String className = xml.getStringProperty("tipoValueKeys"); |
|
446 |
String[] sk = xml.getStringArrayProperty("keys"); |
|
447 |
String[] sv = xml.getStringArrayProperty("values"); |
|
448 |
Value auxValue=null; |
|
449 |
Value auxValue2=null; |
|
479 |
//addSymbol(new NullUniqueValue(),getDefaultSymbol()); |
|
480 |
int numKeys = xml.getIntProperty("numKeys"); |
|
450 | 481 |
|
451 |
for (int i = 0; i < numKeys; i++) { |
|
452 |
//try { |
|
453 |
boolean isDefault=false; |
|
454 |
if (getValue(sk[i])==null) |
|
455 |
isDefault=true; |
|
456 |
if (className.equals("com.hardcode.gdbms.engine.values.NullUniqueValue") || isDefault){ |
|
457 |
auxValue=new NullUniqueValue(); |
|
458 |
auxValue2=ValueFactory.createNullValue(); |
|
459 |
}else{ |
|
460 |
auxValue = getValue(sk[i]);//ValueFactory.createValue(sk[i], className); |
|
461 |
auxValue2 =getValue(sv[i]);// ValueFactory.createValue(sv[i], className); |
|
462 |
} |
|
463 |
FSymbol sym = FSymbol.createFromXML(xml.getChild(i + |
|
464 |
1)); |
|
482 |
if (numKeys > 0) { |
|
483 |
String className = xml.getStringProperty("tipoValueKeys"); |
|
484 |
String[] sk = xml.getStringArrayProperty("keys"); |
|
485 |
String[] sv = xml.getStringArrayProperty("values"); |
|
486 |
Value auxValue = null; |
|
487 |
Value auxValue2 = null; |
|
465 | 488 |
|
466 |
///addSymbol(auxValue, sym); |
|
467 |
symbols.put(auxValue2, sym); |
|
468 |
keys.add(auxValue); |
|
469 |
|
|
470 |
///System.out.println("---set------"+auxValue.toString()); |
|
471 |
/// System.out.println("set-----------"+sk[i]+"--"+sym.getDescription()+"---"+sym.getColor()); |
|
472 |
//} catch (SemanticException e) { |
|
473 |
// e.printStackTrace(); |
|
474 |
//} |
|
475 |
} |
|
476 |
} |
|
477 |
|
|
478 |
} |
|
479 |
private Value getValue(String s) { |
|
480 |
Value val = new NullUniqueValue(); |
|
481 |
try { |
|
482 |
try { |
|
483 |
val = ValueFactory.createValueByType(s, Types.INTEGER); |
|
489 |
for (int i = 0; i < numKeys; i++) { |
|
490 |
//try { |
|
491 |
boolean isDefault = false; |
|
484 | 492 |
|
485 |
return val;
|
|
486 |
} catch (NumberFormatException e) {
|
|
487 |
}
|
|
493 |
if (getValue(sk[i]) == null) {
|
|
494 |
isDefault = true;
|
|
495 |
}
|
|
488 | 496 |
|
489 |
try { |
|
490 |
val = ValueFactory.createValueByType(s, Types.BIGINT); |
|
497 |
if (className.equals( |
|
498 |
"com.hardcode.gdbms.engine.values.NullUniqueValue") || |
|
499 |
isDefault) { |
|
500 |
auxValue = new NullUniqueValue(); |
|
501 |
auxValue2 = ValueFactory.createNullValue(); |
|
502 |
} else { |
|
503 |
auxValue = getValue(sk[i]); //ValueFactory.createValue(sk[i], className); |
|
504 |
auxValue2 = getValue(sv[i]); // ValueFactory.createValue(sv[i], className); |
|
505 |
} |
|
491 | 506 |
|
492 |
return val; |
|
493 |
} catch (NumberFormatException e) { |
|
494 |
} |
|
507 |
FSymbol sym = FSymbol.createFromXML(xml.getChild(i + 1)); |
|
495 | 508 |
|
496 |
try { |
|
497 |
val = ValueFactory.createValueByType(s, Types.FLOAT); |
|
509 |
///addSymbol(auxValue, sym); |
|
510 |
symbols.put(auxValue2, sym); |
|
511 |
keys.add(auxValue); |
|
498 | 512 |
|
499 |
return val; |
|
500 |
} catch (NumberFormatException e) { |
|
501 |
} |
|
513 |
///System.out.println("---set------"+auxValue.toString()); |
|
514 |
/// System.out.println("set-----------"+sk[i]+"--"+sym.getDescription()+"---"+sym.getColor()); |
|
515 |
//} catch (SemanticException e) { |
|
516 |
// e.printStackTrace(); |
|
517 |
//} |
|
518 |
} |
|
519 |
} |
|
520 |
} |
|
502 | 521 |
|
503 |
try { |
|
504 |
val = ValueFactory.createValueByType(s, Types.DOUBLE); |
|
522 |
/** |
|
523 |
* Devuelve el valor a partir de su valor en un string. |
|
524 |
* |
|
525 |
* @param s String con el valor. |
|
526 |
* |
|
527 |
* @return Value. |
|
528 |
*/ |
|
529 |
private Value getValue(String s) { |
|
530 |
Value val = new NullUniqueValue(); |
|
531 |
if (s.equals("Resto de Valores"))return val; |
|
532 |
try { |
|
533 |
try { |
|
534 |
val = ValueFactory.createValueByType(s, Types.INTEGER); |
|
505 | 535 |
|
506 |
return val;
|
|
507 |
} catch (NumberFormatException e) {
|
|
508 |
}
|
|
536 |
return val;
|
|
537 |
} catch (NumberFormatException e) {
|
|
538 |
}
|
|
509 | 539 |
|
510 |
val = ValueFactory.createValueByType(s, Types.LONGVARCHAR); |
|
511 |
} catch (ParseException e) { |
|
512 |
e.printStackTrace(); |
|
513 |
} |
|
514 |
return val; |
|
515 |
} |
|
540 |
try { |
|
541 |
val = ValueFactory.createValueByType(s, Types.BIGINT); |
|
516 | 542 |
|
543 |
return val; |
|
544 |
} catch (NumberFormatException e) { |
|
545 |
} |
|
517 | 546 |
|
518 |
/** |
|
519 |
* @see com.iver.cit.gvsig.fmap.rendering.Legend#cloneLegend() |
|
520 |
*/ |
|
521 |
public Legend cloneLegend() throws XMLException { |
|
522 |
return (Legend) LegendFactory.createFromXML(getXMLEntity()); |
|
523 |
} |
|
547 |
try { |
|
548 |
val = ValueFactory.createValueByType(s, Types.FLOAT); |
|
524 | 549 |
|
525 |
/* (non-Javadoc) |
|
526 |
* @see com.iver.cit.gvsig.fmap.rendering.VectorialLegend#setDataSource(com.hardcode.gdbms.engine.data.DataSource) |
|
527 |
*/ |
|
528 |
public void setDataSource(DataSource ds) |
|
529 |
throws FieldNotFoundException, DriverException { |
|
530 |
try { |
|
531 |
dataSource = ds; |
|
532 |
ds.start(); |
|
533 |
fieldId = ds.getFieldIndexByName(fieldName); |
|
534 |
ds.stop(); |
|
535 |
} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) { |
|
536 |
throw new DriverException(e); |
|
537 |
} |
|
538 |
} |
|
550 |
return val; |
|
551 |
} catch (NumberFormatException e) { |
|
552 |
} |
|
539 | 553 |
|
540 |
/* (non-Javadoc) |
|
541 |
* @see com.iver.cit.gvsig.fmap.rendering.UniqueValueLegend#getSymbolByValue(com.hardcode.gdbms.engine.values.Value) |
|
542 |
*/ |
|
543 |
public FSymbol getSymbolByValue(Value key) { |
|
544 |
if (symbols.containsKey(key)) { |
|
545 |
return (FSymbol) symbols.get(key); |
|
546 |
}else if (useDefaultSymbol){ |
|
547 |
return getDefaultSymbol(); |
|
548 |
} |
|
549 |
return null; |
|
550 |
} |
|
554 |
try { |
|
555 |
val = ValueFactory.createValueByType(s, Types.DOUBLE); |
|
551 | 556 |
|
552 |
/* (non-Javadoc) |
|
553 |
* @see com.iver.cit.gvsig.fmap.rendering.VectorialLegend#getShapeType() |
|
554 |
*/ |
|
555 |
public int getShapeType() { |
|
556 |
return shapeType; |
|
557 |
} |
|
557 |
return val; |
|
558 |
} catch (NumberFormatException e) { |
|
559 |
} |
|
560 |
|
|
561 |
val = ValueFactory.createValueByType(s, Types.LONGVARCHAR); |
|
562 |
|
|
563 |
} catch (ParseException e) { |
|
564 |
e.printStackTrace(); |
|
565 |
} |
|
558 | 566 |
|
559 |
/* (non-Javadoc) |
|
560 |
* @see com.iver.cit.gvsig.fmap.rendering.VectorialLegend#getLabelHeightField() |
|
561 |
*/ |
|
562 |
public String getLabelHeightField() { |
|
563 |
return labelFieldHeight; |
|
564 |
} |
|
567 |
return val; |
|
568 |
} |
|
565 | 569 |
|
566 |
/** |
|
567 |
* Inserta el alto de campo. |
|
568 |
* |
|
569 |
* @param str alto. |
|
570 |
*/ |
|
571 |
public void setLabelHeightField(String str) { |
|
572 |
labelFieldHeight = str; |
|
573 |
} |
|
570 |
/** |
|
571 |
* @see com.iver.cit.gvsig.fmap.rendering.Legend#cloneLegend() |
|
572 |
*/ |
|
573 |
public Legend cloneLegend() throws XMLException { |
|
574 |
return (Legend) LegendFactory.createFromXML(getXMLEntity()); |
|
575 |
} |
|
574 | 576 |
|
575 |
/* (non-Javadoc) |
|
576 |
* @see com.iver.cit.gvsig.fmap.rendering.VectorialLegend#getLabelRotationField() |
|
577 |
*/ |
|
578 |
public String getLabelRotationField() { |
|
579 |
return labelFieldRotation; |
|
580 |
} |
|
577 |
/* (non-Javadoc) |
|
578 |
* @see com.iver.cit.gvsig.fmap.rendering.VectorialLegend#setDataSource(com.hardcode.gdbms.engine.data.DataSource) |
|
579 |
*/ |
|
580 |
public void setDataSource(DataSource ds) |
|
581 |
throws FieldNotFoundException, DriverException { |
|
582 |
try { |
|
583 |
dataSource = ds; |
|
584 |
ds.start(); |
|
585 |
fieldId = ds.getFieldIndexByName(fieldName); |
|
586 |
ds.stop(); |
|
587 |
} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) { |
|
588 |
throw new DriverException(e); |
|
589 |
} |
|
590 |
} |
|
581 | 591 |
|
582 |
/** |
|
583 |
* Inserta rotaci?n. |
|
584 |
* |
|
585 |
* @param str Rotaci?n. |
|
586 |
*/ |
|
587 |
public void setLabelRotationField(String str) { |
|
588 |
labelFieldRotation = str; |
|
589 |
} |
|
592 |
/* (non-Javadoc) |
|
593 |
* @see com.iver.cit.gvsig.fmap.rendering.UniqueValueLegend#getSymbolByValue(com.hardcode.gdbms.engine.values.Value) |
|
594 |
*/ |
|
595 |
public FSymbol getSymbolByValue(Value key) { |
|
596 |
if (symbols.containsKey(key)) { |
|
597 |
return (FSymbol) symbols.get(key); |
|
598 |
} else if (useDefaultSymbol) { |
|
599 |
return getDefaultSymbol(); |
|
600 |
} |
|
590 | 601 |
|
591 |
public void useDefaultSymbol(boolean b) { |
|
592 |
useDefaultSymbol=b; |
|
593 |
} |
|
602 |
return null; |
|
603 |
} |
|
594 | 604 |
|
595 |
public boolean isBWithHeightText() { |
|
596 |
return bWithHeightText; |
|
597 |
} |
|
605 |
/* (non-Javadoc) |
|
606 |
* @see com.iver.cit.gvsig.fmap.rendering.VectorialLegend#getShapeType() |
|
607 |
*/ |
|
608 |
public int getShapeType() { |
|
609 |
return shapeType; |
|
610 |
} |
|
598 | 611 |
|
599 |
public void setBWithHeightText(boolean withHeightText) { |
|
600 |
bWithHeightText = withHeightText; |
|
601 |
} |
|
612 |
/* (non-Javadoc) |
|
613 |
* @see com.iver.cit.gvsig.fmap.rendering.VectorialLegend#getLabelHeightField() |
|
614 |
*/ |
|
615 |
public String getLabelHeightField() { |
|
616 |
return labelFieldHeight; |
|
617 |
} |
|
618 |
|
|
619 |
/** |
|
620 |
* Inserta el alto de campo. |
|
621 |
* |
|
622 |
* @param str alto. |
|
623 |
*/ |
|
624 |
public void setLabelHeightField(String str) { |
|
625 |
labelFieldHeight = str; |
|
626 |
} |
|
627 |
|
|
628 |
/* (non-Javadoc) |
|
629 |
* @see com.iver.cit.gvsig.fmap.rendering.VectorialLegend#getLabelRotationField() |
|
630 |
*/ |
|
631 |
public String getLabelRotationField() { |
|
632 |
return labelFieldRotation; |
|
633 |
} |
|
634 |
|
|
635 |
/** |
|
636 |
* Inserta rotaci?n. |
|
637 |
* |
|
638 |
* @param str Rotaci?n. |
|
639 |
*/ |
|
640 |
public void setLabelRotationField(String str) { |
|
641 |
labelFieldRotation = str; |
|
642 |
} |
|
643 |
|
|
644 |
/** |
|
645 |
* Introduce si se tiene que representar el resto de valores o no. |
|
646 |
* |
|
647 |
* @param b True si se utiliza el resto de valores. |
|
648 |
*/ |
|
649 |
public void useDefaultSymbol(boolean b) { |
|
650 |
useDefaultSymbol = b; |
|
651 |
} |
|
652 |
/** |
|
653 |
* Devuelve si se utiliza o no el resto de valores para representarse. |
|
654 |
* |
|
655 |
* @return True si se utiliza el resto de valores. |
|
656 |
*/ |
|
657 |
public boolean isUseDefaultSymbol() { |
|
658 |
return useDefaultSymbol; |
|
659 |
} |
|
660 |
/** |
|
661 |
* Devuelve true si el etiquetado de la capa se ha modificado. |
|
662 |
* |
|
663 |
* @return True si se ha modificado el etiquetado de la capa. |
|
664 |
*/ |
|
665 |
public boolean isBWithHeightText() { |
|
666 |
return bWithHeightText; |
|
667 |
} |
|
668 |
|
|
669 |
/** |
|
670 |
* Introduce si se ha modificado el etiquetado de la capa. |
|
671 |
* |
|
672 |
* @param withHeightText True si se ha modificado el etiquetado de la capa. |
|
673 |
*/ |
|
674 |
public void setBWithHeightText(boolean withHeightText) { |
|
675 |
bWithHeightText = withHeightText; |
|
676 |
} |
|
677 |
|
|
678 |
/** |
|
679 |
* Elimina el s?mbolo que tiene como clave el valor que se pasa como par?metro. |
|
680 |
* |
|
681 |
* @param key clave. |
|
682 |
*/ |
|
683 |
public void delSymbol(Object key) { |
|
684 |
keys.remove(key); |
|
685 |
symbols.remove(key); |
|
686 |
} |
|
602 | 687 |
} |
Also available in: Unified diff