Skip to content

Commit 38b9c5a

Browse files
#1017 fixed filled lakes caused by geos ignoring inverted rings unlike boost geometry
1 parent 37a4aa8 commit 38b9c5a

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

all22.sln

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "geometry", "geometry", "{DA
128128
library\geometry\Grid2Poly.dms = library\geometry\Grid2Poly.dms
129129
EndProjectSection
130130
EndProject
131+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "basedata_nl", "basedata_nl", "{4BA5370E-B346-4808-8EB1-FFEA14F95C08}"
132+
ProjectSection(SolutionItems) = preProject
133+
library\basedata_nl\grids.dms = library\basedata_nl\grids.dms
134+
library\basedata_nl\rdc.dms = library\basedata_nl\rdc.dms
135+
library\basedata_nl\RegioIndelingen.dms = library\basedata_nl\RegioIndelingen.dms
136+
EndProjectSection
137+
EndProject
138+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "rdc", "rdc", "{DF48FB24-2017-41E7-AE22-3E7A013014E1}"
139+
ProjectSection(SolutionItems) = preProject
140+
library\basedata_nl\rdc\ngr_layer.dms = library\basedata_nl\rdc\ngr_layer.dms
141+
EndProjectSection
142+
EndProject
131143
Global
132144
GlobalSection(SolutionConfigurationPlatforms) = preSolution
133145
Debug|Any CPU = Debug|Any CPU
@@ -459,6 +471,8 @@ Global
459471
GlobalSection(NestedProjects) = preSolution
460472
{F6034506-5822-49C4-B88A-ECF5818E44C3} = {43041446-F114-4F3C-8750-B147FD69766E}
461473
{DAEA2268-E8F4-4B5A-BA92-78B6706573F0} = {5EB69BFA-4450-4654-9D5D-3BD8A6252EFA}
474+
{4BA5370E-B346-4808-8EB1-FFEA14F95C08} = {5EB69BFA-4450-4654-9D5D-3BD8A6252EFA}
475+
{DF48FB24-2017-41E7-AE22-3E7A013014E1} = {4BA5370E-B346-4808-8EB1-FFEA14F95C08}
462476
EndGlobalSection
463477
GlobalSection(ExtensibilityGlobals) = postSolution
464478
SolutionGuid = {C5FA5874-0ACE-4DE3-8FFD-61207AF7E57B}

library/geometry/Grid2Poly.dms

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ template grid2poly
341341

342342
attribute<coordinate_system> geometry(poly) := points2polygon(ClosedZoneRingPoint/geometry, ClosedZoneRingPoint/ZoneRing_rel, ClosedZoneRingPoint/Ring_ordinal);
343343
attribute<meter2> area := area(geometry, meter2);
344+
attribute<coordinate_system> geometry_reversed(poly) := points2polygon(ClosedZoneRingPoint/geometry, ClosedZoneRingPoint/ZoneRing_rel, ClosedZoneRingPoint/Ring_ordinal_reversed);
344345
}
345346

346347
unit<uint32> ZoneRingJunction := range(uint32, 0, sum(ZoneRing/nrJunctions))
@@ -376,29 +377,35 @@ template grid2poly
376377
attribute<JunctionLink> JunctionLink_rel := ZoneRingJunction_rel->JunctionLink_rel;
377378
attribute<JFLS2> JFLS2_rel := JunctionLink_rel->outJFLS2;
378379
attribute<JFLS2_Point> JFLS2_Point_rel := JFLS2_rel->JFLS2_Point_Base + RingJunction_ordinal;
379-
attribute<coordinate_system> geometry := JFLS2_Point_rel->geometry;
380+
attribute<coordinate_system> geometry := JFLS2_Point_rel->geometry;
380381
}
381382
// add a closing point to each ring equal to the first point of that ring.
382383
unit<uint32> ClosedZoneRingPoint := range(uint32, 0, sum(ZoneRingJunction/nrPoints)+#ZoneRing)
383384
{
384385
attribute<coordinate_system> geometry := union_data(., ZoneRingPoint/geometry, ZoneRing/ZoneRingPointBase->geometry);
385-
attribute<ZoneRing> ZoneRing_rel := union_data(., ZoneRingPoint/ZoneRing_rel, id(ZoneRing));
386-
attribute<uint32> Ring_ordinal := union_data(., ZoneRingPoint/Ring_ordinal, sum(ZoneRingJunction/nrPoints, ZoneRingJunction/ZoneRing_rel));
387-
attribute<Zone> Zone_rel := ZoneRing_rel->FirstZone_rel;
386+
attribute<ZoneRing> ZoneRing_rel := union_data(., ZoneRingPoint/ZoneRing_rel, id(ZoneRing));
387+
attribute<uint32> Ring_ordinal := union_data(., ZoneRingPoint/Ring_ordinal, sum(ZoneRingJunction/nrPoints, ZoneRingJunction/ZoneRing_rel));
388+
attribute<Zone> Zone_rel := ZoneRing_rel->FirstZone_rel;
388389
}
389390

390391
unit<uint32> RingResults := union_unit(ZoneRing, NonEmptyJFRing, NonEmptyJFRing)
391392
{
392393
attribute<coordinate_system> geometry(poly) := union_data(., ZoneRing/geometry, NonEmptyJFRing/SimplifiedRing, NonEmptyJFRing/SimplifiedReversedRing);
394+
unit<uint32> all_points := sequence2points(geometry);
395+
396+
attribute<coordinate_system> geometry_reversed(poly) := points2sequence(all_points/point, all_points/sequence_rel, max(all_points/ordinal, all_points/sequence_rel)[all_points/sequence_rel] - all_points/ordinal);
397+
393398
attribute<meter2> area := area(geometry, meter2);
394399
attribute<Zone> Zone_rel := union_data(., ZoneRing/FirstZone_rel, NonEmptyJFRing/RightZone_rel, NonEmptyJFRing/Left_Zone_rel), IntegrityCheck = "ZoneRing/CheckUniqueZonePerRing";
395400
}
396401

397402
unit<uint32> Results := Zone
398403
{
399404
// Polygonen van dezelfde regio samenvoegen tot multi-polygons, in een afzonderlijke template
400-
// TODO: met afzonderlijke punten doen o.b.v. de te checked aanname dat ze niet overlappen.
401-
attribute<coordinate_system> geometry(poly) := geos_union_polygon(RingResults/geometry, RingResults/Zone_rel);
405+
// TODO: met afzonderlijke ringen samenstellen o.b.v. de te checked aanname dat ze niet overlappen.
406+
attribute<coordinate_system> islands (poly) := geos_union_polygon(RingResults/geometry , RingResults/area > 0.0 ? RingResults/Zone_rel : null_u);
407+
attribute<coordinate_system> lakes (poly) := geos_union_polygon(RingResults/geometry_reversed, RingResults/area < 0.0 ? RingResults/Zone_rel : null_u);
408+
attribute<coordinate_system> geometry(poly) := geos_difference (islands, lakes);
402409

403410
// check dat result geen overlappende polygonen bevat
404411
unit<uint32> overlap_check := geos_polygon_connectivity(geometry)

stx/dll/src/StxInterface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ TreeItem* AppendTreeFromConfiguration(CharPtr sourceFileName, TreeItem* context
218218
SharedStr sourcePathNameStrFromCurrent = DelimitedConcat(ConfigurationFilenameContainer::GetConfigLoadDirFromCurrentDir().c_str(), sourcePathName);
219219
if (!IsFileOrDirAccessible(sourcePathNameStrFromCurrent))
220220
throwErrorF("File Open", "Cannot open configuration file %s.%s"
221-
context ? "\nNote that #include statements are relative to the subdir that accompanies the referent" : ""
221+
, context ? "\nNote that #include statements are relative to the subdir that accompanies the referent" : ""
222222
, sourcePathName);
223223

224224
// read last changed time in the context of an open file to prevent getting the wrong info.

0 commit comments

Comments
 (0)