-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c5c7e9a
commit 93dda1f
Showing
53 changed files
with
757 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import sys | ||
|
||
#sys.path.append(r"C:\Users\katri\AppData\Roaming\Speckle\connector_installations\QGIS") | ||
sys.path.append(r"C:\OSGeo4W\apps\qgis\python") | ||
sys.path.insert(0,r"C:\Users\katri\AppData\Roaming\Speckle\connector_installations\QGIS") |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from speckle.converter.features.utils import ( | ||
addFeatVariant, | ||
updateFeat, | ||
getPolygonFeatureHeight, | ||
) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from speckle.converter.geometry.conversions import ( | ||
convertToSpeckle, | ||
convertToNative, | ||
multiPointToNative, | ||
multiPolylineToNative, | ||
multiPolygonToNative, | ||
convertToNativeMulti, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...s/unit/geometry_tests/test_point_mixed.py → ...verter/geometry_tests/test_point_mixed.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from speckle.converter.geometry.polygon import ( | ||
polygonToSpeckleMesh, | ||
getZaxisTranslation, | ||
isFlat, | ||
polygonToSpeckle, | ||
polygonToNative, | ||
getPolyBoundaryVoids, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from speckle.converter.geometry.polygon import ( | ||
polygonToSpeckleMesh, | ||
getZaxisTranslation, | ||
isFlat, | ||
polygonToSpeckle, | ||
polygonToNative, | ||
getPolyBoundaryVoids, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from speckle.converter.geometry.polyline import ( | ||
polylineFromVerticesToSpeckle, | ||
unknownLineToSpeckle, | ||
compoudCurveToSpeckle, | ||
anyLineToSpeckle, | ||
polylineToSpeckle, | ||
arcToSpeckle, | ||
getArcCenter, | ||
lineToNative, | ||
polylineToNative, | ||
ellipseToNative, | ||
curveToNative, | ||
arcToNative, | ||
circleToNative, | ||
polycurveToNative, | ||
speckleEllipseToPoints, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from speckle.converter.geometry.polyline import ( | ||
polylineFromVerticesToSpeckle, | ||
unknownLineToSpeckle, | ||
compoudCurveToSpeckle, | ||
anyLineToSpeckle, | ||
polylineToSpeckle, | ||
arcToSpeckle, | ||
getArcCenter, | ||
lineToNative, | ||
polylineToNative, | ||
ellipseToNative, | ||
curveToNative, | ||
arcToNative, | ||
circleToNative, | ||
polycurveToNative, | ||
speckleEllipseToPoints, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from speckle.converter.geometry.transform import transform |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from speckle.converter.layers import ( | ||
getAllLayers, | ||
getAllLayersWithTree, | ||
findAndClearLayerGroup, | ||
getSavedLayers, | ||
getSelectedLayers, | ||
getSelectedLayersWithStructure, | ||
getTreeFromLayers, | ||
) |
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from plugin_utils.helpers import ( | ||
get_scale_factor, | ||
get_scale_factor_to_meter, | ||
jsonFromList, | ||
constructCommitURL, | ||
getAppName, | ||
findOrCreatePath, | ||
removeSpecialCharacters, | ||
splitTextIntoLines, | ||
findFeatColors, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from plugin_utils.object_utils import ( | ||
traverseObject, | ||
traverseValue, | ||
callback, | ||
getBaseValidName, | ||
loopObj, | ||
loopVal, | ||
) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from speckle.ui_widgets.dockwidget_main import SpeckleQGISDialog | ||
|
||
|
||
def test_create_widget(): | ||
# widget = SpeckleQGISDialog() | ||
# widget.createMappingDialog() | ||
assert True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from speckle.ui_widgets.widget_transforms import MappingSendDialogQGIS | ||
|
||
|
||
def test_create_widget(): | ||
# widget = MappingSendDialogQGIS() | ||
# widget.runSetup() | ||
assert True |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from speckle.utils.panel_logging import logToUser, Logging | ||
|
||
|
||
def test_logToUser(): | ||
msg = "" | ||
func = None | ||
level = 1 | ||
plugin = None | ||
url = "" | ||
blue = False | ||
report = False | ||
# logToUser(msg, func, level, plugin, url, blue, report) | ||
assert False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from speckle.utils.project_vars import ( | ||
get_project_streams, | ||
set_project_streams, | ||
get_project_saved_layers, | ||
set_project_layer_selection, | ||
get_rotation, | ||
set_rotation, | ||
get_survey_point, | ||
set_survey_point, | ||
get_crs_offsets, | ||
set_crs_offsets, | ||
get_transformations, | ||
set_transformations, | ||
get_elevationLayer, | ||
set_elevationLayer, | ||
setProjectReferenceSystem, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from speckle.utils.utils import get_qgis_python_path | ||
|
||
|
||
def test_get_qgis_python_path(): | ||
result = get_qgis_python_path() | ||
assert isinstance(result, str) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from speckle.utils.validation import ( | ||
tryGetClient, | ||
tryGetStream, | ||
validateStream, | ||
validateBranch, | ||
validateCommit, | ||
validateTransport, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import sys | ||
|
||
sys.path.insert(0,r"C:\OSGeo4W\apps\qgis\python") | ||
sys.path.insert(0,r"C:\Users\katri\AppData\Roaming\Speckle\connector_installations\QGIS") |
File renamed without changes.
8 changes: 8 additions & 0 deletions
8
tests_qgis/unit/converter/feature_tests/test_feature_conversions_qgis.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from speckle.converter.features.feature_conversions import ( | ||
featureToSpeckle, | ||
rasterFeatureToSpeckle, | ||
featureToNative, | ||
bimFeatureToNative, | ||
nonGeomFeatureToNative, | ||
cadFeatureToNative, | ||
) |
129 changes: 129 additions & 0 deletions
129
tests_qgis/unit/converter/feature_tests/test_feature_utils_qgis.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
import pytest | ||
from speckle.converter.features.utils import ( | ||
addFeatVariant, | ||
updateFeat, | ||
getPolygonFeatureHeight, | ||
) | ||
|
||
from specklepy.objects import Base | ||
from specklepy_qt_ui.qt_ui.DataStorage import DataStorage | ||
|
||
try: | ||
from qgis._core import ( | ||
QgsCoordinateTransform, | ||
Qgis, | ||
QgsPointXY, | ||
QgsGeometry, | ||
QgsRasterBandStats, | ||
QgsFeature, | ||
QgsFields, | ||
QgsField, | ||
QgsVectorLayer, | ||
QgsRasterLayer, | ||
QgsCoordinateReferenceSystem, | ||
QgsProject, | ||
QgsUnitTypes, | ||
) | ||
except ModuleNotFoundError: | ||
pass | ||
|
||
|
||
@pytest.fixture() | ||
def data_storage(): | ||
sample_obj = DataStorage() | ||
sample_obj.project = QgsProject.instance() | ||
return sample_obj | ||
|
||
|
||
def test_addFeatVariant(): | ||
key = "some key" | ||
variant = 10 # string | ||
value = "value to add" | ||
feature = QgsFeature() | ||
result = addFeatVariant(key, variant, value, feature) | ||
assert isinstance(result, QgsFeature) | ||
|
||
|
||
def test_updateFeat(): | ||
feat = QgsFeature() | ||
fields = QgsFields() | ||
fields.append(QgsField("attr1", 4)) | ||
fields.append(QgsField("attr2", 10)) | ||
fields.append(QgsField("attr3_attr31", 4)) | ||
fields.append(QgsField("attr3_attr32", 4)) | ||
feat.setFields(fields) | ||
|
||
base = Base() | ||
base.attr1 = 1 | ||
base.attr2 = "xx" | ||
base.attr3 = Base() | ||
base.attr3.attr31 = 222 | ||
base.attr3.attr32 = 333 | ||
|
||
result = updateFeat(feat, fields, base) | ||
assert isinstance(result, QgsFeature) | ||
assert result["attr1"] == 1 | ||
|
||
|
||
def test_getPolygonFeatureHeight(data_storage): | ||
feat = QgsFeature() | ||
fields = QgsFields() | ||
fields.append(QgsField("height_m", 4)) | ||
feat.setFields(fields) | ||
feat["height_m"] = 10 | ||
|
||
geomType = "Polygon" | ||
layer_name = "layer1" | ||
layer = QgsVectorLayer(geomType + "?crs=" + "WGS84", layer_name, "memory") | ||
# layer.setCrs(QgsCoordinateReferenceSystem(32630)) | ||
|
||
data_storage.project.setCrs(QgsCoordinateReferenceSystem(32630)) | ||
data_storage.savedTransforms = [] | ||
data_storage.savedTransforms.append( | ||
layer_name + " ('height_m') -> Extrude polygon by selected attribute" | ||
) | ||
result = getPolygonFeatureHeight(feat, layer, data_storage) | ||
assert result == 10 | ||
|
||
|
||
def test_getPolygonFeatureHeight_geo_crs(data_storage): | ||
feat = QgsFeature() | ||
fields = QgsFields() | ||
fields.append(QgsField("height_m", 4)) | ||
feat.setFields(fields) | ||
feat["height_m"] = 10 | ||
|
||
geomType = "Polygon" | ||
layer_name = "layer1" | ||
layer = QgsVectorLayer(geomType + "?crs=" + "WGS84", layer_name, "memory") | ||
|
||
data_storage.project.setCrs(QgsCoordinateReferenceSystem(4326)) | ||
data_storage.savedTransforms = [] | ||
data_storage.savedTransforms.append( | ||
layer_name + " ('height_m') -> Extrude polygon by selected attribute" | ||
) | ||
result = getPolygonFeatureHeight(feat, layer, data_storage) | ||
assert result is None | ||
|
||
|
||
def test_getPolygonFeatureHeight_ignore(data_storage): | ||
feat = QgsFeature() | ||
fields = QgsFields() | ||
fields.append(QgsField("height_m", 4)) | ||
feat.setFields(fields) | ||
feat["height_m"] = 10 | ||
|
||
geomType = "Polygon" | ||
layer_name = "layer1" | ||
layer = QgsVectorLayer(geomType + "?crs=" + "WGS84", layer_name, "memory") | ||
# layer.setCrs(QgsCoordinateReferenceSystem(32630)) | ||
|
||
data_storage.project.setCrs(QgsCoordinateReferenceSystem(32630)) | ||
data_storage.savedTransforms = [] | ||
data_storage.savedTransforms.append( | ||
layer_name | ||
+ " ('floors') -> Extrude polygon by selected attribute (randomly populate)" | ||
) | ||
result = getPolygonFeatureHeight(feat, layer, data_storage) | ||
assert isinstance(result, int) | ||
assert 10 <= result <= 20 |
Empty file.
Oops, something went wrong.