Skip to content

Commit 734c11b

Browse files
committed
fix eenrichtingsverkeerfouten
1 parent 9c1d691 commit 734c11b

File tree

1 file changed

+57
-37
lines changed

1 file changed

+57
-37
lines changed

cfg/main/Templates.dms

Lines changed: 57 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,17 @@ container Templates: Using = "Units;Classifications;geometries;Classifications/T
241241
attribute<km> LengthKm;
242242
attribute<bool> IsOneDirection;
243243
attribute<bool> IsOD_connection_road;
244+
245+
// For visualisation
246+
attribute<BaseProjection> FirstPoint := FinalNodeSet/Geometry[F1];
247+
attribute<BaseProjection> LastPoint := FinalNodeSet/Geometry[F2];
248+
attribute<BaseProjection> geometry (arc) := points2sequence(PointSet/Point, PointSet/SeqNr, PointSet/Ordinal);
249+
unit<uint32> PointSet := union_unit(.,.)
250+
{
251+
attribute<BaseProjection> Point := Union_Data(., ../FirstPoint, ../LastPoint);
252+
attribute<..> SeqNr := value(id(.) % nrofrows(..), ..);
253+
attribute<uint32> Ordinal := id(.) / nrofrows(..);
254+
}
244255
}
245256
unit<uint32> FinalLinkSet := FinalLinkSet_Read
246257
{
@@ -304,32 +315,28 @@ container Templates: Using = "Units;Classifications;geometries;Classifications/T
304315
attribute<bool> IsOneDirection := PrevIntermediateLinkSet/IsOneDirection;
305316

306317
// For visualisation
307-
// attribute<BaseProjection_ip> FirstPoint := NodeSet/geometry[F1];
308-
// attribute<BaseProjection_ip> LastPoint := NodeSet/geometry[F2];
309-
// attribute<BaseProjection_ip> geometry (arc) := points2sequence(PointSet/Point, PointSet/SeqNr, PointSet/Ordinal);
310-
// unit<uint32> PointSet := union_unit(.,.)
311-
// {
312-
// attribute<BaseProjection_ip> Point := Union_Data(., ../FirstPoint, ../LastPoint);
313-
// attribute<..> SeqNr := value(id(.) % nrofrows(..), ..);
314-
// attribute<uint32> Ordinal := id(.) / nrofrows(..);
315-
// }
318+
attribute<BaseProjection_ip> geometry (arc) := PrevIntermediateLinkSet/geometry[BaseProjection_ip];
316319
}
317320

318321
unit<uint32> NodeSet := NodeSet_src
319322
{
320323
attribute<uint32> NrConnectedLinks := pcount(LinkSet/F1) + pcount(LinkSet/F2);
321324
attribute<bool> BordersWithOneDirectionalRoad := LinkSet/IsOneDirection[invert(LinkSet/F1)] || LinkSet/IsOneDirection[invert(LinkSet/F2)];
322-
attribute<bool> WillBeDeleted := NrConnectedLinks == 2 && pcount(UniqueLocations/Node_rel) == 0 && pcount(UniqueLocations/Node_rel_of_link_to_network) == 0; // 2 connectinglinks means intermediary without junction, and if there are no node_rel's then it is not an OD-point.,
323-
// attribute<bool> IsOD_connection_road := NodeSet_src/IsOD_connection_road;
325+
attribute<bool> WillBeDeleted := NrConnectedLinks == 2 // 2 connectinglinks means intermediary without junction
326+
&& !IsOD_connection_road;
327+
attribute<bool> IsOD_connection_road := pcount(UniqueLocations/Node_rel) != 0 // if there are node_rel's then it is an OD-point.
328+
|| pcount(UniqueLocations/Node_rel_of_link_to_network) != 0; //if there are nodes related to the network to the OD-point, then it is the cnnecting node
324329

325330
//Forward relations
326331
attribute<JunctionFreeSection> JunctionFreeSection_rel := ConnectedParts/JunctionFreeSection_rel[ConnectedParts_rel];
327-
328332
attribute<ConnectedParts> ConnectedParts_rel := ConnectedParts/PartNr;
329333

330334
attribute<bool> IsOrgDest_location := IsDefined(rlookup(values, UniqueLocations/Values));
331335
attribute<uint32> NrConnectedLinks_in_LinkSet_cleanedforJFS := pcount(LinkSet_cleanedforJFS/F1) + pcount(LinkSet_cleanedforJFS/F2);
332336
attribute<bool> IsDeadEnd_and_NotOD := NrConnectedLinks_in_LinkSet_cleanedforJFS == 1 && !IsOrgDest_location;
337+
338+
// For visualisation
339+
attribute<BaseProjection_ip> geometry := NodeSet_src/geometry[BaseProjection_ip];
333340
}
334341

335342
unit<uint32> LinksInsideJunctionFreeSection := select(LinkSet/IsInsideJunctionFreeSection), Descr = "Those links that are in the junction free section"
@@ -342,7 +349,7 @@ container Templates: Using = "Units;Classifications;geometries;Classifications/T
342349
attribute<JunctionFreeSection> JunctionFreeSection_rel := NodeSet/JunctionFreeSection_rel[F1];
343350

344351
//For visualisation
345-
// attribute<BaseProjection_ip> geometry (arc) := collect_by_cond(LinksInsideJunctionFreeSection, LinkSet/IsInsideJunctionFreeSection, LinkSet/geometry);
352+
attribute<BaseProjection_ip> geometry (arc) := collect_by_cond(LinksInsideJunctionFreeSection, LinkSet/IsInsideJunctionFreeSection, LinkSet/geometry);
346353
}
347354

348355
unit<uint32> ConnectedParts := connected_parts(LinksInsideJunctionFreeSection/F1, LinksInsideJunctionFreeSection/F2)
@@ -365,6 +372,9 @@ container Templates: Using = "Units;Classifications;geometries;Classifications/T
365372
attribute<s_f> Impedance := LinkSet/Impedance[org_rel];
366373
attribute<km> LengthKm := LinkSet/LengthKm[org_rel];
367374
attribute<bool> IsOneDirection := LinkSet/IsOneDirection[org_rel];
375+
376+
//For visualisation
377+
attribute<BaseProjection_ip> geometry (arc) := LinkSet/geometry[org_rel];
368378
}
369379

370380

@@ -385,8 +395,11 @@ container Templates: Using = "Units;Classifications;geometries;Classifications/T
385395
attribute<km> Last_ConnectorLink_LengthKm := ConnectorLink/LengthKm[Last_ConnectorLink_rel];
386396
attribute<km> Total_LengthKm := Aggregated_LengthKm + First_ConnectorLink_LengthKm + Last_ConnectorLink_LengthKm;
387397

388-
attribute<NodeSet> F1 := ConnectorLink/NodeSet_rel[First_ConnectorLink_rel];
389-
attribute<NodeSet> F2 := ConnectorLink/NodeSet_rel[Last_ConnectorLink_rel];
398+
attribute<NodeSet> Fa := ConnectorLink/NodeSet_rel[First_ConnectorLink_rel];
399+
attribute<NodeSet> Fb := ConnectorLink/NodeSet_rel[Last_ConnectorLink_rel];
400+
401+
attribute<NodeSet> F1 := First_ConnectorLink_rel -> F1 == Fa ? Fa : Fb;
402+
attribute<NodeSet> F2 := First_ConnectorLink_rel -> F1 == Fa ? Fb : Fa;
390403

391404
attribute<bool> First_ConnectorLink_IsOneDirection := ConnectorLink/IsOneDirection[First_ConnectorLink_rel];
392405
attribute<bool> Last_ConnectorLink_IsOneDirection := ConnectorLink/IsOneDirection[Last_ConnectorLink_rel];
@@ -396,15 +409,15 @@ container Templates: Using = "Units;Classifications;geometries;Classifications/T
396409
attribute<bool> IsOD_connection_road := const(FALSE,.);
397410

398411
//For visualisation
399-
// attribute<BaseProjection_ip> FirstPoint := NodeSet/Geometry[F1];
400-
// attribute<BaseProjection_ip> LastPoint := NodeSet/Geometry[F2];
401-
// attribute<BaseProjection_ip> geometry (arc) := points2sequence(PointSet/Point, PointSet/SeqNr, PointSet/Ordinal);
402-
// unit<uint32> PointSet := union_unit(.,.)
403-
// {
404-
// attribute<BaseProjection_ip> Point := Union_Data(., ../FirstPoint, ../LastPoint);
405-
// attribute<..> SeqNr := value(id(.) % nrofrows(..), ..);
406-
// attribute<uint32> Ordinal := id(.) / nrofrows(..);
407-
// }
412+
attribute<BaseProjection_ip> FirstPoint := NodeSet/Geometry[F1];
413+
attribute<BaseProjection_ip> LastPoint := NodeSet/Geometry[F2];
414+
attribute<BaseProjection_ip> geometry (arc) := points2sequence(PointSet/Point, PointSet/SeqNr, PointSet/Ordinal);
415+
unit<uint32> PointSet := union_unit(.,.)
416+
{
417+
attribute<BaseProjection_ip> Point := Union_Data(., ../FirstPoint, ../LastPoint);
418+
attribute<..> SeqNr := value(id(.) % nrofrows(..), ..);
419+
attribute<uint32> Ordinal := id(.) / nrofrows(..);
420+
}
408421
}
409422
unit<uint32> DisconnectedJunctionFreeSection := select_with_attr_by_cond(JunctionFreeSection, JunctionFreeSection/IsDisconnected);
410423

@@ -417,19 +430,19 @@ container Templates: Using = "Units;Classifications;geometries;Classifications/T
417430
attribute<km> LengthKm := LinkSet/LengthKm[org_rel];
418431
attribute<bool> IsOneDirection := LinkSet/IsOneDirection[org_rel];
419432
attribute<bool> IsOD_connection_road := LinkSet/IsOD_connection_road[org_rel];
433+
420434
//For visualisation
421-
// attribute<BaseProjection_ip> FirstPoint := NodeSet/geometry[F1];
422-
// attribute<BaseProjection_ip> LastPoint := NodeSet/geometry[F2];
423-
// attribute<BaseProjection_ip> geometry (arc) := points2sequence(PointSet/Point, PointSet/SeqNr, PointSet/Ordinal);
424-
// unit<uint32> PointSet := union_unit(.,.)
425-
// {
426-
// attribute<BaseProjection_ip> Point := Union_Data(., ../FirstPoint, ../LastPoint);
427-
// attribute<..> SeqNr := value(id(.) % nrofrows(..), ..);
428-
// attribute<uint32> Ordinal := id(.) / nrofrows(..);
429-
// }
435+
attribute<BaseProjection_ip> FirstPoint := NodeSet/geometry[F1];
436+
attribute<BaseProjection_ip> LastPoint := NodeSet/geometry[F2];
437+
attribute<BaseProjection_ip> geometry (arc) := points2sequence(PointSet/Point, PointSet/SeqNr, PointSet/Ordinal);
438+
unit<uint32> PointSet := union_unit(.,.)
439+
{
440+
attribute<BaseProjection_ip> Point := Union_Data(., ../FirstPoint, ../LastPoint);
441+
attribute<..> SeqNr := value(id(.) % nrofrows(..), ..);
442+
attribute<uint32> Ordinal := id(.) / nrofrows(..);
443+
}
430444
}
431445

432-
433446
unit<uint32> LinkSet_cleanedforJFS := union_unit(UnchangedLinkSet, JunctionFreeSection)
434447
, Descr = "The final link set"
435448
{
@@ -463,8 +476,15 @@ container Templates: Using = "Units;Classifications;geometries;Classifications/T
463476
}
464477

465478
//For visualisation
466-
// unit<uint32> PointSet := union_unit(.,.);
467-
// attribute<BaseProjection_ip> geometry (arc) := points2sequence(Union_Data(PointSet, NodeSet/geometry[F1], NodeSet/geometry[F2]), value(id(PointSet) %., .));
479+
attribute<BaseProjection_ip> FirstPoint := NodeSet/geometry[F1];
480+
attribute<BaseProjection_ip> LastPoint := NodeSet/geometry[F2];
481+
attribute<BaseProjection_ip> geometry (arc) := points2sequence(PointSet/Point, PointSet/SeqNr, PointSet/Ordinal);
482+
unit<uint32> PointSet := union_unit(.,.)
483+
{
484+
attribute<BaseProjection_ip> Point := Union_Data(., ../FirstPoint, ../LastPoint);
485+
attribute<..> SeqNr := value(id(.) % nrofrows(..), ..);
486+
attribute<uint32> Ordinal := id(.) / nrofrows(..);
487+
}
468488
}
469489

470490
//Verwijder links naar dead ends (if F1 or F2 occurs only once in all F1/F2, and not being OD-location)
@@ -482,7 +502,7 @@ container Templates: Using = "Units;Classifications;geometries;Classifications/T
482502

483503
//For visualisation
484504
unit<uint32> PointSet := union_unit(.,.);
485-
attribute<BaseProjection> geometry (arc) := points2sequence(Union_Data(PointSet, NodeSet/geometry[F1], NodeSet/geometry[F2]), value(id(PointSet) %#IntermediateLinkSet, IntermediateLinkSet));
505+
attribute<BaseProjection_ip> geometry (arc) := points2sequence(Union_Data(PointSet, NodeSet/geometry[F1], NodeSet/geometry[F2]), value(id(PointSet) %#IntermediateLinkSet, IntermediateLinkSet));
486506
}
487507
}
488508
}

0 commit comments

Comments
 (0)