Revision 13749 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/MultiLayerLineSymbol.java
MultiLayerLineSymbol.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.13 2007-09-17 09:33:47 jaume |
|
46 |
* Revision 1.14 2007-09-17 14:16:11 jaume |
|
47 |
* multilayer symbols sizing bug fixed |
|
48 |
* |
|
49 |
* Revision 1.13 2007/09/17 09:33:47 jaume |
|
47 | 50 |
* some multishapedsymbol bugs fixed |
48 | 51 |
* |
49 | 52 |
* Revision 1.12 2007/08/09 08:04:48 jvidal |
... | ... | |
120 | 123 |
ILineSymbol, IMultiLayerSymbol { |
121 | 124 |
private ILineSymbol[] layers = new ILineSymbol[0]; |
122 | 125 |
private ILineSymbol selectionSymbol; |
126 |
private double width; |
|
123 | 127 |
|
124 | 128 |
public Color getColor() { |
125 | 129 |
/* |
... | ... | |
138 | 142 |
} |
139 | 143 |
|
140 | 144 |
public double getLineWidth() { |
141 |
/* |
|
142 |
* will return the widest symbol's width |
|
143 |
*/ |
|
144 |
double width = Double.NEGATIVE_INFINITY; |
|
145 |
for (int i = 0; i < layers.length; i++) { |
|
146 |
width = Math.max(width, layers[i].getLineWidth()); |
|
147 |
} |
|
148 | 145 |
return width; |
149 | 146 |
} |
150 | 147 |
|
... | ... | |
171 | 168 |
* extract a factor scale that will be applied |
172 | 169 |
* to each layer. |
173 | 170 |
*/ |
174 |
double myWidth = getLineWidth(); |
|
175 |
double scaleFactor = width / myWidth; |
|
176 |
for (int i = 0; i < layers.length; i++) { |
|
177 |
layers[i].setLineWidth(layers[i].getLineWidth()*scaleFactor); |
|
171 |
if (width > 0) { |
|
172 |
double scaleFactor = width / getLineWidth(); |
|
173 |
this.width = width; |
|
174 |
for (int i = 0; i < layers.length; i++) { |
|
175 |
layers[i].setLineWidth(layers[i].getLineWidth()*scaleFactor); |
|
176 |
} |
|
178 | 177 |
} |
179 | 178 |
} |
180 | 179 |
|
... | ... | |
218 | 217 |
xml.putProperty("className", getClass().getName()); |
219 | 218 |
xml.putProperty("isShapeVisible", isShapeVisible()); |
220 | 219 |
xml.putProperty("desc", getDescription()); |
220 |
xml.putProperty("lineWidth", getLineWidth()); |
|
221 |
xml.putProperty("unit", getUnit()); |
|
222 |
xml.putProperty("referenceSystem", getReferenceSystem()); |
|
221 | 223 |
for (int i = 0; i < layers.length; i++) { |
222 | 224 |
xml.addChild(layers[i].getXMLEntity()); |
223 | 225 |
} |
... | ... | |
235 | 237 |
public void setXMLEntity(XMLEntity xml) { |
236 | 238 |
setIsShapeVisible(xml.getBooleanProperty("isShapeVisible")); |
237 | 239 |
setDescription(xml.getStringProperty("desc")); |
240 |
setLineWidth(xml.getDoubleProperty("lineWidth")); |
|
241 |
setUnit(xml.getIntProperty("unit")); |
|
242 |
setReferenceSystem(xml.getIntProperty("referenceSystem")); |
|
238 | 243 |
layers = new ILineSymbol[xml.getChildrenCount()]; |
239 | 244 |
for (int i = 0; i < layers.length; i++) { |
240 | 245 |
layers[i] = (ILineSymbol) SymbologyFactory.createSymbolFromXML(xml.getChild(i), "layer" + i); |
... | ... | |
355 | 360 |
layers[i].setUnit(unitIndex); |
356 | 361 |
} |
357 | 362 |
} |
358 |
|
|
363 |
|
|
364 |
|
|
359 | 365 |
// public double computeCartographicSize(ViewPort viewPort, double dpi, FShape shp) { |
360 | 366 |
// double dpiScale = dpi/MapContext.getScreenDPI(); |
361 | 367 |
// int unit = getUnit(); |
Also available in: Unified diff