Qgis toolbox button - Giswater/giswater_dbmodel GitHub Wiki
Giswater toolbox permits executing processes created as database functions. It allows not only to use processes already created on giswater, but also gives an oportunity to advanced users to create their own function, configurate it and use on QGIS Giswater project. In order to find out how to do it, check out section Create new PLSQL function.
In QGIS project user opens a list of available processes grouped in sections, depending on the role of user permissions, defined on sys_function table, field sys_role. Name of a function, that appears on the list is defined on config_toolbox table, field alias. Both tables (sys_function and config_toolbox) are related by using the id of function, assigned on sys_function table.
Automatically another section called Selection type is added. Here user may use the entire network to execute the process or only a couple of features previously selected on the layer.
The section Option parameters is prepared for all the additional parameters needed to execute the process. They may be also defined config_toolbox table, field inputparams. Here there is an example of a list of input parameters defintion:
[{"widgetname":"parameter1", "label":"Param 1:", "widgettype":"check", "datatype":"boolean", "layoutname":"grl_option_parameters", "layoutorder":1,"value":"false"},
{"widgetname":"parameter2", "label":"Param 1:", "widgettype":"combo", "datatype":"text", "layoutname":"grl_option_parameters", "layoutorder":2, "comboIds":["DMA","PRESSZONE","SECTOR"], "comboNames":["District Metering Areas (DMA)","PRESSZONE", "SECTOR"], "selectedId":"DMA"},
{"widgetname":"parameter3", "label":"Param 3:", "widgettype":"text", "datatype":"string", "layoutname":"grl_option_parameters", "layoutorder":3, "value":"c_sector"},
{"widgetname":"parameter4", "label":"Param 4:", "widgettype":"spinbox", "datatype":"float", "layoutname":"grl_option_parameters", "layoutorder":4, "value":0.01}]
Json key explanation:
Key | Description | Example |
---|---|---|
widgetname | Parameter name passed to the function | "widgetname":"parameter1" |
label | Label of the parameter, showed to the user on the form | "label":"Param 1:" |
datatype | Data type of parameter | "datatype":"boolean" |
widgettype | Type of widget on which value is inserted | "widgettype":"check" |
comboIds | If widgettype is combo, it's necessary to create a list of available options. ComboIds are values that will be passed to the function | "comboIds":["DMA","PRESSZONE","SECTOR"] |
comboNames | If widgettype is combo, it's necessary to create a list of available options. ComboNames are values that will be showe to the user on form | "comboNames":["District Metering Areas (DMA)","PRESSZONE", "SECTOR"] |
selectedId | If widgettype is combo, it's a combo value selected by default | "selectedId":"DMA" |
value | If widgettype is different than combo, it's a default value of widget | "value":0.0 |
layoutname | Name of layout on which widgets are inserted, it's always grl_option_parameters | "layoutname":"grl_option_parameters" |
layoutorder | Order of widgets inside the form | "layoutorder":4 |