Revision 525
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrDefault.java | ||
---|---|---|
1 | 1 |
/* Generated by Together */ |
2 | 2 |
package com.iver.cit.gvsig.fmap.layers; |
3 | 3 |
|
4 |
import java.beans.PropertyChangeSupport;
|
|
4 |
import com.hardcode.gdbms.engine.data.DriverException;
|
|
5 | 5 |
|
6 |
import com.iver.utiles.XMLEntity; |
|
7 |
|
|
6 | 8 |
import org.cresques.cts.ICoordTrans; |
7 | 9 |
import org.cresques.cts.IProjection; |
8 | 10 |
|
9 |
import com.hardcode.driverManager.DriverLoadException; |
|
10 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
|
11 |
import com.iver.utiles.XMLEntity; |
|
11 |
import java.beans.PropertyChangeSupport; |
|
12 | 12 |
|
13 | 13 |
|
14 | 14 |
/** |
... | ... | |
16 | 16 |
* visibilidad, activaci?n, nombre, ... |
17 | 17 |
*/ |
18 | 18 |
public abstract class FLyrDefault implements FLayer { |
19 |
PropertyChangeSupport lnkPropertyChangeSupport;
|
|
19 |
PropertyChangeSupport lnkPropertyChangeSupport;
|
|
20 | 20 |
|
21 |
/** Path de la capa en el arbol de capas */
|
|
22 |
private FLayers parentLayer=null;
|
|
21 |
/** Path de la capa en el arbol de capas */ |
|
22 |
private FLayers parentLayer = null;
|
|
23 | 23 |
private String name; |
24 | 24 |
private IProjection projection; |
25 |
private boolean visible=true;
|
|
25 |
private boolean visible = true;
|
|
26 | 26 |
private boolean active; |
27 | 27 |
private int transparency = 0; |
28 | 28 |
|
29 |
/** |
|
30 |
* DOCUMENT ME! |
|
31 |
* |
|
32 |
* @param xml DOCUMENT ME! |
|
33 |
* |
|
34 |
* @return DOCUMENT ME! |
|
35 |
* @throws DifferentVersionException |
|
36 |
* @throws CancelationException |
|
37 |
* @throws IllegalAccessException |
|
38 |
* @throws InstantiationException |
|
39 |
* @throws ClassNotFoundException |
|
40 |
*/ |
|
41 |
/* public static FLyrDefault createFromXML(XMLEntity xml) |
|
42 |
throws DifferentVersionException, CancelationException, ClassNotFoundException, InstantiationException, IllegalAccessException { |
|
43 |
FLyrDefault def = null; |
|
29 |
/** |
|
30 |
* DOCUMENT ME! |
|
31 |
* |
|
32 |
* @param selected DOCUMENT ME! |
|
33 |
*/ |
|
44 | 34 |
|
45 |
Class clase = null; |
|
35 |
/* public static FLyrDefault createFromXML(XMLEntity xml) |
|
36 |
throws DifferentVersionException, CancelationException, ClassNotFoundException, InstantiationException, IllegalAccessException { |
|
37 |
FLyrDefault def = null; |
|
38 |
Class clase = null; |
|
39 |
try { |
|
40 |
clase = Class.forName(xml.getStringProperty("nameClass")); |
|
41 |
} catch (ClassNotFoundException e) { |
|
42 |
throw new DifferentVersionException(e); |
|
43 |
} |
|
44 |
try { |
|
45 |
def = (FLyrDefault) clase.newInstance(); |
|
46 |
} catch (InstantiationException e1) { |
|
47 |
throw new DifferentVersionException(e1); |
|
48 |
} catch (IllegalAccessException e1) { |
|
49 |
throw new DifferentVersionException(e1); |
|
50 |
} |
|
51 |
def.active = xml.getBooleanProperty("active"); |
|
52 |
def.name = xml.getStringProperty("name"); |
|
53 |
//def.parentLayer.setXMLEntity(xml.getChild(0)); |
|
54 |
//TODO def.projection= |
|
55 |
def.visible = xml.getBooleanProperty("visible"); |
|
56 |
if (def instanceof FLayers){ |
|
57 |
FLayers layers=(FLayers)def; |
|
58 |
|
|
59 |
for (int i=0;i<layers.getLayersCount();i++){ |
|
60 |
layers.addLayer(createFromXML(xml.getChild(i))); |
|
61 |
|
|
62 |
} |
|
63 |
}else{ |
|
64 |
def.setXMLEntity(xml); |
|
65 |
} |
|
66 |
return def; |
|
67 |
} |
|
68 |
*/ |
|
46 | 69 |
|
47 |
try { |
|
48 |
clase = Class.forName(xml.getStringProperty("nameClass")); |
|
49 |
} catch (ClassNotFoundException e) { |
|
50 |
throw new DifferentVersionException(e); |
|
51 |
} |
|
70 |
/** |
|
71 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#setActive(boolean) |
|
72 |
*/ |
|
73 |
public void setActive(boolean selected) { |
|
74 |
active = selected; |
|
75 |
} |
|
52 | 76 |
|
53 |
try { |
|
54 |
def = (FLyrDefault) clase.newInstance(); |
|
55 |
} catch (InstantiationException e1) { |
|
56 |
throw new DifferentVersionException(e1); |
|
57 |
} catch (IllegalAccessException e1) { |
|
58 |
throw new DifferentVersionException(e1); |
|
59 |
} |
|
77 |
/** |
|
78 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#isActive() |
|
79 |
*/ |
|
80 |
public boolean isActive() { |
|
81 |
return active; |
|
82 |
} |
|
60 | 83 |
|
61 |
def.active = xml.getBooleanProperty("active"); |
|
62 |
def.name = xml.getStringProperty("name"); |
|
63 |
//def.parentLayer.setXMLEntity(xml.getChild(0)); |
|
84 |
/** |
|
85 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#setName(java.lang.String) |
|
86 |
*/ |
|
87 |
public void setName(String name) { |
|
88 |
this.name = name; |
|
89 |
} |
|
64 | 90 |
|
65 |
//TODO def.projection= |
|
66 |
def.visible = xml.getBooleanProperty("visible"); |
|
67 |
if (def instanceof FLayers){ |
|
68 |
FLayers layers=(FLayers)def; |
|
69 |
|
|
70 |
for (int i=0;i<layers.getLayersCount();i++){ |
|
71 |
layers.addLayer(createFromXML(xml.getChild(i))); |
|
72 |
|
|
73 |
} |
|
74 |
}else{ |
|
75 |
def.setXMLEntity(xml); |
|
76 |
} |
|
91 |
/** |
|
92 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#getName() |
|
93 |
*/ |
|
94 |
public String getName() { |
|
95 |
return name; |
|
96 |
} |
|
77 | 97 |
|
78 |
return def; |
|
79 |
} |
|
80 |
*/ |
|
81 |
/** |
|
82 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#setActive(boolean) |
|
83 |
*/ |
|
84 |
public void setActive(boolean selected) { |
|
85 |
active = selected; |
|
86 |
} |
|
98 |
/** |
|
99 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#load() |
|
100 |
*/ |
|
101 |
public void load() { |
|
102 |
} |
|
87 | 103 |
|
88 |
/** |
|
89 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#isActive() |
|
90 |
*/ |
|
91 |
public boolean isActive() { |
|
92 |
return active; |
|
93 |
} |
|
104 |
/** |
|
105 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#setVisible(boolean) |
|
106 |
*/ |
|
107 |
public void setVisible(boolean visibility) { |
|
108 |
visible = visibility; |
|
109 |
System.out.println("visible= " + visibility); |
|
110 |
} |
|
94 | 111 |
|
95 |
/** |
|
96 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#setName(java.lang.String) |
|
97 |
*/ |
|
98 |
public void setName(String name) { |
|
99 |
this.name = name; |
|
100 |
} |
|
112 |
/** |
|
113 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#isVisible() |
|
114 |
*/ |
|
115 |
public boolean isVisible() { |
|
116 |
return visible; |
|
101 | 117 |
|
102 |
/** |
|
103 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#getName() |
|
104 |
*/ |
|
105 |
public String getName() { |
|
106 |
return name; |
|
107 |
} |
|
118 |
// return visible; |
|
119 |
} |
|
108 | 120 |
|
109 |
/** |
|
110 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#load() |
|
111 |
*/ |
|
112 |
public void load() { |
|
113 |
} |
|
121 |
/** |
|
122 |
* DOCUMENT ME! |
|
123 |
* |
|
124 |
* @return DOCUMENT ME! |
|
125 |
*/ |
|
126 |
public FLayers getParentLayer() { |
|
127 |
return parentLayer; |
|
128 |
} |
|
114 | 129 |
|
115 |
/** |
|
116 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#setVisible(boolean) |
|
117 |
*/ |
|
118 |
public void setVisible(boolean visibility) { |
|
119 |
visible = visibility; |
|
120 |
System.out.println("visible= "+visibility); |
|
121 |
} |
|
130 |
/** |
|
131 |
* DOCUMENT ME! |
|
132 |
* |
|
133 |
* @param root DOCUMENT ME! |
|
134 |
*/ |
|
135 |
public void setParentLayer(FLayers root) { |
|
136 |
this.parentLayer = root; |
|
137 |
} |
|
122 | 138 |
|
123 |
/**
|
|
124 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#isVisible()
|
|
125 |
*/
|
|
126 |
public boolean isVisible() {
|
|
127 |
|
|
128 |
return visible;
|
|
129 |
// return visible;
|
|
130 |
}
|
|
139 |
/**
|
|
140 |
* DOCUMENT ME!
|
|
141 |
*
|
|
142 |
* @param proj DOCUMENT ME!
|
|
143 |
*/ |
|
144 |
public void setProjection(IProjection proj) {
|
|
145 |
projection = proj;
|
|
146 |
}
|
|
131 | 147 |
|
132 |
/** |
|
133 |
* DOCUMENT ME! |
|
134 |
* |
|
135 |
* @return DOCUMENT ME! |
|
136 |
*/ |
|
137 |
public FLayers getParentLayer() { |
|
138 |
return parentLayer; |
|
139 |
} |
|
148 |
/** |
|
149 |
* @see org.cresques.geo.Projected#getProjection() |
|
150 |
*/ |
|
151 |
public IProjection getProjection() { |
|
152 |
return projection; |
|
153 |
} |
|
140 | 154 |
|
141 |
/** |
|
142 |
* DOCUMENT ME! |
|
143 |
* |
|
144 |
* @param root DOCUMENT ME! |
|
145 |
*/ |
|
146 |
public void setParentLayer(FLayers root) { |
|
147 |
this.parentLayer = root; |
|
148 |
} |
|
155 |
/** |
|
156 |
* @see org.cresques.geo.Projected#reProject(org.cresques.cts.ICoordTrans) |
|
157 |
*/ |
|
158 |
public void reProject(ICoordTrans arg0) { |
|
159 |
} |
|
149 | 160 |
|
150 |
/** |
|
151 |
* DOCUMENT ME! |
|
152 |
* |
|
153 |
* @param proj DOCUMENT ME! |
|
154 |
*/ |
|
155 |
public void setProjection(IProjection proj) { |
|
156 |
projection = proj; |
|
157 |
} |
|
158 |
|
|
159 |
/** |
|
160 |
* @see org.cresques.geo.Projected#getProjection() |
|
161 |
*/ |
|
162 |
public IProjection getProjection() { |
|
163 |
return projection; |
|
164 |
} |
|
165 |
|
|
166 |
/** |
|
167 |
* @see org.cresques.geo.Projected#reProject(org.cresques.cts.ICoordTrans) |
|
168 |
*/ |
|
169 |
public void reProject(ICoordTrans arg0) { |
|
170 |
} |
|
171 |
public int getTransparency() { |
|
161 |
/** |
|
162 |
* DOCUMENT ME! |
|
163 |
* |
|
164 |
* @return DOCUMENT ME! |
|
165 |
*/ |
|
166 |
public int getTransparency() { |
|
172 | 167 |
return transparency; |
173 | 168 |
} |
169 |
|
|
170 |
/** |
|
171 |
* DOCUMENT ME! |
|
172 |
* |
|
173 |
* @param trans DOCUMENT ME! |
|
174 |
*/ |
|
174 | 175 |
public void setTransparency(int trans) { |
175 | 176 |
transparency = trans; |
176 | 177 |
} |
177 |
/** |
|
178 |
* DOCUMENT ME! |
|
179 |
* |
|
180 |
* @return DOCUMENT ME! |
|
181 |
*/ |
|
182 |
public XMLEntity getXMLEntity() { |
|
183 |
XMLEntity xml = new XMLEntity(); |
|
184 |
xml.putProperty("nameClass", this.getClass().getName()); |
|
185 |
if (this instanceof FLayers){ |
|
186 |
} |
|
187 |
xml.putProperty("active", active); |
|
188 |
xml.putProperty("name", name); |
|
189 |
//TODO xml.addChild(parentLayer.getXMLEntity()); |
|
190 | 178 |
|
191 |
//TODO xml.addChild(projection.getXMLEntity()); |
|
192 |
xml.putProperty("visible", visible); |
|
179 |
/** |
|
180 |
* DOCUMENT ME! |
|
181 |
* |
|
182 |
* @return DOCUMENT ME! |
|
183 |
* |
|
184 |
* @throws DriverException |
|
185 |
*/ |
|
186 |
public XMLEntity getXMLEntity() throws DriverException { |
|
187 |
XMLEntity xml = new XMLEntity(); |
|
188 |
xml.putProperty("nameClass", this.getClass().getName()); |
|
193 | 189 |
|
194 |
return xml; |
|
195 |
} |
|
196 |
public void setXMLEntity(XMLEntity xml) throws XMLException{ |
|
197 |
active=xml.getBooleanProperty("active"); |
|
198 |
name=xml.getStringProperty("name"); |
|
199 |
visible=xml.getBooleanProperty("visible"); |
|
190 |
if (this instanceof FLayers) { |
|
191 |
} |
|
192 |
|
|
193 |
xml.putProperty("active", active); |
|
194 |
xml.putProperty("name", name); |
|
195 |
|
|
196 |
//TODO xml.addChild(parentLayer.getXMLEntity()); |
|
197 |
//TODO xml.addChild(projection.getXMLEntity()); |
|
198 |
xml.putProperty("visible", visible); |
|
199 |
|
|
200 |
return xml; |
|
201 |
} |
|
202 |
|
|
203 |
/** |
|
204 |
* DOCUMENT ME! |
|
205 |
* |
|
206 |
* @param xml DOCUMENT ME! |
|
207 |
* |
|
208 |
* @throws XMLException DOCUMENT ME! |
|
209 |
*/ |
|
210 |
public void setXMLEntity(XMLEntity xml) throws XMLException { |
|
211 |
active = xml.getBooleanProperty("active"); |
|
212 |
name = xml.getStringProperty("name"); |
|
213 |
visible = xml.getBooleanProperty("visible"); |
|
214 |
} |
|
200 | 215 |
} |
201 |
} |
Also available in: Unified diff