ASM #14630 Not able to import basins.dat with apostrophe and incorrect data posted

Change-Id: Icb37fa478bac99a7214e391c9237caa4c298528a

Former-commit-id: 27ec9fc2bfec99ba60fe48753237bcfb104e05f6
This commit is contained in:
Xuezhi.Wei 2015-06-29 15:17:11 +00:00
parent 7788905e20
commit fbc513cf97
2 changed files with 22 additions and 12 deletions

View file

@ -77,6 +77,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* 09 Sep 2009 2772 mpduff Implemented Dialog.
* 16 Apr 2013 1790 rferrel Made dialog non-blocking.
* 16 Jul 2013 2088 rferrel Changes for non-blocking TextEditorDlg.
* 29 June 2015 14630 xwei Fixed : Not able to import basins.dat with apostrophe and incorrect data posted
*
* </pre>
*
@ -692,6 +693,7 @@ public class ArealDefinitionsDlg extends CaveSWTDialog {
/* Remove any excess whitespace. */
str = str.trim();
str = str.replaceAll("\\s{2,}", " ");
str = str.replaceAll("'", "''");
String[] parts = str.split(" ");
int numParts = parts.length;

View file

@ -37,7 +37,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 15, 2009 2772 mpduff Initial creation
* Apr 16, 2013 1790 rferrel Code clean up for non-blocking dialogs.
* Apr 16, 2013 1790 rferrel Code clean up for non-blocking dialogs.
* June 29, 2015 14630 xwei Fixed : Not able to import basins.dat with apostrophe and incorrect data posted
*
* </pre>
*
@ -204,8 +205,7 @@ public class LineSegmentUtil {
* longitude box defined by the max lat/lon and the min lat/lon pairs
* retrieved above.
*/
Coordinate hrap = HrapUtil.latLonToHrap(new Coordinate(minLatLon.x,
maxLatLon.y));
Coordinate hrap = HrapUtil.latLonToHrap(new Coordinate(maxLatLon.x, maxLatLon.y));
minRow = hrap.y;
maxRow = hrap.y;
minCol = hrap.x;
@ -214,18 +214,15 @@ public class LineSegmentUtil {
for (int i = LATLON_NORTHEAST_CORNER; i <= LATLON_SOUTHWEST_CORNER; i++) {
switch (i) {
case LATLON_NORTHEAST_CORNER:
hrap = HrapUtil.latLonToHrap(new Coordinate(maxLatLon.x,
maxLatLon.y));
hrap = HrapUtil.latLonToHrap(new Coordinate(minLatLon.x, maxLatLon.y));
break;
case LATLON_SOUTHEAST_CORNER:
hrap = HrapUtil.latLonToHrap(new Coordinate(maxLatLon.x,
minLatLon.y));
hrap = HrapUtil.latLonToHrap(new Coordinate(minLatLon.x, minLatLon.y));
break;
case LATLON_SOUTHWEST_CORNER:
hrap = HrapUtil.latLonToHrap(new Coordinate(minLatLon.x,
minLatLon.y));
hrap = HrapUtil.latLonToHrap(new Coordinate(maxLatLon.x, minLatLon.y));
break;
default:
@ -295,9 +292,20 @@ public class LineSegmentUtil {
binList.setArea(binList.getArea() + singleBinArea);
} else {
/* previous bin was outside */
binList.getRows().add((long) r);
binList.getBeginCols().add((long) c);
binList.getEndCols().add((long) c);
if ( index >= binList.getRows().size() ){
binList.getRows().add((long) r);
binList.getBeginCols().add((long) c);
binList.getEndCols().add((long) c);
}else{
binList.getRows().set( index, (long) r );
binList.getBeginCols().set( index, (long) c );
binList.getEndCols().set( index, (long) c );
}
binList.setNumBins(binList.getNumBins() + 1);
singleBinArea = HrapUtil.getHrapBinArea(new Coordinate(