Skip to content

Commit

Permalink
fix (setarcdivide): correctly manage links with exit_type NODE relate…
Browse files Browse the repository at this point in the history
…d to node_2 (both for operative and planified nodes)
  • Loading branch information
albertbofill committed Aug 1, 2024
1 parent 4a83ad7 commit 2c69e1f
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions utils/fct/gw_fct_setarcdivide.sql
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ BEGIN
END LOOP;
END IF;

-- reconnect operative node links
-- reconnect operative node links from node_1
FOR rec_link IN SELECT * FROM v_edit_link WHERE exit_type = 'NODE' AND exit_id = (SELECT node_1 FROM arc WHERE arc_id = rec_aux1.arc_id)
LOOP
UPDATE link SET exit_id = rec_aux1.arc_id WHERE link_id = rec_link.link_id;
Expand All @@ -593,12 +593,31 @@ BEGIN
END IF;
END LOOP;

-- reconnect planned node links
-- reconnect operative node links from node_2
FOR rec_link IN SELECT * FROM v_edit_link WHERE exit_type = 'NODE' AND exit_id = (SELECT node_2 FROM arc WHERE arc_id = rec_aux2.arc_id)
LOOP
UPDATE link SET exit_id = rec_aux2.arc_id WHERE link_id = rec_link.link_id;
UPDATE connec SET arc_id = rec_aux2.arc_id WHERE arc_id = v_arc_id AND connec_id = rec_link.feature_id;
IF v_project_type ='UD' THEN
UPDATE gully SET arc_id = rec_aux2.arc_id WHERE arc_id = v_arc_id AND gully_id = rec_link.feature_id;
END IF;
END LOOP;

-- reconnect planned node links from node_1
FOR rec_link IN SELECT * FROM v_edit_link WHERE exit_type = 'NODE' AND exit_id = (SELECT node_1 FROM arc WHERE arc_id = rec_aux1.arc_id)
LOOP
UPDATE plan_psector_x_connec SET arc_id = rec_aux1.arc_id WHERE connec_id = rec_link.feature_id;
UPDATE plan_psector_x_connec SET arc_id = rec_aux1.arc_id WHERE link_id = rec_link.link_id;
IF v_project_type ='UD' THEN
UPDATE plan_psector_x_gully SET arc_id = rec_aux1.arc_id WHERE link_id = rec_link.feature_id;
END IF;
END LOOP;

-- reconnect planned node links from node_2
FOR rec_link IN SELECT * FROM v_edit_link WHERE exit_type = 'NODE' AND exit_id = (SELECT node_2 FROM arc WHERE arc_id = rec_aux2.arc_id)
LOOP
UPDATE plan_psector_x_connec SET arc_id = rec_aux2.arc_id WHERE link_id = rec_link.link_id;
IF v_project_type ='UD' THEN
UPDATE plan_psector_x_gully SET arc_id = rec_aux1.arc_id WHERE gully_id = rec_link.feature_id;
UPDATE plan_psector_x_gully SET arc_id = rec_aux2.arc_id WHERE link_id = rec_link.feature_id;
END IF;
END LOOP;

Expand Down

0 comments on commit 2c69e1f

Please sign in to comment.