Commit 6359e046 authored by duminil's avatar duminil
Browse files

RegionChooser: ManhattanSmall

parent a0e12248
......@@ -90,7 +90,7 @@ private Path citygmlPath(String project, String citygml) {
public RegionChooserBrowserNewYorkEdition() {
//apply the styles
getStyleClass().add("browser");
String url = RegionChooserFX.class.getResource("website/index_nyc.html").toExternalForm();
String url = RegionChooserNewYorkEdition.class.getResource("website/index_nyc.html").toExternalForm();
webEngine.load(url); // load the web page
// process page loading
webEngine.getLoadWorker().stateProperty().addListener(
......
......@@ -57,6 +57,7 @@ static public StringBuffer selectRegionDirectlyFromCityGML(Path citygmlPath, Str
}
}
System.out.println("Buildings found in selected region " + i);
//TODO: Don't write anything if i==0
cityObjectMatcher.appendTail(sb);
// System.out.println(Duration.between(start, Instant.now()));
return sb;
......
......@@ -23,18 +23,17 @@ static public StringBuffer selectRegionDirectlyFromCityGML(Path citygmlPath, Str
// Instant start = Instant.now();
Geometry poly = wktReader.read(wktPolygon);
final GeometryFactory gf = new GeometryFactory();
//TODO: Don't read all the file. Not possible for 15GB gml files
String s = new String(Files.readAllBytes(citygmlPath), Charset.defaultCharset());
Pattern cityObjectPattern = Pattern
.compile("(?s)<(core:)?cityObjectMember[^>]*>.*?<\\/(core:)?cityObjectMember>\\s*");
//TODO: Allow other coordinate systems
Pattern nad83CoordinatesPattern = Pattern
.compile("(?<![\\d\\.])([23]\\d\\d\\d\\d\\d[\\.\\d]*) ([56]\\d\\d\\d\\d[\\.\\d]*)");
.compile("(?<![\\d\\.])([23]\\d\\d\\d\\d\\d[\\.\\d]*) ([4-8]\\d\\d\\d\\d[\\.\\d]*)");
Matcher cityObjectMatcher = cityObjectPattern.matcher(s);
StringBuffer sb = new StringBuffer();
int i = 0;
while (cityObjectMatcher.find()) {
System.out.println("BLD");
cityObjectMatcher.appendReplacement(sb, "");
String cityObject = cityObjectMatcher.group();
Matcher nad83CoordinatesMatcher = nad83CoordinatesPattern.matcher(cityObject);
......@@ -51,13 +50,13 @@ static public StringBuffer selectRegionDirectlyFromCityGML(Path citygmlPath, Str
Coordinate coord = new Coordinate(x, y);
Point point = gf.createPoint(coord);
if (point.within(poly)) {
System.out.println(coord);
i++;
sb.append(cityObject);
}
}
System.out.println("Buildings found in selected region " + i);
cityObjectMatcher.appendTail(sb);
// System.out.println(Duration.between(start, Instant.now()));
return sb;
}
......
......@@ -18,5 +18,22 @@
</outerBoundaryIs>
</Polygon>
</Placemark>
<Placemark>
<name>ManhattanSmall.gml</name>
<ExtendedData>
<Data name="project">
<value>NewYork</value>
</Data>
</ExtendedData>
<Polygon>
<outerBoundaryIs>
<LinearRing>
<tessellate>1</tessellate>
<coordinates>-74.0056253,40.7294668,0 -74.0053484,40.7272316,0 -74.005111,40.7272111,0 -74.0050053,40.727202,0 -73.9968092,40.7271834,0 -73.9928453,40.7273709,0 -73.9905297,40.7275413,0 -73.9904107,40.7277055,0 -73.9903612,40.7277749,0 -73.9902701,40.7280447,0 -73.9902142,40.7327445,0 -73.9903382,40.7336279,0 -73.9909377,40.7347126,0 -73.9910923,40.7347799,0 -73.9932613,40.7348532,0 -73.99814,40.7348976,0 -74.0012625,40.7349003,0 -74.0026956,40.7348996,0 -74.004586,40.7348956,0 -74.0049082,40.7348889,0 -74.0051523,40.734853,0 -74.0052862,40.734824,0 -74.0054646,40.7331513,0 -74.0056253,40.7294668,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
</Document>
</kml>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment