[PATCH] Implement deepCopy on WMSLayerFacet WMSDBLayerFacet and WSPLGENLayerFacet
Wald Commits
scm-commit at wald.intevation.org
Thu Feb 6 14:47:26 CET 2014
# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1391694449 -3600
# Node ID 72d0cec59c78ee2543c8230110784405bb896c67
# Parent 44a9233c62eb322d952e109256f4fb853c045906
Implement deepCopy on WMSLayerFacet WMSDBLayerFacet and WSPLGENLayerFacet
This fixes double map-out and dissappearance of visible floodmap if
cloning happened.
diff -r 44a9233c62eb -r 72d0cec59c78 artifacts/src/main/java/org/dive4elements/river/artifacts/model/map/WMSDBLayerFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/map/WMSDBLayerFacet.java Thu Feb 06 13:22:10 2014 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/map/WMSDBLayerFacet.java Thu Feb 06 14:47:29 2014 +0100
@@ -9,6 +9,7 @@
package org.dive4elements.river.artifacts.model.map;
import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+import org.dive4elements.artifactdatabase.state.Facet;
public class WMSDBLayerFacet extends WMSLayerFacet {
@@ -110,5 +111,27 @@
public boolean isQueryable() {
return true;
}
+
+ /** Clone Facet-bound data. */
+ protected void cloneData(WMSDBLayerFacet copy) {
+ super.cloneData(copy);
+ copy.setFilter(this.getFilter());
+ copy.setData(this.getData());
+ copy.setGeometryType(this.getGeometryType());
+ copy.setConnection(this.getConnection());
+ copy.setConnectionType(this.getConnectionType());
+ copy.setLabelItem(this.getLabelItem());
+ }
+
+ /** Copy deeply. */
+ @Override
+ public Facet deepCopy() {
+ WMSDBLayerFacet copy = new WMSDBLayerFacet();
+ copy.set(this);
+
+ cloneData(copy);
+
+ return copy;
+ }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r 44a9233c62eb -r 72d0cec59c78 artifacts/src/main/java/org/dive4elements/river/artifacts/model/map/WMSLayerFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/map/WMSLayerFacet.java Thu Feb 06 13:22:10 2014 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/map/WMSLayerFacet.java Thu Feb 06 14:47:29 2014 +0100
@@ -173,18 +173,30 @@
}
+ /** Clone facet-bound data. */
+ protected void cloneData(WMSLayerFacet copy) {
+ copy.type = type;
+ copy.stateId = stateId;
+ copy.hash = hash;
+
+ if (layers != null) {
+ copy.layers = new ArrayList<String>(layers);
+ }
+ else {
+ copy.layers = new ArrayList<String>();
+ }
+
+ copy.url = url;
+ copy.extent = extent;
+ copy.srid = srid;
+ }
+
@Override
public Facet deepCopy() {
WMSLayerFacet copy = new WMSLayerFacet();
copy.set(this);
- copy.type = type;
- copy.layers = new ArrayList<String>(layers);
- copy.stateId = stateId;
- copy.hash = hash;
- copy.url = url;
- copy.extent = extent;
- copy.srid = srid;
+ cloneData(copy);
return copy;
}
diff -r 44a9233c62eb -r 72d0cec59c78 artifacts/src/main/java/org/dive4elements/river/artifacts/model/map/WSPLGENLayerFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/map/WSPLGENLayerFacet.java Thu Feb 06 13:22:10 2014 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/map/WSPLGENLayerFacet.java Thu Feb 06 14:47:29 2014 +0100
@@ -9,6 +9,7 @@
package org.dive4elements.river.artifacts.model.map;
import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+import org.dive4elements.artifactdatabase.state.Facet;
public class WSPLGENLayerFacet
extends WMSLayerFacet
@@ -50,5 +51,17 @@
public boolean isQueryable() {
return true;
}
+
+
+ /** Copy deeply. */
+ @Override
+ public Facet deepCopy() {
+ WSPLGENLayerFacet copy = new WSPLGENLayerFacet();
+ copy.set(this);
+
+ cloneData(copy);
+
+ return copy;
+ }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
More information about the Dive4elements-commits
mailing list