Revision 9923
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/MapContext.java | ||
---|---|---|
340 | 340 |
* @throws XMLException |
341 | 341 |
*/ |
342 | 342 |
public MapContext cloneFMap() throws XMLException { |
343 |
return createFromXML(getXMLEntity()); |
|
343 |
ViewPort vp = getViewPort().cloneViewPort(); |
|
344 |
FLayers antLayers = getLayers(); |
|
345 |
MapContext ret = new MapContext(vp); |
|
346 |
FLayers aux = new FLayers(ret, null); |
|
347 |
for (int i=0; i < antLayers.getLayersCount(); i++) |
|
348 |
{ |
|
349 |
FLayer lyr = antLayers.getLayer(i); |
|
350 |
try { |
|
351 |
aux.addLayer(lyr.cloneLayer()); |
|
352 |
} catch (Exception e) { |
|
353 |
// TODO Auto-generated catch block |
|
354 |
e.printStackTrace(); |
|
355 |
} |
|
356 |
} |
|
357 |
ret.layers = aux; |
|
358 |
return ret; |
|
359 |
|
|
360 |
// return createFromXML(getXMLEntity()); |
|
361 |
|
|
344 | 362 |
} |
345 | 363 |
public MapContext cloneToDraw() { |
346 | 364 |
ViewPort vp = getViewPort().cloneViewPort(); |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrDefault.java | ||
---|---|---|
762 | 762 |
public boolean isWritable() { |
763 | 763 |
return status.writable; |
764 | 764 |
} |
765 |
|
|
766 |
/* (non-Javadoc) |
|
767 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#cloneLayer() |
|
768 |
*/ |
|
769 |
public FLayer cloneLayer() throws Exception { |
|
770 |
return this; |
|
771 |
} |
|
765 | 772 |
|
766 | 773 |
|
767 | 774 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLayer.java | ||
---|---|---|
396 | 396 |
public boolean isWritable(); |
397 | 397 |
|
398 | 398 |
/** |
399 |
* This method can be used to have a fast cloned layer. The implementations should take care of |
|
400 |
* NOT recreate the layer. Instead of this, is better to use the same source (driver) and deepclone |
|
401 |
* the legend. Exception=> the labels aren't deepcloned to avoid memory consumption. |
|
402 |
* Note: Labels are memory consuming to speed up layers like PostGIS and so on. |
|
403 |
* @return clonedLayer |
|
404 |
* @throws Exception |
|
405 |
*/ |
|
406 |
public FLayer cloneLayer() throws Exception; |
|
407 |
|
|
408 |
|
|
409 |
/** |
|
399 | 410 |
* Useful to associate any object to a layer. For example, you |
400 | 411 |
* can attach a network definition to key "network" and |
401 | 412 |
* check if a layer has a network loaded if getAssociatedObject("network") |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrVect.java | ||
---|---|---|
1386 | 1386 |
|
1387 | 1387 |
} |
1388 | 1388 |
|
1389 |
public FLayer cloneLayer() throws Exception { |
|
1390 |
FLyrVect clonedLayer = new FLyrVect(); |
|
1391 |
clonedLayer.setSource(getSource()); |
|
1392 |
clonedLayer.setVisible(isVisible()); |
|
1393 |
clonedLayer.setISpatialIndex(getISpatialIndex()); |
|
1394 |
clonedLayer.setName(getName()); |
|
1395 |
clonedLayer.setCoordTrans(getCoordTrans()); |
|
1396 |
|
|
1397 |
if (legend.getLabelField() != null) // Hay etiquetas |
|
1398 |
{ |
|
1399 |
FLyrText lyrText = getLayerText(); |
|
1400 |
String antLabelField = legend.getLabelField(); |
|
1401 |
VectorialLegend clonedLegend = (VectorialLegend) legend.cloneLegend(); |
|
1402 |
clonedLegend.setLabelField(null); |
|
1403 |
clonedLayer.setLegend(clonedLegend); |
|
1404 |
clonedLayer.setLayerText(lyrText); |
|
1405 |
clonedLegend.setLabelField(antLabelField); |
|
1406 |
|
|
1407 |
} |
|
1408 |
else |
|
1409 |
clonedLayer.setLegend((VectorialLegend)getLegend()); |
|
1410 |
return clonedLayer; |
|
1411 |
} |
|
1412 |
|
|
1389 | 1413 |
} |
Also available in: Unified diff