Skip to content

Commit

Permalink
Bugfix: DTC need the original mohid files and not the shapefiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui Correia committed Feb 1, 2023
1 parent 95f6c47 commit 7aabd3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 35 deletions.
7 changes: 4 additions & 3 deletions mohid_qgis/plugin/tab_bathymetry/tab_bathymetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def addGridToLayer(self):
vlayer = self.bat_gridBox.currentData()
item = QTreeWidgetItem(self.bat_gridTree)
item.setText(0, os.path.basename(vlayer.name()).replace("MOHID Grid - ", ""))
item.setText(1, vlayer.source())
item.setText(1, vlayer.source().replace(".shp", ".grd"))

def removeGridLayer(self):

Expand Down Expand Up @@ -94,7 +94,7 @@ def addXYZToLayer(self):
vlayer = self.bat_XYZBox.currentData()
item = QTreeWidgetItem(self.bat_xyzTree)
item.setText(0, os.path.basename(vlayer.name()).replace("MOHID Points - ", ""))
item.setText(1, vlayer.source())
item.setText(1, vlayer.source().replace(".shp", ".xyz"))

def removeXYZLayer(self):

Expand All @@ -121,7 +121,7 @@ def addLandToLayer(self):
vlayer = self.bat_landBox.currentData()
item = QTreeWidgetItem(self.bat_landTree)
item.setText(0, os.path.basename(vlayer.name()).replace("MOHID Land - ", ""))
item.setText(1, vlayer.source())
item.setText(1, vlayer.source().replace(".shp", ".xy"))

def removeLandLayer(self):

Expand Down Expand Up @@ -271,6 +271,7 @@ def loadLayer(self):

def _runDigitalTerrain(self):
# TODO: remove hardcoded configurations after implementing options solution
# Check the other plugin to see how output is passed
DTCpath = os.path.abspath(os.path.join(os.path.dirname( __file__ ),
'../..',
'core/Digital_Terrain_Creator/DigitalTerrainCreator_release_double_x64.exe'))
Expand Down
34 changes: 2 additions & 32 deletions mohid_qgis/plugin/tab_load/tab_Load.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

from qgis.PyQt import uic
from PyQt5.QtWidgets import QTabWidget, QTreeWidgetItem
from PyQt5.QtWidgets import QTabWidget

from qgis.PyQt.QtCore import QObject
from qgis.PyQt.QtWidgets import QPushButton, QFileDialog
Expand All @@ -13,7 +13,6 @@
from mohid_qgis.core.utils.xyzConverter import XYZ2shp
from mohid_qgis.core.utils.bathymetryConverter import MOHIDBathymetry2shp, saveToMohidFile, \
saveGenerateMohidFile
from mohid_qgis.plugin.base.thread import ProgramThread
import logging

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -258,33 +257,4 @@ def convert(self, input, convertFunction, output=None,):
return convertFunction(input)

def loadLayer(self):
raise NotImplementedError

def _runDigitalTerrain(self):
# TODO: remove hardcoded configurations after implementing options solution
DTCpath = os.path.abspath(os.path.join(os.path.dirname( __file__ ),
'../..',
'core/Digital_Terrain_Creator/DigitalTerrainCreator_release_double_x64.exe'))
thread = ProgramThread(DTCpath)

def on_output(out: str) -> None:
logger.debug("on_output callback")
# self.stdout_textarea.appendPlainText(out)
# vert_scrollbar = self.stdout_textarea.verticalScrollBar()
# vert_scrollbar.setValue(vert_scrollbar.maximum())

def on_finished() -> None:
# When lines come in fast, then the highlighter is not called on each line.
# Re-highlighting at the end is a work-around to at least have correct
# highlighting after program termination.
# self.stdout_highlighter.rehighlight()
logger.debug("on_finished callback")
if thread.exc_info:
# on_done(path, None)
raise thread.exc_info[0].with_traceback(*thread.exc_info[1:])
# on_done(path, thread.error)
thread.output.connect(on_output)
thread.finished.connect(on_finished)
thread.start()
# so that we can kill the program later if requested
self.thread = thread
raise NotImplementedError

0 comments on commit 7aabd3b

Please sign in to comment.