Revision 33331 branches/v2_0_0_prep/extensions/extWMS/src/org/gvsig/wms/fmap/layers/FLyrWMS.java
FLyrWMS.java | ||
---|---|---|
74 | 74 |
import org.gvsig.andami.PluginServices; |
75 | 75 |
import org.gvsig.andami.messages.NotificationManager; |
76 | 76 |
import org.gvsig.fmap.crs.CRSFactory; |
77 |
import org.gvsig.fmap.dal.DataTypes; |
|
77 | 78 |
import org.gvsig.fmap.dal.exception.DataException; |
78 | 79 |
import org.gvsig.fmap.dal.exception.ReadException; |
80 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
79 | 81 |
import org.gvsig.fmap.geom.GeometryLocator; |
80 | 82 |
import org.gvsig.fmap.geom.GeometryManager; |
81 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
82 | 83 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
83 | 84 |
import org.gvsig.fmap.geom.primitive.Envelope; |
84 | 85 |
import org.gvsig.fmap.mapcontext.ViewPort; |
... | ... | |
117 | 118 |
import org.gvsig.tools.persistence.PersistentState; |
118 | 119 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
119 | 120 |
import org.gvsig.tools.task.Cancellable; |
120 |
import org.gvsig.utils.StringUtilities; |
|
121 | 121 |
import org.gvsig.wmc.WebMapContextTags; |
122 | 122 |
import org.gvsig.wmc.XmlBuilder; |
123 | 123 |
import org.gvsig.wms.fmap.WMSDriverExceptionType; |
... | ... | |
182 | 182 |
private FMapWMSDriver wms; |
183 | 183 |
private WMSStatus wmsStatus = new WMSStatus(); |
184 | 184 |
private boolean wmsTransparency; |
185 |
private Vector styles;
|
|
186 |
private Vector dimensions;
|
|
185 |
private Vector<String> styles;
|
|
186 |
private Vector<String> dimensions;
|
|
187 | 187 |
private boolean firstLoad = false; |
188 |
private Hashtable onlineResources = new Hashtable();
|
|
188 |
private Map<String,String> onlineResources = new Hashtable<String,String>();
|
|
189 | 189 |
private Dimension fixedSize; |
190 | 190 |
private boolean queryable = true; |
191 | 191 |
private VisualStatus visualStatus = new VisualStatus(); |
... | ... | |
196 | 196 |
private GridTransparency transparency = null; |
197 | 197 |
private int[] renderBands = null; |
198 | 198 |
private FLyrRasterSE[] layerRaster = null; |
199 |
private ArrayList filterArguments = null;
|
|
199 |
private List<String> filterArguments = null;
|
|
200 | 200 |
|
201 |
private List disableUpdateDrawVersion;
|
|
201 |
private List<WeakReference<Thread>> disableUpdateDrawVersion;
|
|
202 | 202 |
private int lastNColumns = 0; |
203 | 203 |
private int lastNRows = 0; |
204 | 204 |
|
... | ... | |
362 | 362 |
throws PersistenceException { |
363 | 363 |
super.loadFromState(state); |
364 | 364 |
|
365 |
this.fullEnvelope = (Envelope) state.get("fullExtent"); |
|
365 | 366 |
|
366 |
// FIXME |
|
367 |
this.setFullEnvelope(this.getEnvelopeFromRectable2D(StringUtilities |
|
368 |
.string2Rect(state.getString("fullExtent")))); |
|
369 |
|
|
370 | 367 |
// Host |
371 |
try { |
|
372 |
host = new URL(state.getString("host")); |
|
373 |
} catch (MalformedURLException e) { |
|
374 |
throw new PersistenceException("Param host is not a valid URL", e); |
|
375 |
} |
|
368 |
host = (URL) state.get("host"); |
|
376 | 369 |
|
377 | 370 |
// Part of the query that is not the host, or the |
378 | 371 |
// layer names, or other not listed bellow |
... | ... | |
387 | 380 |
// SRS |
388 | 381 |
m_SRS = state.getString("srs"); |
389 | 382 |
|
390 |
// String claseStr = StatusLayerRaster.defaultClass; |
|
391 |
// if (xml.contains("raster.class")) { |
|
392 |
// claseStr = xml.getStringProperty("raster.class"); |
|
393 |
// } |
|
394 |
|
|
395 | 383 |
// Transparency |
396 | 384 |
if (state.hasValue("wms_transparency")) { |
397 | 385 |
wmsTransparency = state.getBoolean("wms_transparency"); |
... | ... | |
420 | 408 |
|
421 | 409 |
// fixedSize |
422 | 410 |
if (state.hasValue("fixedSize")) { |
423 |
fixedSize = new Dimension(state.getInt("fixedWidth"), |
|
424 |
state.getInt("fixedHeight")); |
|
411 |
fixedSize = (Dimension) state.get("fixedSize"); |
|
412 |
} else { |
|
413 |
fixedSize = null; |
|
425 | 414 |
} |
426 |
|
|
427 |
// if(status!=null) { |
|
428 |
// status.setXMLEntity(xml, this); |
|
429 |
// } else{ |
|
430 |
// if(claseStr != null && !claseStr.equals("")){ |
|
431 |
// try{ |
|
432 |
// // Class clase = |
|
433 |
// // LayerFactory.getLayerClassForLayerClassName(claseStr); |
|
434 |
// Class clase = this.getClass(); |
|
435 |
// Constructor constr = clase.getConstructor(null); |
|
436 |
// status = (IStatusRaster)constr.newInstance(null); |
|
437 |
// if(status != null) { |
|
438 |
// ((StatusLayerRaster)status).setNameClass(claseStr); |
|
439 |
// status.setXMLEntity(xml, this); |
|
440 |
// filterArguments = status.getFilterArguments(); |
|
441 |
// transparency = status.getTransparency(); |
|
442 |
// renderBands = status.getRenderBands(); |
|
443 |
// } |
|
444 |
// // }catch(ClassNotFoundException exc){ |
|
445 |
// // exc.printStackTrace(); |
|
446 |
// }catch(InstantiationException exc){ |
|
447 |
// exc.printStackTrace(); |
|
448 |
// }catch(IllegalAccessException exc){ |
|
449 |
// exc.printStackTrace(); |
|
450 |
// }catch(NoSuchMethodException exc){ |
|
451 |
// exc.printStackTrace(); |
|
452 |
// }catch(InvocationTargetException exc){ |
|
453 |
// exc.printStackTrace(); |
|
454 |
// } |
|
455 |
// } |
|
456 |
// } |
|
457 | 415 |
firstLoad = true; |
458 | 416 |
} |
459 | 417 |
|
... | ... | |
461 | 419 |
public void saveToState(PersistentState state) throws PersistenceException { |
462 | 420 |
super.saveToState(state); |
463 | 421 |
|
464 |
state.set("fullExtent", StringUtilities.rect2String(this |
|
465 |
.getRectable2DFromEnvelope(this.fullEnvelope))); |
|
422 |
state.set("fullEnvelope", this.fullEnvelope); |
|
466 | 423 |
|
467 | 424 |
// Host |
468 |
state.set("host", host.toExternalForm());
|
|
425 |
state.set("host", host); |
|
469 | 426 |
|
470 | 427 |
// Part of the query that is not the host, or the |
471 | 428 |
// layer names, or other not listed bellow |
... | ... | |
479 | 436 |
|
480 | 437 |
// SRS |
481 | 438 |
state.set("srs", m_SRS); |
482 |
// if (status!=null) { |
|
483 |
// status.getXMLEntity(xml, true, this); |
|
484 |
// } else{ |
|
485 |
// status = new StatusLayerRaster(); |
|
486 |
// status.getXMLEntity(xml, true, this); |
|
487 |
// } |
|
488 | 439 |
|
489 | 440 |
// Transparency |
490 | 441 |
state.set("wms_transparency", wmsTransparency); |
... | ... | |
507 | 458 |
|
508 | 459 |
// fixedSize |
509 | 460 |
if (isSizeFixed()) { |
510 |
state.set("fixedSize", true); |
|
511 |
state.set("fixedWidth", fixedSize.width); |
|
512 |
state.set("fixedHeight", fixedSize.height); |
|
461 |
state.set("fixedSize", fixedSize); |
|
513 | 462 |
} |
514 | 463 |
} |
515 | 464 |
|
516 | 465 |
public static void registerPersistent() { |
517 | 466 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
518 |
DynStruct definition = manager.addDefinition( |
|
519 |
FLyrWMS.class, |
|
520 |
PERSISTENT_NAME, |
|
521 |
PERSISTENT_DESCRIPTION, |
|
522 |
null, |
|
523 |
null |
|
524 |
); |
|
525 |
definition.extend( |
|
526 |
(DynClass)ToolsLocator.getPersistenceManager() |
|
527 |
.getDefinition(FLyrRasterSE.class) |
|
528 |
); |
|
529 |
|
|
530 |
definition.addDynFieldObject("fullExtent").setMandatory(true); |
|
531 |
definition.addDynFieldString("host").setMandatory(true); |
|
532 |
definition.addDynFieldString("infoLayerQuery").setMandatory(true); |
|
533 |
definition.addDynFieldString("layerQuery").setMandatory(true); |
|
534 |
definition.addDynFieldString("format").setMandatory(true); |
|
535 |
definition.addDynFieldString("srs").setMandatory(true); |
|
536 |
definition.addDynFieldObject("wms_transparency").setMandatory(true); |
|
537 |
definition.addDynFieldList("styles").setMandatory(false); |
|
538 |
definition.addDynFieldList("dimensions").setMandatory(false); |
|
539 |
definition.addDynFieldMap("onlineResources").setMandatory(true); |
|
540 |
definition.addDynFieldBoolean("queryable").setMandatory(false); |
|
541 |
definition.addDynFieldBoolean("fixedSize").setMandatory(false); |
|
542 |
definition.addDynFieldInt("fixedWidth").setMandatory(false); |
|
543 |
definition.addDynFieldInt("fixedHeight").setMandatory(false); |
|
467 |
DynStruct definition = manager.getDefinition(PERSISTENT_NAME); |
|
468 |
if( definition == null ) { |
|
469 |
FLyrRasterSE.registerPersistent(); |
|
470 |
definition = manager.addDefinition( |
|
471 |
FLyrWMS.class, |
|
472 |
PERSISTENT_NAME, |
|
473 |
PERSISTENT_DESCRIPTION, |
|
474 |
null, |
|
475 |
null |
|
476 |
); |
|
477 |
definition.extend( |
|
478 |
(DynClass)ToolsLocator.getPersistenceManager() |
|
479 |
.getDefinition(FLyrRasterSE.class) |
|
480 |
); |
|
481 |
|
|
482 |
definition.addDynFieldObject("fullExtent") |
|
483 |
.setType(DataTypes.ENVELOPE) |
|
484 |
.setMandatory(true); |
|
485 |
definition.addDynFieldURL("host") |
|
486 |
.setMandatory(true); |
|
487 |
definition.addDynFieldString("infoLayerQuery").setMandatory(true); |
|
488 |
definition.addDynFieldString("layerQuery").setMandatory(true); |
|
489 |
definition.addDynFieldString("format").setMandatory(true); |
|
490 |
definition.addDynFieldString("srs").setMandatory(true); |
|
491 |
definition.addDynFieldBoolean("wms_transparency").setMandatory(true); |
|
492 |
definition.addDynFieldList("styles") |
|
493 |
.setClassOfItems(String.class) |
|
494 |
.setMandatory(false); |
|
495 |
definition.addDynFieldList("dimensions") |
|
496 |
.setClassOfItems(String.class) |
|
497 |
.setMandatory(false); |
|
498 |
definition.addDynFieldMap("onlineResources") |
|
499 |
.setClassOfItems(String.class) |
|
500 |
.setMandatory(true); |
|
501 |
definition.addDynFieldBoolean("queryable").setMandatory(false); |
|
502 |
definition.addDynFieldObject("fixedSize") |
|
503 |
.setClassOfValue(Dimension.class) |
|
504 |
.setMandatory(false); |
|
505 |
} |
|
544 | 506 |
} |
545 | 507 |
|
546 | 508 |
|
... | ... | |
956 | 918 |
fl.addEnvParam("MultiRasterDataset", layerRaster[nLyr].getDataSource()); |
957 | 919 |
fl.setInitDataType(layerRaster[nLyr].getDataType()[0]); |
958 | 920 |
RasterFilterListManager filterListManager = new RasterFilterListManager(fl); |
959 |
filterListManager.createFilterListFromStrings(filterArguments); |
|
921 |
filterListManager.createFilterListFromStrings((ArrayList) filterArguments);
|
|
960 | 922 |
filterArguments = null; |
961 | 923 |
filterList = fl; |
962 | 924 |
} |
Also available in: Unified diff