Revision 10436 branches/simbologia/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/LabeledTestFLayer.java
LabeledTestFLayer.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.1.2.5 2007-02-15 16:23:44 jaume |
|
46 |
* Revision 1.1.2.6 2007-02-21 07:34:09 jaume |
|
47 |
* labeling starts working |
|
48 |
* |
|
49 |
* Revision 1.1.2.5 2007/02/15 16:23:44 jaume |
|
47 | 50 |
* *** empty log message *** |
48 | 51 |
* |
49 | 52 |
* Revision 1.1.2.4 2007/02/09 07:47:05 jaume |
... | ... | |
64 | 67 |
|
65 | 68 |
import java.awt.Graphics2D; |
66 | 69 |
import java.awt.image.BufferedImage; |
70 |
import java.util.logging.Logger; |
|
67 | 71 |
|
68 | 72 |
import com.iver.cit.gvsig.fmap.DriverException; |
69 | 73 |
import com.iver.cit.gvsig.fmap.ViewPort; |
... | ... | |
71 | 75 |
import com.iver.cit.gvsig.fmap.rendering.styling.ILabelingMethod; |
72 | 76 |
import com.iver.cit.gvsig.fmap.rendering.styling.ILabelingStrategy; |
73 | 77 |
import com.iver.cit.gvsig.fmap.rendering.styling.LabelingFactory; |
78 |
import com.iver.utiles.NotExistInXMLEntity; |
|
74 | 79 |
import com.iver.utiles.XMLEntity; |
75 | 80 |
import com.iver.utiles.swing.threads.Cancellable; |
76 | 81 |
|
... | ... | |
79 | 84 |
*/ |
80 | 85 |
public class LabeledTestFLayer extends FLyrVect implements ILabelable { |
81 | 86 |
|
82 |
private static final String PROPERTY_LOCATOR = "Property locator"; |
|
83 |
/** |
|
84 |
* @uml.property name="isLabeled" |
|
85 |
*/ |
|
86 | 87 |
private boolean isLabeled; |
87 |
private ILabelingMethod method; |
|
88 | 88 |
private ILabelingStrategy strategy; |
89 | 89 |
|
90 | 90 |
public LabeledTestFLayer() { |
... | ... | |
121 | 121 |
xml.remove("className"); |
122 | 122 |
xml.putProperty("className", getClass().getName()); |
123 | 123 |
xml.putProperty("isLabeled", isLabeled); |
124 |
|
|
125 |
if (method != null) { |
|
126 |
XMLEntity methodXML = method.getXMLEntity(); |
|
127 |
methodXML.putProperty("Method", PROPERTY_LOCATOR); |
|
128 |
xml.addChild(methodXML); |
|
129 |
} |
|
130 |
|
|
124 |
|
|
131 | 125 |
if (strategy != null) { |
132 | 126 |
XMLEntity strategyXML = strategy.getXMLEntity(); |
133 |
strategyXML.putProperty("Strategy", PROPERTY_LOCATOR);
|
|
127 |
strategyXML.putProperty("Strategy", strategy.getClassName());
|
|
134 | 128 |
xml.addChild(strategy.getXMLEntity()); |
135 | 129 |
} |
136 | 130 |
return xml; |
... | ... | |
138 | 132 |
|
139 | 133 |
public void setXMLEntity(XMLEntity xml) throws XMLException { |
140 | 134 |
super.setXMLEntity(xml); |
141 |
int i; |
|
142 |
if ((i = xml.firstIndexOfChild("Method", PROPERTY_LOCATOR))>0) { |
|
143 |
this.method = LabelingFactory.createMethodFromXML(xml.getChild(i)); |
|
135 |
|
|
136 |
|
|
137 |
for (int i = 0; i < xml.getChildrenCount(); i++) { |
|
138 |
try { |
|
139 |
xml.getChild(i).getStringProperty("Strategy"); |
|
140 |
this.strategy = LabelingFactory.createStrategyFromXML(xml.getChild(i)); |
|
141 |
} catch (NotExistInXMLEntity neXMLEX) { |
|
142 |
// no strategy was set, just continue; |
|
143 |
Logger.getAnonymousLogger().warning("Reached what should be unreachable code"); |
|
144 |
} |
|
144 | 145 |
} |
145 |
if ((i = xml.firstIndexOfChild("Strategy", PROPERTY_LOCATOR))>0) { |
|
146 |
this.strategy = LabelingFactory.createStrategyFromXML(xml.getChild(i)); |
|
147 |
} |
|
148 | 146 |
|
149 | 147 |
} |
150 | 148 |
|
Also available in: Unified diff