Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
tayden committed Aug 17, 2022
2 parents 2762905 + 6eb8136 commit f25704f
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 353 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/gui-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
poetry run pip install --upgrade setuptools
- name: Building GUI
run: |
poetry run pyinstaller --name=LAS-TRX-${{ steps.tag.outputs.tag }} --onefile --icon='las_trx/resources/las-trx.ico' --add-data='las_trx/resources/las-trx.ico:resources' las_trx/main.py
poetry run pyinstaller --name=LAS-TRX-${{ steps.tag.outputs.tag }} --onefile --icon='las_trx/resources/las-trx.ico' --add-data='las_trx/resources/las-trx.ico:resources' las_trx/__main__.py
- name: Gzip release
run: |
tar -czvf dist/LAS-TRX-${{ steps.tag.outputs.tag }}-linux.tar.gz -C dist LAS-TRX-${{ steps.tag.outputs.tag }}
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
poetry run pip install --upgrade setuptools
- name: Building GUI
run: |
poetry run pyinstaller --name=LAS-TRX-${{ steps.tag.outputs.tag }} --onefile --windowed --icon='las_trx\resources\las-trx.ico' --add-data='las_trx\resources\las-trx.ico;resources' las_trx\main.py
poetry run pyinstaller --name=LAS-TRX-${{ steps.tag.outputs.tag }} --onefile --windowed --icon='las_trx\resources\las-trx.ico' --add-data='las_trx\resources\las-trx.ico;resources' las_trx\__main__.py
- name: Zip release
run: |
cd dist
Expand All @@ -79,7 +79,7 @@ jobs:
path: dist/LAS-TRX-${{ steps.tag.outputs.tag }}-win64.zip

Release:
needs: [Linux, Windows]
needs: [ Linux, Windows ]
runs-on: ubuntu-latest

steps:
Expand Down
125 changes: 0 additions & 125 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,128 +1,3 @@
### VisualStudioCode template
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Linux template
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### Windows template
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
2 changes: 2 additions & 0 deletions .idea/Las-TRX.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions las_trx/main.py → las_trx/__main__.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def convert(self):
self.thread.start()


class LogStream(object):
class LogWriteStream(object):
def __init__(self, queue):
super().__init__()
self.queue = queue
Expand All @@ -256,7 +256,7 @@ def write(self, text):
self.queue.put(text)


class LogThread(QThread):
class LogDisplayThread(QThread):
on_msg = Signal(str)

def __init__(self, queue: Queue, *args, **kwargs):
Expand All @@ -277,7 +277,7 @@ def run(self):

# Configure logging
log_msg_queue = Queue()
log_write_stream = LogStream(log_msg_queue)
log_write_stream = LogWriteStream(log_msg_queue)
log_handler = logging.StreamHandler(log_write_stream)

logging.basicConfig(level=logging.INFO, handlers=[log_handler])
Expand All @@ -288,7 +288,7 @@ def run(self):

# When a new message is written to the log_queue via the log_write_stream, log_thread emits a signal that causes the main
# window to display that msg in the textBrowser
log_thread = LogThread(log_msg_queue)
log_thread = LogDisplayThread(log_msg_queue)
log_thread.on_msg.connect(window.append_text)
app.aboutToQuit.connect(log_thread.requestInterruption)
log_thread.start()
Expand Down
28 changes: 15 additions & 13 deletions las_trx/worker.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import copy
import logging
import math
import multiprocessing
import os
from concurrent import futures
from pathlib import Path
from time import sleep

import laspy
import math
import numpy as np
from PySide2.QtCore import QThread, Signal
from laspy import LasHeader
Expand All @@ -30,7 +30,7 @@ class TransformWorker(QThread):
error = Signal(BaseException)

def __init__(
self, config: TransformConfig, input_files: list[Path], output_files: list[Path]
self, config: TransformConfig, input_files: list[Path], output_files: list[Path]
):
super().__init__(parent=None)
self.config = config
Expand Down Expand Up @@ -77,6 +77,8 @@ def _do_transform(self):
config = self.config.dict(exclude_none=True)
futs = []
for input_file, output_file in zip(self.input_files, self.output_files):
if not Path(output_file).suffix:
output_file += ".laz"
logger.info(f"{input_file} -> {output_file}")
fut = self.pool.submit(
transform, config, input_file, output_file, self.lock, self.current_iter
Expand Down Expand Up @@ -112,11 +114,11 @@ def run(self):


def transform(
config: dict,
input_file: Path,
output_file: Path,
lock: multiprocessing.RLock,
cur: multiprocessing.Value,
config: dict,
input_file: Path,
output_file: Path,
lock: multiprocessing.RLock,
cur: multiprocessing.Value,
):
transformer = CSRSTransformer(**config)
config = TransformConfig(**config)
Expand All @@ -132,7 +134,7 @@ def transform(
logger.debug(f"{laz_backend=}")

with laspy.open(
output_file, mode="w", header=new_header, laz_backend=laz_backend
output_file, mode="w", header=new_header, laz_backend=laz_backend
) as out_las:
for points in in_las.chunk_iterator(CHUNK_SIZE):
# Convert the coordinates
Expand All @@ -153,7 +155,7 @@ def transform(


def write_header_offsets(
header: "LasHeader", input_file: Path, transformer: "CSRSTransformer"
header: "LasHeader", input_file: Path, transformer: "CSRSTransformer"
) -> "LasHeader":
with laspy.open(input_file) as in_las:
points = next(in_las.chunk_iterator(CHUNK_SIZE))
Expand All @@ -172,10 +174,10 @@ def clear_header_geokeys(header: "LasHeader") -> "LasHeader":
# Update GeoKeyDirectoryVLR
# check and remove any existing crs vlrs
for crs_vlr_name in (
"WktCoordinateSystemVlr",
"GeoKeyDirectoryVlr",
"GeoAsciiParamsVlr",
"GeoDoubleParamsVlr",
"WktCoordinateSystemVlr",
"GeoKeyDirectoryVlr",
"GeoAsciiParamsVlr",
"GeoDoubleParamsVlr",
):
try:
header.vlrs.extract(crs_vlr_name)
Expand Down
Loading

0 comments on commit f25704f

Please sign in to comment.