Skip to content

Commit

Permalink
Merge pull request #886 from Giswater/dev-3.5
Browse files Browse the repository at this point in the history
Dev 3.5
  • Loading branch information
edgarfuste authored Apr 5, 2023
2 parents a53a097 + d541534 commit b2ff457
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
25 changes: 13 additions & 12 deletions core/shared/nonvisual.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,16 @@ def _exec_print(self):
cross_arccat = tools_qt.is_checked(self.dlg_print, 'chk_cross_arccat')

if cross_arccat:
sql = f"select ic.id as curve_id, ca.id as arccat_id, geom1, geom2 from ud.v_edit_inp_curve ic join ud.cat_arc ca on ca.curve_id = ic.id " \
sql = f"select ic.id as curve_id, ca.id as arccat_id, geom1, geom2 from v_edit_inp_curve ic join cat_arc ca on ca.curve_id = ic.id " \
f"WHERE ic.curve_type = 'SHAPE' and ca.shape = 'CUSTOM' and ic.id ILIKE '%{filter}%'"
curve_results = tools_db.get_rows(sql)
for curve in curve_results:
geom1 = curve[2]
geom2 = curve[3]
name = f"{curve[0]} - {curve[1]}"
self.get_print_curves(curve[0], path, name, geom1)
self.get_print_curves(curve[0], path, name, geom1, geom2)
else:
sql = f"select id as curve_id from ud.v_edit_inp_curve ic " \
sql = f"select id as curve_id from v_edit_inp_curve ic " \
f"WHERE ic.curve_type = 'SHAPE' and ic.id ILIKE '%{filter}%'"
curve_results = tools_db.get_rows(sql)
for curve in curve_results:
Expand Down Expand Up @@ -375,7 +376,7 @@ def get_curves(self, curve_id=None, duplicate=False):
# Open dialog
tools_gw.open_dialog(self.dialog, dlg_name=f'dlg_nonvisual_curve')

def get_print_curves(self, curve_id, path, file_name, geom1=None):
def get_print_curves(self, curve_id, path, file_name, geom1=None, geom2=None):
""" Opens dialog for curve """

# Get dialog
Expand All @@ -396,7 +397,7 @@ def get_print_curves(self, curve_id, path, file_name, geom1=None):
self._populate_curve_widgets(curve_id)

# Set initial curve_value table headers
self._manage_curve_plot(self.dialog, tbl_curve_value, plot_widget, file_name, geom1)
self._manage_curve_plot(self.dialog, tbl_curve_value, plot_widget, file_name, geom1, geom2)
output_path = os.path.join(path, file_name)
plot_widget.figure.savefig(output_path)

Expand Down Expand Up @@ -507,7 +508,7 @@ def _manage_curve_value(self, dialog, table, row, column):
if cur_cell.data(0) not in (None, '') and prev_cell.data(0) not in (None, ''):
cur_value = float(cur_cell.data(0))
prev_value = float(prev_cell.data(0))
if (cur_value < prev_value) and (curve_type != 'SHAPE' and global_vars.project_type != 'ud'):
if cur_value < prev_value:
valid = False
self.valid = (False, "Invalid curve. First column values must be ascending.")

Expand Down Expand Up @@ -541,7 +542,7 @@ def _manage_curve_value(self, dialog, table, row, column):
for i, n in enumerate(x_values):
if i == 0 or n is None:
continue
if (n > x_values[i-1]) or (curve_type == 'SHAPE' and global_vars.project_type == 'ud'):
if n > x_values[i-1]:
continue
valid = False
self.valid = (False, "Invalid curve. First column values must be ascending.")
Expand All @@ -566,7 +567,7 @@ def _manage_curve_value(self, dialog, table, row, column):
self.valid = (valid, "Invalid curve. Values must go in pairs.")


def _manage_curve_plot(self, dialog, table, plot_widget, file_name=None, geom1=None):
def _manage_curve_plot(self, dialog, table, plot_widget, file_name=None, geom1=None, geom2=None):
""" Note: row & column parameters are passed by the signal """

# Clear plot
Expand Down Expand Up @@ -644,8 +645,8 @@ def _manage_curve_plot(self, dialog, table, plot_widget, file_name=None, geom1=N
y_list[i] *= float(geom1)

# Calcule el área
area = np.trapz(y_list, x_list)

area = np.trapz(y_list, x_list) * 2
# Create inverted plot
plot_widget.axes.plot(y_list, x_list, color="blue")

Expand All @@ -666,8 +667,8 @@ def _manage_curve_plot(self, dialog, table, plot_widget, file_name=None, geom1=N
plot_widget.axes.plot(aux_y_list, aux_x_list, color="grey", alpha=0.5, linestyle="dashed")

if file_name:
fig_title = f"{file_name} (S: {round(area*100, 2)} dm2)"
plot_widget.axes.text(min(y_list_inverted)*1.1, max(x_list)*1.07, f"{fig_title}", fontsize=12)
fig_title = f"{file_name} (S: {round(area*100, 2)} dm2 - {round(geom1, 2)}x{round(geom2, 2)})"
plot_widget.axes.text(min(y_list_inverted)*1.1, max(x_list)*1.07, f"{fig_title}", fontsize=8)
else:
plot_widget.axes.plot(x_list, y_list, color='indianred')

Expand Down
2 changes: 1 addition & 1 deletion dbmodel
Submodule dbmodel updated 41 files
+2 −2 ud/fct/ud_gw_fct_calculate_sander.sql
+0 −4 ud/fct/ud_gw_fct_pg2epa_fill_data.sql
+11 −6 ud/ftrg/ud_gw_trg_edit_arc.sql
+11 −6 ud/ftrg/ud_gw_trg_edit_connec.sql
+11 −6 ud/ftrg/ud_gw_trg_edit_gully.sql
+1 −1 ud/ftrg/ud_gw_trg_edit_hydrology.sql
+3 −3 ud/ftrg/ud_gw_trg_edit_inp_gully.sql
+12 −18 ud/ftrg/ud_gw_trg_edit_node.sql
+2 −1 ud/ftrg/ud_gw_trg_edit_review_audit_arc.sql
+9 −9 ud/ftrg/ud_gw_trg_vi.sql
+8 −1 updates/35/35033/ud/trg.sql
+5 −0 updates/35/35035/changelog.txt
+12 −0 updates/35/35035/ud/ddl.sql
+1,001 −0 updates/35/35035/ud/ddlview.sql
+25 −0 updates/35/35035/ud/dml.sql
+11 −0 updates/35/35035/ud/tablect.sql
+10 −0 updates/35/35035/ud/trg.sql
+19 −0 updates/35/35035/utils/ddl.sql
+52 −0 updates/35/35035/utils/ddlview.sql
+72 −0 updates/35/35035/utils/dml.sql
+17 −0 updates/35/35035/utils/tablect.sql
+15 −0 updates/35/35035/utils/trg.sql
+10 −0 updates/35/35035/ws/ddl.sql
+768 −0 updates/35/35035/ws/ddlview.sql
+28 −0 updates/35/35035/ws/dml.sql
+47 −28 utils/fct/gw_fct_admin_manage_visit.sql
+7 −6 utils/fct/gw_fct_admin_manage_visit_view.sql
+2 −2 utils/fct/gw_fct_anl_node_proximity.sql
+2 −59 utils/fct/gw_fct_config_feature_border.sql
+15 −4 utils/fct/gw_fct_getfeatureupsert.sql
+1 −1 utils/fct/gw_fct_getreport.sql
+2 −2 utils/fct/gw_fct_getstyle.sql
+2 −2 utils/fct/gw_fct_vnode_repair.sql
+49 −0 utils/ftrg/gw_trg_link_data.sql
+0 −13 ws/fct/ws_gw_fct_pg2epa_demand.sql
+0 −11 ws/fct/ws_gw_fct_pg2epa_dscenario.sql
+15 −2 ws/fct/ws_gw_fct_pg2epa_main.sql
+1 −1 ws/fct/ws_gw_fct_setmapzonestrigger.sql
+8 −3 ws/ftrg/ws_gw_trg_edit_arc.sql
+8 −3 ws/ftrg/ws_gw_trg_edit_connec.sql
+8 −3 ws/ftrg/ws_gw_trg_edit_node.sql
5 changes: 3 additions & 2 deletions metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ qgisMinimumVersion=3.10
qgisMaximumVersion=3.99
description=Plugin to manage water networks (water supply, sewerage and urban drainage) using QGIS and PostGIS-PostgreSQL(from 9.5 to 14.x)
about=Disclaimer: This plugin is released using the open source GNU-GPL3 license. Although a reasonable effort has been made to assure that the results obtained are correct, some of the capabilities provided by Giswater are experimental, therefore the development team and the Giswater Association are not responsible and assume no liability whatsoever for any results or any use made of the results obtained from the program, nor for any damages or litigation that result from the use of these programs for any purpose.
version=3.5.034
version=3.5.035
author=David Erill, Luigi Pirelli, Natasa Cica, Nestor Ibañez, Adrian Valenciano, Barbara Rzepka, Sergi Muñoz, Josep Lluís Sala, Edgar Fusté, Albert Bofill, Sergi Maspons, Elies Bertran, Abel García Juanes, Xavier Torret

Changelog=Version 3.5.034
Changelog=Version 3.5.035
- Add button "print" on NonVisualObject for export SHAPES png


tags= giswater, water networks, sewerage, urban drainage, EPANET, SWMM
Expand Down

0 comments on commit b2ff457

Please sign in to comment.