Revision 42289 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/vectorial/FLyrVect.java
FLyrVect.java | ||
---|---|---|
3 | 3 |
* |
4 | 4 |
* Copyright (C) 2007-2013 gvSIG Association. |
5 | 5 |
* |
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License
|
|
8 |
* as published by the Free Software Foundation; either version 3
|
|
9 |
* of the License, or (at your option) any later version.
|
|
6 |
* This program is free software; you can redistribute it and/or modify it under
|
|
7 |
* the terms of the GNU General Public License as published by the Free Software
|
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later
|
|
9 |
* version. |
|
10 | 10 |
* |
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
* GNU General Public License for more details.
|
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
14 |
* details. |
|
15 | 15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
16 |
* You should have received a copy of the GNU General Public License along with |
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51 |
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
20 | 19 |
* |
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
|
20 |
* For any additional information, do not hesitate to contact us at info AT
|
|
21 |
* gvsig.com, or visit our website www.gvsig.com. |
|
23 | 22 |
*/ |
24 | 23 |
package org.gvsig.fmap.mapcontext.layers.vectorial; |
25 | 24 |
|
... | ... | |
89 | 88 |
import org.gvsig.tools.persistence.PersistenceManager; |
90 | 89 |
import org.gvsig.tools.persistence.PersistentState; |
91 | 90 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
92 |
import org.gvsig.tools.persistence.exception.PersistenceRuntimeException; |
|
93 | 91 |
import org.gvsig.tools.task.Cancellable; |
94 | 92 |
import org.gvsig.tools.util.Callable; |
95 | 93 |
|
96 | 94 |
/** |
97 | 95 |
* Capa b?sica Vectorial. |
98 |
*
|
|
96 |
* |
|
99 | 97 |
*/ |
100 |
|
|
101 | 98 |
public class FLyrVect extends FLyrDefault implements VectorLayer, |
102 |
LegendContentsChangedListener, Observer { |
|
99 |
LegendContentsChangedListener, Observer {
|
|
103 | 100 |
|
104 |
final static private org.slf4j.Logger logger =
|
|
105 |
LoggerFactory.getLogger(FLyrVect.class); |
|
106 |
private final GeometryManager geomManager =
|
|
107 |
GeometryLocator.getGeometryManager(); |
|
101 |
final static private org.slf4j.Logger logger |
|
102 |
= LoggerFactory.getLogger(FLyrVect.class);
|
|
103 |
private final GeometryManager geomManager |
|
104 |
= GeometryLocator.getGeometryManager();
|
|
108 | 105 |
|
109 |
/** Leyenda de la capa vectorial */ |
|
106 |
/** |
|
107 |
* Leyenda de la capa vectorial |
|
108 |
*/ |
|
110 | 109 |
private IVectorLegend legend; |
111 | 110 |
private int typeShape = -1; |
112 | 111 |
private FeatureStore featureStore = null; |
... | ... | |
125 | 124 |
public FLyrVect() { |
126 | 125 |
super(); |
127 | 126 |
} |
128 |
|
|
129 |
public String getTocImageIcon() {
|
|
130 |
if (this.isAvailable()) {
|
|
127 |
|
|
128 |
public String getTocImageIcon() {
|
|
129 |
if (this.isAvailable()) {
|
|
131 | 130 |
return MapContextLocator.getMapContextManager().getIconLayer(this.getDataStore()); |
132 |
} else {
|
|
133 |
/*
|
|
134 |
* data store can be be null,
|
|
135 |
* for example, a layer not loaded from persistence
|
|
136 |
*/
|
|
131 |
} else {
|
|
132 |
/*
|
|
133 |
* data store can be be null,
|
|
134 |
* for example, a layer not loaded from persistence
|
|
135 |
*/
|
|
137 | 136 |
return "layer-icon-unavailable"; |
138 |
} |
|
139 |
|
|
140 |
} |
|
137 |
} |
|
141 | 138 |
|
139 |
} |
|
140 |
|
|
142 | 141 |
/** |
143 | 142 |
* Devuelve el VectorialAdapater de la capa. |
144 |
*
|
|
143 |
* |
|
145 | 144 |
* @return VectorialAdapter. |
146 | 145 |
*/ |
147 | 146 |
public DataStore getDataStore() { |
... | ... | |
150 | 149 |
} |
151 | 150 |
return featureStore; |
152 | 151 |
} |
153 |
|
|
152 |
|
|
154 | 153 |
/** |
155 |
* Asigna el data-store a la capa. |
|
156 |
* Esta operacion no se deneria poder hacer desde fuera de la clase.
|
|
157 |
*
|
|
154 |
* Asigna el data-store a la capa. Esta operacion no se deneria poder hacer
|
|
155 |
* desde fuera de la clase. |
|
156 |
* |
|
158 | 157 |
* @param dataStore |
159 | 158 |
* @throws LoadLayerException |
160 | 159 |
* @deprecated use {@link #bindToDataStore(DataStore)} |
161 | 160 |
*/ |
162 | 161 |
public void setDataStore(DataStore dataStore) throws LoadLayerException { |
163 |
bindToDataStore(dataStore);
|
|
162 |
bindToDataStore(dataStore);
|
|
164 | 163 |
} |
165 |
|
|
164 |
|
|
166 | 165 |
/** |
167 | 166 |
* Enlaza la capa con el DataStore indicado. |
168 |
*
|
|
167 |
* |
|
169 | 168 |
* @param dataStore |
170 | 169 |
* @throws LoadLayerException |
171 | 170 |
*/ |
... | ... | |
176 | 175 |
|
177 | 176 |
featureStore = (FeatureStore) dataStore; |
178 | 177 |
|
179 |
MapContextManager mapContextManager =
|
|
180 |
MapContextLocator.getMapContextManager(); |
|
181 |
|
|
178 |
MapContextManager mapContextManager |
|
179 |
= MapContextLocator.getMapContextManager();
|
|
180 |
|
|
182 | 181 |
//Set the legend |
183 |
IVectorLegend legend =
|
|
184 |
(IVectorLegend)mapContextManager.getLegend(dataStore);
|
|
182 |
IVectorLegend legend |
|
183 |
= (IVectorLegend) mapContextManager.getLegend(dataStore);
|
|
185 | 184 |
|
186 | 185 |
if (legend == null) { |
187 | 186 |
throw new LegendLayerException(this.getName()); |
... | ... | |
190 | 189 |
this.setLegend(legend); |
191 | 190 |
|
192 | 191 |
//Set the labeling strategy |
193 |
ILabelingStrategy labeler =
|
|
194 |
(ILabelingStrategy) mapContextManager.getLabelingStrategy(dataStore); |
|
192 |
ILabelingStrategy labeler |
|
193 |
= (ILabelingStrategy) mapContextManager.getLabelingStrategy(dataStore);
|
|
195 | 194 |
|
196 | 195 |
if (labeler != null) { |
197 | 196 |
labeler.setLayer(this); |
198 | 197 |
this.setLabelingStrategy(labeler); |
199 | 198 |
this.setIsLabeled(true); // TODO: ac? no s'hauria de detectar si t? |
200 |
// etiquetes?????
|
|
199 |
// etiquetes????? |
|
201 | 200 |
} |
202 | 201 |
|
203 | 202 |
this.delegate(dataStore); |
... | ... | |
218 | 217 |
// Esto es para cuando se crea una capa nueva con el fullExtent de ancho |
219 | 218 |
// y alto 0. |
220 | 219 |
if (rAux == null || rAux.isEmpty() || rAux.getMaximum(0) - rAux.getMinimum(0) == 0 |
221 |
&& rAux.getMaximum(1) - rAux.getMinimum(1) == 0) { |
|
220 |
&& rAux.getMaximum(1) - rAux.getMinimum(1) == 0) {
|
|
222 | 221 |
try { |
223 |
rAux =
|
|
224 |
geomManager.createEnvelope(0, 0, 90, 90, SUBTYPES.GEOM2D); |
|
222 |
rAux |
|
223 |
= geomManager.createEnvelope(0, 0, 90, 90, SUBTYPES.GEOM2D);
|
|
225 | 224 |
} catch (CreateEnvelopeException e) { |
226 | 225 |
logger.error("Error creating the envelope", e); |
227 | 226 |
e.printStackTrace(); |
... | ... | |
230 | 229 |
// Si existe reproyecci?n, reproyectar el extent |
231 | 230 |
ICoordTrans ct = getCoordTrans(); |
232 | 231 |
if (ct != null) { |
233 |
rAux = rAux.convert(ct);
|
|
232 |
rAux = rAux.convert(ct);
|
|
234 | 233 |
} |
235 | 234 |
return rAux; |
236 | 235 |
|
... | ... | |
239 | 238 |
/** |
240 | 239 |
* Draws using IFeatureIterator. This method will replace the old draw(...) |
241 | 240 |
* one. |
242 |
*
|
|
241 |
* |
|
243 | 242 |
* @autor jaume dominguez faus - jaume.dominguez@iver.es |
244 | 243 |
* @param image |
245 | 244 |
* @param g |
... | ... | |
249 | 248 |
* @throws ReadDriverException |
250 | 249 |
*/ |
251 | 250 |
public void draw(BufferedImage image, |
252 |
Graphics2D g, |
|
253 |
ViewPort viewPort, |
|
254 |
Cancellable cancel, |
|
255 |
double scale) throws ReadException { |
|
251 |
Graphics2D g,
|
|
252 |
ViewPort viewPort,
|
|
253 |
Cancellable cancel,
|
|
254 |
double scale) throws ReadException {
|
|
256 | 255 |
|
257 | 256 |
if (legend == null) { |
258 | 257 |
return; |
... | ... | |
272 | 271 |
|
273 | 272 |
FeatureQuery featureQuery = null; |
274 | 273 |
try { |
275 |
FeatureAttributeDescriptor featureAttributeDescriptor =
|
|
276 |
getFeatureStore().getDefaultFeatureType().getDefaultTimeAttribute(); |
|
274 |
FeatureAttributeDescriptor featureAttributeDescriptor |
|
275 |
= getFeatureStore().getDefaultFeatureType().getDefaultTimeAttribute();
|
|
277 | 276 |
|
278 |
if ((viewPort.getTime() != null) && (featureAttributeDescriptor != null)){ |
|
277 |
if ((viewPort.getTime() != null) && (featureAttributeDescriptor != null)) {
|
|
279 | 278 |
featureQuery = getFeatureStore().createFeatureQuery(); |
280 |
IntersectsTimeEvaluator intersectsTimeEvaluator =
|
|
281 |
new IntersectsTimeEvaluator(viewPort.getTime(), featureAttributeDescriptor.getName()); |
|
279 |
IntersectsTimeEvaluator intersectsTimeEvaluator |
|
280 |
= new IntersectsTimeEvaluator(viewPort.getTime(), featureAttributeDescriptor.getName());
|
|
282 | 281 |
featureQuery.addFilter(intersectsTimeEvaluator); |
283 | 282 |
} |
284 | 283 |
} catch (DataException e1) { |
... | ... | |
286 | 285 |
} |
287 | 286 |
|
288 | 287 |
try { |
289 |
|
|
288 |
|
|
290 | 289 |
long tini = System.currentTimeMillis(); |
291 |
|
|
290 |
|
|
292 | 291 |
legend.draw(image, |
293 |
g, |
|
294 |
viewPort, |
|
295 |
cancel, |
|
296 |
scale, |
|
297 |
null, |
|
298 |
getCoordTrans(), |
|
299 |
getFeatureStore(), |
|
300 |
featureQuery); |
|
301 |
|
|
302 |
logger.debug("Layer " + this.getName() + " drawn in " + |
|
303 |
(System.currentTimeMillis() - tini) + " milliseconds."); |
|
292 |
g, |
|
293 |
viewPort, |
|
294 |
cancel, |
|
295 |
scale, |
|
296 |
null, |
|
297 |
getCoordTrans(), |
|
298 |
getFeatureStore(), |
|
299 |
featureQuery); |
|
304 | 300 |
|
301 |
logger.debug("Layer " + this.getName() + " drawn in " |
|
302 |
+ (System.currentTimeMillis() - tini) + " milliseconds."); |
|
303 |
|
|
305 | 304 |
} catch (LegendException e) { |
306 | 305 |
this.setVisible(false); |
307 | 306 |
this.setActive(false); |
... | ... | |
314 | 313 |
} |
315 | 314 |
|
316 | 315 |
public void print(Graphics2D g, |
317 |
ViewPort viewPort, |
|
318 |
Cancellable cancel, |
|
319 |
double scale, |
|
320 |
PrintAttributes properties) throws ReadException { |
|
316 |
ViewPort viewPort,
|
|
317 |
Cancellable cancel,
|
|
318 |
double scale,
|
|
319 |
PrintAttributes properties) throws ReadException {
|
|
321 | 320 |
if (!this.isWithinScale(scale)) { |
322 | 321 |
return; |
323 | 322 |
} |
... | ... | |
327 | 326 |
|
328 | 327 |
try { |
329 | 328 |
legend.print(g, |
330 |
viewPort, |
|
331 |
cancel, |
|
332 |
scale, |
|
333 |
null, |
|
334 |
getCoordTrans(), |
|
335 |
getFeatureStore(), |
|
336 |
null, |
|
337 |
properties); |
|
329 |
viewPort,
|
|
330 |
cancel,
|
|
331 |
scale,
|
|
332 |
null,
|
|
333 |
getCoordTrans(),
|
|
334 |
getFeatureStore(),
|
|
335 |
null,
|
|
336 |
properties);
|
|
338 | 337 |
|
339 | 338 |
} catch (LegendException e) { |
340 | 339 |
this.setVisible(false); |
... | ... | |
360 | 359 |
this.legend.addDrawingObserver(this); |
361 | 360 |
this.legend.addLegendListener(this); |
362 | 361 |
} |
363 |
LegendChangedEvent e =
|
|
364 |
LegendChangedEvent.createLegendChangedEvent(oldLegend, this.legend); |
|
362 |
LegendChangedEvent e |
|
363 |
= LegendChangedEvent.createLegendChangedEvent(oldLegend, this.legend);
|
|
365 | 364 |
e.setLayer(this); |
366 | 365 |
updateDrawVersion(); |
367 | 366 |
callLegendChanged(e); |
... | ... | |
369 | 368 |
|
370 | 369 |
/** |
371 | 370 |
* Devuelve la Leyenda de la capa. |
372 |
*
|
|
371 |
* |
|
373 | 372 |
* @return Leyenda. |
374 | 373 |
*/ |
375 | 374 |
public ILegend getLegend() { |
... | ... | |
377 | 376 |
} |
378 | 377 |
|
379 | 378 |
public int getShapeType() throws ReadException { |
380 |
if (typeShape == -1) {
|
|
381 |
FeatureType featureType = null;
|
|
382 |
try {
|
|
383 |
if( getDataStore()!=null ){
|
|
384 |
featureType =
|
|
385 |
(((FeatureStore) getDataStore()).getDefaultFeatureType());
|
|
386 |
}
|
|
387 |
} catch (DataException e) {
|
|
388 |
throw new ReadException(getName(), e);
|
|
389 |
}
|
|
390 |
if( featureType!=null ){
|
|
391 |
int indexGeom = featureType.getDefaultGeometryAttributeIndex();
|
|
392 |
typeShape =
|
|
393 |
featureType.getAttributeDescriptor(indexGeom).getGeometryType();
|
|
394 |
}
|
|
395 |
}
|
|
396 |
return typeShape;
|
|
379 |
if (typeShape == -1) {
|
|
380 |
FeatureType featureType = null;
|
|
381 |
try {
|
|
382 |
if (getDataStore() != null) {
|
|
383 |
featureType
|
|
384 |
= (((FeatureStore) getDataStore()).getDefaultFeatureType());
|
|
385 |
}
|
|
386 |
} catch (DataException e) {
|
|
387 |
throw new ReadException(getName(), e);
|
|
388 |
}
|
|
389 |
if (featureType != null) {
|
|
390 |
int indexGeom = featureType.getDefaultGeometryAttributeIndex();
|
|
391 |
typeShape
|
|
392 |
= featureType.getAttributeDescriptor(indexGeom).getGeometryType();
|
|
393 |
}
|
|
394 |
}
|
|
395 |
return typeShape;
|
|
397 | 396 |
} |
398 | 397 |
|
399 | 398 |
/** |
400 | 399 |
* Returns the layer's geometry type |
401 |
*
|
|
400 |
* |
|
402 | 401 |
* @return the geometry type |
403 |
* |
|
404 |
* @throws ReadException |
|
405 |
* if there is an error getting the geometry type |
|
402 |
* |
|
403 |
* @throws ReadException if there is an error getting the geometry type |
|
406 | 404 |
*/ |
407 | 405 |
public GeometryType getGeometryType() throws ReadException { |
408 | 406 |
FeatureType featureType = null; |
409 | 407 |
try { |
410 | 408 |
if (getDataStore() != null) { |
411 |
featureType =
|
|
412 |
(((FeatureStore) getDataStore()).getDefaultFeatureType()); |
|
409 |
featureType |
|
410 |
= (((FeatureStore) getDataStore()).getDefaultFeatureType());
|
|
413 | 411 |
} |
414 | 412 |
} catch (DataException e) { |
415 | 413 |
throw new ReadException(getName(), e); |
416 | 414 |
} |
417 | 415 |
return featureType == null ? null : featureType |
418 |
.getDefaultGeometryAttribute().getGeomType(); |
|
416 |
.getDefaultGeometryAttribute().getGeomType();
|
|
419 | 417 |
} |
420 | 418 |
|
421 | 419 |
public void saveToState(PersistentState state) throws PersistenceException { |
422 | 420 |
|
423 | 421 |
FeatureStore featureStore = null; |
424 | 422 |
|
425 |
if ( !this.isAvailable() ) {
|
|
423 |
if (!this.isAvailable()) {
|
|
426 | 424 |
logger.info("The '" + this.getName() + "' layer is not available, it will persist not."); |
427 | 425 |
return; |
428 | 426 |
} |
429 |
|
|
427 |
|
|
430 | 428 |
try { |
431 | 429 |
super.saveToState(state); |
432 | 430 |
|
433 |
if ( getLegend() != null ) {
|
|
431 |
if (getLegend() != null) {
|
|
434 | 432 |
state.set("legend", getLegend()); |
435 | 433 |
} |
436 | 434 |
|
437 | 435 |
featureStore = getFeatureStore(); |
438 | 436 |
|
439 |
if ( featureStore != null ) {
|
|
437 |
if (featureStore != null) {
|
|
440 | 438 |
state.set("featureStore", featureStore); |
441 | 439 |
} |
442 | 440 |
|
443 | 441 |
state.set("isLabeled", isLabeled); |
444 | 442 |
|
445 |
if ( strategy != null ) {
|
|
443 |
if (strategy != null) {
|
|
446 | 444 |
state.set("labelingStrategy", strategy); |
447 | 445 |
} |
448 | 446 |
|
449 |
if ( getLinkProperties() != null ) {
|
|
447 |
if (getLinkProperties() != null) {
|
|
450 | 448 |
state.set("linkProperties", getLinkProperties()); |
451 | 449 |
} |
452 | 450 |
|
... | ... | |
461 | 459 |
|
462 | 460 |
} |
463 | 461 |
|
464 |
|
|
465 | 462 |
public void loadFromState(PersistentState state) throws PersistenceException { |
466 | 463 |
|
467 | 464 |
DataStore store = null; |
... | ... | |
470 | 467 |
Boolean isLabeled = Boolean.FALSE; |
471 | 468 |
|
472 | 469 |
try { |
473 |
super.loadFromState(state);
|
|
474 |
store = (DataStore) state.get("featureStore");
|
|
470 |
super.loadFromState(state); |
|
471 |
store = (DataStore) state.get("featureStore"); |
|
475 | 472 |
|
476 | 473 |
try { |
477 | 474 |
this.bindToDataStore(store); |
478 | 475 |
} catch (LoadLayerException e) { |
479 |
throw new PersistenceException("Can't bind layer '"+this.getName()+"' to store '"+store.getFullName()+"'.",e);
|
|
476 |
throw new PersistenceException("Can't bind layer '" + this.getName() + "' to store '" + store.getFullName() + "'.", e);
|
|
480 | 477 |
} |
481 | 478 |
|
482 |
|
|
483 | 479 |
vectorLegend = (IVectorLegend) state.get("legend"); |
484 | 480 |
|
485 | 481 |
try { |
... | ... | |
488 | 484 |
throw new PersistenceException("Can't set vector legend to the layer.", e); |
489 | 485 |
} |
490 | 486 |
|
491 |
|
|
492 | 487 |
try { |
493 | 488 |
isLabeled = (Boolean) state.get("isLabeled"); |
494 |
if ( isLabeled.booleanValue() ) {
|
|
489 |
if (isLabeled.booleanValue()) {
|
|
495 | 490 |
labelingStrategy = (ILabelingStrategy) state.get("labelingStrategy"); |
496 | 491 |
} |
497 | 492 |
} catch (Exception ex) { |
... | ... | |
499 | 494 |
ex); |
500 | 495 |
} |
501 | 496 |
|
502 |
if ( isLabeled.booleanValue() ) {
|
|
497 |
if (isLabeled.booleanValue()) {
|
|
503 | 498 |
this.setIsLabeled(true); |
504 | 499 |
this.setLabelingStrategy(labelingStrategy); |
505 | 500 |
} else { |
... | ... | |
510 | 505 |
typeShape = state.getInt("typeShape"); |
511 | 506 |
|
512 | 507 |
} catch (Throwable e) { |
513 |
String storeName = (store == null)? "unknow" : store.getFullName(); |
|
514 |
logger.warn("can't load layer '" + this.getName() + "' (store="+storeName+") from persisted state.", e);
|
|
508 |
String storeName = (store == null) ? "unknow" : store.getFullName();
|
|
509 |
logger.warn("can't load layer '" + this.getName() + "' (store=" + storeName + ") from persisted state.", e);
|
|
515 | 510 |
this.setAvailable(false); |
516 | 511 |
return; |
517 | 512 |
} |
... | ... | |
521 | 516 |
/** |
522 | 517 |
* Sobreimplementaci?n del m?todo toString para que las bases de datos |
523 | 518 |
* identifiquen la capa. |
524 |
*
|
|
519 |
* |
|
525 | 520 |
* @return DOCUMENT ME! |
526 | 521 |
*/ |
527 | 522 |
public String toString() { |
... | ... | |
546 | 541 |
return fs.isEditing(); |
547 | 542 |
} |
548 | 543 |
} |
549 |
|
|
550 |
|
|
544 |
|
|
551 | 545 |
public void setEditing(boolean b) throws StartEditionLayerException { |
552 |
|
|
546 |
|
|
553 | 547 |
try { |
554 | 548 |
throw new RuntimeException(); |
555 | 549 |
} catch (Throwable th) { |
556 | 550 |
logger.info("This method is deprecated. ", th); |
557 | 551 |
} |
558 |
|
|
552 |
|
|
559 | 553 |
if (b == super.isEditing()) { |
560 | 554 |
return; |
561 | 555 |
} |
562 |
|
|
556 |
|
|
563 | 557 |
super.setEditing(b); |
564 | 558 |
FeatureStore fs = getFeatureStore(); |
565 | 559 |
if (b) { |
... | ... | |
573 | 567 |
callEditionChanged(LayerEvent.createEditionChangedEvent(this, "edition")); |
574 | 568 |
} |
575 | 569 |
|
576 |
|
|
577 | 570 |
/** |
578 | 571 |
* @deprecated Use {@link #getSpatialCache()} |
579 | 572 |
*/ |
... | ... | |
601 | 594 |
|
602 | 595 |
/** |
603 | 596 |
* Siempre es un numero mayor de 1000 |
604 |
*
|
|
597 |
* |
|
605 | 598 |
* @param maxFeatures |
606 | 599 |
*/ |
607 | 600 |
public void setMaxFeaturesInEditionCache(int maxFeatures) { |
... | ... | |
612 | 605 |
} |
613 | 606 |
|
614 | 607 |
/** |
615 |
* This method returns a boolean that is used by the FPopMenu |
|
616 |
* to make visible the properties menu or not. It is visible by |
|
617 |
* default, and if a later don't have to show this menu only |
|
618 |
* has to override this method. |
|
619 |
* |
|
620 |
* @return |
|
621 |
* If the properties menu is visible (or not) |
|
608 |
* This method returns a boolean that is used by the FPopMenu to make |
|
609 |
* visible the properties menu or not. It is visible by default, and if a |
|
610 |
* later don't have to show this menu only has to override this method. |
|
611 |
* |
|
612 |
* @return If the properties menu is visible (or not) |
|
622 | 613 |
*/ |
623 | 614 |
public boolean isPropertiesMenuVisible() { |
624 | 615 |
return true; |
... | ... | |
691 | 682 |
} |
692 | 683 |
|
693 | 684 |
protected boolean isOnePoint(AffineTransform graphicsTransform, |
694 |
ViewPort viewPort, |
|
695 |
double dpi, |
|
696 |
CartographicSupport csSym, |
|
697 |
Geometry geom, |
|
698 |
int[] xyCoords) { |
|
685 |
ViewPort viewPort,
|
|
686 |
double dpi,
|
|
687 |
CartographicSupport csSym,
|
|
688 |
Geometry geom,
|
|
689 |
int[] xyCoords) {
|
|
699 | 690 |
return isOnePoint(graphicsTransform, viewPort, geom, xyCoords) |
700 |
&& csSym.getCartographicSize(viewPort, dpi, geom) <= 1; |
|
691 |
&& csSym.getCartographicSize(viewPort, dpi, geom) <= 1;
|
|
701 | 692 |
} |
702 | 693 |
|
703 | 694 |
private boolean isOnePoint(AffineTransform graphicsTransform, |
704 |
ViewPort viewPort, |
|
705 |
Geometry geom, |
|
706 |
int[] xyCoords) { |
|
695 |
ViewPort viewPort,
|
|
696 |
Geometry geom,
|
|
697 |
int[] xyCoords) {
|
|
707 | 698 |
boolean onePoint = false; |
708 | 699 |
int type = geom.getType(); |
709 | 700 |
if (type == Geometry.TYPES.NULL) { |
... | ... | |
714 | 705 |
Envelope geomBounds = geom.getEnvelope(); |
715 | 706 |
|
716 | 707 |
// ICoordTrans ct = getCoordTrans(); |
717 |
|
|
718 | 708 |
// Se supone que la geometria ya esta reproyectada |
719 | 709 |
// if (ct!=null) { |
720 | 710 |
// // geomBounds = ct.getInverted().convert(geomBounds); |
721 | 711 |
// geomBounds = geomBounds.convert(ct); |
722 | 712 |
// } |
723 |
|
|
724 | 713 |
double dist1Pixel = viewPort.getDist1pixel(); |
725 | 714 |
|
726 |
onePoint =
|
|
727 |
(geomBounds.getLength(0) <= dist1Pixel && geomBounds.getLength(1) <= dist1Pixel); |
|
715 |
onePoint |
|
716 |
= (geomBounds.getLength(0) <= dist1Pixel && geomBounds.getLength(1) <= dist1Pixel);
|
|
728 | 717 |
|
729 | 718 |
if (onePoint) { |
730 | 719 |
// avoid out of range exceptions |
731 | 720 |
org.gvsig.fmap.geom.primitive.Point p; |
732 | 721 |
try { |
733 |
p =
|
|
734 |
geomManager.createPoint(geomBounds.getMinimum(0), |
|
735 |
geomBounds.getMinimum(1), |
|
736 |
SUBTYPES.GEOM2D); |
|
722 |
p |
|
723 |
= geomManager.createPoint(geomBounds.getMinimum(0),
|
|
724 |
geomBounds.getMinimum(1),
|
|
725 |
SUBTYPES.GEOM2D);
|
|
737 | 726 |
p.transform(viewPort.getAffineTransform()); |
738 | 727 |
p.transform(graphicsTransform); |
739 | 728 |
xyCoords[0] = (int) p.getX(); |
... | ... | |
770 | 759 |
} |
771 | 760 |
|
772 | 761 |
public void drawLabels(BufferedImage image, |
773 |
Graphics2D g, |
|
774 |
ViewPort viewPort, |
|
775 |
Cancellable cancel, |
|
776 |
double scale, |
|
777 |
double dpi) throws ReadException { |
|
762 |
Graphics2D g,
|
|
763 |
ViewPort viewPort,
|
|
764 |
Cancellable cancel,
|
|
765 |
double scale,
|
|
766 |
double dpi) throws ReadException {
|
|
778 | 767 |
if (strategy != null && isWithinScale(scale)) { |
779 | 768 |
strategy.draw(image, g, scale, viewPort, cancel, dpi); |
780 | 769 |
} |
781 | 770 |
} |
782 | 771 |
|
783 | 772 |
public void printLabels(Graphics2D g, |
784 |
ViewPort viewPort, |
|
785 |
Cancellable cancel, |
|
786 |
double scale, |
|
787 |
PrintAttributes properties) throws ReadException { |
|
773 |
ViewPort viewPort,
|
|
774 |
Cancellable cancel,
|
|
775 |
double scale,
|
|
776 |
PrintAttributes properties) throws ReadException {
|
|
788 | 777 |
if (strategy != null) { |
789 | 778 |
strategy.print(g, scale, viewPort, cancel, properties); |
790 | 779 |
} |
... | ... | |
792 | 781 |
|
793 | 782 |
/** |
794 | 783 |
* Return true, because a Vectorial Layer supports HyperLink |
795 |
*
|
|
784 |
* |
|
796 | 785 |
* @deprecated the hiperlink functionaliti is out the layer now |
797 | 786 |
*/ |
798 | 787 |
public boolean allowLinks() { |
... | ... | |
808 | 797 |
} |
809 | 798 |
|
810 | 799 |
/** |
811 |
* @deprecated use instead {@link #queryByPoint(org.gvsig.fmap.geom.primitive.Point, double, FeatureType)} |
|
800 |
* @deprecated use instead |
|
801 |
* {@link #queryByPoint(org.gvsig.fmap.geom.primitive.Point, double, FeatureType)} |
|
812 | 802 |
*/ |
813 | 803 |
public FeatureSet queryByPoint(Point2D mapPoint, |
814 |
double tol, |
|
815 |
FeatureType featureType) throws DataException { |
|
804 |
double tol,
|
|
805 |
FeatureType featureType) throws DataException {
|
|
816 | 806 |
logger.warn("Deprecated use of queryByPoint."); |
817 | 807 |
GeometryManager manager = GeometryLocator.getGeometryManager(); |
818 | 808 |
org.gvsig.fmap.geom.primitive.Point center; |
819 | 809 |
try { |
820 |
center =
|
|
821 |
(org.gvsig.fmap.geom.primitive.Point) manager.create(TYPES.POINT, |
|
822 |
SUBTYPES.GEOM2D); |
|
810 |
center |
|
811 |
= (org.gvsig.fmap.geom.primitive.Point) manager.create(TYPES.POINT,
|
|
812 |
SUBTYPES.GEOM2D);
|
|
823 | 813 |
center.setX(mapPoint.getX()); |
824 | 814 |
center.setY(mapPoint.getY()); |
825 |
Circle circle =
|
|
826 |
(Circle) manager.create(TYPES.CIRCLE, SUBTYPES.GEOM2D); |
|
815 |
Circle circle |
|
816 |
= (Circle) manager.create(TYPES.CIRCLE, SUBTYPES.GEOM2D);
|
|
827 | 817 |
circle.setPoints(center, tol); |
828 | 818 |
return queryByGeometry(circle, featureType); |
829 | 819 |
} catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) { |
... | ... | |
832 | 822 |
} |
833 | 823 |
|
834 | 824 |
public FeatureSet queryByPoint(org.gvsig.fmap.geom.primitive.Point point, |
835 |
double tol, |
|
836 |
FeatureType featureType) throws DataException { |
|
825 |
double tol,
|
|
826 |
FeatureType featureType) throws DataException {
|
|
837 | 827 |
GeometryManager manager = GeometryLocator.getGeometryManager(); |
838 | 828 |
try { |
839 |
Circle circle =
|
|
840 |
(Circle) manager.create(TYPES.CIRCLE, SUBTYPES.GEOM2D); |
|
829 |
Circle circle |
|
830 |
= (Circle) manager.create(TYPES.CIRCLE, SUBTYPES.GEOM2D);
|
|
841 | 831 |
circle.setPoints(point, tol); |
842 | 832 |
return queryByGeometry(circle, featureType); |
843 | 833 |
} catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) { |
... | ... | |
847 | 837 |
|
848 | 838 |
/** |
849 | 839 |
* Input geom must be in the CRS of the view. |
850 |
*
|
|
840 |
* |
|
851 | 841 |
* @param geom |
852 | 842 |
* @param featureType |
853 | 843 |
* @return |
... | ... | |
855 | 845 |
*/ |
856 | 846 |
public FeatureSet queryByGeometry(Geometry geom, FeatureType featureType) throws DataException { |
857 | 847 |
FeatureQuery featureQuery = featureStore.createFeatureQuery(); |
858 |
String geomName =
|
|
859 |
featureStore.getDefaultFeatureType() |
|
848 |
String geomName |
|
849 |
= featureStore.getDefaultFeatureType()
|
|
860 | 850 |
.getDefaultGeometryAttributeName(); |
861 | 851 |
featureQuery.setFeatureType(featureType); |
862 |
|
|
852 |
|
|
863 | 853 |
Geometry query_geo = this.transformToSourceCRS(geom, true); |
864 | 854 |
IProjection query_proj = getMapContext().getProjection(); |
865 | 855 |
if (this.getCoordTrans() != null) { |
866 |
query_proj = this.getCoordTrans().getPOrig();
|
|
856 |
query_proj = this.getCoordTrans().getPOrig(); |
|
867 | 857 |
} |
868 | 858 |
|
869 |
IntersectsGeometryEvaluator iee =
|
|
870 |
new IntersectsGeometryEvaluator( |
|
871 |
query_geo, |
|
872 |
query_proj, |
|
873 |
featureStore.getDefaultFeatureType(), |
|
874 |
geomName); |
|
859 |
IntersectsGeometryEvaluator iee |
|
860 |
= new IntersectsGeometryEvaluator(
|
|
861 |
query_geo,
|
|
862 |
query_proj,
|
|
863 |
featureStore.getDefaultFeatureType(),
|
|
864 |
geomName);
|
|
875 | 865 |
featureQuery.setFilter(iee); |
876 | 866 |
featureQuery.setAttributeNames(null); |
877 | 867 |
return getFeatureStore().getFeatureSet(featureQuery); |
... | ... | |
880 | 870 |
|
881 | 871 |
/** |
882 | 872 |
* It return the {@link FeatureSet} that intersects with the envelope. |
883 |
* @param envelope |
|
884 |
* envelope that defines the area for the query. |
|
885 |
* @param featureType |
|
886 |
* only the features with this feature type are used in |
|
887 |
* the query. |
|
888 |
* @return |
|
889 |
* the set of features that intersect with the envelope. |
|
873 |
* |
|
874 |
* @param envelope envelope that defines the area for the query. |
|
875 |
* @param featureType only the features with this feature type are used in |
|
876 |
* the query. |
|
877 |
* @return the set of features that intersect with the envelope. |
|
890 | 878 |
* @throws DataException |
891 | 879 |
*/ |
892 | 880 |
public FeatureSet queryByEnvelope(Envelope envelope, FeatureType featureType) throws DataException { |
... | ... | |
895 | 883 |
|
896 | 884 |
/** |
897 | 885 |
* It return the {@link FeatureSet} that intersects with the envelope. |
898 |
* @param envelope |
|
899 |
* envelope that defines the area for the query in viewport CRS |
|
900 |
* @param featureType |
|
901 |
* only the features with this feature type are used in |
|
902 |
* the query. |
|
903 |
* @param names |
|
904 |
* the feature attributes that have to be checked. |
|
905 |
* @return |
|
906 |
* the set of features that intersect with the envelope. |
|
886 |
* |
|
887 |
* @param envelope envelope that defines the area for the query in viewport |
|
888 |
* CRS |
|
889 |
* @param featureType only the features with this feature type are used in |
|
890 |
* the query. |
|
891 |
* @param names the feature attributes that have to be checked. |
|
892 |
* @return the set of features that intersect with the envelope. |
|
907 | 893 |
* @throws DataException |
908 | 894 |
*/ |
909 | 895 |
public FeatureSet queryByEnvelope(Envelope envelope, |
910 |
FeatureType featureType, |
|
911 |
String[] names) throws DataException { |
|
896 |
FeatureType featureType,
|
|
897 |
String[] names) throws DataException {
|
|
912 | 898 |
FeatureQuery featureQuery = featureStore.createFeatureQuery(); |
913 | 899 |
if (names == null) { |
914 | 900 |
featureQuery.setFeatureType(featureType); |
... | ... | |
918 | 904 |
} |
919 | 905 |
String geomName = featureStore.getDefaultFeatureType() |
920 | 906 |
.getDefaultGeometryAttributeName(); |
921 |
|
|
907 |
|
|
922 | 908 |
Envelope query_env = fromViewPortCRSToSourceCRS(this, envelope); |
923 | 909 |
IProjection query_proj = getMapContext().getProjection(); |
924 | 910 |
if (this.getCoordTrans() != null) { |
925 |
query_proj = this.getCoordTrans().getPOrig();
|
|
911 |
query_proj = this.getCoordTrans().getPOrig(); |
|
926 | 912 |
} |
927 |
|
|
928 |
IntersectsGeometryEvaluator iee =
|
|
929 |
new IntersectsGeometryEvaluator( |
|
930 |
query_env.getGeometry(), query_proj,
|
|
931 |
featureStore.getDefaultFeatureType(), |
|
932 |
geomName); |
|
913 |
|
|
914 |
IntersectsGeometryEvaluator iee |
|
915 |
= new IntersectsGeometryEvaluator(
|
|
916 |
query_env.getGeometry(), query_proj,
|
|
917 |
featureStore.getDefaultFeatureType(),
|
|
918 |
geomName);
|
|
933 | 919 |
featureQuery.setFilter(iee); |
934 | 920 |
return getFeatureStore().getFeatureSet(featureQuery); |
935 | 921 |
|
936 | 922 |
} |
937 | 923 |
|
938 | 924 |
public DynObjectSet getInfo(Point p, double tolerance, Cancellable cancel) throws LoadLayerException, |
939 |
DataException { |
|
925 |
DataException {
|
|
940 | 926 |
|
941 | 927 |
return getInfo(p, tolerance, cancel, true); |
942 | 928 |
} |
943 | 929 |
|
944 | 930 |
public DynObjectSet getInfo(Point p, |
945 |
double tolerance, |
|
946 |
Cancellable cancel, |
|
947 |
boolean fast) throws LoadLayerException, DataException { |
|
931 |
double tolerance,
|
|
932 |
Cancellable cancel,
|
|
933 |
boolean fast) throws LoadLayerException, DataException {
|
|
948 | 934 |
Point2D infop = new Point2D.Double(p.x, p.y); |
949 | 935 |
Point2D pReal = this.getMapContext().getViewPort().toMapPoint(infop); |
950 | 936 |
return queryByPoint(pReal, |
951 |
tolerance, |
|
952 |
getFeatureStore().getDefaultFeatureType()).getDynObjectSet(fast); |
|
937 |
tolerance,
|
|
938 |
getFeatureStore().getDefaultFeatureType()).getDynObjectSet(fast);
|
|
953 | 939 |
} |
954 | 940 |
|
955 | 941 |
public DynObjectSet getInfo(org.gvsig.fmap.geom.primitive.Point p, |
956 |
double tolerance) throws LoadLayerException, DataException { |
|
957 |
return queryByPoint(p,tolerance, getFeatureStore().getDefaultFeatureType()).getDynObjectSet(false); |
|
942 |
double tolerance) throws LoadLayerException, DataException {
|
|
943 |
return queryByPoint(p, tolerance, getFeatureStore().getDefaultFeatureType()).getDynObjectSet(false);
|
|
958 | 944 |
} |
959 |
|
|
945 |
|
|
960 | 946 |
public void legendCleared(LegendClearEvent event) { |
961 | 947 |
this.updateDrawVersion(); |
962 |
LegendChangedEvent e =
|
|
963 |
LegendChangedEvent.createLegendChangedEvent(legend, legend); |
|
948 |
LegendChangedEvent e |
|
949 |
= LegendChangedEvent.createLegendChangedEvent(legend, legend);
|
|
964 | 950 |
this.callLegendChanged(e); |
965 | 951 |
} |
966 | 952 |
|
967 | 953 |
public boolean symbolChanged(SymbolLegendEvent e) { |
968 | 954 |
this.updateDrawVersion(); |
969 |
LegendChangedEvent ev =
|
|
970 |
LegendChangedEvent.createLegendChangedEvent(legend, legend); |
|
955 |
LegendChangedEvent ev |
|
956 |
= LegendChangedEvent.createLegendChangedEvent(legend, legend);
|
|
971 | 957 |
this.callLegendChanged(ev); |
972 | 958 |
return true; |
973 | 959 |
} |
... | ... | |
975 | 961 |
public void update(Observable observable, Object notification) { |
976 | 962 |
if (observable.equals(this.featureStore)) { |
977 | 963 |
if (notification instanceof FeatureStoreNotification) { |
978 |
FeatureStoreNotification event =
|
|
979 |
(FeatureStoreNotification) notification; |
|
964 |
FeatureStoreNotification event |
|
965 |
= (FeatureStoreNotification) notification;
|
|
980 | 966 |
if (event.getType() == FeatureStoreNotification.AFTER_DELETE |
981 |
|| event.getType() == FeatureStoreNotification.AFTER_UNDO |
|
982 |
|| event.getType() == FeatureStoreNotification.AFTER_REDO |
|
983 |
|| event.getType() == FeatureStoreNotification.AFTER_REFRESH |
|
984 |
|| event.getType() == FeatureStoreNotification.AFTER_UPDATE |
|
985 |
|| event.getType() == FeatureStoreNotification.AFTER_UPDATE_TYPE |
|
986 |
|| event.getType() == FeatureStoreNotification.SELECTION_CHANGE |
|
987 |
|| event.getType() == FeatureStoreNotification.AFTER_INSERT) { |
|
967 |
|| event.getType() == FeatureStoreNotification.AFTER_UNDO
|
|
968 |
|| event.getType() == FeatureStoreNotification.AFTER_REDO
|
|
969 |
|| event.getType() == FeatureStoreNotification.AFTER_REFRESH
|
|
970 |
|| event.getType() == FeatureStoreNotification.AFTER_UPDATE
|
|
971 |
|| event.getType() == FeatureStoreNotification.AFTER_UPDATE_TYPE
|
|
972 |
|| event.getType() == FeatureStoreNotification.SELECTION_CHANGE
|
|
973 |
|| event.getType() == FeatureStoreNotification.AFTER_INSERT) {
|
|
988 | 974 |
this.updateDrawVersion(); |
989 |
|
|
975 |
|
|
990 | 976 |
} else if (event.getType() == FeatureStoreNotification.AFTER_CANCELEDITING) { |
991 |
|
|
977 |
|
|
992 | 978 |
setSpatialCacheEnabled(false); |
993 | 979 |
callEditionChanged(LayerEvent.createEditionChangedEvent(this, "edition")); |
994 | 980 |
this.updateDrawVersion(); |
995 |
|
|
981 |
|
|
996 | 982 |
} else if (event.getType() == FeatureStoreNotification.AFTER_STARTEDITING) { |
997 |
|
|
983 |
|
|
998 | 984 |
setSpatialCacheEnabled(true); |
999 | 985 |
callEditionChanged(LayerEvent.createEditionChangedEvent(this, "edition")); |
1000 | 986 |
|
1001 |
} else if (event.getType() == FeatureStoreNotification.TRANSFORM_CHANGE){ |
|
987 |
} else if (event.getType() == FeatureStoreNotification.TRANSFORM_CHANGE) {
|
|
1002 | 988 |
//If a transform has to be applied, try to reload the layer. |
1003 | 989 |
try { |
1004 | 990 |
reload(); |
... | ... | |
1008 | 994 |
} |
1009 | 995 |
} else if (event.getType() == FeatureStoreNotification.RESOURCE_CHANGED) { |
1010 | 996 |
this.setAvailable(false); |
1011 |
} else if (event.getType() == FeatureStoreNotification.AFTER_FINISHEDITING) {
|
|
997 |
} else if (event.getType() == FeatureStoreNotification.AFTER_FINISHEDITING) { |
|
1012 | 998 |
this.setAvailable(true); |
1013 | 999 |
setSpatialCacheEnabled(false); |
1014 | 1000 |
callEditionChanged(LayerEvent.createEditionChangedEvent(this, "edition")); |
1015 | 1001 |
this.updateDrawVersion(); |
1016 | 1002 |
} |
1017 | 1003 |
} |
1018 |
} |
|
1019 |
else if (notification instanceof FeatureDrawnNotification |
|
1020 |
&& (isEditing() || isLayerToSnap())) { |
|
1004 |
} else if (notification instanceof FeatureDrawnNotification |
|
1005 |
&& (isEditing() || isLayerToSnap())) { |
|
1021 | 1006 |
// This code is needed in editing mode |
1022 |
// for all layers involved in snapping
|
|
1023 |
// (including the layer being edited)
|
|
1024 |
Geometry geometry =
|
|
1025 |
((FeatureDrawnNotification) notification).getDrawnGeometry(); |
|
1007 |
// for all layers involved in snapping
|
|
1008 |
// (including the layer being edited)
|
|
1009 |
Geometry geometry |
|
1010 |
= ((FeatureDrawnNotification) notification).getDrawnGeometry();
|
|
1026 | 1011 |
spatialCache.insert(geometry.getEnvelope(), geometry); |
1027 | 1012 |
} |
1028 | 1013 |
} |
... | ... | |
1037 | 1022 |
} else { |
1038 | 1023 |
return this.getMapContext().getLayersToSnap().contains(this); |
1039 | 1024 |
} |
1040 |
|
|
1041 |
/* |
|
1042 |
Iterator itersnap = this.getMapContext().getLayersToSnap().iterator(); |
|
1043 |
Object item = null; |
|
1044 |
while (itersnap.hasNext()) { |
|
1045 |
item = itersnap.next(); |
|
1046 |
if (item == this) { |
|
1047 |
return true; |
|
1048 |
} |
|
1049 |
} |
|
1050 |
return false; |
|
1051 |
*/ |
|
1052 |
} |
|
1053 | 1025 |
|
1054 |
/* |
|
1026 |
/* |
|
1027 |
Iterator itersnap = this.getMapContext().getLayersToSnap().iterator(); |
|
1028 |
Object item = null; |
|
1029 |
while (itersnap.hasNext()) { |
|
1030 |
item = itersnap.next(); |
|
1031 |
if (item == this) { |
|
1032 |
return true; |
|
1033 |
} |
|
1034 |
} |
|
1035 |
return false; |
|
1036 |
*/ |
|
1037 |
} |
|
1038 |
|
|
1039 |
/* |
|
1055 | 1040 |
* (non-Javadoc) |
1056 | 1041 |
* |
1057 | 1042 |
* @see org.gvsig.metadata.Metadata#getMetadataChildren() |
... | ... | |
1069 | 1054 |
*/ |
1070 | 1055 |
public Object getMetadataID() throws MetadataException { |
1071 | 1056 |
return "Layer(" + this.getName() + "):" |
1072 |
+ this.featureStore.getMetadataID(); |
|
1057 |
+ this.featureStore.getMetadataID();
|
|
1073 | 1058 |
} |
1074 | 1059 |
|
1075 |
|
|
1076 |
|
|
1077 | 1060 |
public GeometryType getTypeVectorLayer() throws DataException, |
1078 |
LocatorException, |
|
1079 |
GeometryTypeNotSupportedException, |
|
1080 |
GeometryTypeNotValidException { |
|
1061 |
LocatorException,
|
|
1062 |
GeometryTypeNotSupportedException,
|
|
1063 |
GeometryTypeNotValidException {
|
|
1081 | 1064 |
// FIXME Esto deberia de pedirse a FType!!!! |
1082 | 1065 |
FeatureStore fs = this.getFeatureStore(); |
1083 | 1066 |
FeatureType fType = fs.getDefaultFeatureType(); |
1084 |
FeatureAttributeDescriptor attr =
|
|
1085 |
fType.getAttributeDescriptor(fType.getDefaultGeometryAttributeIndex()); |
|
1086 |
GeometryType geomType =
|
|
1087 |
GeometryLocator.getGeometryManager() |
|
1067 |
FeatureAttributeDescriptor attr |
|
1068 |
= fType.getAttributeDescriptor(fType.getDefaultGeometryAttributeIndex());
|
|
1069 |
GeometryType geomType |
|
1070 |
= GeometryLocator.getGeometryManager()
|
|
1088 | 1071 |
.getGeometryType(attr.getGeometryType(), |
1089 |
attr.getGeometrySubType()); |
|
1072 |
attr.getGeometrySubType());
|
|
1090 | 1073 |
return geomType; |
1091 | 1074 |
} |
1092 | 1075 |
|
... | ... | |
1124 | 1107 |
dispose(featureStore); |
1125 | 1108 |
spatialCache.clearAll(); |
1126 | 1109 |
} |
1127 |
|
|
1110 |
|
|
1128 | 1111 |
/** |
1129 |
* Returns envelope in layer's data source CRS |
|
1130 |
* from envelope provided in viewport CRS
|
|
1131 |
*
|
|
1112 |
* Returns envelope in layer's data source CRS from envelope provided in
|
|
1113 |
* viewport CRS |
|
1114 |
* |
|
1132 | 1115 |
* @param lyr |
1133 | 1116 |
* @param env |
1134 | 1117 |
* @return |
... | ... | |
1148 | 1131 |
} |
1149 | 1132 |
|
1150 | 1133 |
public Geometry transformToSourceCRS(Geometry geom, boolean clone) { |
1151 |
return fromViewPortCRSToSourceCRS(this,geom,clone);
|
|
1134 |
return fromViewPortCRSToSourceCRS(this, geom, clone);
|
|
1152 | 1135 |
} |
1153 |
|
|
1154 |
|
|
1136 |
|
|
1155 | 1137 |
/** |
1156 |
* Returns geometry in layer's data source CRS |
|
1157 |
* from geometry provided in viewport CRS
|
|
1158 |
*
|
|
1138 |
* Returns geometry in layer's data source CRS from geometry provided in
|
|
1139 |
* viewport CRS |
|
1140 |
* |
|
1159 | 1141 |
* @param lyr |
1160 | 1142 |
* @param geo |
1161 | 1143 |
* @param clone |
... | ... | |
1163 | 1145 |
* @deprecated use the transformToSourceCRS method of layer. |
1164 | 1146 |
*/ |
1165 | 1147 |
public static Geometry fromViewPortCRSToSourceCRS( |
1166 |
FLayer lyr, |
|
1167 |
Geometry geo, |
|
1168 |
boolean clone) { |
|
1169 |
|
|
1148 |
FLayer lyr,
|
|
1149 |
Geometry geo,
|
|
1150 |
boolean clone) {
|
|
1151 |
|
|
1170 | 1152 |
if (lyr == null || geo == null) { |
1171 | 1153 |
return null; |
1172 | 1154 |
} |
... | ... | |
1181 | 1163 |
return resp; |
1182 | 1164 |
} |
1183 | 1165 |
|
1184 |
|
|
1185 | 1166 |
} |
Also available in: Unified diff