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;
}
......
......@@ -13,6 +13,23 @@
<LinearRing>
<tessellate>1</tessellate>
<coordinates>-74.019012,40.7062519,0 -74.0189717,40.7058604,0 -74.0189418,40.7057319,0 -74.0184794,40.7042805,0 -74.0172664,40.7028968,0 -74.015158,40.7011657,0 -74.015107,40.7011428,0 -74.0135003,40.7004843,0 -73.9746149,40.698469,0 -73.9698348,40.7010661,0 -73.9696604,40.7011962,0 -73.969608,40.7498934,0 -73.9696103,40.7577021,0 -73.970055,40.7578905,0 -73.9702186,40.7579597,0 -73.9706688,40.7580941,0 -73.9716929,40.7582638,0 -73.9788927,40.7582855,0 -73.9888251,40.7582835,0 -73.9925648,40.7582471,0 -73.9980335,40.7581217,0 -73.9997291,40.7580401,0 -74.0002613,40.7578747,0 -74.0065919,40.7556662,0 -74.006643,40.7555973,0 -74.0071602,40.7548532,0 -74.0087472,40.7523398,0 -74.0112393,40.7479423,0 -74.019012,40.7062519,0
</coordinates>
</LinearRing>
</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>
......
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