Revision 41853
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/FLayer.java | ||
---|---|---|
53 | 53 |
|
54 | 54 |
|
55 | 55 |
/** |
56 |
* <p>Definition of the basic functionality that all kind of <i>FMap</i> layers should implement.</p>
|
|
57 |
* |
|
58 |
* <p>This kind of layers store their data, are drawable, projectable (with a projection), can be a node of a tree of layers, and
|
|
59 |
* could be editable and have a cache with previous draws. They also can be visible or not, and active or not.</p>
|
|
60 |
* |
|
61 |
* <p>A layer can also store information about errors produced working with it, and have a name (kind of layer) and
|
|
62 |
* a brief summary explaining what's for.</p>
|
|
63 |
* |
|
64 |
* <p>Each particular implementation can add new properties, and limit or expand the functionality.</p>
|
|
65 |
* |
|
56 |
* Definition of the basic functionality that all kind of layers should implement.
|
|
57 |
* <br>
|
|
58 |
* This kind of layers store their data, are drawable, projectable (with a projection), can be a node of a tree of layers, and |
|
59 |
* could be editable and have a cache with previous draws. They also can be visible or not, and active or not.
|
|
60 |
* <br>
|
|
61 |
* A layer can also store information about errors produced working with it, and have a name (kind of layer) and |
|
62 |
* a brief summary explaining what's for.
|
|
63 |
* <br>
|
|
64 |
* Each particular implementation can add new properties, and limit or expand the functionality.</p
|
|
65 |
* <br>
|
|
66 | 66 |
* @see Projected |
67 | 67 |
*/ |
68 | 68 |
public interface FLayer extends Projected, Persistent, Metadata, Disposable, ExtendedPropertiesSupport |
... | ... | |
73 | 73 |
public static final String METADATA_CRS = DataStore.METADATA_CRS; |
74 | 74 |
public static final String METADATA_NAME = "name"; |
75 | 75 |
|
76 |
|
|
77 |
// /** |
|
78 |
// * <p>Returns an entity that represents this layer.</p> |
|
79 |
// * |
|
80 |
// * <p>This XML entity has elements that represent and store information about this layer.</p> |
|
81 |
// * |
|
82 |
// * @return an XML entity with information of this layer |
|
83 |
// * @throws XMLException if there is an error obtaining the object. |
|
84 |
// * |
|
85 |
// * @see #setXMLEntity(XMLEntity) |
|
86 |
// * @see #setXMLEntity03(XMLEntity) |
|
87 |
// */ |
|
88 |
// XMLEntity getXMLEntity() throws XMLException; |
|
89 |
// |
|
90 |
// /** |
|
91 |
// * <p>Inserts information to this layer from an XML entity.</p> |
|
92 |
// * |
|
93 |
// * <p>This XML entity has elements that represent and store information about this layer.</p> |
|
94 |
// * |
|
95 |
// * @param xml an <code>XMLEntity</code> with the information |
|
96 |
// * |
|
97 |
// * @throws XMLException if there is an error setting the object. |
|
98 |
// * |
|
99 |
// * @see #getXMLEntity() |
|
100 |
// * @see #setXMLEntity03(XMLEntity) |
|
101 |
// */ |
|
102 |
// void setXMLEntity(XMLEntity xml) throws XMLException; |
|
103 |
|
|
104 | 76 |
/** |
105 | 77 |
* <p>Changes the status of this layer to active or inactive.</p> |
106 | 78 |
* <p>One layer is active if is selected in TOC.</p> |
... | ... | |
143 | 115 |
* <p>Executes the initialization operations of this layer. This method is invoked |
144 | 116 |
* only one time during the life of this layer and just before visualize it.</p> |
145 | 117 |
* |
146 |
* @throws org.gvsig.fmap.drivers.reading.DriverIOException if fails loading the layer.
|
|
118 |
* @throws LoadLayerException if fails loading the layer.
|
|
147 | 119 |
* |
148 | 120 |
* @see #reload() |
149 | 121 |
*/ |
... | ... | |
339 | 311 |
* @see #getMaxScale() |
340 | 312 |
*/ |
341 | 313 |
public void setMaxScale(double maxScale); |
342 |
/** |
|
343 |
* <p>Changes the status of this layer to editable or not.</p> |
|
344 |
* <p>One layer is editable if user can modify its information with graphical tools.</p> |
|
345 |
* |
|
346 |
* @param b the boolean to be set |
|
347 |
* |
|
348 |
* @throws com.iver.cit.gvsig.fmap.edition.EditionException if fails enabling for edition this kind of layer. |
|
349 |
* |
|
350 |
* @see #isEditing() |
|
351 |
* @deprecated Editing status is managed internally by layer, cannot be assigned here. |
|
352 |
*/ |
|
353 |
public void setEditing(boolean b) throws StartEditionLayerException; |
|
354 |
/** |
|
314 |
|
|
315 |
/** |
|
355 | 316 |
* <p>Returns if this layer is editable.</p> |
356 | 317 |
* <p>One layer is editable if user can modify its information with graphical tools.</p> |
357 | 318 |
* |
... | ... | |
432 | 393 |
/** |
433 | 394 |
* Adds an error reason that describes this layer's wrong status. |
434 | 395 |
* |
435 |
* @param error
|
|
396 |
* @param exception
|
|
436 | 397 |
* a <code>BaseException</code> with the information of the error |
437 | 398 |
* |
438 | 399 |
* @see #getNumErrors() |
... | ... | |
454 | 415 |
* <p>Changes the status of availability of this layer.</p> |
455 | 416 |
* <p>One layer is available if the source of data is on-line.</p> |
456 | 417 |
* |
457 |
* @param the boolean to be set |
|
418 |
* @param available the boolean to be set
|
|
458 | 419 |
* |
459 | 420 |
* @see #isAvailable() |
460 | 421 |
*/ |
... | ... | |
547 | 508 |
*/ |
548 | 509 |
Image getTocStatusImage(); |
549 | 510 |
|
550 |
// M?todos para la utilizaci?n de HyperLinks |
|
511 |
/** |
|
512 |
* <p>Sets the projection to this layer.</p> |
|
513 |
* |
|
514 |
* @param proj information about the new projection |
|
515 |
* |
|
516 |
*/ |
|
517 |
public void setProjection(IProjection proj); |
|
518 |
|
|
519 |
public long getDrawVersion(); |
|
551 | 520 |
|
521 |
public boolean isTemporary(); |
|
522 |
|
|
523 |
public void setTemporary(boolean temporary); |
|
524 |
|
|
525 |
/** |
|
526 |
* Do nothing. |
|
527 |
* |
|
528 |
* @param b |
|
529 |
* @throws org.gvsig.fmap.mapcontext.exceptions.StartEditionLayerException |
|
530 |
* @deprecated Editing status is managed internally by layer, cannot be assigned here. |
|
531 |
*/ |
|
532 |
public void setEditing(boolean b) throws StartEditionLayerException; |
|
533 |
|
|
552 | 534 |
/** |
553 |
* Returns information about if the layer allows HyperLink or not |
|
554 |
* @return boolean true if allows Link, false if not |
|
535 |
* Alwais return false |
|
536 |
* @return false |
|
537 |
* @deprecated see https://redmine.gvsig.net/redmine/projects/gvsig-hyperlink |
|
555 | 538 |
*/ |
556 | 539 |
public boolean allowLinks(); |
557 | 540 |
|
558 | 541 |
/** |
559 |
* Returns an instance of AbstractLinkProperties that contains the information
|
|
560 |
* of the HyperLink
|
|
561 |
* @return Abstra
|
|
542 |
* Alwais return null.
|
|
543 |
* @return null
|
|
544 |
* @deprecated see https://redmine.gvsig.net/redmine/projects/gvsig-hyperlink
|
|
562 | 545 |
*/ |
563 | 546 |
public AbstractLinkProperties getLinkProperties(); |
564 | 547 |
|
565 | 548 |
/** |
566 |
* Provides an array with URIs. Returns one URI by geometry that includes the point |
|
567 |
* in its own geometry limits with a allowed tolerance. |
|
568 |
* @param layer, the layer |
|
569 |
* @param point, the point to check that is contained or not in the geometries in the layer |
|
570 |
* @param tolerance, the tolerance allowed. Allowed margin of error to detect if the point |
|
571 |
* is contained in some geometries of the layer |
|
572 |
* @return |
|
573 |
* @throws ReadException |
|
574 |
* @throws BehaviorException |
|
549 |
* alwais return null |
|
550 |
* |
|
551 |
* @param point |
|
552 |
* @param tolerance |
|
553 |
* @return null |
|
554 |
* @throws org.gvsig.fmap.dal.exception.ReadException |
|
555 |
* @deprecated see https://redmine.gvsig.net/redmine/projects/gvsig-hyperlink |
|
575 | 556 |
*/ |
576 | 557 |
public URI[] getLink(Point2D point, double tolerance) throws ReadException; |
577 | 558 |
|
578 | 559 |
|
579 |
/** |
|
580 |
* <p>Inserts the projection to this layer.</p> |
|
581 |
* |
|
582 |
* @param proj information about the new projection |
|
583 |
* |
|
584 |
*/ |
|
585 |
public void setProjection(IProjection proj); |
|
586 |
|
|
587 |
public long getDrawVersion(); |
|
588 |
|
|
560 |
|
|
589 | 561 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/FLyrDefault.java | ||
---|---|---|
94 | 94 |
|
95 | 95 |
private LayerChangeSupport layerChangeSupport = new LayerChangeSupport(); |
96 | 96 |
|
97 |
/** |
|
98 |
* Flag to set the layer as a temporary layer. |
|
99 |
*/ |
|
100 |
private boolean temporary; |
|
101 |
|
|
97 | 102 |
/** |
98 | 103 |
* Path to the upper layer which this layer belongs. |
99 | 104 |
* |
... | ... | |
785 | 790 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#getTocStatusImage() |
786 | 791 |
*/ |
787 | 792 |
public Image getTocStatusImage() { |
788 |
return tocStatusImage;
|
|
793 |
return tocStatusImage;
|
|
789 | 794 |
} |
790 | 795 |
|
791 | 796 |
/** |
... | ... | |
799 | 804 |
this.tocStatusImage = tocStatusImage; |
800 | 805 |
logger.debug("setTocStatusImage " + tocStatusImage + " sobre capa " + this.getName()); |
801 | 806 |
} |
802 |
/* |
|
803 |
* (non-Javadoc) |
|
804 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#newComposedLayer() |
|
805 |
*/ |
|
807 |
|
|
806 | 808 |
public ComposedLayer newComposedLayer() { |
807 | 809 |
return null; |
808 | 810 |
} |
809 | 811 |
|
810 |
/* |
|
811 |
* (non-Javadoc) |
|
812 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#allowLinks() |
|
813 |
*/ |
|
814 | 812 |
public boolean allowLinks() |
815 | 813 |
{ |
816 | 814 |
return false; |
817 | 815 |
} |
818 | 816 |
|
819 |
/* |
|
820 |
* (non-Javadoc) |
|
821 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#getLinkProperties() |
|
822 |
*/ |
|
823 | 817 |
public AbstractLinkProperties getLinkProperties() |
824 | 818 |
{ |
825 | 819 |
return null; |
826 | 820 |
} |
827 | 821 |
|
828 |
/* |
|
829 |
* (non-Javadoc) |
|
830 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#getLink(java.awt.geom.Point2D, double) |
|
831 |
*/ |
|
832 | 822 |
public URI[] getLink(Point2D point, double tolerance) throws ReadException{ |
833 | 823 |
return null; |
834 | 824 |
} |
835 | 825 |
|
836 |
/** |
|
837 |
* @see LayerChangeSupport#addLayerListener(LegendListener) |
|
838 |
*/ |
|
839 | 826 |
public void addLegendListener(LegendListener listener) { |
840 | 827 |
layerChangeSupport.addLayerListener(listener); |
841 | 828 |
} |
... | ... | |
1056 | 1043 |
public boolean hidesThisArea(Envelope area) { |
1057 | 1044 |
return false; |
1058 | 1045 |
} |
1046 |
|
|
1047 |
public boolean isTemporary() { |
|
1048 |
return this.temporary; |
|
1049 |
} |
|
1050 |
|
|
1051 |
public void setTemporary(boolean temporary) { |
|
1052 |
this.temporary = temporary; |
|
1053 |
} |
|
1059 | 1054 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/FLayerStatus.java | ||
---|---|---|
106 | 106 |
*/ |
107 | 107 |
public boolean cacheDrawnLayers; |
108 | 108 |
|
109 |
|
|
109 |
private boolean temporal = false; |
|
110 | 110 |
/** |
111 | 111 |
* <p>List with the information of the driver errors produced working this layer.</p> |
112 | 112 |
*/ |
113 |
private ArrayList layerErrors;
|
|
113 |
private List layerErrors; |
|
114 | 114 |
|
115 | 115 |
/** |
116 | 116 |
* <p>This state reports if the driver for managing the layer has been loaded successfully.</p> |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/FLayers.java | ||
---|---|---|
765 | 765 |
super.saveToState(state); |
766 | 766 |
|
767 | 767 |
state.set("mapContext", fmap); |
768 |
state.set("layers", layers); |
|
768 |
|
|
769 |
List layersToSave = new ArrayList(); |
|
770 |
Iterator iter = this.layers.iterator(); |
|
771 |
while (iter.hasNext()) { |
|
772 |
FLayer layer = (FLayer) iter.next(); |
|
773 |
if( !layer.isTemporary() ) { |
|
774 |
layersToSave.add(layer); |
|
775 |
} |
|
776 |
} |
|
777 |
state.set("layers", layersToSave); |
|
769 | 778 |
} |
770 | 779 |
|
771 | 780 |
public void loadFromState(PersistentState state) throws PersistenceException { |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/ViewManager.java | ||
---|---|---|
247 | 247 |
IconThemeHelper.registerIcon("layer", "layer-icon-postgresql", ViewManager.class); |
248 | 248 |
IconThemeHelper.registerIcon("layer", "layer-icon-mysql", ViewManager.class); |
249 | 249 |
IconThemeHelper.registerIcon("layer", "layer-icon-jdbc", ViewManager.class); |
250 |
IconThemeHelper.registerIcon("layer", "layer-icon-unavailable", ViewManager.class); |
|
250 |
//IconThemeHelper.registerIcon("layer", "layer-icon-unavailable", ViewManager.class); |
|
251 |
IconThemeHelper.registerIcon("layer", "layer-chk-unavailable", ViewManager.class); |
|
252 |
IconThemeHelper.registerIcon("layer", "layer-chk-temporary", ViewManager.class); |
|
251 | 253 |
|
252 | 254 |
IconThemeHelper.registerIcon("legend", "legend-overview-single-symbol", ViewManager.class); |
253 | 255 |
IconThemeHelper.registerIcon("legend", "legend-overview-vectorial-interval", ViewManager.class); |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/toc/TocItemBranch.java | ||
---|---|---|
58 | 58 |
private ImageIcon finalIcon = null; |
59 | 59 |
|
60 | 60 |
private BufferedImage unavailableImg = null; |
61 |
|
|
61 |
|
|
62 |
private BufferedImage temporaryLayerImg = null; |
|
63 |
|
|
62 | 64 |
private final String defaultIcon = "images/icolayer.PNG"; |
63 | 65 |
|
64 | 66 |
private boolean isAvailable = true; |
... | ... | |
118 | 120 |
|
119 | 121 |
} |
120 | 122 |
private void updateStateIcon() { |
121 |
if (icolayer == null) return; |
|
122 |
if (lyr.getTocStatusImage() != null) |
|
123 |
{ |
|
124 |
BufferedImage newImage = new BufferedImage(icolayer.getIconWidth(),icolayer.getIconHeight(),BufferedImage.TYPE_INT_ARGB); |
|
125 |
Graphics2D grp = newImage.createGraphics(); |
|
126 |
grp.drawImage(icolayer.getImage(),0,0,null); |
|
123 |
if (icolayer == null) { |
|
124 |
return; |
|
125 |
} |
|
126 |
BufferedImage newImage = new BufferedImage(icolayer.getIconWidth(),icolayer.getIconHeight(),BufferedImage.TYPE_INT_ARGB); |
|
127 |
Graphics2D grp = newImage.createGraphics(); |
|
128 |
grp.drawImage(icolayer.getImage(),0,0,null); |
|
129 |
if (lyr.getTocStatusImage() != null) { |
|
127 | 130 |
Image img = lyr.getTocStatusImage(); |
128 |
grp.drawImage( |
|
129 |
img, |
|
130 |
0, |
|
131 |
icolayer.getIconHeight() -img.getHeight(null), |
|
132 |
null |
|
133 |
); |
|
134 |
this.finalIcon = new ImageIcon(newImage); |
|
131 |
grp.drawImage(img,0,icolayer.getIconHeight()-img.getHeight(null),null); |
|
135 | 132 |
} |
136 |
if (this.lyr.isAvailable() != this.isAvailable || finalIcon==null) { |
|
133 |
|
|
134 |
if (this.lyr.isAvailable() != this.isAvailable ) { |
|
137 | 135 |
if (!this.lyr.isAvailable()) { |
138 |
BufferedImage newImage = new BufferedImage(icolayer.getIconWidth(),icolayer.getIconHeight(),BufferedImage.TYPE_INT_ARGB); |
|
139 |
Graphics2D grp = newImage.createGraphics(); |
|
140 |
grp.drawImage(icolayer.getImage(),0,0,null); |
|
141 |
/*grp.setComposite(AlphaComposite.getInstance( |
|
142 |
AlphaComposite.SRC_OVER, (float) 1));*/ |
|
143 | 136 |
BufferedImage img = this.getUnavailableImage(); |
144 |
grp.drawImage( |
|
145 |
img, |
|
146 |
0, |
|
147 |
icolayer.getIconHeight() -img.getHeight(), |
|
148 |
null |
|
149 |
); |
|
150 |
this.finalIcon = new ImageIcon(newImage); |
|
151 |
|
|
152 |
} else { |
|
153 |
this.finalIcon = new ImageIcon(icolayer.getImage()); |
|
137 |
grp.drawImage(img,0,icolayer.getIconHeight()-img.getHeight(),null); |
|
154 | 138 |
} |
155 | 139 |
this.isAvailable =(this.lyr.isAvailable()); |
156 | 140 |
} |
141 |
|
|
142 |
if( this.lyr.isTemporary() ) { |
|
143 |
BufferedImage img = this.getTemporaryLayerImage(); |
|
144 |
grp.drawImage(img,icolayer.getIconWidth()-img.getWidth(),icolayer.getIconHeight()-img.getHeight(),null); |
|
145 |
} |
|
146 |
|
|
147 |
this.finalIcon = new ImageIcon(newImage); |
|
148 |
} |
|
157 | 149 |
|
158 |
} |
|
159 |
|
|
160 | 150 |
private void setIcon(ImageIcon icon) { |
161 | 151 |
if (icon!=null) { |
162 | 152 |
icolayer = icon; |
... | ... | |
210 | 200 |
|
211 | 201 |
private BufferedImage getUnavailableImage() { |
212 | 202 |
if (this.unavailableImg == null) { |
213 |
ImageIcon uIcon = IconThemeHelper.getImageIcon("layer-icon-unavailable");
|
|
203 |
ImageIcon uIcon = IconThemeHelper.getImageIcon("layer-chk-unavailable");
|
|
214 | 204 |
if (uIcon != null) { |
215 | 205 |
this.unavailableImg = new BufferedImage(uIcon.getIconWidth(), uIcon.getIconHeight(), BufferedImage.TYPE_INT_RGB); |
216 | 206 |
this.unavailableImg.getGraphics().drawImage(uIcon.getImage(), 0, 0, null); |
... | ... | |
218 | 208 |
} |
219 | 209 |
return this.unavailableImg; |
220 | 210 |
} |
211 |
|
|
212 |
private BufferedImage getTemporaryLayerImage() { |
|
213 |
if (this.temporaryLayerImg == null) { |
|
214 |
ImageIcon uIcon = IconThemeHelper.getImageIcon("layer-chk-temporary"); |
|
215 |
if (uIcon != null) { |
|
216 |
this.temporaryLayerImg = new BufferedImage(uIcon.getIconWidth(), uIcon.getIconHeight(), BufferedImage.TYPE_INT_RGB); |
|
217 |
this.temporaryLayerImg.getGraphics().drawImage(uIcon.getImage(), 0, 0, null); |
|
218 |
} |
|
219 |
} |
|
220 |
return this.temporaryLayerImg; |
|
221 |
} |
|
221 | 222 |
|
222 | 223 |
public IContextMenuAction getDoubleClickAction() { |
223 | 224 |
// TODO |
Also available in: Unified diff