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