Skip to content

Commit

Permalink
Merge branch 'dev-3.6' into master-3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
smaspons committed Oct 7, 2024
2 parents 2e23664 + 92a9e0f commit a308cdd
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 9 deletions.
3 changes: 2 additions & 1 deletion core/shared/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,8 @@ def _open_generic_form(self, complet_result):
finally:
action_edit.setEnabled(is_enabled)
action_edit.triggered.connect(partial(self._manage_edition, self.dlg_generic, action_edit, fid, new_feature, generic=True))
action_edit.setChecked(layer.isEditable() and can_edit)
if layer:
action_edit.setChecked(layer.isEditable() and can_edit)

# Signals
self.dlg_generic.btn_accept.clicked.connect(partial(
Expand Down
2 changes: 1 addition & 1 deletion core/shared/nonvisual.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def _delete_object(self, dialog):
def _print_object(self):

# Get dialog
self.dlg_print = GwNonVisualPrint()
self.dlg_print = GwNonVisualPrint(self)
tools_gw.load_settings(self.dlg_print)

# Set values
Expand Down
43 changes: 43 additions & 0 deletions core/shared/workcat.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,49 @@ def workcat_open_table_items(self, item):
display_name = item['display_name']
if workcat_id is None:
return False
if 'sys_geometry' not in item:
sql = f"""
SELECT row_to_json(row) FROM (SELECT
CASE
WHEN st_geometrytype(st_concavehull(d.the_geom, 0.99::double precision)) = 'ST_Polygon'::text THEN st_astext(st_buffer(st_concavehull(d.the_geom, 0.99::double precision), 10::double precision)::geometry(Polygon, {lib_vars.project_epsg}))
ELSE st_astext(st_expand(st_buffer(d.the_geom, 10::double precision), 1::double precision)::geometry(Polygon, {lib_vars.project_epsg}))
END AS st_astext
FROM (SELECT st_collect(a.the_geom) AS the_geom, a.workcat_id FROM ( SELECT node.workcat_id, node.the_geom FROM node WHERE node.state = 1
UNION
SELECT arc.workcat_id, arc.the_geom FROM arc WHERE arc.state = 1
UNION
SELECT connec.workcat_id, connec.the_geom FROM connec WHERE connec.state = 1
UNION
SELECT element.workcat_id, element.the_geom FROM element WHERE element.state = 1
UNION
SELECT node.workcat_id_end AS workcat_id,node.the_geom FROM node WHERE node.state = 0
UNION
SELECT arc.workcat_id_end AS workcat_id, arc.the_geom FROM arc WHERE arc.state = 0
UNION
SELECT connec.workcat_id_end AS workcat_id,connec.the_geom FROM connec WHERE connec.state = 0
UNION
SELECT element.workcat_id_end AS workcat_id, element.the_geom FROM element WHERE element.state = 0) a GROUP BY a.workcat_id ) d
JOIN cat_work AS b ON d.workcat_id = b.id WHERE d.workcat_id::text = '{workcat_id}' LIMIT 1 )row
"""
row = tools_db.get_row(sql)
try:
item['sys_geometry'] = row[0]['st_astext']
except Exception:
pass

if 'sys_geometry' in item:
# Zoom to result
list_coord = re.search('\(\((.*)\)\)', str(item['sys_geometry']))
if not list_coord:
msg = "Empty coordinate list"
tools_qgis.show_warning(msg)
return
points = tools_qgis.get_geometry_vertex(list_coord)
tools_qgis.draw_polygon(points, self.rubber_band)
max_x, max_y, min_x, min_y = tools_qgis.get_max_rectangle_from_coords(list_coord)
tools_qgis.zoom_to_rectangle(max_x, max_y, min_x, min_y)

self._update_selector_workcat(workcat_id)
current_selectors = self._get_current_selectors()
Expand Down
2 changes: 2 additions & 0 deletions core/toolbars/utilities/toolbox_btn.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,9 +721,11 @@ def _populate_layer_combo(self, feature_types):
elem.append(layer_name)
elem.append(feature_type)
layers.append(elem)
tools_qt.set_widget_enabled(self.dlg_functions, 'btn_run', True)
if not layers:
elem = [f"There is no layer related to {feature_type}.", None, None]
layers.append(elem)
tools_qt.set_widget_enabled(self.dlg_functions, 'btn_run', False)

tools_qt.fill_combo_values(self.dlg_functions.cmb_layers, layers, sort_combo=False, index_to_show=0)

Expand Down
9 changes: 2 additions & 7 deletions metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@ qgisMinimumVersion=3.22
qgisMaximumVersion=3.38
description=Plugin to manage water networks (water supply, sewerage and urban drainage) using QGIS and PostGIS-PostgreSQL
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.6.013
version=3.6.014
author=David Erill, Barbara Rzepka, Sergi Muñoz, Josep Lluís Sala, Edgar Fusté, Albert Bofill, Sergi Maspons, Elies Bertran, Abel García Juanes, Maria Guzmán, Jordi Blanch, Xavier Torret, Daniel Marín, Ferran Martínez

Changelog=Version 3.6.013
- Configure 'Change feature type' form in config_form_fields and add 4 new widgets: Fluid, Location, Category & Function.
- Fix valves symbology.
- Add 'ignore' to mapzone config.
- Remove toolbars_shortcuts from user config files (it wasn't used).
- Add project variable 'gwCurrentStyle'
Changelog=Version 3.6.014


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

0 comments on commit a308cdd

Please sign in to comment.