root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / rendering / SingleSymbolLegend.java @ 458
History | View | Annotate | Download (1.8 KB)
1 |
package com.iver.cit.gvsig.fmap.rendering; |
---|---|
2 |
|
3 |
|
4 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
5 |
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D; |
6 |
import com.iver.utiles.XMLEntity; |
7 |
|
8 |
|
9 |
|
10 |
public class SingleSymbolLegend implements VectorialLegend, Legend { |
11 |
|
12 |
private FSymbol symbol;
|
13 |
private int labelField = -1; |
14 |
|
15 |
public SingleSymbolLegend(FSymbol style){
|
16 |
symbol = style; |
17 |
} |
18 |
public SingleSymbolLegend(){
|
19 |
symbol = LegendFactory.DEFAULT_POLYGON_SYMBOL; |
20 |
} |
21 |
/**
|
22 |
* @see com.iver.cit.gvsig.fmap.rendering.Legend#setDefaultSymbol(FStyle2D)
|
23 |
*/
|
24 |
public void setDefaultSymbol(FSymbol s) { |
25 |
symbol = s; |
26 |
} |
27 |
|
28 |
/**
|
29 |
* @see com.iver.cit.gvsig.fmap.rendering.Legend#getLabelField()
|
30 |
*/
|
31 |
public int getLabelField() { |
32 |
return labelField;
|
33 |
} |
34 |
|
35 |
/**
|
36 |
* @see com.iver.cit.gvsig.fmap.rendering.Legend#setLabelField(int)
|
37 |
*/
|
38 |
public void setLabelField(int fieldIndex) { |
39 |
labelField = fieldIndex; |
40 |
} |
41 |
|
42 |
/**
|
43 |
* @see com.iver.cit.gvsig.fmap.rendering.Legend#getSymbol(int)
|
44 |
*/
|
45 |
public FSymbol getSymbol(int recordIndex) { |
46 |
return symbol;
|
47 |
} |
48 |
|
49 |
/**
|
50 |
* @see com.iver.cit.gvsig.fmap.rendering.Legend#getDefaultSymbol()
|
51 |
*/
|
52 |
public FSymbol getDefaultSymbol() {
|
53 |
return symbol;
|
54 |
} |
55 |
/**
|
56 |
* @see com.iver.cit.gvsig.fmap.rendering.Legend#getXMLEntity()
|
57 |
*/
|
58 |
public XMLEntity getXMLEntity() {
|
59 |
XMLEntity xml=new XMLEntity();
|
60 |
xml.putProperty("nameClass",this.getClass().getName()); |
61 |
xml.putProperty("labelField",labelField);
|
62 |
//TODO symbol
|
63 |
return xml;
|
64 |
} |
65 |
|
66 |
public void setXMLEntity(XMLEntity xml){ |
67 |
|
68 |
//TODO setDefaultSymbol(FStyle2D.createFromXML(xml));
|
69 |
setLabelField(xml.getIntProperty("labelField"));
|
70 |
} |
71 |
|
72 |
/**
|
73 |
* @see com.iver.cit.gvsig.fmap.rendering.Legend#cloner()
|
74 |
*/
|
75 |
public Legend cloner() throws ClassNotFoundException, InstantiationException, IllegalAccessException { |
76 |
return (Legend)LegendFactory.createFromXML(getXMLEntity());
|
77 |
} |
78 |
|
79 |
} |