|
9 | 9 |
|
10 | 10 | public partial class RoadNetworkTopologyProjection |
11 | 11 | { |
| 12 | + public void Project(IEvent<ImportedRoadNode> e, IDocumentOperations ops) |
| 13 | + { |
| 14 | + ops.QueueSqlCommand($"INSERT INTO {RoadNodesTableName} (id, geometry, timestamp, is_v2) VALUES (?, ST_GeomFromText(?, ?), ?, FALSE)", |
| 15 | + e.Data.RoadNodeId, |
| 16 | + e.Data.Geometry.WKT, |
| 17 | + e.Data.Geometry.SRID, |
| 18 | + e.Timestamp |
| 19 | + ); |
| 20 | + } |
| 21 | + |
| 22 | + public void Project(IEvent<RoadNodeAdded> e, IDocumentOperations ops) |
| 23 | + { |
| 24 | + ops.QueueSqlCommand($"INSERT INTO {RoadNodesTableName} (id, geometry, timestamp, is_v2) VALUES (?, ST_GeomFromText(?, ?), ?, FALSE)", |
| 25 | + e.Data.RoadNodeId, |
| 26 | + e.Data.Geometry.WKT, |
| 27 | + e.Data.Geometry.SRID, |
| 28 | + e.Timestamp |
| 29 | + ); |
| 30 | + } |
| 31 | + |
| 32 | + public void Project(IEvent<RoadNodeModified> e, IDocumentOperations ops) |
| 33 | + { |
| 34 | + ops.QueueSqlCommand("SELECT projections.networktopology_update_roadnode(?, ?, ?, ?);", |
| 35 | + e.Data.RoadNodeId, |
| 36 | + e.Timestamp, |
| 37 | + e.Data.Geometry.WKT, |
| 38 | + e.Data.Geometry.SRID |
| 39 | + ); |
| 40 | + } |
| 41 | + |
| 42 | + public void Project(IEvent<RoadNodeRemoved> e, IDocumentOperations ops) |
| 43 | + { |
| 44 | + ops.QueueSqlCommand("SELECT projections.networktopology_delete_roadnode(?, ?);", |
| 45 | + e.Data.RoadNodeId, |
| 46 | + e.Timestamp |
| 47 | + ); |
| 48 | + } |
| 49 | + |
12 | 50 | public void Project(IEvent<ImportedRoadSegment> e, IDocumentOperations ops) |
13 | 51 | { |
14 | | - ops.QueueSqlCommand($"INSERT INTO {RoadSegmentsTableName} (id, geometry, start_node_id, end_node_id, timestamp) VALUES (?, ST_GeomFromText(?, ?), ?, ?, ?)", |
15 | | - e.Data.RoadSegmentId, e.Data.Geometry.WKT, e.Data.Geometry.SRID, e.Data.StartNodeId, e.Data.EndNodeId, e.Timestamp |
| 52 | + ops.QueueSqlCommand($"INSERT INTO {RoadSegmentsTableName} (id, geometry, start_node_id, end_node_id, timestamp, is_v2) VALUES (?, ST_GeomFromText(?, ?), ?, ?, ?, FALSE)", |
| 53 | + e.Data.RoadSegmentId, |
| 54 | + e.Data.Geometry.WKT, |
| 55 | + e.Data.Geometry.SRID, |
| 56 | + e.Data.StartNodeId, |
| 57 | + e.Data.EndNodeId, |
| 58 | + e.Timestamp |
16 | 59 | ); |
17 | 60 | } |
| 61 | + |
18 | 62 | public void Project(IEvent<RoadSegmentAdded> e, IDocumentOperations ops) |
19 | 63 | { |
20 | | - ops.QueueSqlCommand($"INSERT INTO {RoadSegmentsTableName} (id, geometry, start_node_id, end_node_id, timestamp) VALUES (?, ST_GeomFromText(?, ?), ?, ?, ?)", |
21 | | - e.Data.RoadSegmentId, e.Data.Geometry.WKT, e.Data.Geometry.SRID, e.Data.StartNodeId, e.Data.EndNodeId, e.Timestamp |
| 64 | + ops.QueueSqlCommand($"INSERT INTO {RoadSegmentsTableName} (id, geometry, start_node_id, end_node_id, timestamp, is_v2) VALUES (?, ST_GeomFromText(?, ?), ?, ?, ?, FALSE)", |
| 65 | + e.Data.RoadSegmentId, |
| 66 | + e.Data.Geometry.WKT, |
| 67 | + e.Data.Geometry.SRID, |
| 68 | + e.Data.StartNodeId, |
| 69 | + e.Data.EndNodeId, |
| 70 | + e.Timestamp |
22 | 71 | ); |
23 | 72 | } |
| 73 | + |
24 | 74 | public void Project(IEvent<RoadSegmentModified> e, IDocumentOperations ops) |
25 | 75 | { |
26 | | - var parameters = new object?[] |
27 | | - { |
| 76 | + ops.QueueSqlCommand("SELECT projections.networktopology_update_roadsegment(?, ?, ?, ?, ?, ?);", |
28 | 77 | e.Data.RoadSegmentId, |
29 | 78 | e.Timestamp, |
30 | 79 | e.Data.Geometry.WKT, |
31 | 80 | e.Data.Geometry.SRID, |
32 | 81 | e.Data.StartNodeId, |
33 | 82 | e.Data.EndNodeId |
34 | | - }; |
35 | | - |
36 | | - ops.QueueSqlCommand("SELECT projections.networktopology_update_roadsegment(?, ?, ?, ?, ?, ?);", parameters); |
| 83 | + ); |
37 | 84 | } |
| 85 | + |
38 | 86 | public void Project(IEvent<RoadSegmentGeometryModified> e, IDocumentOperations ops) |
39 | 87 | { |
40 | | - var parameters = new object?[] |
41 | | - { |
| 88 | + ops.QueueSqlCommand("SELECT projections.networktopology_update_roadsegment(?, ?, ?, ?, null, null);", |
42 | 89 | e.Data.RoadSegmentId, |
43 | 90 | e.Timestamp, |
44 | 91 | e.Data.Geometry.WKT, |
45 | 92 | e.Data.Geometry.SRID |
46 | | - }; |
47 | | - |
48 | | - ops.QueueSqlCommand("SELECT projections.networktopology_update_roadsegment(?, ?, ?, ?, null, null);", parameters); |
| 93 | + ); |
49 | 94 | } |
50 | 95 |
|
51 | 96 | public void Project(IEvent<RoadSegmentRemoved> e, IDocumentOperations ops) |
52 | 97 | { |
53 | | - var parameters = new object[] |
54 | | - { |
| 98 | + ops.QueueSqlCommand("SELECT projections.networktopology_delete_roadsegment(?, ?);", |
55 | 99 | e.Data.RoadSegmentId, |
56 | 100 | e.Timestamp |
57 | | - }; |
58 | | - |
59 | | - ops.QueueSqlCommand("SELECT projections.networktopology_delete_roadsegment(?, ?);", parameters); |
| 101 | + ); |
60 | 102 | } |
61 | 103 |
|
62 | 104 | public void Project(IEvent<ImportedGradeSeparatedJunction> e, IDocumentOperations ops) |
63 | 105 | { |
64 | | - ops.QueueSqlCommand($"INSERT INTO {GradeSeparatedJunctionsTableName} (id, lower_road_segment_id, upper_road_segment_id, timestamp) VALUES (?, ?, ?, ?)", |
65 | | - e.Data.Id, e.Data.LowerRoadSegmentId, e.Data.UpperRoadSegmentId, e.Timestamp |
| 106 | + ops.QueueSqlCommand($"INSERT INTO {GradeSeparatedJunctionsTableName} (id, lower_road_segment_id, upper_road_segment_id, timestamp, is_v2) VALUES (?, ?, ?, ?, FALSE)", |
| 107 | + e.Data.Id, |
| 108 | + e.Data.LowerRoadSegmentId, |
| 109 | + e.Data.UpperRoadSegmentId, |
| 110 | + e.Timestamp |
66 | 111 | ); |
67 | 112 | } |
| 113 | + |
68 | 114 | public void Project(IEvent<GradeSeparatedJunctionAdded> e, IDocumentOperations ops) |
69 | 115 | { |
70 | | - ops.QueueSqlCommand($"INSERT INTO {GradeSeparatedJunctionsTableName} (id, lower_road_segment_id, upper_road_segment_id, timestamp) VALUES (?, ?, ?, ?)", |
71 | | - e.Data.Id, e.Data.LowerRoadSegmentId, e.Data.UpperRoadSegmentId, e.Timestamp |
| 116 | + ops.QueueSqlCommand($"INSERT INTO {GradeSeparatedJunctionsTableName} (id, lower_road_segment_id, upper_road_segment_id, timestamp, is_v2) VALUES (?, ?, ?, ?, FALSE)", |
| 117 | + e.Data.Id, |
| 118 | + e.Data.LowerRoadSegmentId, |
| 119 | + e.Data.UpperRoadSegmentId, |
| 120 | + e.Timestamp |
72 | 121 | ); |
73 | 122 | } |
| 123 | + |
74 | 124 | public void Project(IEvent<GradeSeparatedJunctionRemoved> e, IDocumentOperations ops) |
75 | 125 | { |
76 | | - var parameters = new object[] |
77 | | - { |
| 126 | + ops.QueueSqlCommand("SELECT projections.networktopology_delete_gradeseparatedjunction(?, ?);", |
78 | 127 | e.Data.Id, |
79 | 128 | e.Timestamp |
80 | | - }; |
81 | | - |
82 | | - ops.QueueSqlCommand("SELECT projections.networktopology_delete_gradeseparatedjunction(?, ?);", parameters); |
| 129 | + ); |
83 | 130 | } |
84 | 131 |
|
85 | | - public void Project(IEvent<ImportedRoadNode> e, IDocumentOperations ops) |
86 | | - { |
87 | | - // Do nothing |
88 | | - } |
89 | | - public void Project(IEvent<RoadNodeAdded> e, IDocumentOperations ops) |
90 | | - { |
91 | | - // Do nothing |
92 | | - } |
93 | | - public void Project(IEvent<RoadNodeModified> e, IDocumentOperations ops) |
94 | | - { |
95 | | - // Do nothing |
96 | | - } |
97 | | - public void Project(IEvent<RoadNodeRemoved> e, IDocumentOperations ops) |
98 | | - { |
99 | | - // Do nothing |
100 | | - } |
101 | 132 | public void Project(IEvent<RoadNetworkChangesAccepted> e, IDocumentOperations ops) |
102 | 133 | { |
103 | 134 | // Do nothing |
104 | 135 | } |
| 136 | + |
105 | 137 | public void Project(IEvent<RoadSegmentAttributesModified> e, IDocumentOperations ops) |
106 | 138 | { |
107 | 139 | // Do nothing |
108 | 140 | } |
| 141 | + |
109 | 142 | public void Project(IEvent<RoadSegmentAddedToEuropeanRoad> e, IDocumentOperations ops) |
110 | 143 | { |
111 | 144 | // Do nothing |
112 | 145 | } |
| 146 | + |
113 | 147 | public void Project(IEvent<RoadSegmentAddedToNationalRoad> e, IDocumentOperations ops) |
114 | 148 | { |
115 | 149 | // Do nothing |
116 | 150 | } |
| 151 | + |
117 | 152 | public void Project(IEvent<RoadSegmentAddedToNumberedRoad> e, IDocumentOperations ops) |
118 | 153 | { |
119 | 154 | // Do nothing |
120 | 155 | } |
| 156 | + |
121 | 157 | public void Project(IEvent<RoadSegmentRemovedFromEuropeanRoad> e, IDocumentOperations ops) |
122 | 158 | { |
123 | 159 | // Do nothing |
124 | 160 | } |
| 161 | + |
125 | 162 | public void Project(IEvent<RoadSegmentRemovedFromNationalRoad> e, IDocumentOperations ops) |
126 | 163 | { |
127 | 164 | // Do nothing |
128 | 165 | } |
| 166 | + |
129 | 167 | public void Project(IEvent<RoadSegmentRemovedFromNumberedRoad> e, IDocumentOperations ops) |
130 | 168 | { |
131 | 169 | // Do nothing |
132 | 170 | } |
| 171 | + |
133 | 172 | public void Project(IEvent<OutlinedRoadSegmentRemoved> e, IDocumentOperations ops) |
134 | 173 | { |
135 | 174 | // Do nothing |
136 | 175 | } |
| 176 | + |
137 | 177 | public void Project(IEvent<RoadSegmentStreetNamesChanged> e, IDocumentOperations ops) |
138 | 178 | { |
139 | 179 | // Do nothing |
|
0 commit comments