Skip to content

Commit

Permalink
another bit
Browse files Browse the repository at this point in the history
  • Loading branch information
signedav committed Aug 11, 2023
1 parent cddc71c commit 1797191
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions modelbaker/generator/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
***************************************************************************/
"""
import re
from enum import Enum

from qgis.core import QgsApplication, QgsRelation, QgsWkbTypes
from qgis.PyQt.QtCore import QCoreApplication, QLocale, QObject, pyqtSignal
Expand All @@ -37,6 +38,11 @@ class Generator(QObject):
stdout = pyqtSignal(str)
new_message = pyqtSignal(int, str)

class OptimizeStrategy(Enum):
NONE = 0
RENAME = 1
HIDE = 2

def __init__(
self,
tool,
Expand All @@ -47,7 +53,7 @@ def __init__(
parent=None,
mgmt_uri=None,
consider_basket_handling=False,
optimize_extended=True #TRUE for-relevance-tests: should be false after
optimize_strategy=Generator.OptimizeStrategy.HIDE #HIDE for-relevance-tests: should be NONE after
):
"""
Creates a new Generator objects.
Expand All @@ -69,7 +75,7 @@ def __init__(
self._db_connector.stdout.connect(self.print_info)
self._db_connector.new_message.connect(self.append_print_message)
self.basket_handling = consider_basket_handling and self.get_basket_handling()
self.optimize_extended = optimize_extended
self.optimize_strategy = optimize_strategy

self._additional_ignored_layers = (
[]
Expand Down Expand Up @@ -139,7 +145,7 @@ def layers(self, filter_layer_list=[]):
record.get("tablename") == self._db_connector.dataset_table_name
)

is_relevant = bool(record.get("relevance")) if self.optimize_extended else True
is_relevant = bool(record.get("relevance")) if self.optimize_strategy != Generator.OptimizeStrategy.NONE else True

alias = record["table_alias"] if "table_alias" in record else None
if not alias:
Expand Down

0 comments on commit 1797191

Please sign in to comment.