Skip to content

Class QfRubberbandModel

ClassList > QfRubberbandModel

More...

  • #include <qfrubberbandmodel.h>

Inherits the following classes: QObject

Public Properties

Type Name
property QgsCoordinateReferenceSystem crs
Coordinate reference system.
property QgsPoint currentCoordinate
Current vertex point.
property int currentCoordinateIndex
Current vertex index.
property QDateTime currentPositionTimestamp
currentPositionTimestamp is used externally by tracking, not (yet) stored in the coordinates (m) by the rubberbandmodel itself
property QgsPoint firstCoordinate
First vertex point.
property bool frozen
Freeze the rubberband so it doesn't get modified while panning map.
property Qgis::GeometryType geometryType
QfGeometry type of the model.
property QgsPoint lastCoordinate
Last vertex point.
property double measureValue
measureValue defines the M value of the coordinates
property QgsPoint penultimateCoordinate
Penultimate (last but one) vertex point.
property QgsVectorLayer * vectorLayer
The vector layer the model is for.
property int vertexCount
Total count of vertices.
property QVector< QgsPoint > vertices
All vertex points.

Public Signals

Type Name
signal void crsChanged
signal void currentCoordinateChanged
signal void currentCoordinateIndexChanged
signal void currentPositionTimestampChanged
signal void frozenChanged
Freeze the rubberband so it doesn't get modified while panning map.
signal void geometryTypeChanged
signal void measureValueChanged
signal void vectorLayerChanged
signal void vertexChanged (int index)
signal void vertexCountChanged
signal void verticesInserted (int index, int count)
signal void verticesRemoved (int index, int count)

Public Functions

Type Name
QfRubberbandModel (QObject * parent=nullptr)
Q_INVOKABLE void addVertex ()
Add vertex from the current position.
Q_INVOKABLE void addVertexFromPoint (const QgsPoint & point)
Add vertex with a given point.
QgsCoordinateReferenceSystem crs () const
Coordinate reference system.
QgsPoint currentCoordinate () const
Current vertex point.
int currentCoordinateIndex () const
Current vertex index.
QgsPoint currentPoint (const QgsCoordinateReferenceSystem & crs=QgsCoordinateReferenceSystem(), Qgis::WkbType wkbType=Qgis::WkbType::PointZ) const
Returns the current vertex point transformed to the given crs .
QDateTime currentPositionTimestamp () const
currentPositionTimestamp is used externally by tracking, not (yet) stored in the coordinates (m) by the rubberbandmodel itself
QgsPoint firstCoordinate () const
First vertex point.
QVector< QgsPointXY > flatPointSequence (const QgsCoordinateReferenceSystem & crs=QgsCoordinateReferenceSystem()) const
Returns all vertices points keeping only X and Y coordinates and transformed to the given crs .
bool frozen () const
Freeze the rubberband so it doesn't get modified while panning map.
Qgis::GeometryType geometryType () const
QfGeometry type of the model.
void insertVertices (int index, int count)
Inserts vertices.
bool isEmpty () const
Returns whether there is at least one vertex in the model.
QgsPoint lastCoordinate () const
Last vertex point.
double measureValue () const
measureValue defines the M value of the coordinates
QgsPoint penultimateCoordinate () const
Penultimate (last but one) vertex point.
Q_INVOKABLE QgsPointSequence pointSequence (const QgsCoordinateReferenceSystem & crs=QgsCoordinateReferenceSystem(), Qgis::WkbType wkbType=Qgis::WkbType::Point, bool closeLine=false) const
Q_INVOKABLE void removeVertex ()
Remove the vertex at the current index.
void removeVertices (int index, int count, bool keepLast=true)
Remove count vertices starting at__index .
Q_INVOKABLE void reset (bool keepLast=true)
Reset the model, remove all vertices and restart the vertex index.
void setCrs (const QgsCoordinateReferenceSystem & crs)
Coordinate reference system.
void setCurrentCoordinate (const QgsPoint & currentCoordinate)
Current vertex point.
void setCurrentCoordinateIndex (int currentCoordinateIndex)
Current vertex index.
void setCurrentPositionTimestamp (const QDateTime & currentPositionTimestamp)
currentPositionTimestamp is used externally by tracking, not (yet) stored in the coordinates (m) by the rubberbandmodel itself
void setDataFromGeometry (QgsGeometry geometry, const QgsCoordinateReferenceSystem & crs=QgsCoordinateReferenceSystem())
void setFrozen (const bool & frozen)
Freeze the rubberband so it doesn't get modified while panning map.
void setGeometryType (const Qgis::GeometryType & geometryType)
QfGeometry type of the model.
void setMeasureValue (const double measureValue)
measureValue defines the M value of the coordinates
void setVectorLayer (QgsVectorLayer * vectorLayer)
The vector layer the model is for.
void setVertex (int index, QgsPoint coordinate)
Sets a vertex point at given index.
Q_INVOKABLE void smoothSegment (qsizetype firstVertex, qsizetype lastVertex, double simplificationTolerance=0.0)
QgsVectorLayer * vectorLayer () const
The vector layer the model is for.
QgsPoint vertexAt (int index, const QgsCoordinateReferenceSystem & crs=QgsCoordinateReferenceSystem()) const
Returns the vertex point at a given index transformed to the given__crs .
int vertexCount () const
Total count of vertices.
QVector< QgsPoint > vertices () const
All vertex points.
QVector< QgsPoint > verticesCopy (bool skipCurrentPoint=false) const
Returns a copy of all vertice points in the model, with the option to skip the current vertex.

Detailed Description

This model manages a list of vertices. It can be used as a linestring or as a ring in a polygon.

Public Properties Documentation

property crs [1/2]

Coordinate reference system.

QgsCoordinateReferenceSystem QfRubberbandModel::crs;


property currentCoordinate [1/2]

Current vertex point.

QgsPoint QfRubberbandModel::currentCoordinate;


property currentCoordinateIndex [1/2]

Current vertex index.

int QfRubberbandModel::currentCoordinateIndex;


property currentPositionTimestamp [1/2]

currentPositionTimestamp is used externally by tracking, not (yet) stored in the coordinates (m) by the rubberbandmodel itself

QDateTime QfRubberbandModel::currentPositionTimestamp;


property firstCoordinate [1/2]

First vertex point.

QgsPoint QfRubberbandModel::firstCoordinate;


property frozen [1/2]

Freeze the rubberband so it doesn't get modified while panning map.

bool QfRubberbandModel::frozen;


property geometryType [1/2]

QfGeometry type of the model.

Qgis::GeometryType QfRubberbandModel::geometryType;


property lastCoordinate [1/2]

Last vertex point.

QgsPoint QfRubberbandModel::lastCoordinate;


property measureValue [1/2]

measureValue defines the M value of the coordinates

double QfRubberbandModel::measureValue;


property penultimateCoordinate [1/2]

Penultimate (last but one) vertex point.

QgsPoint QfRubberbandModel::penultimateCoordinate;


property vectorLayer [1/2]

The vector layer the model is for.

QgsVectorLayer * QfRubberbandModel::vectorLayer;


property vertexCount [1/2]

Total count of vertices.

int QfRubberbandModel::vertexCount;


property vertices [1/2]

All vertex points.

QVector<QgsPoint> QfRubberbandModel::vertices;


Public Signals Documentation

signal crsChanged

void QfRubberbandModel::crsChanged;

signal currentCoordinateChanged

void QfRubberbandModel::currentCoordinateChanged;

signal currentCoordinateIndexChanged

void QfRubberbandModel::currentCoordinateIndexChanged;

signal currentPositionTimestampChanged

void QfRubberbandModel::currentPositionTimestampChanged;

signal frozenChanged

Freeze the rubberband so it doesn't get modified while panning map.

void QfRubberbandModel::frozenChanged;


signal geometryTypeChanged

void QfRubberbandModel::geometryTypeChanged;

signal measureValueChanged

void QfRubberbandModel::measureValueChanged;

signal vectorLayerChanged

void QfRubberbandModel::vectorLayerChanged;

signal vertexChanged

void QfRubberbandModel::vertexChanged;

signal vertexCountChanged

void QfRubberbandModel::vertexCountChanged;

signal verticesInserted

void QfRubberbandModel::verticesInserted;

signal verticesRemoved

void QfRubberbandModel::verticesRemoved;

Public Functions Documentation

function QfRubberbandModel

explicit QfRubberbandModel::QfRubberbandModel (
    QObject * parent=nullptr
) 

function addVertex

Add vertex from the current position.

Q_INVOKABLE void QfRubberbandModel::addVertex () 


function addVertexFromPoint

Add vertex with a given point.

Q_INVOKABLE void QfRubberbandModel::addVertexFromPoint (
    const QgsPoint & point
) 


function crs [2/2]

Coordinate reference system.

QgsCoordinateReferenceSystem QfRubberbandModel::crs () const


function currentCoordinate [2/2]

Current vertex point.

QgsPoint QfRubberbandModel::currentCoordinate () const


function currentCoordinateIndex [2/2]

Current vertex index.

int QfRubberbandModel::currentCoordinateIndex () const


function currentPoint

Returns the current vertex point transformed to the given crs .

QgsPoint QfRubberbandModel::currentPoint (
    const QgsCoordinateReferenceSystem & crs=QgsCoordinateReferenceSystem(),
    Qgis::WkbType wkbType=Qgis::WkbType::PointZ
) const


function currentPositionTimestamp [2/2]

currentPositionTimestamp is used externally by tracking, not (yet) stored in the coordinates (m) by the rubberbandmodel itself

QDateTime QfRubberbandModel::currentPositionTimestamp () const


function firstCoordinate [2/2]

First vertex point.

QgsPoint QfRubberbandModel::firstCoordinate () const


function flatPointSequence

Returns all vertices points keeping only X and Y coordinates and transformed to the given crs .

QVector< QgsPointXY > QfRubberbandModel::flatPointSequence (
    const QgsCoordinateReferenceSystem & crs=QgsCoordinateReferenceSystem()
) const


function frozen [2/2]

Freeze the rubberband so it doesn't get modified while panning map.

bool QfRubberbandModel::frozen () const


function geometryType [2/2]

QfGeometry type of the model.

Qgis::GeometryType QfRubberbandModel::geometryType () const


function insertVertices

Inserts vertices.

void QfRubberbandModel::insertVertices (
    int index,
    int count
) 


function isEmpty

Returns whether there is at least one vertex in the model.

bool QfRubberbandModel::isEmpty () const


function lastCoordinate [2/2]

Last vertex point.

QgsPoint QfRubberbandModel::lastCoordinate () const


function measureValue [2/2]

measureValue defines the M value of the coordinates

double QfRubberbandModel::measureValue () const


function penultimateCoordinate [2/2]

Penultimate (last but one) vertex point.

QgsPoint QfRubberbandModel::penultimateCoordinate () const


function pointSequence

Q_INVOKABLE QgsPointSequence QfRubberbandModel::pointSequence (
    const QgsCoordinateReferenceSystem & crs=QgsCoordinateReferenceSystem(),
    Qgis::WkbType wkbType=Qgis::WkbType::Point,
    bool closeLine=false
) const

The target CRS into which points should be reprojected. To retrieve unprojected points pass an invalid QgsCoordinateReferenceSystem object.

By default coordinates will be returned unprojected.


function removeVertex

Remove the vertex at the current index.

Q_INVOKABLE void QfRubberbandModel::removeVertex () 


function removeVertices

Remove count vertices starting at__index .

void QfRubberbandModel::removeVertices (
    int index,
    int count,
    bool keepLast=true
) 


function reset

Reset the model, remove all vertices and restart the vertex index.

Q_INVOKABLE void QfRubberbandModel::reset (
    bool keepLast=true
) 


function setCrs

Coordinate reference system.

void QfRubberbandModel::setCrs (
    const QgsCoordinateReferenceSystem & crs
) 


function setCurrentCoordinate

Current vertex point.

void QfRubberbandModel::setCurrentCoordinate (
    const QgsPoint & currentCoordinate
) 


function setCurrentCoordinateIndex

Current vertex index.

void QfRubberbandModel::setCurrentCoordinateIndex (
    int currentCoordinateIndex
) 


function setCurrentPositionTimestamp

currentPositionTimestamp is used externally by tracking, not (yet) stored in the coordinates (m) by the rubberbandmodel itself

void QfRubberbandModel::setCurrentPositionTimestamp (
    const QDateTime & currentPositionTimestamp
) 


function setDataFromGeometry

void QfRubberbandModel::setDataFromGeometry (
    QgsGeometry geometry,
    const QgsCoordinateReferenceSystem & crs=QgsCoordinateReferenceSystem()
) 

Sets the model data to match a given geometry

Note:

rings and multiparts are discarded


function setFrozen

Freeze the rubberband so it doesn't get modified while panning map.

void QfRubberbandModel::setFrozen (
    const bool & frozen
) 


function setGeometryType

QfGeometry type of the model.

void QfRubberbandModel::setGeometryType (
    const Qgis::GeometryType & geometryType
) 


function setMeasureValue

measureValue defines the M value of the coordinates

void QfRubberbandModel::setMeasureValue (
    const double measureValue
) 


function setVectorLayer

The vector layer the model is for.

void QfRubberbandModel::setVectorLayer (
    QgsVectorLayer * vectorLayer
) 


function setVertex

Sets a vertex point at given index.

void QfRubberbandModel::setVertex (
    int index,
    QgsPoint coordinate
) 


function smoothSegment

Q_INVOKABLE void QfRubberbandModel::smoothSegment (
    qsizetype firstVertex,
    qsizetype lastVertex,
    double simplificationTolerance=0.0
) 

Smooths the sub-line formed by the vertices between firstVertex and lastVertex.


function vectorLayer [2/2]

The vector layer the model is for.

QgsVectorLayer * QfRubberbandModel::vectorLayer () const


function vertexAt

Returns the vertex point at a given index transformed to the given__crs .

QgsPoint QfRubberbandModel::vertexAt (
    int index,
    const QgsCoordinateReferenceSystem & crs=QgsCoordinateReferenceSystem()
) const


function vertexCount [2/2]

Total count of vertices.

int QfRubberbandModel::vertexCount () const


function vertices [2/2]

All vertex points.

QVector< QgsPoint > QfRubberbandModel::vertices () const


function verticesCopy

Returns a copy of all vertice points in the model, with the option to skip the current vertex.

QVector< QgsPoint > QfRubberbandModel::verticesCopy (
    bool skipCurrentPoint=false
) const



The documentation for this class was generated from the following file src/core/qfrubberbandmodel.h