Commit 8f4df31b authored by Eric Duminil's avatar Eric Duminil
Browse files

Allow holes in polygon, just for fun.

parent 371d6127
......@@ -377,7 +377,7 @@ const regionChooser = (function(){
dataPanel.append("<a href='http://simstadt.hft-stuttgart.de/related-softwares/region-chooser/'>SimStadt documentation</a><br>\n");
dataPanel.append("<form id='importWKT' style='position:fixed; bottom:0;'>\n" +
"<input id='wktPolygon' type='text' placeholder='WKT Polygon' " +
"required pattern=' *POLYGON *\\( *\\([\\-0-9\., ]+\\) *\\) *' " +
"required pattern=' *POLYGON *\\( *\\([\\-0-9\., \)\()]+\\) *\\) *' " +
"title='Please input a valid WKT Polygon. Example : POLYGON((9.961675 49.807053, 9.951375 49.798521, 9.969486 49.797746, 9.961675 49.807053)) '/>\n" +
"<input type='submit' value='Import Polygon'/>\n" +
"</form>\n");
......@@ -411,6 +411,7 @@ const regionChooser = (function(){
var coordinatesCount = feature.getGeometry().getLinearRing(0).getCoordinates().length - 1;
if (coordinatesCount < 2){
console.error("Too few points!");
dataPanel.prepend("<h2 class='error'>There should be at least 2 points in WKT polygon</h2><br/>\n");
return false;
}
......@@ -426,6 +427,8 @@ const regionChooser = (function(){
displayInfo();
draw.setActive(false);
console.log("Import was succesful!");
dataPanel.prepend("<h2 class='ok'>WKT Polygon succesfully imported!</h2><br/>");
}
......
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