mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
rename QgsPointSequence QgsMapToolCapture::points() const; to QgsPointSequence QgsMapToolCapture::pointsZM() const;
This commit is contained in:
parent
c1421455b8
commit
31e416c4a9
@ -213,13 +213,32 @@ Number of points digitized
|
|||||||
:return: Number of points
|
:return: Number of points
|
||||||
%End
|
%End
|
||||||
|
|
||||||
QgsPointSequence points() const;
|
QVector<QgsPointXY> points() const /Deprecated/;
|
||||||
%Docstring
|
%Docstring
|
||||||
List of digitized points
|
List of digitized points
|
||||||
|
|
||||||
:return: List of points
|
:return: List of points
|
||||||
|
|
||||||
.. versionadded:: 3.10
|
.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0
|
||||||
|
%End
|
||||||
|
|
||||||
|
|
||||||
|
QgsPointSequence pointsZM() const;
|
||||||
|
%Docstring
|
||||||
|
List of digitized points
|
||||||
|
|
||||||
|
:return: List of points
|
||||||
|
|
||||||
|
.. versionadded:: 3.12
|
||||||
|
%End
|
||||||
|
|
||||||
|
void setPoints( const QVector<QgsPointXY> &pointList ) /Deprecated/;
|
||||||
|
%Docstring
|
||||||
|
Set the points on which to work
|
||||||
|
|
||||||
|
:param pointList: A list of points
|
||||||
|
|
||||||
|
.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0
|
||||||
%End
|
%End
|
||||||
|
|
||||||
void setPoints( const QgsPointSequence &pointList );
|
void setPoints( const QgsPointSequence &pointList );
|
||||||
@ -227,6 +246,8 @@ List of digitized points
|
|||||||
Set the points on which to work
|
Set the points on which to work
|
||||||
|
|
||||||
:param pointList: A list of points
|
:param pointList: A list of points
|
||||||
|
|
||||||
|
.. versionadded:: 3.12
|
||||||
%End
|
%End
|
||||||
|
|
||||||
void closePolygon();
|
void closePolygon();
|
||||||
|
@ -198,7 +198,7 @@ void QgsMapToolAddPart::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
|
|||||||
bool topologicalEditing = QgsProject::instance()->topologicalEditing();
|
bool topologicalEditing = QgsProject::instance()->topologicalEditing();
|
||||||
if ( topologicalEditing )
|
if ( topologicalEditing )
|
||||||
{
|
{
|
||||||
addTopologicalPoints( points() );
|
addTopologicalPoints( pointsZM() );
|
||||||
}
|
}
|
||||||
|
|
||||||
vlayer->endEditCommand();
|
vlayer->endEditCommand();
|
||||||
|
@ -89,7 +89,7 @@ void QgsMapToolFillRing::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
|
|||||||
|
|
||||||
vlayer->beginEditCommand( tr( "Ring added and filled" ) );
|
vlayer->beginEditCommand( tr( "Ring added and filled" ) );
|
||||||
|
|
||||||
QgsPointSequence pointList = points();
|
QgsPointSequence pointList = pointsZM();
|
||||||
|
|
||||||
QgsGeometry::OperationResult addRingReturnCode = vlayer->addRing( pointList, &fid );
|
QgsGeometry::OperationResult addRingReturnCode = vlayer->addRing( pointList, &fid );
|
||||||
|
|
||||||
|
@ -88,8 +88,8 @@ bool QgsMapToolReshape::isBindingLine( QgsVectorLayer *vlayer, const QgsRectangl
|
|||||||
|
|
||||||
bool begin = false;
|
bool begin = false;
|
||||||
bool end = false;
|
bool end = false;
|
||||||
const QgsPointXY beginPoint = points().first();
|
const QgsPointXY beginPoint = pointsZM().first();
|
||||||
const QgsPointXY endPoint = points().last();
|
const QgsPointXY endPoint = pointsZM().last();
|
||||||
|
|
||||||
QgsFeatureIterator fit = vlayer->getFeatures( QgsFeatureRequest().setFilterRect( bbox ).setNoAttributes() );
|
QgsFeatureIterator fit = vlayer->getFeatures( QgsFeatureRequest().setFilterRect( bbox ).setNoAttributes() );
|
||||||
QgsFeature f;
|
QgsFeature f;
|
||||||
@ -114,11 +114,11 @@ bool QgsMapToolReshape::isBindingLine( QgsVectorLayer *vlayer, const QgsRectangl
|
|||||||
|
|
||||||
void QgsMapToolReshape::reshape( QgsVectorLayer *vlayer )
|
void QgsMapToolReshape::reshape( QgsVectorLayer *vlayer )
|
||||||
{
|
{
|
||||||
QgsPointXY firstPoint = points().at( 0 );
|
QgsPointXY firstPoint = pointsZM().at( 0 );
|
||||||
QgsRectangle bbox( firstPoint.x(), firstPoint.y(), firstPoint.x(), firstPoint.y() );
|
QgsRectangle bbox( firstPoint.x(), firstPoint.y(), firstPoint.x(), firstPoint.y() );
|
||||||
for ( int i = 1; i < size(); ++i )
|
for ( int i = 1; i < size(); ++i )
|
||||||
{
|
{
|
||||||
bbox.combineExtentWith( points().at( i ).x(), points().at( i ).y() );
|
bbox.combineExtentWith( pointsZM().at( i ).x(), pointsZM().at( i ).y() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ void QgsMapToolSplitFeatures::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
|
|||||||
if ( e->button() == Qt::LeftButton )
|
if ( e->button() == Qt::LeftButton )
|
||||||
{
|
{
|
||||||
//If we snap the first point on a vertex of a line layer, we directly split the feature at this point
|
//If we snap the first point on a vertex of a line layer, we directly split the feature at this point
|
||||||
if ( vlayer->geometryType() == QgsWkbTypes::LineGeometry && points().isEmpty() )
|
if ( vlayer->geometryType() == QgsWkbTypes::LineGeometry && pointsZM().isEmpty() )
|
||||||
{
|
{
|
||||||
QgsPointLocator::Match m = mCanvas->snappingUtils()->snapToCurrentLayer( e->pos(), QgsPointLocator::Vertex );
|
QgsPointLocator::Match m = mCanvas->snappingUtils()->snapToCurrentLayer( e->pos(), QgsPointLocator::Vertex );
|
||||||
if ( m.isValid() )
|
if ( m.isValid() )
|
||||||
@ -94,7 +94,7 @@ void QgsMapToolSplitFeatures::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
|
|||||||
//bring up dialog if a split was not possible (polygon) or only done once (line)
|
//bring up dialog if a split was not possible (polygon) or only done once (line)
|
||||||
int topologicalEditing = QgsProject::instance()->topologicalEditing();
|
int topologicalEditing = QgsProject::instance()->topologicalEditing();
|
||||||
vlayer->beginEditCommand( tr( "Features split" ) );
|
vlayer->beginEditCommand( tr( "Features split" ) );
|
||||||
QgsGeometry::OperationResult returnCode = vlayer->splitFeatures( points(), topologicalEditing );
|
QgsGeometry::OperationResult returnCode = vlayer->splitFeatures( pointsZM(), topologicalEditing );
|
||||||
vlayer->endEditCommand();
|
vlayer->endEditCommand();
|
||||||
if ( returnCode == QgsGeometry::OperationResult::NothingHappened )
|
if ( returnCode == QgsGeometry::OperationResult::NothingHappened )
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@ void QgsMapToolSplitParts::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
|
|||||||
if ( e->button() == Qt::LeftButton )
|
if ( e->button() == Qt::LeftButton )
|
||||||
{
|
{
|
||||||
//If we snap the first point on a vertex of a line layer, we directly split the feature at this point
|
//If we snap the first point on a vertex of a line layer, we directly split the feature at this point
|
||||||
if ( vlayer->geometryType() == QgsWkbTypes::LineGeometry && points().isEmpty() )
|
if ( vlayer->geometryType() == QgsWkbTypes::LineGeometry && pointsZM().isEmpty() )
|
||||||
{
|
{
|
||||||
QgsPointLocator::Match m = mCanvas->snappingUtils()->snapToCurrentLayer( e->pos(), QgsPointLocator::Vertex );
|
QgsPointLocator::Match m = mCanvas->snappingUtils()->snapToCurrentLayer( e->pos(), QgsPointLocator::Vertex );
|
||||||
if ( m.isValid() )
|
if ( m.isValid() )
|
||||||
@ -92,7 +92,7 @@ void QgsMapToolSplitParts::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
|
|||||||
//bring up dialog if a split was not possible (polygon) or only done once (line)
|
//bring up dialog if a split was not possible (polygon) or only done once (line)
|
||||||
bool topologicalEditing = QgsProject::instance()->topologicalEditing();
|
bool topologicalEditing = QgsProject::instance()->topologicalEditing();
|
||||||
vlayer->beginEditCommand( tr( "Parts split" ) );
|
vlayer->beginEditCommand( tr( "Parts split" ) );
|
||||||
QgsGeometry::OperationResult returnCode = vlayer->splitParts( points(), topologicalEditing );
|
QgsGeometry::OperationResult returnCode = vlayer->splitParts( pointsZM(), topologicalEditing );
|
||||||
vlayer->endEditCommand();
|
vlayer->endEditCommand();
|
||||||
if ( returnCode == QgsGeometry::OperationResult::NothingHappened )
|
if ( returnCode == QgsGeometry::OperationResult::NothingHappened )
|
||||||
{
|
{
|
||||||
|
@ -738,13 +738,31 @@ int QgsMapToolCapture::size()
|
|||||||
return mCaptureCurve.numPoints();
|
return mCaptureCurve.numPoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsPointSequence QgsMapToolCapture::points() const
|
QVector<QgsPointXY> QgsMapToolCapture::points() const
|
||||||
|
{
|
||||||
|
QVector<QgsPointXY> pointsXY;
|
||||||
|
QgsGeometry::convertPointList( pointsZM(), pointsXY );
|
||||||
|
|
||||||
|
return pointsXY;
|
||||||
|
}
|
||||||
|
|
||||||
|
QgsPointSequence QgsMapToolCapture::pointsZM() const
|
||||||
{
|
{
|
||||||
QgsPointSequence pts;
|
QgsPointSequence pts;
|
||||||
mCaptureCurve.points( pts );
|
mCaptureCurve.points( pts );
|
||||||
return pts;
|
return pts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsMapToolCapture::setPoints( const QVector<QgsPointXY> &pointList )
|
||||||
|
{
|
||||||
|
QgsLineString *line = new QgsLineString( pointList );
|
||||||
|
mCaptureCurve.clear();
|
||||||
|
mCaptureCurve.addCurve( line );
|
||||||
|
mSnappingMatches.clear();
|
||||||
|
for ( int i = 0; i < line->length(); ++i )
|
||||||
|
mSnappingMatches.append( QgsPointLocator::Match() );
|
||||||
|
}
|
||||||
|
|
||||||
void QgsMapToolCapture::setPoints( const QgsPointSequence &pointList )
|
void QgsMapToolCapture::setPoints( const QgsPointSequence &pointList )
|
||||||
{
|
{
|
||||||
QgsLineString *line = new QgsLineString( pointList );
|
QgsLineString *line = new QgsLineString( pointList );
|
||||||
|
@ -224,14 +224,32 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
|
|||||||
/**
|
/**
|
||||||
* List of digitized points
|
* List of digitized points
|
||||||
* \returns List of points
|
* \returns List of points
|
||||||
* \since 3.10
|
* \deprecated in QGIS 3.12 - will be removed in QGIS 4.0
|
||||||
*/
|
*/
|
||||||
QgsPointSequence points() const;
|
Q_DECL_DEPRECATED QVector<QgsPointXY> points() const SIP_DEPRECATED;
|
||||||
|
|
||||||
|
// TODO QGIS 4.0 rename it to points()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of digitized points
|
||||||
|
* \returns List of points
|
||||||
|
* \since 3.12
|
||||||
|
*/
|
||||||
|
QgsPointSequence pointsZM() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the points on which to work
|
* Set the points on which to work
|
||||||
*
|
*
|
||||||
* \param pointList A list of points
|
* \param pointList A list of points
|
||||||
|
* \deprecated in QGIS 3.12 - will be removed in QGIS 4.0
|
||||||
|
*/
|
||||||
|
Q_DECL_DEPRECATED void setPoints( const QVector<QgsPointXY> &pointList ) SIP_DEPRECATED;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the points on which to work
|
||||||
|
*
|
||||||
|
* \param pointList A list of points
|
||||||
|
* \since 3.12
|
||||||
*/
|
*/
|
||||||
void setPoints( const QgsPointSequence &pointList );
|
void setPoints( const QgsPointSequence &pointList );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user