mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Add QgsRubberBand::setToGeometry with crs parameter
This commit is contained in:
parent
ad7d03c64f
commit
db65b9a8fc
@ -212,7 +212,7 @@ Returns number of vertices in feature part
|
|||||||
|
|
||||||
void setToGeometry( const QgsGeometry &geom, QgsVectorLayer *layer );
|
void setToGeometry( const QgsGeometry &geom, QgsVectorLayer *layer );
|
||||||
%Docstring
|
%Docstring
|
||||||
Sets this rubber band to the geometry of an existing feature.
|
Sets this rubber band to ``geom``.
|
||||||
This is useful for feature highlighting.
|
This is useful for feature highlighting.
|
||||||
In contrast to addGeometry(), this method does also change the geometry type of the rubberband.
|
In contrast to addGeometry(), this method does also change the geometry type of the rubberband.
|
||||||
|
|
||||||
@ -221,6 +221,17 @@ In contrast to addGeometry(), this method does also change the geometry type of
|
|||||||
crs. In case of 0 pointer, the coordinates are not going to be transformed.
|
crs. In case of 0 pointer, the coordinates are not going to be transformed.
|
||||||
%End
|
%End
|
||||||
|
|
||||||
|
void setToGeometry( const QgsGeometry &geometry, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
|
||||||
|
%Docstring
|
||||||
|
Sets this rubber band to ``geometry``.
|
||||||
|
In contrast to addGeometry(), this method does also change the geometry type of the rubberband.
|
||||||
|
The coordinate reference system of the geometry can be specified with ``crs``. If an invalid ``crs``
|
||||||
|
is passed, the geometry will not be reprojected and needs to be in canvas crs already.
|
||||||
|
By default, no reprojection is done.
|
||||||
|
|
||||||
|
.. versionadded:: 3.4
|
||||||
|
%End
|
||||||
|
|
||||||
void setToCanvasRectangle( QRect rect );
|
void setToCanvasRectangle( QRect rect );
|
||||||
%Docstring
|
%Docstring
|
||||||
Sets this rubber band to a map canvas rectangle
|
Sets this rubber band to a map canvas rectangle
|
||||||
|
@ -231,6 +231,18 @@ void QgsRubberBand::setToGeometry( const QgsGeometry &geom, QgsVectorLayer *laye
|
|||||||
addGeometry( geom, layer );
|
addGeometry( geom, layer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsRubberBand::setToGeometry( const QgsGeometry &geom, const QgsCoordinateReferenceSystem &crs )
|
||||||
|
{
|
||||||
|
if ( geom.isNull() )
|
||||||
|
{
|
||||||
|
reset( mGeometryType );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
reset( geom.type() );
|
||||||
|
addGeometry( geom, crs );
|
||||||
|
}
|
||||||
|
|
||||||
void QgsRubberBand::addGeometry( const QgsGeometry &geometry, QgsVectorLayer *layer )
|
void QgsRubberBand::addGeometry( const QgsGeometry &geometry, QgsVectorLayer *layer )
|
||||||
{
|
{
|
||||||
QgsGeometry geom = geometry;
|
QgsGeometry geom = geometry;
|
||||||
|
@ -237,7 +237,7 @@ class GUI_EXPORT QgsRubberBand: public QgsMapCanvasItem
|
|||||||
int partSize( int geometryIndex ) const;
|
int partSize( int geometryIndex ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this rubber band to the geometry of an existing feature.
|
* Sets this rubber band to \a geom.
|
||||||
* This is useful for feature highlighting.
|
* This is useful for feature highlighting.
|
||||||
* In contrast to addGeometry(), this method does also change the geometry type of the rubberband.
|
* In contrast to addGeometry(), this method does also change the geometry type of the rubberband.
|
||||||
* \param geom the geometry object
|
* \param geom the geometry object
|
||||||
@ -246,6 +246,17 @@ class GUI_EXPORT QgsRubberBand: public QgsMapCanvasItem
|
|||||||
*/
|
*/
|
||||||
void setToGeometry( const QgsGeometry &geom, QgsVectorLayer *layer );
|
void setToGeometry( const QgsGeometry &geom, QgsVectorLayer *layer );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets this rubber band to \a geometry.
|
||||||
|
* In contrast to addGeometry(), this method does also change the geometry type of the rubberband.
|
||||||
|
* The coordinate reference system of the geometry can be specified with \a crs. If an invalid \a crs
|
||||||
|
* is passed, the geometry will not be reprojected and needs to be in canvas crs already.
|
||||||
|
* By default, no reprojection is done.
|
||||||
|
*
|
||||||
|
* \since QGIS 3.4
|
||||||
|
*/
|
||||||
|
void setToGeometry( const QgsGeometry &geometry, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this rubber band to a map canvas rectangle
|
* Sets this rubber band to a map canvas rectangle
|
||||||
* \param rect rectangle in canvas coordinates
|
* \param rect rectangle in canvas coordinates
|
||||||
|
Loading…
x
Reference in New Issue
Block a user