diff --git a/QgisModelBaker/gui/workflow_wizard/project_creation_page.py b/QgisModelBaker/gui/workflow_wizard/project_creation_page.py index f22b38ef4..0fecff1de 100644 --- a/QgisModelBaker/gui/workflow_wizard/project_creation_page.py +++ b/QgisModelBaker/gui/workflow_wizard/project_creation_page.py @@ -69,14 +69,7 @@ def __init__(self, parent, title): self.existing_projecttopping_id = None self.projecttopping_id = None - self.optimize_combo.clear() - self.optimize_combo.addItem( - self.tr("Hide unused base class layers"), OptimizeStrategy.HIDE - ) - self.optimize_combo.addItem( - self.tr("Group unused base class layers"), OptimizeStrategy.GROUP - ) - self.optimize_combo.addItem(self.tr("No optimization"), OptimizeStrategy.NONE) + self._update_optimize_combo() self.create_project_button.clicked.connect(self._create_project) self.is_complete = False @@ -121,6 +114,10 @@ def restore_configuration(self, configuration): self.configuration = configuration self.db_connector = db_utils.get_db_connector(self.configuration) + # get inheritance + self.configuration.inheritance = self._inheritance() + self._update_optimize_combo() + # get existing topping self.existing_topping_checkbox.setVisible(False) self.existing_projecttopping_id = self._existing_projecttopping_id() @@ -130,6 +127,7 @@ def restore_configuration(self, configuration): self.existing_topping_checkbox.setChecked(True) else: self._use_existing(False) + self.workflow_wizard.busy(self, False) def _use_existing(self, state): @@ -195,6 +193,47 @@ def _enable_optimize_combo(self, state): self.optimize_combo.setEnabled(state) self.optimize_label.setEnabled(state) + def _update_optimize_combo(self): + index = self.optimize_combo.currentIndex() + self.optimize_combo.clear() + if self.configuration and self.configuration.inheritance == "smart2": + self.optimize_combo.addItem( + self.tr("Hide unused base class layers"), OptimizeStrategy.HIDE + ) + self.optimize_combo.addItem( + self.tr("Group unused base class layers"), OptimizeStrategy.GROUP + ) + self.optimize_combo.setToolTip( + self.tr( + """ + +

Hide unused base class layers:

+

- Base class layers with same named extensions will be hidden and and base class layers with multiple extensions as well. Except if the extension is in the same model, then it's will not be hidden but renamed.

+

- Relations of hidden layers will not be created and with them no widgets

+

Group unused base class layers:

+

- Base class layers with same named extensions will be collected in a group and base class layers with multiple extensions as well. Except if the extension is in the same model, then it will not be grouped but renamed.

+

- Relations of grouped layers will be created but the widgets not applied to the form.

+ + """ + ) + ) + else: + self.optimize_combo.addItem( + self.tr("Hide unused base class types"), OptimizeStrategy.HIDE + ) + self.optimize_combo.setToolTip( + self.tr( + """ + +

Hide unused base class types:

+

- Base class tables with same named extensions will be hidden in the t_type dropdown and and base class tables with multiple extensions as well. Except if the extension is in the same model, then it will not be hidden.

+ + """ + ) + ) + self.optimize_combo.addItem(self.tr("No optimization"), OptimizeStrategy.NONE) + self.optimize_combo.setCurrentIndex(index) + def _complete_completer(self): if self.topping_line_edit.hasFocus() and self.topping_line_edit.completer(): if not self.topping_line_edit.text(): @@ -669,3 +708,9 @@ def _modelnames(self): ): modelnames.append(name) return modelnames + + def _inheritance(self): + setting_records = self.db_connector.get_ili2db_settings() + for setting_record in setting_records: + if setting_record["tag"] == "ch.ehi.ili2db.inheritanceTrafo": + return setting_record["setting"] diff --git a/docs/docs/background_info/extended_models_optimization.md b/docs/docs/background_info/extended_models_optimization.md index ca1b30d95..4d8e3652b 100644 --- a/docs/docs/background_info/extended_models_optimization.md +++ b/docs/docs/background_info/extended_models_optimization.md @@ -1,4 +1,4 @@ -If a model or topic contains extended classes, the inclusive base classes are implemented in the physical database. The users only want to see, what is relevant for them and mostly work on the most extended instance of the topics/classes. Model Baker detects the ***irrelevant*** tables and offers optimization strategies to the users on ***smart1intehritance*** implementations. +If a model or topic contains extended classes, the inclusive base classes are implemented in the physical database. The users only want to see, what is relevant for them and mostly work on the most extended instance of the topics/classes. Model Baker detects the ***irrelevant*** tables and offers optimization strategies. In the [workflow wizard](../../user_guide/import_workflow/#optimize-qgis-project-if-extended) you can choose the optimization [strategy](../../background_info/extended_models_optimization/#strategies) and receive a nicely prepared layertree and forms. @@ -36,7 +36,7 @@ What to do then? Well, you have always the option for the [NONE-strategy](../../ ## Strategies -Let's check out the following examle model and it's implementation according to the strategies. +Let's check out the following example model and it's implementation according to the strategies on a database created with ***smart2intehritance***. ### Ortsplanung Example @@ -57,6 +57,9 @@ Base class layers with extensions of the same name are **_hidden_** and base cla Relations of hidden layers are **_not created_** and thus the widgets for them _**neither**_. +!!! Note + With ***smart1inheritance***, the extended `Gebaeude` classes would all be summarised in a layer with a `t_type`, which defines what type of extension it is. This strategy hides the irrelevant values for ‘t_type’. + #### Group strategy Base class layers with extensions of the same name are ***grouped***, base class layers with multiple extensions ***also***. Unless the extension is in the same model, then it's ***not grouped*** but ***renamed***. @@ -66,6 +69,7 @@ Base class layers with extensions of the same name are ***grouped***, base class Relationships of grouped layers are ***created***, but widgets are ***not applied*** to the form. #### None strategy + Independently from extended models (but pretty much connected to it), we eliminate ambiguous layer naming in general. This means: - If layername is ambiuous append topic name as suffix. diff --git a/docs/docs/user_guide/import_workflow.md b/docs/docs/user_guide/import_workflow.md index 5fa2cda14..fe505d355 100644 --- a/docs/docs/user_guide/import_workflow.md +++ b/docs/docs/user_guide/import_workflow.md @@ -187,6 +187,9 @@ Choose your optimization strategy in the checkbox: Relations of grouped layers will be *created* but the widgets are *not applied* to the form. +!!! Note + As well you can optimize projects created with *smart1inheritance*. There it only appends the relevant type-values to the `t_type` dropdown box in the form, when ***Hide unused base class types*** is selected. A "grouping" optimization does not make sense for *smart1inheritance*. + For more information about the optimization of extended models, see the [corresponding chapter](../../background_info/extended_models_optimization). ## 8. OID Values diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 2469d1cdd..74d0ffffe 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -91,7 +91,7 @@ plugins: Basket and Dataset Handling: Dataset und Basket Handling OID Generator: OID Generator UsabILIty Hub: UsabILIty Hub - Overview: Übersicht + Overview: Overview Model Baker Integration: Model Baker Integration Technical Concept: Technisches Konzept Optimized Projects for Extended Models: Optimierte Projekte für erweiterte