Skip to content

Commit

Permalink
Send coordinates to gw_api_getdimensioning
Browse files Browse the repository at this point in the history
  • Loading branch information
nestorip committed Oct 27, 2020
1 parent 87ecf2d commit 40abf1f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
5 changes: 3 additions & 2 deletions actions/api_dimensioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, iface, settings, controller, plugin_dir):
self.settings = settings
self.controller = controller
self.plugin_dir = plugin_dir

self.points = None
self.canvas = self.iface.mapCanvas()

# Snapper
Expand Down Expand Up @@ -67,7 +67,8 @@ def open_form(self, new_feature=None, layer=None, new_feature_id=None, info_json

self.create_map_tips()
if info_json is None:
body = self.create_body()
extras = f'"coordinates":{{{self.points}}}'
body = self.create_body(extras=extras)
# Get layers under mouse clicked
sql = f"SELECT gw_api_getdimensioning($${{{body}}}$$)::text"
row = self.controller.get_row(sql, log_sql=True, commit=True)
Expand Down
15 changes: 14 additions & 1 deletion map_tools/dimensioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,19 @@ def open_new_dimensioning(self, feature_id):
feature = self.get_feature_by_id(self.layer, feature_id)
idx = self.layer.fields().indexFromName("id")
new_feature_id = self.layer.maximumValue(idx)

geom = feature.geometry()
list_points = None
if self.layer.geometryType() == 0:
points = geom.asPoint()
list_points = f'"x1":{points.x()}, "y1":{points.y()}'
elif self.layer.geometryType() in (1, 2):
points = geom.asPolyline()
init_point = points[0]
last_point = points[-1]
list_points = f'"x1":{init_point.x()}, "y1":{init_point.y()}'
list_points += f', "x2":{last_point.x()}, "y2":{last_point.y()}'
else:
self.controller.log_info(str(type("NO FEATURE TYPE DEFINED")))
# Control when layer haven't rows
if not new_feature_id:
new_feature_id = 0
Expand All @@ -40,6 +52,7 @@ def open_new_dimensioning(self, feature_id):
self.recover_previus_maptool()

self.api_dim = ApiDimensioning(self.iface, self.settings, self.controller, self.plugin_dir)
self.api_dim.points = list_points
result, dialog = self.api_dim.open_form(new_feature=feature, layer=self.layer, new_feature_id=new_feature_id)


Expand Down
2 changes: 1 addition & 1 deletion sql
Submodule sql updated 55 files
+1 −1 api/fct/gw_api_getconfig.sql
+38 −6 api/fct/gw_api_getdimensioning.sql
+3 −4 api/fct/gw_api_getinfofromcoordinates.sql
+18 −8 api/fct/gw_api_getlist.sql
+160 −23 api/fct/gw_api_setfields.sql
+14 −0 api/updates/33/33042/ud/dml.sql
+27 −0 api/updates/33/33042/utils/dml.sql
+0 −4 example/user/ws/ws_99_sample_other.sql
+0 −1 ud/ftrg/ud_gw_trg_edit_connec.sql
+0 −1 ud/ftrg/ud_gw_trg_edit_custom_gully.sql
+0 −1 ud/ftrg/ud_gw_trg_edit_gully.sql
+14 −14 ud/ftrg/ud_gw_trg_edit_inp_node.sql
+128 −37 ud/ftrg/ud_gw_trg_edit_node.sql
+3 −3 ud/ftrg/ud_gw_trg_review_audit_arc.sql
+3 −3 ud/ftrg/ud_gw_trg_review_audit_connec.sql
+3 −0 updates/33/33040/changelog.txt
+7 −0 updates/33/33041/changelog.txt
+53 −0 updates/33/33041/ud/ddlview.sql
+53 −0 updates/33/33041/utils/ddlview.sql
+15 −0 updates/33/33041/utils/dml.sql
+7 −0 updates/33/33042/changelog.txt
+590 −0 updates/33/33042/ud/ddlview.sql
+13 −0 updates/33/33042/utils/ddl.sql
+53 −0 updates/33/33042/utils/ddlview.sql
+25 −0 updates/33/33042/utils/dml.sql
+651 −0 updates/33/33042/ws/ddlview.sql
+6 −0 updates/33/33043/changelog.txt
+87 −0 updates/33/33043/ud/ddlview.sql
+16 −0 updates/33/33043/utils/ddl.sql
+17 −0 updates/33/33043/utils/dml.sql
+12 −0 updates/33/33043/ws/ddl.sql
+59 −0 updates/33/33043/ws/ddlview.sql
+3 −0 updates/33/33044/changelog.txt
+46 −0 updates/33/33044/ws/dml.sql
+16 −0 updates/33/33045/utils/dml.sql
+31 −0 updates/33/33045/ws/dml.sql
+2 −1 utils/fct/gw_fct_admin_schema_manage_child_views.sql
+36 −16 utils/fct/gw_fct_arc_divide.sql
+2 −2 utils/fct/gw_fct_arc_fusion.sql
+8 −3 utils/fct/gw_fct_audit_check_project.sql
+17 −19 utils/fct/gw_fct_connect_to_network.sql
+384 −0 utils/fct/gw_fct_grafanalytics_lrs.sql
+34 −53 utils/fct/gw_fct_odbc2pg_hydro_filldata.sql
+16 −1 utils/fct/gw_fct_om_check_data.sql
+4 −4 utils/fct/gw_fct_repair_link.sql
+51 −0 utils/fct/gw_fct_vnode_repair.sql
+2 −2 utils/ftrg/gw_trg_edit_link.sql
+0 −24 utils/ftrg/gw_trg_link_connecrotation_update.sql
+317 −109 ws/fct/ws_gw_fct_grafanalytics_mapzones.sql
+18 −6 ws/fct/ws_gw_fct_grafanalytics_mapzones_advanced.sql
+18 −3 ws/fct/ws_gw_fct_mincut.sql
+7 −4 ws/fct/ws_gw_fct_pg2epa_rtc.sql
+0 −1 ws/ftrg/ws_gw_trg_edit_connec.sql
+1 −1 ws/ftrg/ws_gw_trg_edit_inp_node.sql
+5 −3 ws/ftrg/ws_gw_trg_edit_node.sql

0 comments on commit 40abf1f

Please sign in to comment.