comparison artifacts/src/main/java/org/dive4elements/river/artifacts/CrossSectionArtifact.java @ 6539:4c463ca9b36e

issue1157: Make a better choice for master and active CrossSection.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 04 Jul 2013 12:12:37 +0200
parents f2722602936c
children 4930ea445bdd
comparison
equal deleted inserted replaced
6538:de62db0f2035 6539:4c463ca9b36e
141 } 141 }
142 } 142 }
143 fs.add(new CrossSectionFacet(0, cs.getDescription())); 143 fs.add(new CrossSectionFacet(0, cs.getDescription()));
144 144
145 // Find out if we are newest and become master if so. 145 // Find out if we are newest and become master if so.
146 boolean isNewest = CrossSectionFactory.isNewest(cs); 146 boolean isNewest = cs.shouldBeMaster(getParentKm());
147 String newString = (isNewest) ? "1" : "0"; 147 String newString = (isNewest) ? "1" : "0";
148 addStringData(DATA_IS_NEWEST, newString); 148 addStringData(DATA_IS_NEWEST, newString);
149 addStringData(DATA_IS_MASTER, newString); 149 addStringData(DATA_IS_MASTER, newString);
150 150
151 if (!fs.isEmpty()) { 151 if (!fs.isEmpty()) {
163 { 163 {
164 D4EArtifact flys = (D4EArtifact) artifact; 164 D4EArtifact flys = (D4EArtifact) artifact;
165 165
166 RangeAccess rangeAccess = new RangeAccess(flys); 166 RangeAccess rangeAccess = new RangeAccess(flys);
167 double[] range = rangeAccess.getKmRange(); 167 double[] range = rangeAccess.getKmRange();
168 double min = 0.0f;
169 if (range != null && range.length > 0) { 168 if (range != null && range.length > 0) {
170 min = range[0]; 169 this.addStringData(DATA_KM, Double.toString(range[0]));
171 } 170 this.addStringData(PARENT_KM, Double.toString(range[0]));
172 this.addStringData(DATA_KM, Double.toString(min)); 171 }
173 } 172 }
174 173
175 174
176 /** Returns next possible km for a cross-section. */ 175 /** Returns next possible km for a cross-section. */
177 public Double getNextKm() { 176 public Double getNextKm() {

http://dive4elements.wald.intevation.org