comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSCatchmentArtifact.java @ 2671:055315495f8d

Modified floodmap specific datacage configuration and improved WMS catchment layer. flys-artifacts/trunk@4359 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 08 May 2012 12:14:55 +0000
parents 410e40b88c7a
children 5afccab9aac1
comparison
equal deleted inserted replaced
2670:402695ee7c24 2671:055315495f8d
76 { 76 {
77 private static final Logger logger = 77 private static final Logger logger =
78 Logger.getLogger(CatchmentState.class); 78 Logger.getLogger(CatchmentState.class);
79 79
80 protected int riverId; 80 protected int riverId;
81 protected String name;
81 82
82 public CatchmentState(WMSDBArtifact artifact) { 83 public CatchmentState(WMSDBArtifact artifact) {
83 super(artifact); 84 super(artifact);
84 riverId = 0; 85 riverId = 0;
86 name = null;
85 } 87 }
86 88
87 public int getRiverId() { 89 public int getRiverId() {
88 if (riverId == 0) { 90 if (riverId == 0) {
89 String ids = artifact.getDataAsString("ids"); 91 String ids = artifact.getDataAsString("ids");
92 String[] parts = ids.split(";");
90 93
91 try { 94 try {
92 riverId = Integer.valueOf(ids); 95 riverId = Integer.valueOf(parts[0]);
93 } 96 }
94 catch (NumberFormatException nfe) { 97 catch (NumberFormatException nfe) {
95 logger.error("Cannot parse river id from '" + ids + "'"); 98 logger.error("Cannot parse river id from '" + ids + "'");
96 } 99 }
97 } 100 }
98 101
99 return riverId; 102 return riverId;
103 }
104
105 public String getName() {
106 if (name == null) {
107 String ids = artifact.getDataAsString("ids");
108
109 String parts[] = ids.split(";");
110 name = parts[1];
111 }
112
113 return name;
100 } 114 }
101 115
102 @Override 116 @Override
103 protected String getFacetType() { 117 protected String getFacetType() {
104 return FLOODMAP_CATCHMENT; 118 return FLOODMAP_CATCHMENT;
123 return FLYSUtils.getRiverSrid(river.getName()); 137 return FLYSUtils.getRiverSrid(river.getName());
124 } 138 }
125 139
126 @Override 140 @Override
127 protected Envelope getExtent() { 141 protected Envelope getExtent() {
128 List<Catchment> catchments = Catchment.getCatchments(getRiverId()); 142 List<Catchment> catchments =
143 Catchment.getCatchments(getRiverId(), getName());
129 144
130 Envelope max = null; 145 Envelope max = null;
131 146
132 for (Catchment c: catchments) { 147 for (Catchment c: catchments) {
133 Envelope env = c.getGeom().getEnvelopeInternal(); 148 Envelope env = c.getGeom().getEnvelopeInternal();
143 return max; 158 return max;
144 } 159 }
145 160
146 @Override 161 @Override
147 protected String getFilter() { 162 protected String getFilter() {
148 return "river_id=" + String.valueOf(getRiverId()); 163 return "river_id=" + String.valueOf(getRiverId())
164 + " AND name='" + getName() + "'";
149 } 165 }
150 166
151 @Override 167 @Override
152 protected String getDataString() { 168 protected String getDataString() {
153 String srid = getSrid(); 169 String srid = getSrid();

http://dive4elements.wald.intevation.org