Issue #1817 BOX issue with only having HUC0 in template
Change-Id: I4dee15d72c1a5b56bbb3d04c7a74f292d6ff87b8 Former-commit-id:58a37d1e44
[formerly f0641a4771b6816944f38d1ec51b0356b983e2f4] Former-commit-id:d114302b06
This commit is contained in:
parent
0d1cba8eae
commit
3cdd8f8ed2
2 changed files with 35 additions and 7 deletions
|
@ -85,6 +85,7 @@ import com.vividsolutions.jts.io.WKBReader;
|
|||
* 02/01/13 1569 D.Hladky Constants
|
||||
* 03/01/13 DR13228 G. Zhang Add VGB county and related code
|
||||
* 02/20/13 1635 D. Hladky Constants
|
||||
* 03/18/13 1817 D. Hladky Fixed issue with BOX where only 1 HUC was showing up.
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
|
@ -250,11 +251,35 @@ public class FFMPTemplates {
|
|||
"No configuration file found, default settings applied");
|
||||
|
||||
// we use 4 because it is the 90% solution as a start point for
|
||||
// the analysis
|
||||
ArrayList<Integer> hucParams = FFMPUtils.getHucParameters(4,
|
||||
// the analysis. Added check to make sure at least 2 HUC layers are created.
|
||||
int preliminarystart = 4;
|
||||
// first crack
|
||||
ArrayList<Integer> hucParams = FFMPUtils.getHucParameters(preliminarystart,
|
||||
primaryCWA.getCwa());
|
||||
setHucDepthStart(hucParams.get(0));
|
||||
setTotalHucLevels(hucParams.get(1));
|
||||
int startDepth = hucParams.get(0);
|
||||
int numlevels = hucParams.get(1);
|
||||
int i = 1;
|
||||
// recursively call until we have two layers
|
||||
while (numlevels < 2) {
|
||||
int checkDepth = preliminarystart - i;
|
||||
hucParams = FFMPUtils.getHucParameters(checkDepth,
|
||||
primaryCWA.getCwa());
|
||||
startDepth = hucParams.get(0);
|
||||
numlevels = hucParams.get(1);
|
||||
i++;
|
||||
|
||||
// safety value in case it just won't work with this shape
|
||||
if (checkDepth == 0) {
|
||||
// bail, won't work
|
||||
statusHandler
|
||||
.handle(Priority.ERROR,
|
||||
"Cannot create a good template. There are not enough unique HUC's to create more than 1 layer.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
setHucDepthStart(startDepth);
|
||||
setTotalHucLevels(numlevels);
|
||||
setExtents(20000.0);
|
||||
setVirtual(true);
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@ import com.vividsolutions.jts.io.WKTWriter;
|
|||
* 06/18/12 DR 15108 G. Zhang Fix County FIPS 4-digit issue
|
||||
* 01/02/13 DR 1569 D. Hladky constants, arraylist to list and moved common menthods here
|
||||
* 03/01/13 DR 13228 G. Zhang Add state for VGB query and related code
|
||||
* 03/18/13 1817 D. Hladky Fixed issue with BOX where only 1 HUC was showing up.
|
||||
* </pre>
|
||||
* @author dhladky
|
||||
* @version 1
|
||||
|
@ -304,18 +305,20 @@ public class FFMPUtils {
|
|||
int startDepth = prelimstartDepth;
|
||||
|
||||
for (int i = 0; i < pfafs.length; i++) {
|
||||
int depth = pfafs[i].indexOf("0");
|
||||
int depth = pfafs[i].substring(prelimstartDepth).indexOf("0");
|
||||
depth = prelimstartDepth + depth;
|
||||
if (depth > maxDepth) {
|
||||
maxDepth = depth;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// do an 80% analysis to find min (startDepth)
|
||||
if (pfafs.length > 0) {
|
||||
for (int myMinDepth = maxDepth; myMinDepth > 0; myMinDepth--) {
|
||||
int ilevelcount = 0;
|
||||
for (int i = 0; i < pfafs.length; i++) {
|
||||
int idepth = pfafs[i].indexOf("0");
|
||||
int idepth = pfafs[i].substring(prelimstartDepth).indexOf("0");
|
||||
idepth = prelimstartDepth + idepth;
|
||||
if (idepth >= myMinDepth) {
|
||||
ilevelcount++;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue