@@ -84,57 +84,48 @@ Container TomTom : Using = "Units;geometries;classifications/tomtom"
8484 attribute<m> METERS (domain);
8585 attribute<min_f> MINUTES (domain);
8686 attribute<Directions> Direction (domain);
87+
88+ attribute<Junctions> F_JNCT_rel (domain) := rlookup(F_JNCTID, Junctions/JNCTID);
89+ attribute<bool> Streets_IsJunctionWithinStudyArea (domain ):= FSS/Junctions/IsWithinStudyArea[F_JNCT_rel];
90+ attribute<bool> Streets_IsStreetTypeSubsetSelectie (domain) := ='FRC_rel <= '+ModelParameters/StreetTypeSubsetSelectie;
91+
92+ attribute<bool> Streets_Selection_Condition (domain) := =ModelParameters/UseStreetTypeSubset ? 'Streets_IsStreetTypeSubsetSelectie && Streets_IsJunctionWithinStudyArea' : 'Streets_IsJunctionWithinStudyArea';
8793 }
8894
89- unit<uint32> Streets_src := Read_Streets_container/domain
95+ unit<uint32> Streets_Selectie := select_with_attr_by_cond( Read_Streets_container, Read_Streets_container/Streets_Selection_Condition)
9096 {
91- attribute<BaseProjection> Geometry (arc) := Read_Streets_container/Geometry;
92- attribute<BaseProjection> geometry_clean (arc) := Impl/geometry_clean, IntegrityCheck = "Impl/CleanUp_BeginEndPointLink/Check_ModuloIsEen";
93- attribute<FuncRoadClass> FRC_rel := Read_Streets_container/FRC_rel;
94-
95- attribute<uint64> F_JNCTID_initial := Read_Streets_container/F_JNCTID;
96- attribute<uint64> T_JNCTID_initial := Read_Streets_container/T_JNCTID;
97-
98- attribute<uint64> F_JNCTID := Direction == Directions/v/backwards ? T_JNCTID_initial : F_JNCTID_initial; // relevant voor latere routen (bij direction = 3 moet je f_ en t_ swappen, bij 3 & 4 geldt eenrichtingsverkeer) --> Comment van Chris
99- attribute<uint64> T_JNCTID := Direction == Directions/v/backwards ? F_JNCTID_initial : T_JNCTID_initial; // relevant voor latere routen (bij direction = 3 moet je f_ en t_ swappen, bij 3 & 4 geldt eenrichtingsverkeer) --> Comment van Chris
100-
101- attribute<km_hr> KPH := Read_Streets_container/KPH;
102- attribute<m> METERS := Read_Streets_container/METERS;
103- attribute<min_f> MINUTES := Read_Streets_container/MINUTES;
104- attribute<Directions> Direction := Read_Streets_container/Direction;
105-
106- attribute<Junctions> F_JNCT_rel := rlookup(F_JNCTID, Junctions/JNCTID);
97+ attribute<BaseProjection> geometry_clean (arc) := Impl/geometry_clean;
98+ attribute<uint64> F_JNCTID_directed := Direction == Directions/v/backwards ? T_JNCTID : F_JNCTID; // relevant voor latere routen (bij direction = 3 moet je f_ en t_ swappen, bij 3 & 4 geldt eenrichtingsverkeer) --> Comment van Chris
99+ attribute<uint64> T_JNCTID_directed := Direction == Directions/v/backwards ? F_JNCTID : T_JNCTID; // relevant voor latere routen (bij direction = 3 moet je f_ en t_ swappen, bij 3 & 4 geldt eenrichtingsverkeer) --> Comment van Chris
107100
108101 container Impl
109102 {
110- attribute<BaseProjection> geometry_clean (FSS/Streets_src, arc) := points2sequence(CleanUp_BeginEndPointLink/seq2points/CleanUpPoints/Point, CleanUp_BeginEndPointLink/seq2points/CleanUpPoints/sequence_rel, CleanUp_BeginEndPointLink/seq2points/CleanUpPoints/NewOrdinal);
103+ unit<uint32> src := ..;
104+ attribute<BaseProjection> geometry_clean (src, arc) := points2sequence(CleanUp_BeginEndPointLink/seq2points/CleanUpPoints/Point, CleanUp_BeginEndPointLink/seq2points/CleanUpPoints/sequence_rel, CleanUp_BeginEndPointLink/seq2points/CleanUpPoints/NewOrdinal);
111105
112106 container CleanUp_BeginEndPointLink
113107 {
114108 //// checks
115109 // #punten per sequence in org moet oneven zijn.
116- parameter<bool> Check_ModuloIsEen := sum(aantal_punten_per_sequence % 2) == #FSS/Streets_src;
117-
110+ parameter<bool> Check_ModuloIsEen := all(LastOrdinalNr % 2 == 0);
118111 // geen dubbele punten binnen sequence rel
119-
120112 // er mogen geen punten zijn die wel in de org zitten en niet in clean.
121-
122-
123- attribute<uint32> aantal_punten_per_sequence (FSS/Streets_src) := pcount(seq2points/sequence_rel);
113+ attribute<uint32> aantal_punten_per_sequence (src) := pcount(seq2points/sequence_rel);
124114
125- unit<uint32> seq2points := sequence2points(FSS/Streets_src/geometry)
115+ attribute<uint32> LastOrdinalNr (src) := last(seq2points/ordinal, seq2points/sequence_rel);
116+ attribute<uint32> LastRelevantOrdinal (src) := LastOrdinalNr / 2, IntegrityCheck = "Check_ModuloIsEen";
117+
118+ unit<uint32> seq2points := sequence2points(src/geometry)
126119 {
127- attribute<Directions> Direction := rjoin(sequence_rel, id(FSS/Streets_src), FSS/Streets_src/Direction);
128- attribute<uint32> LastOrdinalNr := rjoin(sequence_rel, id(FSS/Streets_src), last(ordinal, sequence_rel));
129-
130- attribute<uint32> LastRelevantOrdinal := LastOrdinalNr / 2;
131- attribute<bool> IsLastRelevantOrdinal := LastRelevantOrdinal == Ordinal;
132- attribute<bool> IsIrrelevant := Ordinal > LastRelevantOrdinal; //links are doubled, we only want one-way links.
133-
134- attribute<uint32> ReveresedOrdinal := abs(Ordinal[int32] - LastRelevantOrdinal[int32])[uint32];
135- attribute<uint32> NewOrdinal := Direction == Directions/v/backwards ? ReveresedOrdinal : Ordinal;
120+ // attribute<bool> IsLastRelevantOrdinal := LastRelevantOrdinal == Ordinal;
121+ attribute<bool> IsRelevant := Ordinal <= LastRelevantOrdinal[sequence_rel]; //links are doubled, we only want one-way links.
136122
137- unit<uint32> CleanUpPoints := select_with_attr_by_cond(seq2points,!seq2points/IsIrrelevant);
123+ unit<uint32> CleanUpPoints := select_with_attr_by_cond(seq2points, seq2points/IsRelevant)
124+ {
125+ attribute<Directions> Direction := src/Direction[sequence_rel];
126+ attribute<uint32> ReversedOrdinal := LastRelevantOrdinal[sequence_rel] - Ordinal;
127+ attribute<uint32> NewOrdinal := Direction == Directions/v/backwards ? ReversedOrdinal : Ordinal;
128+ }
138129 }
139130 }
140131 }
@@ -143,25 +134,25 @@ Container TomTom : Using = "Units;geometries;classifications/tomtom"
143134
144135 container Selection
145136 {
146- attribute<bool> Streets_IsJunctionWithinStudyArea (FSS/Streets_src) := FSS/Junctions/IsWithinStudyArea[FSS/Streets_src/F_JNCT_rel];
147- attribute<bool> Streets_IsStreetTypeSubsetSelectie (FSS/Streets_src) := ='FSS/Streets_src/FRC_rel <= '+ModelParameters/StreetTypeSubsetSelectie;
148- attribute<bool> Streets_Selection_Condition (FSS/Streets_src) := =ModelParameters/UseStreetTypeSubset ? 'Streets_IsStreetTypeSubsetSelectie && Streets_IsJunctionWithinStudyArea' : 'Streets_IsJunctionWithinStudyArea';
137+ // attribute<bool> Streets_IsJunctionWithinStudyArea (FSS/Streets_src) := FSS/Junctions/IsWithinStudyArea[FSS/Streets_src/F_JNCT_rel];
138+ // attribute<bool> Streets_IsStreetTypeSubsetSelectie (FSS/Streets_src) := ='FSS/Streets_src/FRC_rel <= '+ModelParameters/StreetTypeSubsetSelectie;
139+ // attribute<bool> Streets_Selection_Condition (FSS/Streets_src) := =ModelParameters/UseStreetTypeSubset ? 'Streets_IsStreetTypeSubsetSelectie && Streets_IsJunctionWithinStudyArea' : 'Streets_IsJunctionWithinStudyArea';
149140
150- unit<uint32> Streets_selection_unit := select_with_attr_by_cond(FSS/Streets_src, Streets_Selection_Condition);
141+ // unit<uint32> Streets_selection_unit := select_with_attr_by_cond(FSS/Streets_src, Streets_Selection_Condition);
151142
152- container Make_Streets_selection := Streets_selection_unit
143+ container Make_Streets_selection := FSS/Streets_Selectie
153144 , StorageName = "=ModelParameters/Roads_path"
154145 {
155- attribute<BaseProjection> geometry (Streets_selection_unit , arc) := Streets_selection_unit /geometry_clean;
156- attribute<FuncRoadClass> FRC_rel (Streets_selection_unit ) := Streets_selection_unit /FRC_rel;
157- attribute<uint64> F_JNCTID (Streets_selection_unit ) := Streets_selection_unit /F_JNCTID[uint64];
158- attribute<uint64> T_JNCTID (Streets_selection_unit ) := Streets_selection_unit /T_JNCTID[uint64];
159- attribute<m> METERS (Streets_selection_unit ) := Streets_selection_unit /METERS[m];
160- attribute<min_f> MINUTES (Streets_selection_unit ) := Streets_selection_unit /MINUTES[min_f];
161- attribute<km_hr> KPH (Streets_selection_unit ) := Streets_selection_unit /KPH[km_hr];
162- attribute<Directions> Direction (Streets_selection_unit ) := Streets_selection_unit /Direction;
146+ attribute<BaseProjection> geometry (FSS/Streets_Selectie , arc) := FSS/Streets_Selectie /geometry_clean;
147+ attribute<FuncRoadClass> FRC_rel (FSS/Streets_Selectie ) := FSS/Streets_Selectie /FRC_rel;
148+ attribute<uint64> F_JNCTID (FSS/Streets_Selectie ) := FSS/Streets_Selectie /F_JNCTID[uint64];
149+ attribute<uint64> T_JNCTID (FSS/Streets_Selectie ) := FSS/Streets_Selectie /T_JNCTID[uint64];
150+ attribute<m> METERS (FSS/Streets_Selectie ) := FSS/Streets_Selectie /METERS[m];
151+ attribute<min_f> MINUTES (FSS/Streets_Selectie ) := FSS/Streets_Selectie /MINUTES[min_f];
152+ attribute<km_hr> KPH (FSS/Streets_Selectie ) := FSS/Streets_Selectie /KPH[km_hr];
153+ attribute<Directions> Direction (FSS/Streets_Selectie ) := FSS/Streets_Selectie /Direction;
163154
164- parameter<uint32> n := #Streets_selection_unit ;
155+ parameter<uint32> n := #FSS/Streets_Selectie ;
165156 }
166157
167158 container Read_Streets_selection
0 commit comments