diff --git a/modelbaker/dataobjects/project.py b/modelbaker/dataobjects/project.py index eec6762..8b57133 100644 --- a/modelbaker/dataobjects/project.py +++ b/modelbaker/dataobjects/project.py @@ -269,6 +269,8 @@ def create( self.load_layouts(qgis_project) + self.store_project_variables(qgis_project) + if path: qgis_project.write(path) @@ -371,6 +373,11 @@ def load_mapthemes(self, qgis_project): qgis_project.mapThemeCollection().insert(name, map_theme_record) + def store_project_variables(self, qgis_project): + QgsExpressionContextUtils.setProjectVariable( + qgis_project, "optimize_strategy", self.optimize_strategy.name + ) + def post_generate(self): for layer in self.layers: layer.post_generate(self) diff --git a/modelbaker/ilitoppingmaker/iliprojecttopping.py b/modelbaker/ilitoppingmaker/iliprojecttopping.py index b6f8bb4..7a86454 100644 --- a/modelbaker/ilitoppingmaker/iliprojecttopping.py +++ b/modelbaker/ilitoppingmaker/iliprojecttopping.py @@ -18,7 +18,7 @@ """ -from qgis.core import Qgis, QgsProject +from qgis.core import Qgis, QgsExpressionContextUtils, QgsProject from ..libs.toppingmaker import ExportSettings, ProjectTopping from .ilidata import IliData @@ -82,6 +82,9 @@ def makeit(self, project: QgsProject = None): return False # Creates and sets the project_topping considering the passed QgsProject and the existing ExportSettings. self.parse_project(project, self.export_settings) + + self.append_iliproperties(project) + # Generate topping files (layertree and depending files like style etc) considering existing ProjectTopping and Target. projecttopping_id = self.generate_files(self.target) @@ -102,3 +105,12 @@ def makeit(self, project: QgsProject = None): ) return ilidata_path + + def append_iliproperties(self, project): + # append ilispecific properties like the optimize_strategy to the properties object + optimize_strategy = QgsExpressionContextUtils.projectScope(project).variable( + "optimize_strategy" + ) + + if optimize_strategy: + self.properties["ili_optimize_strategy"] = optimize_strategy diff --git a/scripts/package_pip_packages.sh b/scripts/package_pip_packages.sh index f6fcc9b..e349846 100755 --- a/scripts/package_pip_packages.sh +++ b/scripts/package_pip_packages.sh @@ -3,7 +3,7 @@ LIBS_DIR="modelbaker/libs" DEPRECATION=("deprecation" "2.1.0") PGSERVICEPARSER=("pgserviceparser" "1.1.0") -TOPPINGMAKER=("toppingmaker" "1.2.5") +TOPPINGMAKER=("toppingmaker" "1.3.0") PACKAGES=( DEPRECATION[@]