comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationState.java @ 9563:3955ecc1a516

Restrict inundation map to selected river range
author gernotbelger
date Mon, 29 Oct 2018 17:57:30 +0100
parents bf6b63208f34
children 63bbd5e45839
comparison
equal deleted inserted replaced
9562:2b1626fa4a95 9563:3955ecc1a516
22 import org.dive4elements.river.artifacts.model.EmptyFacet; 22 import org.dive4elements.river.artifacts.model.EmptyFacet;
23 import org.dive4elements.river.artifacts.model.ReportFacet; 23 import org.dive4elements.river.artifacts.model.ReportFacet;
24 import org.dive4elements.river.artifacts.model.map.WMSLayerFacet; 24 import org.dive4elements.river.artifacts.model.map.WMSLayerFacet;
25 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; 25 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact;
26 import org.dive4elements.river.artifacts.uinfo.inundationduration.InundationDurationCalculationResult.WmsLayer; 26 import org.dive4elements.river.artifacts.uinfo.inundationduration.InundationDurationCalculationResult.WmsLayer;
27 import org.dive4elements.river.model.RiverAxisKm;
28 import org.dive4elements.river.utils.GeometryUtils;
29
30 import com.vividsolutions.jts.geom.Envelope;
27 31
28 /** 32 /**
29 * @author Domenico Nardi Tironi 33 * @author Domenico Nardi Tironi
30 */ 34 */
31 public class InundationDurationState extends MapState { 35 public class InundationDurationState extends MapState {
119 if (old instanceof CalculationResult) 123 if (old instanceof CalculationResult)
120 return (CalculationResult) old; 124 return (CalculationResult) old;
121 125
122 return new InundationDurationCalculation(context).calculate(artifact); 126 return new InundationDurationCalculation(context).calculate(artifact);
123 } 127 }
128
129 /**
130 * The extent is restricted to the selected station range
131 */
132 @Override
133 protected Envelope getExtent(final boolean reproject) {
134
135 final InundationDurationAccess access = new InundationDurationAccess((UINFOArtifact) this.artifact);
136
137 final double lowerKm = access.getLowerKm();
138 final double upperKm = access.getUpperKm();
139
140 final List<RiverAxisKm> axisKms = RiverAxisKm.getRiverAxisKms(getRiverId(), lowerKm, upperKm);
141
142 Envelope max = null;
143
144 for (final RiverAxisKm ax : axisKms) {
145 final Envelope env = ax.getGeom().getEnvelopeInternal();
146
147 if (max == null)
148 max = env;
149 else
150 max.expandToInclude(env);
151 }
152
153 return max != null && reproject ? GeometryUtils.transform(max, getSrid()) : max;
154 }
124 } 155 }

http://dive4elements.wald.intevation.org