Skip to content

Commit caa0d50

Browse files
committed
Fix spelling of orthoganilize
1 parent 5228cc5 commit caa0d50

File tree

10 files changed

+45
-44
lines changed

10 files changed

+45
-44
lines changed

python/core/geometry/qgsgeometry.sip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,14 +421,14 @@ class QgsGeometry
421421
QgsGeometry orientedMinimumBoundingBox( double& area /Out/, double &angle /Out/, double& width /Out/, double& height /Out/ ) const;
422422

423423
/**
424-
* Attempts to orthagonalize a line or polygon geometry by shifting vertices to make the geometries
424+
* Attempts to orthogonalize a line or polygon geometry by shifting vertices to make the geometries
425425
* angles either right angles or flat lines. This is an iterative algorithm which will loop until
426426
* either the vertices are within a specified tolerance of right angles or a set number of maximum
427427
* iterations is reached. The angle threshold parameter specifies how close to a right angle or
428428
* straight line an angle must be before it is attempted to be straightened.
429429
* @note added in QGIS 3.0
430430
*/
431-
QgsGeometry orthagonalize( double tolerance = 1.0E-8, int maxIterations = 1000, double angleThreshold = 15.0 ) const;
431+
QgsGeometry orthogonalize( double tolerance = 1.0E-8, int maxIterations = 1000, double angleThreshold = 15.0 ) const;
432432

433433
/** Test for intersection with a rectangle (uses GEOS) */
434434
bool intersects( const QgsRectangle& r ) const;

python/plugins/processing/algs/help/qgis.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,12 +320,12 @@ qgis:orientedminimumboundingbox: >
320320

321321
As an alternative, the output layer can contain not just a single rectangle, but one for each input feature, representing the minimum rectangle that covers each of them.
322322

323-
qgis:orthagonalize: >
324-
This algorithm takes a line or polygon layer and attempts to orthagonalize all the geometries in the layer. This process shifts the nodes in the geometries to try to make every angle in the geometry either a right angle or a straight line.
323+
qgis:orthogonalize: >
324+
This algorithm takes a line or polygon layer and attempts to orthogonalize all the geometries in the layer. This process shifts the nodes in the geometries to try to make every angle in the geometry either a right angle or a straight line.
325325

326326
The angle tolerance parameter is used to specify the maximum deviation from a right angle or straight line a node can have for it to be adjusted. Smaller tolerances mean that only nodes which are already closer to right angles will be adjusted, and larger tolerances mean that nodes which deviate further from right angles will also be adjusted.
327327

328-
The algorithm is iterative. Setting a larger number for the maximum iterations will result in a more orthagonal geometry at the cost of extra processing time.
328+
The algorithm is iterative. Setting a larger number for the maximum iterations will result in a more orthogonal geometry at the cost of extra processing time.
329329

330330
qgis:pointsalonglines: >
331331
Creates points at regular intervals along line or polygon geometries. Created points will have new attributes added for the distance along the geometry and the angle of the line at the point.

python/plugins/processing/algs/qgis/Orthagonalize.py renamed to python/plugins/processing/algs/qgis/Orthogonalize.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
"""
44
***************************************************************************
5-
Orthagonalize.py
5+
Orthogonalize.py
66
----------------
77
Date : December 2016
88
Copyright : (C) 2016 by Nyall Dawson
@@ -33,7 +33,7 @@
3333
from processing.tools import dataobjects, vector
3434

3535

36-
class Orthagonalize(GeoAlgorithm):
36+
class Orthogonalize(GeoAlgorithm):
3737

3838
INPUT_LAYER = 'INPUT_LAYER'
3939
OUTPUT_LAYER = 'OUTPUT_LAYER'
@@ -42,7 +42,7 @@ class Orthagonalize(GeoAlgorithm):
4242
ANGLE_TOLERANCE = 'ANGLE_TOLERANCE'
4343

4444
def defineCharacteristics(self):
45-
self.name, self.i18n_name = self.trAlgorithm('Orthagonalize')
45+
self.name, self.i18n_name = self.trAlgorithm('Orthogonalize')
4646
self.group, self.i18n_group = self.trAlgorithm('Vector geometry tools')
4747
self.tags = self.tr('rectangle,perpendicular,right,angles,square,quadrilateralise')
4848

@@ -59,7 +59,7 @@ def defineCharacteristics(self):
5959
max_iterations.isAdvanced = True
6060
self.addParameter(max_iterations)
6161

62-
self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Orthagonalized')))
62+
self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Orthogonalized')))
6363

6464
def processAlgorithm(self, progress):
6565
layer = dataobjects.getObjectFromUri(
@@ -79,10 +79,10 @@ def processAlgorithm(self, progress):
7979
output_feature = input_feature
8080
input_geometry = input_feature.geometry()
8181
if input_geometry:
82-
output_geometry = input_geometry.orthagonalize(1.0e-8, max_iterations, angle_tolerance)
82+
output_geometry = input_geometry.orthogonalize(1.0e-8, max_iterations, angle_tolerance)
8383
if not output_geometry:
8484
raise GeoAlgorithmExecutionException(
85-
self.tr('Error orthagonalizing geometry'))
85+
self.tr('Error orthogonalizing geometry'))
8686

8787
output_feature.setGeometry(output_geometry)
8888

python/plugins/processing/algs/qgis/QGISAlgorithmProvider.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@
183183
from .DropGeometry import DropGeometry
184184
from .BasicStatistics import BasicStatisticsForField
185185
from .Heatmap import Heatmap
186-
from .Orthagonalize import Orthagonalize
186+
from .Orthogonalize import Orthogonalize
187187

188188
pluginPath = os.path.normpath(os.path.join(
189189
os.path.split(os.path.dirname(__file__))[0], os.pardir))
@@ -249,7 +249,7 @@ def __init__(self):
249249
ExtractSpecificNodes(), GeometryByExpression(), SnapGeometriesToLayer(),
250250
PoleOfInaccessibility(), CreateAttributeIndex(), DropGeometry(),
251251
BasicStatisticsForField(), RasterCalculator(), Heatmap(),
252-
Orthagonalize()
252+
Orthogonalize()
253253
]
254254

255255
if hasMatplotlib:

python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,8 +1879,8 @@ tests:
18791879
geometry:
18801880
precision: 7
18811881

1882-
- algorithm: qgis:orthagonalize
1883-
name: Orthagonalize polys
1882+
- algorithm: qgis:orthogonalize
1883+
name: Orthogonalize polys
18841884
params:
18851885
INPUT_LAYER:
18861886
name: custom/polys_to_orth.gml
@@ -1894,8 +1894,8 @@ tests:
18941894
precision: 7
18951895

18961896

1897-
- algorithm: qgis:orthagonalize
1898-
name: Orthagonalize lines
1897+
- algorithm: qgis:orthogonalize
1898+
name: Orthogonalize lines
18991899
params:
19001900
INPUT_LAYER:
19011901
name: custom/lines_to_orth.gml
@@ -1906,4 +1906,5 @@ tests:
19061906
type: vector
19071907
compare:
19081908
geometry:
1909-
precision: 7
1909+
precision: 7
1910+

src/core/geometry/qgsgeometry.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,11 +919,11 @@ QgsGeometry QgsGeometry::orientedMinimumBoundingBox( double& area, double &angle
919919
return minBounds;
920920
}
921921

922-
QgsGeometry QgsGeometry::orthagonalize( double tolerance, int maxIterations, double angleThreshold ) const
922+
QgsGeometry QgsGeometry::orthogonalize( double tolerance, int maxIterations, double angleThreshold ) const
923923
{
924924
QgsInternalGeometryEngine engine( *this );
925925

926-
return engine.orthagonalize( tolerance, maxIterations, angleThreshold );
926+
return engine.orthogonalize( tolerance, maxIterations, angleThreshold );
927927
}
928928

929929
bool QgsGeometry::intersects( const QgsRectangle& r ) const

src/core/geometry/qgsgeometry.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,14 +474,14 @@ class CORE_EXPORT QgsGeometry
474474
QgsGeometry orientedMinimumBoundingBox( double& area, double &angle, double& width, double& height ) const;
475475

476476
/**
477-
* Attempts to orthagonalize a line or polygon geometry by shifting vertices to make the geometries
477+
* Attempts to orthogonalize a line or polygon geometry by shifting vertices to make the geometries
478478
* angles either right angles or flat lines. This is an iterative algorithm which will loop until
479479
* either the vertices are within a specified tolerance of right angles or a set number of maximum
480480
* iterations is reached. The angle threshold parameter specifies how close to a right angle or
481481
* straight line an angle must be before it is attempted to be straightened.
482482
* @note added in QGIS 3.0
483483
*/
484-
QgsGeometry orthagonalize( double tolerance = 1.0E-8, int maxIterations = 1000, double angleThreshold = 15.0 ) const;
484+
QgsGeometry orthogonalize( double tolerance = 1.0E-8, int maxIterations = 1000, double angleThreshold = 15.0 ) const;
485485

486486
//! Test for intersection with a rectangle (uses GEOS)
487487
bool intersects( const QgsRectangle& r ) const;

src/core/geometry/qgsinternalgeometryengine.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ QgsGeometry QgsInternalGeometryEngine::poleOfInaccessibility( double precision ,
244244
}
245245

246246

247-
// helpers for orthagonalize
247+
// helpers for orthogonalize
248248
// adapted from original code in potlach/id osm editor
249249

250250
bool dotProductWithinAngleTolerance( double dotProduct, double lowerThreshold, double upperThreshold )
@@ -340,7 +340,7 @@ QgsVector calcMotion( const QgsPointV2& a, const QgsPointV2& b, const QgsPointV2
340340
return new_v.normalized() * ( 0.1 * dotProduct * scale );
341341
}
342342

343-
QgsLineString* doOrthagonalize( QgsLineString* ring, int iterations, double tolerance, double lowerThreshold, double upperThreshold )
343+
QgsLineString* doOrthogonalize( QgsLineString* ring, int iterations, double tolerance, double lowerThreshold, double upperThreshold )
344344
{
345345
double minScore = DBL_MAX;
346346

@@ -410,7 +410,7 @@ QgsLineString* doOrthagonalize( QgsLineString* ring, int iterations, double tole
410410
}
411411

412412

413-
QgsAbstractGeometry* orthagonalizeGeom( const QgsAbstractGeometry* geom, int maxIterations, double tolerance, double lowerThreshold, double upperThreshold )
413+
QgsAbstractGeometry* orthogonalizeGeom( const QgsAbstractGeometry* geom, int maxIterations, double tolerance, double lowerThreshold, double upperThreshold )
414414
{
415415
QScopedPointer< QgsAbstractGeometry > segmentizedCopy;
416416
if ( QgsWkbTypes::isCurvedType( geom->wkbType() ) )
@@ -421,7 +421,7 @@ QgsAbstractGeometry* orthagonalizeGeom( const QgsAbstractGeometry* geom, int max
421421

422422
if ( QgsWkbTypes::geometryType( geom->wkbType() ) == QgsWkbTypes::LineGeometry )
423423
{
424-
return doOrthagonalize( static_cast< QgsLineString* >( geom->clone() ),
424+
return doOrthogonalize( static_cast< QgsLineString* >( geom->clone() ),
425425
maxIterations, tolerance, lowerThreshold, upperThreshold );
426426
}
427427
else
@@ -430,19 +430,19 @@ QgsAbstractGeometry* orthagonalizeGeom( const QgsAbstractGeometry* geom, int max
430430
const QgsPolygonV2* polygon = static_cast< const QgsPolygonV2* >( geom );
431431
QgsPolygonV2* result = new QgsPolygonV2();
432432

433-
result->setExteriorRing( doOrthagonalize( static_cast< QgsLineString* >( polygon->exteriorRing()->clone() ),
433+
result->setExteriorRing( doOrthogonalize( static_cast< QgsLineString* >( polygon->exteriorRing()->clone() ),
434434
maxIterations, tolerance, lowerThreshold, upperThreshold ) );
435435
for ( int i = 0; i < polygon->numInteriorRings(); ++i )
436436
{
437-
result->addInteriorRing( doOrthagonalize( static_cast< QgsLineString* >( polygon->interiorRing( i )->clone() ),
437+
result->addInteriorRing( doOrthogonalize( static_cast< QgsLineString* >( polygon->interiorRing( i )->clone() ),
438438
maxIterations, tolerance, lowerThreshold, upperThreshold ) );
439439
}
440440

441441
return result;
442442
}
443443
}
444444

445-
QgsGeometry QgsInternalGeometryEngine::orthagonalize( double tolerance, int maxIterations, double angleThreshold ) const
445+
QgsGeometry QgsInternalGeometryEngine::orthogonalize( double tolerance, int maxIterations, double angleThreshold ) const
446446
{
447447
if ( !mGeometry || ( QgsWkbTypes::geometryType( mGeometry->wkbType() ) != QgsWkbTypes::LineGeometry
448448
&& QgsWkbTypes::geometryType( mGeometry->wkbType() ) != QgsWkbTypes::PolygonGeometry ) )
@@ -460,7 +460,7 @@ QgsGeometry QgsInternalGeometryEngine::orthagonalize( double tolerance, int maxI
460460
geometryList.reserve( numGeom );
461461
for ( int i = 0; i < numGeom; ++i )
462462
{
463-
geometryList << orthagonalizeGeom( gc->geometryN( i ), maxIterations, tolerance, lowerThreshold, upperThreshold );
463+
geometryList << orthogonalizeGeom( gc->geometryN( i ), maxIterations, tolerance, lowerThreshold, upperThreshold );
464464
}
465465

466466
QgsGeometry first = QgsGeometry( geometryList.takeAt( 0 ) );
@@ -472,6 +472,6 @@ QgsGeometry QgsInternalGeometryEngine::orthagonalize( double tolerance, int maxI
472472
}
473473
else
474474
{
475-
return QgsGeometry( orthagonalizeGeom( mGeometry, maxIterations, tolerance, lowerThreshold, upperThreshold ) );
475+
return QgsGeometry( orthogonalizeGeom( mGeometry, maxIterations, tolerance, lowerThreshold, upperThreshold ) );
476476
}
477477
}

src/core/geometry/qgsinternalgeometryengine.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ class QgsInternalGeometryEngine
6262
QgsGeometry poleOfInaccessibility( double precision, double* distanceFromBoundary = nullptr ) const;
6363

6464
/**
65-
* Attempts to orthagonalize a line or polygon geometry by shifting vertices to make the geometries
65+
* Attempts to orthogonalize a line or polygon geometry by shifting vertices to make the geometries
6666
* angles either right angles or flat lines. This is an iterative algorithm which will loop until
6767
* either the vertices are within a specified tolerance of right angles or a set number of maximum
6868
* iterations is reached. The angle threshold parameter specifies how close to a right angle or
6969
* straight line an angle must be before it is attempted to be straightened.
7070
* @note added in QGIS 3.0
7171
*/
72-
QgsGeometry orthagonalize( double tolerance = 1.0E-8, int maxIterations = 1000, double angleThreshold = 15.0 ) const;
72+
QgsGeometry orthogonalize( double tolerance = 1.0E-8, int maxIterations = 1000, double angleThreshold = 15.0 ) const;
7373

7474
private:
7575
const QgsAbstractGeometry* mGeometry;

tests/src/python/test_qgsgeometry.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3668,49 +3668,49 @@ def testMinimumOrientedBoundingBox(self):
36683668
self.assertAlmostEqual(width, 4.4884, places=3)
36693669
self.assertAlmostEqual(height, 6.4420, places=3)
36703670

3671-
def testOrthagonalize(self):
3671+
def testOrthogonalize(self):
36723672
empty = QgsGeometry()
3673-
o = empty.orthagonalize()
3673+
o = empty.orthogonalize()
36743674
self.assertFalse(o)
36753675

36763676
# not a useful geometry
36773677
point = QgsGeometry.fromWkt('Point(1 2)')
3678-
o = point.orthagonalize()
3678+
o = point.orthogonalize()
36793679
self.assertFalse(o)
36803680

36813681
# polygon
36823682
polygon = QgsGeometry.fromWkt('Polygon((-0.699 0.892, -0.703 0.405, -0.022 0.361, 0.014 0.851, -0.699 0.892))')
3683-
o = polygon.orthagonalize()
3683+
o = polygon.orthogonalize()
36843684
exp = 'Polygon ((-0.69899999999999995 0.89200000000000002, -0.72568713635737736 0.38414056283699533, -0.00900222326098143 0.34648000752227009, 0.01768491457044956 0.85433944198378253, -0.69899999999999995 0.89200000000000002))'
36853685
result = o.exportToWkt()
36863686
self.assertTrue(compareWkt(result, exp, 0.00001),
3687-
"orthagonalize: mismatch Expected:\n{}\nGot:\n{}\n".format(exp, result))
3687+
"orthogonalize: mismatch Expected:\n{}\nGot:\n{}\n".format(exp, result))
36883688

36893689
# polygon with ring
36903690
polygon = QgsGeometry.fromWkt('Polygon ((-0.698 0.892, -0.702 0.405, -0.022 0.360, 0.014 0.850, -0.698 0.892),(-0.619 0.777, -0.619 0.574, -0.515 0.567, -0.517 0.516, -0.411 0.499, -0.379 0.767, -0.619 0.777),(-0.322 0.506, -0.185 0.735, -0.046 0.428, -0.322 0.506))')
3691-
o = polygon.orthagonalize()
3691+
o = polygon.orthogonalize()
36923692
exp = 'Polygon ((-0.69799999999999995 0.89200000000000002, -0.72515703079591087 0.38373993222914216, -0.00901577368860811 0.34547552423418099, 0.01814125858957143 0.85373558928902782, -0.69799999999999995 0.89200000000000002),(-0.61899999999999999 0.77700000000000002, -0.63403125159063511 0.56020458713735533, -0.53071476068518508 0.55304126003523246, -0.5343108192220235 0.5011754225601015, -0.40493624158682306 0.49220537936424585, -0.3863089084840608 0.76086661681561074, -0.61899999999999999 0.77700000000000002),(-0.32200000000000001 0.50600000000000001, -0.185 0.73499999999999999, -0.046 0.42799999999999999, -0.32200000000000001 0.50600000000000001))'
36933693
result = o.exportToWkt()
36943694
self.assertTrue(compareWkt(result, exp, 0.00001),
3695-
"orthagonalize: mismatch Expected:\n{}\nGot:\n{}\n".format(exp, result))
3695+
"orthogonalize: mismatch Expected:\n{}\nGot:\n{}\n".format(exp, result))
36963696

36973697
# multipolygon
36983698

36993699
polygon = QgsGeometry.fromWkt('MultiPolygon(((-0.550 -1.553, -0.182 -0.954, -0.182 -0.954, 0.186 -1.538, -0.550 -1.553)),'
37003700
'((0.506 -1.376, 0.433 -1.081, 0.765 -0.900, 0.923 -1.132, 0.923 -1.391, 0.506 -1.376)))')
3701-
o = polygon.orthagonalize()
3701+
o = polygon.orthogonalize()
37023702
exp = 'MultiPolygon (((-0.55000000000000004 -1.55299999999999994, -0.182 -0.95399999999999996, -0.182 -0.95399999999999996, 0.186 -1.53800000000000003, -0.55000000000000004 -1.55299999999999994)),((0.50600000000000001 -1.37599999999999989, 0.34888970623957499 -1.04704644438350125, 0.78332709454235683 -0.83955640656085295, 0.92300000000000004 -1.1319999999999999, 0.91737248858460974 -1.38514497083566535, 0.50600000000000001 -1.37599999999999989)))'
37033703
result = o.exportToWkt()
37043704
self.assertTrue(compareWkt(result, exp, 0.00001),
3705-
"orthagonalize: mismatch Expected:\n{}\nGot:\n{}\n".format(exp, result))
3705+
"orthogonalize: mismatch Expected:\n{}\nGot:\n{}\n".format(exp, result))
37063706

37073707
#line
37083708
line = QgsGeometry.fromWkt('LineString (-1.07445631048298162 -0.91619958829825165, 0.04022568180912156 -0.95572731852137571, 0.04741254184968957 -0.61794489661467789, 0.68704308546024517 -0.66106605685808595)')
3709-
o = line.orthagonalize()
3709+
o = line.orthogonalize()
37103710
exp = 'LineString (-1.07445631048298162 -0.91619958829825165, 0.04812855116470245 -0.96433184892270418, 0.06228000950284909 -0.63427853851139493, 0.68704308546024517 -0.66106605685808595)'
37113711
result = o.exportToWkt()
37123712
self.assertTrue(compareWkt(result, exp, 0.00001),
3713-
"orthagonalize: mismatch Expected:\n{}\nGot:\n{}\n".format(exp, result))
3713+
"orthogonalize: mismatch Expected:\n{}\nGot:\n{}\n".format(exp, result))
37143714

37153715

37163716
if __name__ == '__main__':

0 commit comments

Comments
 (0)