From 8c2afa5b1261e76ad3a14b8059ccfb26398b4c71 Mon Sep 17 00:00:00 2001 From: Jan Caha Date: Thu, 18 Jul 2024 09:53:32 +0200 Subject: [PATCH] columns --- .../processing/to_table/tool_export_los.py | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/los_tools/processing/to_table/tool_export_los.py b/los_tools/processing/to_table/tool_export_los.py index 6e2069c..b025bba 100644 --- a/los_tools/processing/to_table/tool_export_los.py +++ b/los_tools/processing/to_table/tool_export_los.py @@ -13,13 +13,12 @@ QgsProcessingUtils, QgsWkbTypes, ) -from qgis.PyQt.QtCore import QVariant from los_tools.classes.classes_los import LoSGlobal, LoSLocal, LoSWithoutTarget from los_tools.constants.field_names import FieldNames from los_tools.constants.names_constants import NamesConstants from los_tools.processing.tools.util_functions import get_los_type -from los_tools.utils import get_doc_file +from los_tools.utils import COLUMN_TYPE, COLUMN_TYPE_STRING, get_doc_file class ExportLoSAlgorithm(QgsProcessingAlgorithm): @@ -83,24 +82,24 @@ def processAlgorithm(self, parameters, context, feedback): fields = QgsFields() - fields.append(QgsField(FieldNames.ID_LOS, QVariant.Int)) - fields.append(QgsField(FieldNames.ID_OBSERVER, QVariant.Int)) - fields.append(QgsField(FieldNames.OBSERVER_OFFSET, QVariant.Double)) - fields.append(QgsField(FieldNames.CSV_OBSERVER_DISTANCE, QVariant.Double)) - fields.append(QgsField(FieldNames.CSV_ELEVATION, QVariant.Double)) - fields.append(QgsField(FieldNames.CSV_VISIBLE, QVariant.Bool)) - fields.append(QgsField(FieldNames.CSV_HORIZON, QVariant.Bool)) + fields.append(QgsField(FieldNames.ID_LOS, COLUMN_TYPE.Int)) + fields.append(QgsField(FieldNames.ID_OBSERVER, COLUMN_TYPE.Int)) + fields.append(QgsField(FieldNames.OBSERVER_OFFSET, COLUMN_TYPE.Double)) + fields.append(QgsField(FieldNames.CSV_OBSERVER_DISTANCE, COLUMN_TYPE.Double)) + fields.append(QgsField(FieldNames.CSV_ELEVATION, COLUMN_TYPE.Double)) + fields.append(QgsField(FieldNames.CSV_VISIBLE, COLUMN_TYPE.Bool)) + fields.append(QgsField(FieldNames.CSV_HORIZON, COLUMN_TYPE.Bool)) if los_type == NamesConstants.LOS_LOCAL: - fields.append(QgsField(FieldNames.ID_TARGET, QVariant.Int)) - fields.append(QgsField(FieldNames.TARGET_OFFSET, QVariant.Double)) + fields.append(QgsField(FieldNames.ID_TARGET, COLUMN_TYPE.Int)) + fields.append(QgsField(FieldNames.TARGET_OFFSET, COLUMN_TYPE.Double)) elif los_type == NamesConstants.LOS_GLOBAL: - fields.append(QgsField(FieldNames.ID_TARGET, QVariant.Int)) - fields.append(QgsField(FieldNames.TARGET_OFFSET, QVariant.Double)) - fields.append(QgsField(FieldNames.TARGET_X, QVariant.Double)) - fields.append(QgsField(FieldNames.TARGET_Y, QVariant.Double)) - fields.append(QgsField(FieldNames.CSV_TARGET, QVariant.Bool)) + fields.append(QgsField(FieldNames.ID_TARGET, COLUMN_TYPE.Int)) + fields.append(QgsField(FieldNames.TARGET_OFFSET, COLUMN_TYPE.Double)) + fields.append(QgsField(FieldNames.TARGET_X, COLUMN_TYPE.Double)) + fields.append(QgsField(FieldNames.TARGET_Y, COLUMN_TYPE.Double)) + fields.append(QgsField(FieldNames.CSV_TARGET, COLUMN_TYPE.Bool)) # elif los_type == NamesConstants.LOS_NO_TARGET: # pass