Revision 2183 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/VectorialIntervalLegend.java
VectorialIntervalLegend.java | ||
---|---|---|
50 | 50 |
|
51 | 51 |
import com.iver.cit.gvsig.fmap.DriverException; |
52 | 52 |
import com.iver.cit.gvsig.fmap.core.FShape; |
53 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
|
53 | 54 |
import com.iver.cit.gvsig.fmap.core.v02.FConstant; |
54 | 55 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
55 | 56 |
import com.iver.cit.gvsig.fmap.layers.XMLException; |
... | ... | |
166 | 167 |
throw new DriverException(e); |
167 | 168 |
} |
168 | 169 |
} |
170 |
public FSymbol getSymbolByFeature(IFeature feat) { |
|
171 |
Value val = feat.getAttribute(fieldId); |
|
172 |
FInterval interval = getInterval(val); |
|
173 |
FSymbol theSymbol = getSymbolByInterval(interval); |
|
169 | 174 |
|
175 |
if (theSymbol != null) { |
|
176 |
return theSymbol; |
|
177 |
} else { |
|
178 |
return getDefaultSymbol(); |
|
179 |
} |
|
180 |
} |
|
181 |
|
|
170 | 182 |
/** |
171 | 183 |
* Devuelve el s?mbolo a partir del intervalo. |
172 | 184 |
* |
... | ... | |
341 | 353 |
* |
342 | 354 |
* @param xml XMLEntity. |
343 | 355 |
*/ |
356 |
public void setXMLEntity03(XMLEntity xml) { |
|
357 |
fieldName = xml.getStringProperty("fieldName"); |
|
358 |
index = xml.getIntProperty("index"); |
|
359 |
labelFieldName = xml.getStringProperty("labelfield"); |
|
360 |
|
|
361 |
int useDefaultSymbol = xml.getIntProperty("useDefaultSymbol"); |
|
362 |
|
|
363 |
if (useDefaultSymbol == 1) { |
|
364 |
setDefaultSymbol(FSymbol.createFromXML03(xml.getChild(0))); |
|
365 |
} else { |
|
366 |
setDefaultSymbol(null); |
|
367 |
} |
|
368 |
|
|
369 |
int numKeys = xml.getIntProperty("numKeys"); |
|
370 |
|
|
371 |
if (numKeys > 0) { |
|
372 |
String className = xml.getStringProperty("tipoValueKeys"); |
|
373 |
String[] sk = xml.getStringArrayProperty("keys"); |
|
374 |
FInterval auxInterval; |
|
375 |
|
|
376 |
for (int i = 0; i < numKeys; i++) { |
|
377 |
auxInterval = FInterval.create(sk[i]); |
|
378 |
symbols.put(auxInterval, |
|
379 |
FSymbol.createFromXML03(xml.getChild(i + useDefaultSymbol))); |
|
380 |
keys.add(auxInterval); |
|
381 |
System.out.println("auxInterval =" + auxInterval + "Symbol =" + |
|
382 |
FSymbol.createFromXML03(xml.getChild(i + useDefaultSymbol)) |
|
383 |
.getDescription()); |
|
384 |
} |
|
385 |
} |
|
386 |
|
|
387 |
startColor = StringUtilities.string2Color(xml.getStringProperty( |
|
388 |
"startColor")); |
|
389 |
endColor = StringUtilities.string2Color(xml.getStringProperty( |
|
390 |
"endColor")); |
|
391 |
} |
|
392 |
|
|
393 |
/** |
|
394 |
* Inserta los atributos del XMLEntity. |
|
395 |
* |
|
396 |
* @param xml XMLEntity. |
|
397 |
*/ |
|
344 | 398 |
public void setXMLEntity(XMLEntity xml) { |
345 | 399 |
fieldName = xml.getStringProperty("fieldName"); |
346 | 400 |
index = xml.getIntProperty("index"); |
... | ... | |
531 | 585 |
public void setLabelRotationField(String str) { |
532 | 586 |
labelFieldRotation = str; |
533 | 587 |
} |
588 |
|
|
534 | 589 |
} |
Also available in: Unified diff