Skip to content

Commit

Permalink
fix wkbtype vs type
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik committed Jul 27, 2023
1 parent 481a7c7 commit 3150d9e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions app/guidelinecontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ void GuidelineController::buildGuideline()
* - create polygon between first point, crosshair and last added point (make sure it is not the first one)
*/

Qgis::WkbType geotype = mRealGeometry.wkbType();
Qgis::GeometryType geotype = mRealGeometry.type();

if ( geotype == Qgis::WkbType::Point )
if ( geotype == Qgis::GeometryType::Point )
{
setGuidelineGeometry( QgsGeometry() );
return;
Expand All @@ -98,7 +98,7 @@ void GuidelineController::buildGuideline()
previous = mRealGeometry.constGet()->vertexAt( QgsVertexId( current.part, current.ring, current.vertex - 1 ) );

// fix closed polygons rings
if ( geotype == Qgis::WkbType::Polygon )
if ( geotype == Qgis::GeometryType::Polygon )
{
if ( current.vertex == 0 && nVertices >= 4 )
{
Expand All @@ -124,7 +124,7 @@ void GuidelineController::buildGuideline()
{
// recording new points

if ( geotype == Qgis::WkbType::LineString )
if ( geotype == Qgis::GeometryType::Line )
{
// we are adding new point to the end/beginning
QgsGeometry guideline;
Expand Down Expand Up @@ -161,7 +161,7 @@ void GuidelineController::buildGuideline()

setGuidelineGeometry( guideline );
}
else if ( geotype == Qgis::WkbType::Polygon )
else if ( geotype == Qgis::GeometryType::Polygon )
{
int nVertices = mRealGeometry.constGet()->vertexCount( mActivePart, mActiveRing );
if ( nVertices == 0 )
Expand Down
18 changes: 9 additions & 9 deletions app/maptools/recordingmaptool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void RecordingMapTool::addPoint( const QgsPoint &point )
}
}

if ( mRecordedGeometry.wkbType() == Qgis::WkbType::Polygon )
if ( mRecordedGeometry.type() == Qgis::GeometryType::Polygon )
{
// if it is a polygon and ring is not correctly defined yet (e.g. only
// contains 1 point or not closed) we add point directly to the ring
Expand Down Expand Up @@ -250,7 +250,7 @@ void RecordingMapTool::removePoint()
return;
}

if ( mRecordedGeometry.wkbType() == Qgis::WkbType::Polygon )
if ( mRecordedGeometry.type() == Qgis::GeometryType::Polygon )
{
QgsLineString *r;
QgsPolygon *poly;
Expand Down Expand Up @@ -405,7 +405,7 @@ void RecordingMapTool::removePoint()

int vertexToGrab = nVertices - 1;

if ( mRecordedGeometry.wkbType() == Qgis::WkbType::Polygon )
if ( mRecordedGeometry.type() == Qgis::GeometryType::Polygon )
{
if ( nVertices >= 4 )
{
Expand Down Expand Up @@ -601,7 +601,7 @@ void RecordingMapTool::prepareEditing()
mActiveLayer->startEditing();

// if we are editing point layer we start with the grabbed point
if ( mActiveFeature.geometry().wkbType() == Qgis::WkbType::Point && !mActiveFeature.geometry().isMultipart() )
if ( mActiveFeature.geometry().type() == Qgis::GeometryType::Point && !mActiveFeature.geometry().isMultipart() )
{
Vertex v( QgsVertexId( 0, 0, 0 ), QgsPoint( mActiveFeature.geometry().asPoint() ), Vertex::Existing );
setActiveVertex( v );
Expand Down Expand Up @@ -667,7 +667,7 @@ void RecordingMapTool::collectVertices()
{
int vertexCount = geom->vertexCount( vertexId.part, vertexId.ring );

if ( mRecordedGeometry.wkbType() == Qgis::WkbType::Polygon )
if ( mRecordedGeometry.type() == Qgis::GeometryType::Polygon )
{
if ( vertexCount == 1 )
{
Expand Down Expand Up @@ -698,7 +698,7 @@ void RecordingMapTool::collectVertices()
continue;
}
}
else if ( mRecordedGeometry.wkbType() == Qgis::WkbType::LineString )
else if ( mRecordedGeometry.type() == Qgis::GeometryType::Line )
{
// if this is firt point in line (or part) we add handle start point first
if ( vertexId.vertex == 0 && vertexId.part != startPart && vertexCount >= 2 )
Expand Down Expand Up @@ -801,7 +801,7 @@ void RecordingMapTool::updateVisibleItems()
}

// for polygons show midpoint if previous or next vertex is not active
if ( mRecordedGeometry.wkbType() == Qgis::WkbType::Polygon )
if ( mRecordedGeometry.type() == Qgis::GeometryType::Polygon )
{
if ( i > 0 )
{
Expand Down Expand Up @@ -976,7 +976,7 @@ void RecordingMapTool::releaseVertex( const QgsPoint &point )

int vertexCount = mRecordedGeometry.constGet()->vertexCount( mActiveVertex.vertexId().part, mActiveVertex.vertexId().ring );

if ( mRecordedGeometry.wkbType() == Qgis::WkbType::Polygon )
if ( mRecordedGeometry.type() == Qgis::GeometryType::Polygon )
{
QgsPolygon *polygon;
QgsLineString *ring;
Expand Down Expand Up @@ -1029,7 +1029,7 @@ void RecordingMapTool::releaseVertex( const QgsPoint &point )
updateVertex( mActiveVertex, point );

// if it is a first or last vertex of the line we go to the recording mode
if ( mRecordedGeometry.wkbType() == Qgis::WkbType::LineString )
if ( mRecordedGeometry.type() == Qgis::GeometryType::Line )
{
if ( mActiveVertex.type() == Vertex::Existing && mActiveVertex.vertexId().vertex == 0 )
{
Expand Down

0 comments on commit 3150d9e

Please sign in to comment.