renaming and typo

This commit is contained in:
vcloarec 2020-07-29 21:32:04 -04:00
parent fd81a2edfc
commit e022b3eb5c
10 changed files with 43 additions and 56 deletions

View File

@ -894,7 +894,6 @@ Splits this geometry according to a given curve.
:param topological: ``True`` if topological editing is enabled
\param[out] topologyTestPoints points that need to be tested for topological completeness in the dataset
:param splitFeature: Set to True if you want to split a feature, otherwise set to False to split parts
fix this bug?
:return: OperationResult a result code: success or reason of failure

View File

@ -87,7 +87,7 @@ Sets brush style
%Docstring
Sets vertex marker icon type
%End
void setIsVerticesDrawn( bool isVerticesDrawn );
void setVertexDrawingEnabled( bool isVerticesDrawn );
%Docstring
Sets whether the vertices are drawn
%End

View File

@ -119,7 +119,7 @@ transfers ownership to the caller.
%End
public slots:
void setCircularDigitizingEnable( bool enable );
void setCircularDigitizingEnabled( bool enable );
%Docstring
Enable the digitizing with curve
%End

View File

@ -9926,9 +9926,8 @@ void QgisApp::snappingOptions()
void QgisApp::enableDigitizeWithCurve( bool enable )
{
mMapTools.mAddFeature->setCircularDigitizingEnable( enable );
static_cast<QgsMapToolCapture *>( mMapTools.mSplitFeatures )->setCircularDigitizingEnable( enable );
static_cast<QgsMapToolCapture *>( mMapTools.mReshapeFeatures )->setCircularDigitizingEnable( enable );
mMapTools.mAddFeature->setCircularDigitizingEnabled( enable );
static_cast<QgsMapToolCapture *>( mMapTools.mSplitFeatures )->setCircularDigitizingEnabled( enable );
QgsSettings settings;
settings.setValue( QStringLiteral( "UI/digitizeWithCurve" ), enable ? 1 : 0 );
}
@ -9941,7 +9940,6 @@ void QgisApp::enableDigitizeWithCurveAction( bool enable )
if ( sender && sender != this )
enable &= ( sender == mActionAddFeature && mMapTools.mAddFeature->mode() != QgsMapToolCapture::CapturePoint ) ||
sender == mActionSplitFeatures;
else
enable &= ( mMapCanvas->mapTool() == mMapTools.mAddFeature && mMapTools.mAddFeature->mode() != QgsMapToolCapture::CapturePoint ) ||
mMapCanvas->mapTool() == mMapTools.mSplitFeatures;

View File

@ -920,7 +920,6 @@ class CORE_EXPORT QgsGeometry
* \param topological TRUE if topological editing is enabled
* \param[out] topologyTestPoints points that need to be tested for topological completeness in the dataset
* \param splitFeature Set to True if you want to split a feature, otherwise set to False to split parts
* fix this bug?
* \returns OperationResult a result code: success or reason of failure
* \since QGIS 3.16
*/

View File

@ -160,7 +160,7 @@ void QgsGeometryRubberBand::setBrushStyle( Qt::BrushStyle brushStyle )
mBrush.setStyle( brushStyle );
}
void QgsGeometryRubberBand::setIsVerticesDrawn( bool isVerticesDrawn )
void QgsGeometryRubberBand::setVertexDrawingEnabled( bool isVerticesDrawn )
{
mDrawVertices = isVerticesDrawn;
}

View File

@ -113,7 +113,7 @@ class GUI_EXPORT QgsGeometryRubberBand: public QgsMapCanvasItem
//! Sets vertex marker icon type
void setIconType( IconType iconType ) { mIconType = iconType; }
//! Sets whether the vertices are drawn
void setIsVerticesDrawn( bool isVerticesDrawn );
void setVertexDrawingEnabled( bool isVerticesDrawn );
protected:
void paint( QPainter *painter ) override;

View File

@ -151,21 +151,12 @@ bool QgsMapToolCapture::tracingEnabled()
QgsPointXY QgsMapToolCapture::tracingStartPoint()
{
//There is already a try/catch in the toLayerCoordinate() method if transform fails. Can we remove this try/catch?
try
{
// if we have starting point from previous trace, then preferably use that one
// (useful when tracing with offset)
if ( mTracingStartPoint != QgsPointXY() )
return mTracingStartPoint;
// if we have starting point from previous trace, then preferably use that one
// (useful when tracing with offset)
if ( mTracingStartPoint != QgsPointXY() )
return mTracingStartPoint;
return lastCapturedMapPoint();
}
catch ( QgsCsException & )
{
QgsDebugMsg( QStringLiteral( "transformation to layer coordinate failed" ) );
return QgsPointXY();
}
return lastCapturedMapPoint();
}
@ -305,10 +296,10 @@ bool QgsMapToolCapture::tracingAddVertex( const QgsPointXY &point )
return true;
}
QgsMapToolCaptureRubberband *QgsMapToolCapture::createCurveRubberBand() const
QgsMapToolCaptureRubberBand *QgsMapToolCapture::createCurveRubberBand() const
{
QgsSettings settings;
QgsMapToolCaptureRubberband *rb = new QgsMapToolCaptureRubberband( mCanvas );
QgsMapToolCaptureRubberBand *rb = new QgsMapToolCaptureRubberBand( mCanvas );
QColor color = digitizingStrokeColor();
double alphaScale = settings.value( QStringLiteral( "qgis/digitizing/line_color_alpha_scale" ), 0.75 ).toDouble();
@ -349,7 +340,7 @@ QgsRubberBand *QgsMapToolCapture::takeRubberBand()
return mRubberBand.release();
}
void QgsMapToolCapture::setCircularDigitizingEnable( bool enable )
void QgsMapToolCapture::setCircularDigitizingEnabled( bool enable )
{
mDigitizingType = enable ? QgsWkbTypes::CircularString : QgsWkbTypes::LineString;
if ( mTempRubberBand )
@ -995,13 +986,13 @@ void QgsMapToolCapture::updateExtraSnapLayer()
}
}
QgsMapToolCaptureRubberband::QgsMapToolCaptureRubberband( QgsMapCanvas *mapCanvas, QgsWkbTypes::GeometryType geomType ):
QgsMapToolCaptureRubberBand::QgsMapToolCaptureRubberBand( QgsMapCanvas *mapCanvas, QgsWkbTypes::GeometryType geomType ):
QgsGeometryRubberBand( mapCanvas, geomType )
{
setIsVerticesDrawn( false );
setVertexDrawingEnabled( false );
}
QgsCurve *QgsMapToolCaptureRubberband::curve()
QgsCurve *QgsMapToolCaptureRubberBand::curve()
{
if ( mPoints.empty() )
return nullptr;
@ -1024,13 +1015,13 @@ QgsCurve *QgsMapToolCaptureRubberband::curve()
}
}
bool QgsMapToolCaptureRubberband::curveIsComplete() const
bool QgsMapToolCaptureRubberBand::curveIsComplete() const
{
return ( mStringType == QgsWkbTypes::LineString && mPoints.count() > 1 ) ||
( mStringType == QgsWkbTypes::CircularString && mPoints.count() > 2 );
}
void QgsMapToolCaptureRubberband::reset( QgsWkbTypes::GeometryType geomType, QgsWkbTypes::Type stringType, const QgsPoint &firstPolygonPoint )
void QgsMapToolCaptureRubberBand::reset( QgsWkbTypes::GeometryType geomType, QgsWkbTypes::Type stringType, const QgsPoint &firstPolygonPoint )
{
if ( !( geomType == QgsWkbTypes::LineGeometry || geomType == QgsWkbTypes::PolygonGeometry ) )
return;
@ -1041,13 +1032,13 @@ void QgsMapToolCaptureRubberband::reset( QgsWkbTypes::GeometryType geomType, Qgs
setRubberBandGeometryType( geomType );
}
void QgsMapToolCaptureRubberband::setRubberBandGeometryType( QgsWkbTypes::GeometryType geomType )
void QgsMapToolCaptureRubberBand::setRubberBandGeometryType( QgsWkbTypes::GeometryType geomType )
{
QgsGeometryRubberBand::setGeometryType( geomType );
updateCurve();
}
void QgsMapToolCaptureRubberband::addPoint( const QgsPoint &point, bool doUpdate )
void QgsMapToolCaptureRubberBand::addPoint( const QgsPoint &point, bool doUpdate )
{
if ( mPoints.count() == 0 )
mPoints.append( point );
@ -1058,7 +1049,7 @@ void QgsMapToolCaptureRubberband::addPoint( const QgsPoint &point, bool doUpdate
updateCurve();
}
void QgsMapToolCaptureRubberband::movePoint( const QgsPoint &point )
void QgsMapToolCaptureRubberBand::movePoint( const QgsPoint &point )
{
if ( mPoints.count() > 0 )
mPoints.last() = point ;
@ -1066,7 +1057,7 @@ void QgsMapToolCaptureRubberband::movePoint( const QgsPoint &point )
updateCurve();
}
void QgsMapToolCaptureRubberband::movePoint( int index, const QgsPoint &point )
void QgsMapToolCaptureRubberBand::movePoint( int index, const QgsPoint &point )
{
if ( mPoints.count() > 0 && mPoints.size() > index )
mPoints[index] = point;
@ -1074,17 +1065,17 @@ void QgsMapToolCaptureRubberband::movePoint( int index, const QgsPoint &point )
updateCurve();
}
int QgsMapToolCaptureRubberband::pointsCount()
int QgsMapToolCaptureRubberBand::pointsCount()
{
return mPoints.size();
}
QgsWkbTypes::Type QgsMapToolCaptureRubberband::stringType() const
QgsWkbTypes::Type QgsMapToolCaptureRubberBand::stringType() const
{
return mStringType;
}
void QgsMapToolCaptureRubberband::setStringType( const QgsWkbTypes::Type &type )
void QgsMapToolCaptureRubberBand::setStringType( const QgsWkbTypes::Type &type )
{
if ( ( type != QgsWkbTypes::CircularString && type != QgsWkbTypes::LineString ) || type == mStringType )
return;
@ -1095,11 +1086,11 @@ void QgsMapToolCaptureRubberband::setStringType( const QgsWkbTypes::Type &type )
mPoints.removeAt( 1 );
}
setIsVerticesDrawn( type == QgsWkbTypes::CircularString );
setVertexDrawingEnabled( type == QgsWkbTypes::CircularString );
updateCurve();
}
QgsPoint QgsMapToolCaptureRubberband::lastPoint() const
QgsPoint QgsMapToolCaptureRubberBand::lastPoint() const
{
if ( mPoints.empty() )
return QgsPoint();
@ -1107,7 +1098,7 @@ QgsPoint QgsMapToolCaptureRubberband::lastPoint() const
return mPoints.last();
}
QgsPoint QgsMapToolCaptureRubberband::pointFromEnd( int posFromEnd ) const
QgsPoint QgsMapToolCaptureRubberBand::pointFromEnd( int posFromEnd ) const
{
if ( posFromEnd < mPoints.size() )
return mPoints.at( mPoints.size() - 1 - posFromEnd );
@ -1115,7 +1106,7 @@ QgsPoint QgsMapToolCaptureRubberband::pointFromEnd( int posFromEnd ) const
return QgsPoint();
}
void QgsMapToolCaptureRubberband::removeLastPoint()
void QgsMapToolCaptureRubberBand::removeLastPoint()
{
if ( mPoints.count() > 1 )
mPoints.removeLast();
@ -1123,12 +1114,12 @@ void QgsMapToolCaptureRubberband::removeLastPoint()
updateCurve();
}
void QgsMapToolCaptureRubberband::setGeometry( QgsAbstractGeometry *geom )
void QgsMapToolCaptureRubberBand::setGeometry( QgsAbstractGeometry *geom )
{
QgsGeometryRubberBand::setGeometry( geom );
}
void QgsMapToolCaptureRubberband::updateCurve()
void QgsMapToolCaptureRubberBand::updateCurve()
{
std::unique_ptr<QgsCurve> curve;
switch ( mStringType )
@ -1156,7 +1147,7 @@ void QgsMapToolCaptureRubberband::updateCurve()
}
}
QgsCurve *QgsMapToolCaptureRubberband::createLinearString()
QgsCurve *QgsMapToolCaptureRubberBand::createLinearString()
{
std::unique_ptr<QgsLineString> curve( new QgsLineString );
if ( geometryType() == QgsWkbTypes::PolygonGeometry )
@ -1171,7 +1162,7 @@ QgsCurve *QgsMapToolCaptureRubberband::createLinearString()
return curve.release();
}
QgsCurve *QgsMapToolCaptureRubberband::createCircularString()
QgsCurve *QgsMapToolCaptureRubberBand::createCircularString()
{
std::unique_ptr<QgsCircularString> curve( new QgsCircularString );
curve->setPoints( mPoints );

View File

@ -34,7 +34,7 @@ class QgsSnapIndicator;
class QgsVertexMarker;
class QgsMapLayer;
class QgsGeometryValidator;
class QgsMapToolCaptureRubberband;
class QgsMapToolCaptureRubberBand;
#ifndef SIP_RUN
@ -42,15 +42,15 @@ class QgsMapToolCaptureRubberband;
///@cond PRIVATE
/**
* Class that reprensents a rubber can that can be linear or circular.
* Class that reprensents a rubber band that can be linear or circular.
*
* \since QGIS 3.16
*/
class QgsMapToolCaptureRubberband: public QgsGeometryRubberBand
class QgsMapToolCaptureRubberBand: public QgsGeometryRubberBand
{
public:
//! Constructor
QgsMapToolCaptureRubberband( QgsMapCanvas *mapCanvas, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::LineGeometry );
QgsMapToolCaptureRubberBand( QgsMapCanvas *mapCanvas, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::LineGeometry );
//! Returns the curve defined by the rubber band, the caller has to take the ownership, nullptr if no curve is defined.
QgsCurve *curve();
@ -213,7 +213,7 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
public slots:
//! Enable the digitizing with curve
void setCircularDigitizingEnable( bool enable );
void setCircularDigitizingEnabled( bool enable );
private slots:
void addError( const QgsGeometry::Error &error );
@ -378,7 +378,7 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
bool tracingAddVertex( const QgsPointXY &point );
//! create a curve rubber band
QgsMapToolCaptureRubberband *createCurveRubberBand() const;
QgsMapToolCaptureRubberBand *createCurveRubberBand() const;
//! Returns extemity point of the captured curve in map coordinates
QgsPoint firstCapturedMapPoint();
@ -398,7 +398,7 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
QObjectUniquePtr<QgsRubberBand> mRubberBand;
//! Temporary rubber band for polylines and polygons. this connects the last added point to the mouse cursor position
std::unique_ptr<QgsMapToolCaptureRubberband> mTempRubberBand;
std::unique_ptr<QgsMapToolCaptureRubberBand> mTempRubberBand;
//! List to store the points of digitized lines and polygons (in layer coordinates)
QgsCompoundCurve mCaptureCurve;

View File

@ -283,7 +283,7 @@ void TestQgsMapToolAddFeatureLine::testNoTracing()
mLayerLine->undoStack()->undo();
QCOMPARE( mLayerLine->undoStack()->index(), 1 );
mCaptureTool->setCircularDigitizingEnable( true );
mCaptureTool->setCircularDigitizingEnabled( true );
utils.mouseClick( 1, 1, Qt::LeftButton );
utils.mouseClick( 3, 2, Qt::LeftButton );
@ -305,7 +305,7 @@ void TestQgsMapToolAddFeatureLine::testNoTracing()
mLayerLine->undoStack()->undo();
QCOMPARE( mLayerLine->undoStack()->index(), 1 );
mCaptureTool->setCircularDigitizingEnable( false );
mCaptureTool->setCircularDigitizingEnabled( false );
}
void TestQgsMapToolAddFeatureLine::testTracing()