root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / FLyrVect.java @ 442
History | View | Annotate | Download (7.56 KB)
1 |
/* Generated by Together */
|
---|---|
2 |
|
3 |
package com.iver.cit.gvsig.fmap.layers; |
4 |
|
5 |
import java.awt.Graphics2D; |
6 |
import java.awt.geom.Point2D; |
7 |
import java.awt.geom.Rectangle2D; |
8 |
import java.awt.image.BufferedImage; |
9 |
import java.util.BitSet; |
10 |
|
11 |
import com.hardcode.driverManager.DriverLoadException; |
12 |
import com.hardcode.gdbms.engine.data.DataSource; |
13 |
import com.hardcode.gdbms.engine.data.NoSuchTableException; |
14 |
import com.iver.cit.gvsig.fmap.ViewPort; |
15 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
16 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
17 |
import com.iver.cit.gvsig.fmap.operations.Cancellable; |
18 |
import com.iver.cit.gvsig.fmap.operations.QueriedPoint; |
19 |
import com.iver.cit.gvsig.fmap.operations.strategies.FeatureVisitor; |
20 |
import com.iver.cit.gvsig.fmap.operations.strategies.Strategy; |
21 |
import com.iver.cit.gvsig.fmap.operations.strategies.StrategyManager; |
22 |
import com.iver.cit.gvsig.fmap.rendering.LegendFactory; |
23 |
import com.iver.cit.gvsig.fmap.rendering.LegendInfo; |
24 |
import com.iver.cit.gvsig.fmap.rendering.VectorialLegend; |
25 |
import com.iver.utiles.XMLEntity; |
26 |
|
27 |
public class FLyrVect extends FLyrDefault implements LayerOperations, VectorialOperations, CommonOperations { |
28 |
/**
|
29 |
* Colecci?n de leyendas de la capa vectorial. Contendr? tantos elementos como tipos de
|
30 |
* features pueda tener la capa vectorial
|
31 |
*/
|
32 |
private VectorialLegend legend;
|
33 |
|
34 |
public void addLayerListener(LayerListener listener) { |
35 |
} |
36 |
|
37 |
public void removeLayerListener(LayerListener listener) { |
38 |
} |
39 |
|
40 |
/**
|
41 |
* Cuando ocurre un evento de cambio en la selecci?n, ?ste puede ser uno de una gran cantidad de eventos. Con el fin de no propagar todos estos eventos, se realiza la propagaci?n de manera manual al final de la "r?faga" de eventos
|
42 |
*/
|
43 |
public void fireSelectionEvents() { |
44 |
} |
45 |
|
46 |
public VectorialAdapter getSource() {
|
47 |
return source;
|
48 |
} |
49 |
|
50 |
public void setSource(VectorialAdapter va) { |
51 |
source = va; |
52 |
} |
53 |
|
54 |
private BitSet selected ; |
55 |
|
56 |
/**
|
57 |
* @supplierCardinality 0..*
|
58 |
*/
|
59 |
private LayerListener[] listeners; |
60 |
|
61 |
/**
|
62 |
* @clientCardinality 0..*
|
63 |
*/
|
64 |
private VectorialAdapter source;
|
65 |
|
66 |
/**
|
67 |
* @see com.iver.cit.gvsig.fmap.layers.LayerOperations#getFullExtent()
|
68 |
*/
|
69 |
public Rectangle2D getFullExtent() throws DriverIOException { |
70 |
Rectangle2D rAux;
|
71 |
source.start(); |
72 |
rAux = source.getFullExtent(); |
73 |
source.stop(); |
74 |
return rAux;
|
75 |
} |
76 |
|
77 |
/**
|
78 |
* @see com.iver.cit.gvsig.fmap.layers.LayerOperations#draw(java.awt.image.BufferedImage, java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort)
|
79 |
*/
|
80 |
public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort, Cancellable cancel) throws DriverIOException { |
81 |
Strategy strategy = StrategyManager.getStrategy(this);
|
82 |
|
83 |
strategy.draw(image, g, viewPort, cancel); |
84 |
} |
85 |
|
86 |
/**
|
87 |
* @see com.iver.cit.gvsig.fmap.layers.VectorialOperations#createLabelLayer(int)
|
88 |
*/
|
89 |
public FLyrVect createLabelLayer(int fieldId) { |
90 |
return null; |
91 |
} |
92 |
|
93 |
/**
|
94 |
* @see com.iver.cit.gvsig.fmap.layers.VectorialOperations#removeLabels()
|
95 |
*/
|
96 |
public void removeLabels() { |
97 |
} |
98 |
|
99 |
/**
|
100 |
* @see com.iver.cit.gvsig.fmap.layers.VectorialOperations#createIndex()
|
101 |
*/
|
102 |
public void createIndex() { |
103 |
} |
104 |
|
105 |
/**
|
106 |
* @see com.iver.cit.gvsig.fmap.layers.VectorialOperations#process(com.iver.cit.gvsig.fmap.operations.strategies.FeatureVisitor, com.iver.cit.gvsig.fmap.operations.selection.VectorialSubSet)
|
107 |
*/
|
108 |
public void process(FeatureVisitor visitor, BitSet subset) { |
109 |
} |
110 |
|
111 |
/**
|
112 |
* @see com.iver.cit.gvsig.fmap.layers.CommonOperations#setSelection(com.iver.cit.gvsig.fmap.operations.selection.VectorialSubSet)
|
113 |
*/
|
114 |
public void setSelection(BitSet selection) { |
115 |
} |
116 |
|
117 |
/**
|
118 |
* @see com.iver.cit.gvsig.fmap.layers.CommonOperations#isSelected(int)
|
119 |
*/
|
120 |
public boolean isSelected(int index) { |
121 |
return false; |
122 |
} |
123 |
|
124 |
/**
|
125 |
* @see com.iver.cit.gvsig.fmap.layers.CommonOperations#clearSelection()
|
126 |
*/
|
127 |
public void clearSelection() { |
128 |
} |
129 |
|
130 |
/**
|
131 |
* @see com.iver.cit.gvsig.fmap.layers.CommonOperations#queryByPoint(com.iver.cit.gvsig.fmap.operations.QueriedPoint, double)
|
132 |
*/
|
133 |
public BitSet queryByPoint(Point2D p, double tolerance) { |
134 |
return null; |
135 |
} |
136 |
|
137 |
/**
|
138 |
* @see com.iver.cit.gvsig.fmap.layers.CommonOperations#queryByRect(java.awt.geom.Rectangle2D)
|
139 |
*/
|
140 |
public BitSet queryByRect(Rectangle2D rect) { |
141 |
return null; |
142 |
} |
143 |
|
144 |
/**
|
145 |
* @see com.iver.cit.gvsig.fmap.layers.CommonOperations#queryByShape(com.iver.cit.gvsig.fmap.core.IGeometry, int)
|
146 |
*/
|
147 |
public BitSet queryByShape(IGeometry g, int relationship) { |
148 |
return null; |
149 |
} |
150 |
|
151 |
/**
|
152 |
* @see com.iver.cit.gvsig.fmap.layers.CommonOperations#selectByPoint(com.iver.cit.gvsig.fmap.operations.QueriedPoint, double)
|
153 |
*/
|
154 |
public void selectByPoint(QueriedPoint p, double tolerance) { |
155 |
} |
156 |
|
157 |
/**
|
158 |
* @see com.iver.cit.gvsig.fmap.layers.CommonOperations#selectByRect(java.awt.geom.Rectangle2D)
|
159 |
*/
|
160 |
public void selectByRect(Rectangle2D rect) { |
161 |
} |
162 |
|
163 |
/**
|
164 |
* @see com.iver.cit.gvsig.fmap.layers.CommonOperations#selectByShape(com.iver.cit.gvsig.fmap.core.IGeometry, int)
|
165 |
*/
|
166 |
public void selectByShape(IGeometry g, int relationship) { |
167 |
} |
168 |
|
169 |
/**
|
170 |
* @throws DriverLoadException
|
171 |
* @see com.iver.cit.gvsig.fmap.layers.CommonOperations#getRecordset()
|
172 |
*/
|
173 |
public DataSource getRecordset() throws DriverLoadException { |
174 |
try {
|
175 |
return source.getRecordset(getName() + "Table"); |
176 |
} catch (NoSuchTableException e) {
|
177 |
throw new RuntimeException("Error de implementaci?n, se ha a?adido una tabla y luego esa tabla no ha podido ser cargada"); |
178 |
} |
179 |
} |
180 |
|
181 |
/**
|
182 |
* @see com.iver.cit.gvsig.fmap.layers.CommonOperations#setLegend(int, com.iver.cit.gvsig.fmap.rendering.Legend)
|
183 |
*/
|
184 |
public void setLegend(VectorialLegend r) { |
185 |
legend = r; |
186 |
} |
187 |
|
188 |
public VectorialLegend getLegend() {
|
189 |
//Leyenda por defecto
|
190 |
if (legend == null){ |
191 |
legend = LegendFactory.createSingleSymbolLegend(); |
192 |
} |
193 |
|
194 |
return legend;
|
195 |
} |
196 |
|
197 |
/**
|
198 |
* @see com.iver.cit.gvsig.fmap.layers.CommonOperations#getLegendInfo()
|
199 |
*/
|
200 |
public LegendInfo getLegendInfo() {
|
201 |
return (LegendInfo) legend;
|
202 |
} |
203 |
|
204 |
/**
|
205 |
* @see com.iver.cit.gvsig.fmap.layers.CommonOperations#getShapeType()
|
206 |
*/
|
207 |
public int getShapeType() throws DriverIOException { |
208 |
return source.getShapeType();
|
209 |
} |
210 |
|
211 |
/**
|
212 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#getProperties()
|
213 |
*/
|
214 |
public XMLEntity getXMLEntity() {
|
215 |
XMLEntity xml=super.getXMLEntity();
|
216 |
xml.addChild(legend.getXMLEntity()); |
217 |
if (selected!=null){ |
218 |
xml.putProperty("numBitSet",selected.cardinality());
|
219 |
int n=0; |
220 |
for (int i=0;i<selected.length();i++){ |
221 |
if (selected.get(i)){
|
222 |
xml.putProperty(String.valueOf(n),selected.get(i));
|
223 |
n++; |
224 |
} |
225 |
} |
226 |
} |
227 |
if (source instanceof VectorialFileAdapter){ |
228 |
xml.putProperty("file",((VectorialFileAdapter)source).getFile());
|
229 |
}else if (source instanceof VectorialDBAdapter){ |
230 |
|
231 |
}else if (source instanceof WFSAdapter){ |
232 |
|
233 |
} |
234 |
|
235 |
xml.putProperty("driverName",getSource().getDriver().getName());
|
236 |
return xml;
|
237 |
} |
238 |
|
239 |
/**
|
240 |
* @throws ClassNotFoundException
|
241 |
* @throws InstantiationException
|
242 |
* @throws IllegalAccessException
|
243 |
* @throws DriverIOException
|
244 |
* @throws DriverLoadException
|
245 |
* @throws CancelationException
|
246 |
* @throws DifferentVersionException
|
247 |
* @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setXMLEntity(com.iver.utiles.XMLEntity)
|
248 |
*/
|
249 |
public void setXMLEntity(XMLEntity xml) throws ClassNotFoundException, InstantiationException, IllegalAccessException, DifferentVersionException, CancelationException, DriverLoadException, DriverIOException { |
250 |
super.setXMLEntity(xml);
|
251 |
legend=LegendFactory.createFromXML(xml.getChild(0));
|
252 |
int numBitSet=xml.getIntProperty("numBitSet"); |
253 |
if (numBitSet!=0){ |
254 |
selected=new BitSet(); |
255 |
for(int i=0;i<numBitSet;i++){ |
256 |
selected.set(xml.getIntProperty(String.valueOf(i)));
|
257 |
} |
258 |
} |
259 |
//TODO source.setDriver(nameDriver);
|
260 |
|
261 |
} |
262 |
} |