Mercurial > dive4elements > river
changeset 1873:841af55d5e53
Added new WMSFixpointsArtifact for displaying fixpoints in maps.
flys-artifacts/trunk@3227 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 10 Nov 2011 14:25:56 +0000 |
parents | 2e810c50e685 |
children | 68d0baa01c1b |
files | flys-artifacts/ChangeLog flys-artifacts/doc/conf/artifacts/winfo.xml flys-artifacts/doc/conf/conf.xml flys-artifacts/doc/conf/meta-data.xml flys-artifacts/doc/conf/themes.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSFixpointsArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java flys-artifacts/src/main/resources/messages.properties flys-artifacts/src/main/resources/messages_de.properties flys-artifacts/src/main/resources/messages_de_DE.properties flys-artifacts/src/main/resources/messages_en.properties |
diffstat | 11 files changed, 228 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Thu Nov 10 14:06:49 2011 +0000 +++ b/flys-artifacts/ChangeLog Thu Nov 10 14:25:56 2011 +0000 @@ -1,3 +1,26 @@ +2011-11-10 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/flys/artifacts/WMSFixpointsArtifact.java: New + WMSDBArtifact that creates facets for "fixpoints" relation. + + * doc/conf/artifacts/winfo.xml: Registered "floodmap.fixpoints" as valid + "floodmap" facet. + + * doc/conf/conf.xml: Registered the new WMSFixpointsArtifact. + + * doc/conf/themes.xml: Added a theme for "floodmap.fixpoints". + + * src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java: Added + Facet type "floodmap.fixpoints". + + * doc/conf/meta-data.xml: Made "floodmap.fixpoints" available via datacage. + + * src/main/resources/messages.properties, + src/main/resources/messages_de_DE.properties, + src/main/resources/messages_en.properties, + src/main/resources/messages_de.properties: Added titles for + "floodmap.fixpoints" facets. + 2011-11-10 Felix Wolfsteller <felix.wolfsteller@intevation.de> * doc/conf/meta-data.xml: Refactored and (re)use macros.
--- a/flys-artifacts/doc/conf/artifacts/winfo.xml Thu Nov 10 14:06:49 2011 +0000 +++ b/flys-artifacts/doc/conf/artifacts/winfo.xml Thu Nov 10 14:25:56 2011 +0000 @@ -381,6 +381,7 @@ <facet name="floodmap.floodplain"/> <facet name="floodmap.lines"/> <facet name="floodmap.buildings"/> + <facet name="floodmap.fixpoints"/> </facets> </outputmode> <outputmode name="wsplgen_report" description="output.wsplgen_report" mime-type="text/xml" type="report">
--- a/flys-artifacts/doc/conf/conf.xml Thu Nov 10 14:06:49 2011 +0000 +++ b/flys-artifacts/doc/conf/conf.xml Thu Nov 10 14:25:56 2011 +0000 @@ -38,6 +38,9 @@ <artifact-factory name="wmsbuildingsfactory" description="Factory to create an artifact to be used in WINFO" ttl="3600000" artifact="de.intevation.flys.artifacts.WMSBuildingsArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory> + <artifact-factory name="wmsfixpointsfactory" description="Factory to create an artifact to be used in WINFO" + ttl="3600000" + artifact="de.intevation.flys.artifacts.WMSFixpointsArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory> <artifact-factory name="wmsbackground" description="Factory to create an artifact to be used in WINFO" ttl="3600000" artifact="de.intevation.flys.artifacts.WMSBackgroundArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
--- a/flys-artifacts/doc/conf/meta-data.xml Thu Nov 10 14:06:49 2011 +0000 +++ b/flys-artifacts/doc/conf/meta-data.xml Thu Nov 10 14:25:56 2011 +0000 @@ -561,6 +561,22 @@ </dc:elements> </dc:context> </dc:macro> + <dc:macro name="flood-map-fixpoints"> + <dc:context> + <dc:statement> + SELECT count(*) as km_exists + FROM fixpoints WHERE river_id = ${river_id} + </dc:statement> + <dc:elements> + <dc:if test="$km_exists>0"> + <fixpoints> + <dc:attribute name="factory" value="wmsfixpointsfactory"/> + <dc:attribute name="ids" value="${river_id}"/> + </fixpoints> + </dc:if> + </dc:elements> + </dc:context> + </dc:macro> <dc:macro name="flood-map-complete"> <kilometrage> <riveraxis> @@ -574,6 +590,7 @@ <dc:call-macro name="flood-map-floodplain"/> <dc:call-macro name="flood-map-lines"/> <dc:call-macro name="flood-map-buildings"/> + <dc:call-macro name="flood-map-fixpoints"/> </kilometrage> <rastermap> <background>
--- a/flys-artifacts/doc/conf/themes.xml Thu Nov 10 14:06:49 2011 +0000 +++ b/flys-artifacts/doc/conf/themes.xml Thu Nov 10 14:25:56 2011 +0000 @@ -731,6 +731,14 @@ </fields> </theme> + <theme name="Fixpoints"> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="255, 0, 0"/> + <field name="linesize" type="int" display="Liniendicke" default="5" hints="h"/> + <field name="symbol" type="Symbol" display="Symbol" default="point"/> + </fields> + </theme> + <theme name="Qps"> <fields> <field name="linecolor" type="Color" display="Linienfarbe" default="0, 0, 255"/> @@ -861,6 +869,7 @@ <mapping from="floodmap.floodplain" to="Floodplain"/> <mapping from="floodmap.lines" to="Lines"/> <mapping from="floodmap.buildings" to="Buildings"/> + <mapping from="floodmap.fixpoints" to="Fixpoints"/> <mapping from="other.wkms" to="WKms"/> <mapping from="other.wqkms" to="WQKms"/> <mapping from="heightmarks_points" to="heightmarks_points"/>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSFixpointsArtifact.java Thu Nov 10 14:25:56 2011 +0000 @@ -0,0 +1,169 @@ +package de.intevation.flys.artifacts; + +import java.util.List; + +import org.w3c.dom.Document; + +import org.apache.log4j.Logger; + +import com.vividsolutions.jts.geom.Envelope; + +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallMeta; + +import de.intevation.artifactdatabase.state.DefaultOutput; +import de.intevation.artifactdatabase.state.Facet; +import de.intevation.artifactdatabase.state.State; + +import de.intevation.flys.model.River; +import de.intevation.flys.model.Fixpoint; + +import de.intevation.flys.artifacts.model.FacetTypes; +import de.intevation.flys.artifacts.model.RiverFactory; +import de.intevation.flys.artifacts.resources.Resources; +import de.intevation.flys.utils.FLYSUtils; + + +public class WMSFixpointsArtifact extends WMSDBArtifact { + + public static final String NAME = "fixpoints"; + + + private static final Logger logger = + Logger.getLogger(WMSFixpointsArtifact.class); + + + @Override + public void setup( + String identifier, + ArtifactFactory factory, + Object context, + CallMeta callMeta, + Document data) + { + logger.debug("WMSFixpointsArtifact.setup"); + + super.setup(identifier, factory, context, callMeta, data); + } + + + @Override + public String getName() { + return NAME; + } + + + @Override + public State getCurrentState(Object cc) { + State s = new FixpointsState(this); + + List<Facet> fs = facets.get(getCurrentStateId()); + + DefaultOutput o = new DefaultOutput( + "floodmap", + "floodmap", + "image/png", + fs, + "map"); + + s.getOutputs().add(o); + + return s; + } + + + public static class FixpointsState extends WMSDBState implements FacetTypes + { + private static final Logger logger = + Logger.getLogger(FixpointsState.class); + + protected int riverId; + + public FixpointsState(WMSDBArtifact artifact) { + super(artifact); + riverId = 0; + } + + public int getRiverId() { + if (riverId == 0) { + String ids = artifact.getDataAsString("ids"); + + try { + riverId = Integer.valueOf(ids); + } + catch (NumberFormatException nfe) { + logger.error("Cannot parse river id from '" + ids + "'"); + } + } + + return riverId; + } + + @Override + protected String getFacetType() { + return FLOODMAP_FIXPOINTS; + } + + @Override + protected String getTitle(CallMeta meta) { + return Resources.getMsg( + meta, + FLOODMAP_FIXPOINTS, + FLOODMAP_FIXPOINTS); + } + + @Override + protected String getUrl() { + return FLYSUtils.getUserWMSUrl(artifact.identifier()); + } + + @Override + protected String getSrid() { + River river = RiverFactory.getRiver(getRiverId()); + return FLYSUtils.getRiverSrid(river.getName()); + } + + @Override + protected Envelope getExtent() { + List<Fixpoint> fixpoints = Fixpoint.getFixpoints(getRiverId()); + + Envelope max = null; + + for (Fixpoint f: fixpoints) { + Envelope env = f.getGeom().getEnvelopeInternal(); + + if (max == null) { + max = env; + continue; + } + + max.expandToInclude(env); + } + + return max; + } + + @Override + protected String getFilter() { + return "river_id=" + String.valueOf(getRiverId()); + } + + @Override + protected String getDataString() { + String srid = getSrid(); + + if (FLYSUtils.isUsingOracle()) { + return "geom FROM fixpoints USING SRID " + srid; + } + else { + return "geom FROM fixpoints USING UNIQUE id USING SRID " + srid; + } + } + + @Override + protected String getGeometryType() { + return "POINT"; + } + } // end of WMSKmState +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java Thu Nov 10 14:06:49 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java Thu Nov 10 14:25:56 2011 +0000 @@ -25,6 +25,7 @@ String FLOODMAP_FLOODPLAIN = "floodmap.floodplain"; String FLOODMAP_LINES = "floodmap.lines"; String FLOODMAP_BUILDINGS = "floodmap.buildings"; + String FLOODMAP_FIXPOINTS = "floodmap.fixpoints"; String DISCHARGE_LONGITUDINAL_W = "discharge_longitudinal_section.w"; String DISCHARGE_LONGITUDINAL_Q = "discharge_longitudinal_section.q";
--- a/flys-artifacts/src/main/resources/messages.properties Thu Nov 10 14:06:49 2011 +0000 +++ b/flys-artifacts/src/main/resources/messages.properties Thu Nov 10 14:25:56 2011 +0000 @@ -93,6 +93,7 @@ floodmap.floodplain = Floodplain floodmap.lines = Lines floodmap.buildings = Buildings +floodmap.fixpoints = Fixpoints wsplgen.job.queued = WSPLGEN job in queue. wsplgen.job.error = An unexpected error while starting WSPLGEN occured.
--- a/flys-artifacts/src/main/resources/messages_de.properties Thu Nov 10 14:06:49 2011 +0000 +++ b/flys-artifacts/src/main/resources/messages_de.properties Thu Nov 10 14:25:56 2011 +0000 @@ -93,6 +93,7 @@ floodmap.floodplain = Talaue floodmap.lines = Linien floodmap.buildings = Bauwerke +floodmap.fixpoints = Festpunkte wsplgen.job.queued = WSPLGEN Berechnung befindet sich in Warteschlange. wsplgen.job.error = Ein unerwarteter Fehler beim Starten von WSPLGEN ist aufgetreten.
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties Thu Nov 10 14:06:49 2011 +0000 +++ b/flys-artifacts/src/main/resources/messages_de_DE.properties Thu Nov 10 14:25:56 2011 +0000 @@ -93,6 +93,7 @@ floodmap.floodplain = Talaue floodmap.lines = Linien floodmap.buildings = Bauwerke +floodmap.fixpoints = Festpunkte wsplgen.job.queued = WSPLGEN Berechnung befindet sich in Warteschlange. wsplgen.job.error = Ein unerwarteter Fehler beim Starten von WSPLGEN ist aufgetreten.
--- a/flys-artifacts/src/main/resources/messages_en.properties Thu Nov 10 14:06:49 2011 +0000 +++ b/flys-artifacts/src/main/resources/messages_en.properties Thu Nov 10 14:25:56 2011 +0000 @@ -90,6 +90,8 @@ floodmap.catchment = Catchment floodmap.floodplain = Floodplain floodmap.lines = Lines +floodmap.buildings = Buildings +floodmap.fixpoints = Fixpoints wsplgen.job.queued = WSPLGEN job in queue. wsplgen.job.error = An unexpected error while starting WSPLGEN occured.