root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / FMap.java @ 305
History | View | Annotate | Download (8.38 KB)
1 |
/* Generated by Together */
|
---|---|
2 |
package com.iver.cit.gvsig.fmap; |
3 |
|
4 |
import java.awt.Graphics2D; |
5 |
import java.awt.Toolkit; |
6 |
import java.awt.geom.Point2D; |
7 |
import java.awt.geom.Rectangle2D; |
8 |
import java.awt.image.BufferedImage; |
9 |
|
10 |
import org.cresques.cts.ICoordTrans; |
11 |
import org.cresques.cts.IProjection; |
12 |
import org.cresques.geo.Projected; |
13 |
|
14 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
15 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
16 |
import com.iver.cit.gvsig.fmap.layers.ChildrenNotAllowedException; |
17 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
18 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
19 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
20 |
import com.iver.cit.gvsig.fmap.layers.LayerPath; |
21 |
import com.iver.cit.gvsig.fmap.layers.ProjectionMismatchException; |
22 |
import com.iver.cit.gvsig.fmap.layers.VectorialAdapter; |
23 |
import com.iver.cit.gvsig.fmap.operations.Cancellable; |
24 |
import com.iver.cit.gvsig.fmap.operations.selection.Record; |
25 |
import com.iver.cit.gvsig.fmap.operations.strategies.FeatureVisitor; |
26 |
|
27 |
|
28 |
/**
|
29 |
* DOCUMENT ME!
|
30 |
*
|
31 |
* @author Fernando Gonz?lez Cort?s
|
32 |
*/
|
33 |
public class FMap implements Projected { |
34 |
public static final double[] CHANGEM = { |
35 |
1000, 1, 0.01, 0.001, 1609.344, 0.9144, 0.3048, 0.0254 |
36 |
}; |
37 |
|
38 |
/** DOCUMENT ME! */
|
39 |
public static final double[] CHANGE = { |
40 |
100000, 100, 1, 0.1, 160934.4, 91.44, 30.48, 2.54 |
41 |
}; |
42 |
|
43 |
public static final int EQUALS = 0; |
44 |
public static final int DISJOINT = 1; |
45 |
public static final int INTERSECTS = 2; |
46 |
public static final int TOUCHES = 3; |
47 |
public static final int CROSSES = 4; |
48 |
public static final int WITHIN = 5; |
49 |
public static final int CONTAINS = 6; |
50 |
public static final int OVERLAPS = 7; |
51 |
private FLayers layers = new FLayers(); |
52 |
private ViewPort viewPort;
|
53 |
|
54 |
public FMap(ViewPort vp){
|
55 |
this.viewPort = vp;
|
56 |
} |
57 |
|
58 |
/**
|
59 |
* DOCUMENT ME!
|
60 |
*
|
61 |
* @return DOCUMENT ME!
|
62 |
*/
|
63 |
public FLayers getLayers() {
|
64 |
return layers;
|
65 |
} |
66 |
|
67 |
/**
|
68 |
* Dibuja en la imagen que se pasa como par?metro el contenido de las capas
|
69 |
* visibles del mapa y teniendo en cuenta los datos del ViewPort contenido
|
70 |
* en este FMap
|
71 |
*
|
72 |
* @param b DOCUMENT ME!
|
73 |
*/
|
74 |
public void drawLabels(BufferedImage b) { |
75 |
} |
76 |
|
77 |
/**
|
78 |
* DOCUMENT ME!
|
79 |
*
|
80 |
* @param g DOCUMENT ME!
|
81 |
*/
|
82 |
public void print(Graphics2D g) { |
83 |
} |
84 |
|
85 |
/**
|
86 |
* Crea un nuevo FMap con la informaci?n del ViewPort que se pasa como
|
87 |
* par?metro.
|
88 |
*
|
89 |
* @param vp DOCUMENT ME!
|
90 |
*
|
91 |
* @return DOCUMENT ME!
|
92 |
*/
|
93 |
public FMap createNewFMap(ViewPort vp) {
|
94 |
FMap ret = new FMap(vp);
|
95 |
ret.layers = this.layers;
|
96 |
|
97 |
return ret;
|
98 |
} |
99 |
|
100 |
/**
|
101 |
* Crea un nuevo FMap totalmente desligado, se replican las capas y el
|
102 |
* ViewPort
|
103 |
*
|
104 |
* @return DOCUMENT ME!
|
105 |
*/
|
106 |
public FMap cloneFMap() {
|
107 |
return createXMLEntity(getXMLEntity());
|
108 |
} |
109 |
|
110 |
/**
|
111 |
* DOCUMENT ME!
|
112 |
*
|
113 |
* @return DOCUMENT ME!
|
114 |
*/
|
115 |
public XMLEntity getXMLEntity() {
|
116 |
return new XMLEntity(); |
117 |
} |
118 |
|
119 |
/**
|
120 |
* DOCUMENT ME!
|
121 |
*
|
122 |
* @param xe DOCUMENT ME!
|
123 |
*
|
124 |
* @return DOCUMENT ME!
|
125 |
*/
|
126 |
public FMap createXMLEntity(XMLEntity xe) {
|
127 |
// TODO Implementar bien
|
128 |
return new FMap(null); |
129 |
} |
130 |
|
131 |
/**
|
132 |
* A?ade la capa que se pasa como par?metro al nodo que se pasa como
|
133 |
* parametro y lanza ProjectionMismatchException si no est?n todas las
|
134 |
* capas de este FMap en la misma proyecci?n. Lanza un
|
135 |
* ChildNotAllowedException si la capa no es un FLayers y no permite hijos
|
136 |
*
|
137 |
* @param parent DOCUMENT ME!
|
138 |
* @param layer DOCUMENT ME!
|
139 |
*
|
140 |
* @throws ProjectionMismatchException DOCUMENT ME!
|
141 |
* @throws ChildrenNotAllowedException DOCUMENT ME!
|
142 |
*/
|
143 |
/* public void addLayer(LayerPath parent, FLayer layer)
|
144 |
throws ProjectionMismatchException, ChildrenNotAllowedException {
|
145 |
layers.addLayer(parent, layer);
|
146 |
}
|
147 |
public void removeLayer(LayerPath parent)throws ChildrenNotAllowedException{
|
148 |
layers.removeLayer(parent);
|
149 |
}
|
150 |
*/
|
151 |
/**
|
152 |
* A?ade una capa al grupo de capas que se sit?a por encima de todas las
|
153 |
* otras capas
|
154 |
*
|
155 |
* @param vectorial DOCUMENT ME!
|
156 |
*/
|
157 |
public void addToTrackLayer(FLyrVect vectorial) { |
158 |
} |
159 |
|
160 |
public long getScaleView() { |
161 |
Toolkit kit = Toolkit.getDefaultToolkit(); |
162 |
double dpi = kit.getScreenResolution();
|
163 |
IProjection proj = layers.getProjection(); |
164 |
|
165 |
double w = ((viewPort.getImageSize().getWidth() / dpi) * 2.54); |
166 |
|
167 |
if (viewPort.getAdjustedExtent() == null) { |
168 |
return 0; |
169 |
} |
170 |
|
171 |
|
172 |
if (proj == null) |
173 |
return (long) (viewPort.getAdjustedExtent().getWidth() / w * CHANGE[getViewPort() |
174 |
.getMapUnits()]); |
175 |
return (long) proj.getScale(viewPort.getAdjustedExtent().getMinX(), viewPort.getAdjustedExtent().getMaxX(), viewPort.getImageSize().getWidth(), dpi); |
176 |
} |
177 |
|
178 |
/**
|
179 |
* @see com.iver.cit.gvsig.fmap.operations.strategies.Strategy#setVectorial(com.iver.cit.gvsig.fmap.VectorialAdapter)
|
180 |
*/
|
181 |
public void setVectorial(VectorialAdapter v) { |
182 |
} |
183 |
|
184 |
/**
|
185 |
* @see com.iver.cit.gvsig.fmap.operations.strategies.Strategy#process(com.iver.cit.gvsig.fmap.FeatureSelectorVisitor, VectorialSubSet)
|
186 |
*/
|
187 |
public void process(FeatureVisitor visitor) { |
188 |
} |
189 |
|
190 |
/**
|
191 |
* @see com.iver.cit.gvsig.fmap.operations.strategies.Strategy#processSelected(com.iver.cit.gvsig.fmap.FeatureVisitor)
|
192 |
*/
|
193 |
public void processSelected(FeatureVisitor visitor) { |
194 |
} |
195 |
|
196 |
/**
|
197 |
* @see com.iver.cit.gvsig.fmap.operations.strategies.Strategy#select(com.iver.cit.gvsig.fmap.FeatureSelectorVisitor, VectorialSubSet)
|
198 |
*/
|
199 |
public void select(FeatureVisitor visitor) { |
200 |
} |
201 |
|
202 |
/**
|
203 |
* @see com.iver.cit.gvsig.fmap.operations.strategies.Strategy#selectFromSelection()
|
204 |
*/
|
205 |
public void selectFromSelection() { |
206 |
} |
207 |
|
208 |
/**
|
209 |
* @see com.iver.cit.gvsig.fmap.operations.strategies.Strategy#createIndex()
|
210 |
*/
|
211 |
public void createIndex() { |
212 |
} |
213 |
|
214 |
/**
|
215 |
* @see org.cresques.geo.Projected#getProjection()
|
216 |
*/
|
217 |
public IProjection getProjection() {
|
218 |
return null; |
219 |
} |
220 |
|
221 |
/**
|
222 |
* @see org.cresques.geo.Projected#reProject(org.cresques.cts.ICoordTrans)
|
223 |
*/
|
224 |
public void reProject(ICoordTrans arg0) { |
225 |
} |
226 |
|
227 |
/**
|
228 |
* @see com.iver.cit.gvsig.fmap.operations.strategies.Strategy#selectByPoint(java.awt.geom.Point2D,
|
229 |
* double)
|
230 |
*/
|
231 |
public void selectByPoint(Point2D p, double tolerance) { |
232 |
} |
233 |
|
234 |
/**
|
235 |
* @see com.iver.cit.gvsig.fmap.operations.strategies.Strategy#selectByRect(java.awt.geom.Rectangle2D)
|
236 |
*/
|
237 |
public void selectByRect(Rectangle2D rect) { |
238 |
} |
239 |
|
240 |
/**
|
241 |
* @see com.iver.cit.gvsig.fmap.operations.strategies.Strategy#selectByShape(com.iver.cit.gvsig.fmap.fshape.IGeometry,
|
242 |
* int)
|
243 |
*/
|
244 |
public void selectByShape(IGeometry g, int relationship) { |
245 |
} |
246 |
|
247 |
/**
|
248 |
* @see com.iver.cit.gvsig.fmap.operations.strategies.Strategy#queryByPoint(java.awt.geom.Point2D,
|
249 |
* double)
|
250 |
*/
|
251 |
public Record[] queryByPoint(Point2D p, double tolerance) { |
252 |
return null; |
253 |
} |
254 |
|
255 |
/**
|
256 |
* @see com.iver.cit.gvsig.fmap.operations.strategies.Strategy#queryByRect(java.awt.geom.Rectangle2D)
|
257 |
*/
|
258 |
public Record[] queryByRect(Rectangle2D rect) { |
259 |
return null; |
260 |
} |
261 |
|
262 |
/**
|
263 |
* @see com.iver.cit.gvsig.fmap.operations.strategies.Strategy#queryByShape(com.iver.cit.gvsig.fmap.fshape.IGeometry,
|
264 |
* int)
|
265 |
*/
|
266 |
public Record[] queryByShape(IGeometry g, int relationship) { |
267 |
return null; |
268 |
} |
269 |
|
270 |
/**
|
271 |
* @see com.iver.cit.gvsig.fmap.operations.strategies.Strategy#getSelectionBounds()
|
272 |
*/
|
273 |
public Rectangle2D getSelectionBounds() { |
274 |
return null; |
275 |
} |
276 |
|
277 |
/**
|
278 |
* DOCUMENT ME!
|
279 |
*
|
280 |
* @param image DOCUMENT ME!
|
281 |
* @param g DOCUMENT ME!
|
282 |
* @param viewPort DOCUMENT ME!
|
283 |
*
|
284 |
* @throws DriverIOException
|
285 |
*
|
286 |
* @see com.iver.cit.gvsig.fmap.operations.LayerOperations#draw(java.awt.image.BufferedImage,
|
287 |
* java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort)
|
288 |
*/
|
289 |
public void draw(BufferedImage image, Graphics2D g, Cancellable cancel) |
290 |
throws DriverIOException {
|
291 |
layers.draw(image, g, viewPort, cancel); |
292 |
} |
293 |
|
294 |
/**
|
295 |
* DOCUMENT ME!
|
296 |
*
|
297 |
* @param image DOCUMENT ME!
|
298 |
* @param g DOCUMENT ME!
|
299 |
* @param viewPort DOCUMENT ME!
|
300 |
*
|
301 |
* @throws DriverIOException
|
302 |
*
|
303 |
* @see com.iver.cit.gvsig.fmap.operations.LayerOperations#draw(java.awt.image.BufferedImage,
|
304 |
* java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort)
|
305 |
*/
|
306 |
public void draw(BufferedImage image, Graphics2D g) |
307 |
throws DriverIOException {
|
308 |
layers.draw(image, g, viewPort, new Cancellable() {
|
309 |
/**
|
310 |
* @see com.iver.cit.gvsig.fmap.operations.Cancellable#isCanceled()
|
311 |
*/
|
312 |
public boolean isCanceled() { |
313 |
return false; |
314 |
} |
315 |
}); |
316 |
} |
317 |
|
318 |
/**
|
319 |
* @return Returns the viewPort.
|
320 |
*/
|
321 |
public ViewPort getViewPort() {
|
322 |
return viewPort;
|
323 |
} |
324 |
/**
|
325 |
* @param viewPort The viewPort to set.
|
326 |
*/
|
327 |
public void setViewPort(ViewPort viewPort) { |
328 |
this.viewPort = viewPort;
|
329 |
} |
330 |
} |