Mercurial > dive4elements > river
changeset 8466:cc53aae06303
Gauge locations are obsolete since a long time.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 05 Nov 2014 13:04:53 +0100 |
parents | 2772a0fc7400 |
children | 5fa1c8be43db |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/WMSGaugeLocationArtifact.java backend/doc/schema/oracle-drop-spatial.sql backend/doc/schema/oracle-spatial.sql backend/doc/schema/oracle-spatial_idx.sql backend/doc/schema/postgresql-drop-spatial.sql backend/doc/schema/postgresql-spatial.sql backend/src/main/java/org/dive4elements/river/backend/FLYSCredentials.java backend/src/main/java/org/dive4elements/river/model/GaugeLocation.java |
diffstat | 8 files changed, 0 insertions(+), 294 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSGaugeLocationArtifact.java Tue Nov 04 17:09:04 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,141 +0,0 @@ -/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde - * Software engineering by Intevation GmbH - * - * This file is Free Software under the GNU AGPL (>=v3) - * and comes with ABSOLUTELY NO WARRANTY! Check out the - * documentation coming with Dive4Elements River for details. - */ - -package org.dive4elements.river.artifacts; - -import java.util.List; - -import org.apache.log4j.Logger; - -import com.vividsolutions.jts.geom.Envelope; -import com.vividsolutions.jts.geom.Geometry; - -import org.dive4elements.artifactdatabase.state.Facet; -import org.dive4elements.artifactdatabase.state.DefaultOutput; -import org.dive4elements.artifactdatabase.state.State; - -import org.dive4elements.river.model.River; -import org.dive4elements.river.model.GaugeLocation; - -import org.dive4elements.river.artifacts.model.FacetTypes; -import org.dive4elements.river.artifacts.model.RiverFactory; -import org.dive4elements.river.utils.RiverUtils; -import org.dive4elements.river.utils.GeometryUtils; - - -public class WMSGaugeLocationArtifact extends WMSDBArtifact { - - public static final String NAME = "wmsgaugelocation"; - - - private static final Logger log = - Logger.getLogger(WMSGaugeLocationArtifact.class); - - - @Override - public String getName() { - return NAME; - } - - - @Override - public State getCurrentState(Object cc) { - State s = new WMSGaugeLocationState(this); - - List<Facet> fs = getFacets(getCurrentStateId()); - - DefaultOutput o = new DefaultOutput( - "floodmap", - "floodmap", - "image/png", - fs, - "map"); - - s.getOutputs().add(o); - - return s; - } - - - - public static class WMSGaugeLocationState extends WMSDBState implements FacetTypes { - - private static final Logger log = - Logger.getLogger(WMSGaugeLocationState.class); - - protected Geometry geom; - - public WMSGaugeLocationState(WMSDBArtifact artifact) { - super(artifact); - } - - @Override - protected String getFacetType() { - return FLOODMAP_GAUGE_LOCATION; - } - - @Override - protected String getUrl() { - return RiverUtils.getUserWMSUrl(artifact.identifier()); - } - - @Override - protected String getSrid() { - River river = RiverFactory.getRiver(getRiverId()); - return RiverUtils.getRiverSrid(river.getName()); - } - - @Override - protected Envelope getExtent(boolean reproject) { - List<GaugeLocation> gauges = - GaugeLocation.getGaugeLocations(getRiverId(), getName()); - - Envelope max = null; - - for (GaugeLocation gauge: gauges) { - Envelope env = gauge.getGeom().getEnvelopeInternal(); - - if (max == null) { - max = env; - continue; - } - - max.expandToInclude(env); - } - - return max != null && reproject - ? GeometryUtils.transform(max, getSrid()) - : max; - } - - @Override - protected String getFilter() { - return "river_id=" + String.valueOf(getRiverId()) + - " and name='" + getName() + "'"; - } - - @Override - protected String getDataString() { - String srid = getSrid(); - - if (RiverUtils.isUsingOracle()) { - return "geom FROM gauge_location USING SRID " + srid; - } - else { - return "geom FROM gauge_location " + - "USING UNIQUE id USING SRID " + srid; - } - } - - @Override - protected String getGeometryType() { - return "POINT"; - } - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/backend/doc/schema/oracle-drop-spatial.sql Tue Nov 04 17:09:04 2014 +0100 +++ b/backend/doc/schema/oracle-drop-spatial.sql Wed Nov 05 13:04:53 2014 +0100 @@ -57,11 +57,6 @@ DELETE FROM USER_SDO_GEOM_METADATA WHERE TABLE_NAME = 'HYDR_BOUNDARIES_POLY'; DROP SEQUENCE HYDR_BOUNDARIES_POLY_ID_SEQ; -DROP TRIGGER gauge_location_trigger; -DROP TABLE gauge_location PURGE; -DELETE FROM USER_SDO_GEOM_METADATA WHERE TABLE_NAME = 'GAUGE_LOCATION'; -DROP SEQUENCE GAUGE_LOCATION_ID_SEQ; - DROP TRIGGER jetties_trigger; DROP TABLE jetties PURGE; DELETE FROM USER_SDO_GEOM_METADATA WHERE TABLE_NAME = 'JETTIES';
--- a/backend/doc/schema/oracle-spatial.sql Tue Nov 04 17:09:04 2014 +0100 +++ b/backend/doc/schema/oracle-spatial.sql Wed Nov 05 13:04:53 2014 +0100 @@ -372,23 +372,6 @@ / -- Hydrologie/Streckendaten/ -CREATE SEQUENCE GAUGE_LOCATION_ID_SEQ; -CREATE TABLE gauge_location ( - OGR_FID NUMBER(38), - GEOM MDSYS.SDO_GEOMETRY, - river_id NUMBER(38), - name VARCHAR(64), - path VARCHAR(256), - id NUMBER PRIMARY KEY NOT NULL -); -INSERT INTO USER_SDO_GEOM_METADATA VALUES ('gauge_location', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',3282450,3912240,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5248260,6100130,0.001),MDSYS.SDO_DIM_ELEMENT('Z',-100000,100000,0.002)), 31467); -CREATE OR REPLACE TRIGGER gauge_location_trigger BEFORE INSERT ON gauge_location FOR EACH ROW - BEGIN - SELECT GAUGE_LOCATION_ID_SEQ.nextval INTO :new.id FROM dual; - END; -/ - - CREATE TABLE jetty_kinds( id NUMBER PRIMARY KEY NOT NULL, name VARCHAR(64)
--- a/backend/doc/schema/oracle-spatial_idx.sql Tue Nov 04 17:09:04 2014 +0100 +++ b/backend/doc/schema/oracle-spatial_idx.sql Wed Nov 05 13:04:53 2014 +0100 @@ -17,7 +17,6 @@ CREATE INDEX floodmaps_spatial_idx ON floodmaps(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=MULTIPOLYGON'); -CREATE INDEX gauge_location_idx ON gauge_location(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=POINT'); CREATE INDEX hydr_boundaries_poly_idx ON hydr_boundaries_poly(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=MULTIPOLYGON'); CREATE INDEX jetties_idx ON jetties(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=POINT');
--- a/backend/doc/schema/postgresql-drop-spatial.sql Tue Nov 04 17:09:04 2014 +0100 +++ b/backend/doc/schema/postgresql-drop-spatial.sql Wed Nov 05 13:04:53 2014 +0100 @@ -36,9 +36,6 @@ DROP TABLE hydr_boundaries_poly; DROP SEQUENCE HYDR_BOUNDARIES_POLY_ID_SEQ; -DROP TABLE gauge_location; -DROP SEQUENCE GAUGE_LOCATION_ID_SEQ; - DROP TABLE fed_states; DROP TABLE hws_kinds; DROP TABLE sobek_kinds;
--- a/backend/doc/schema/postgresql-spatial.sql Tue Nov 04 17:09:04 2014 +0100 +++ b/backend/doc/schema/postgresql-spatial.sql Wed Nov 05 13:04:53 2014 +0100 @@ -300,17 +300,6 @@ ALTER TABLE hydr_boundaries_poly ALTER COLUMN id SET DEFAULT NEXTVAL('HYDR_BOUNDARIES_POLY_ID_SEQ'); -CREATE SEQUENCE GAUGE_LOCATION_ID_SEQ; -CREATE TABLE gauge_location ( - id int PRIMARY KEY NOT NULL, - river_id int REFERENCES rivers(id) ON DELETE CASCADE, - name VARCHAR(255), - path VARCHAR(256) -); -SELECT AddGeometryColumn('gauge_location','geom',31467,'POINT',2); -ALTER TABLE gauge_location ALTER COLUMN id SET DEFAULT NEXTVAL('GAUGE_LOCATION_ID_SEQ'); - - CREATE TABLE jetty_kinds( id int PRIMARY KEY NOT NULL, name VARCHAR(64)
--- a/backend/src/main/java/org/dive4elements/river/backend/FLYSCredentials.java Tue Nov 04 17:09:04 2014 +0100 +++ b/backend/src/main/java/org/dive4elements/river/backend/FLYSCredentials.java Wed Nov 05 13:04:53 2014 +0100 @@ -42,7 +42,6 @@ import org.dive4elements.river.model.FlowVelocityModel; import org.dive4elements.river.model.FlowVelocityModelValue; import org.dive4elements.river.model.Gauge; -import org.dive4elements.river.model.GaugeLocation; import org.dive4elements.river.model.GrainFraction; import org.dive4elements.river.model.HWSKind; import org.dive4elements.river.model.HWSLine; @@ -167,7 +166,6 @@ FlowVelocityModel.class, FlowVelocityModelValue.class, Gauge.class, - GaugeLocation.class, GrainFraction.class, HWSKind.class, HWSLine.class,
--- a/backend/src/main/java/org/dive4elements/river/model/GaugeLocation.java Tue Nov 04 17:09:04 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde - * Software engineering by Intevation GmbH - * - * This file is Free Software under the GNU AGPL (>=v3) - * and comes with ABSOLUTELY NO WARRANTY! Check out the - * documentation coming with Dive4Elements River for details. - */ - -package org.dive4elements.river.model; - -import com.vividsolutions.jts.geom.Point; - -import org.dive4elements.river.backend.SessionHolder; - -import java.io.Serializable; - -import java.util.List; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.OneToOne; -import javax.persistence.Table; - -import org.hibernate.Query; -import org.hibernate.Session; - -import org.hibernate.annotations.Type; - - -@Entity -@Table(name = "gauge_location") -public class GaugeLocation -implements Serializable -{ - private Integer id; - private River river; - private String name; - private Point geom; - - - public GaugeLocation() { - } - - - @Id - @Column(name = "id") - public Integer getId() { - return id; - } - - - public void setId(Integer id) { - this.id = id; - } - - - @OneToOne - @JoinColumn(name = "river_id") - public River getRiver() { - return river; - } - - - public void setRiver(River river) { - this.river = river; - } - - - @Column(name = "name") - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - @Column(name = "geom") - @Type(type = "org.hibernatespatial.GeometryUserType") - public Point getGeom() { - return geom; - } - - - public void setGeom(Point geom) { - this.geom = geom; - } - - - /** - * Returns a list of RiverAxisKm objects for a given river. - * - * @param riverid The ID of a river in the database. - * - * @return a list of RiverAxisKm objects. - */ - public static List<GaugeLocation> getGaugeLocations(int riverid, String name) { - Session session = SessionHolder.HOLDER.get(); - - Query query = session.createQuery( - "from GaugeLocation where river.id =:riverid and name=:name"); - query.setParameter("riverid", riverid); - query.setParameter("name", name); - - List<GaugeLocation> list = query.list(); - - return list; - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :