mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-07 00:03:52 -05:00
Disable clipping planes when outside current extent
This commit is contained in:
parent
a19271cf39
commit
705a2cade7
@ -212,6 +212,12 @@ Disables OpenGL clipping.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
QList<QVector4D> clipPlaneEquations() const;
|
||||||
|
%Docstring
|
||||||
|
Returns list of clipping planes if clipping is enabled, otherwise an empty list.
|
||||||
|
|
||||||
|
.. versionadded:: 3.44
|
||||||
|
%End
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void terrainEntityChanged();
|
void terrainEntityChanged();
|
||||||
|
|||||||
@ -212,6 +212,12 @@ Disables OpenGL clipping.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
QList<QVector4D> clipPlaneEquations() const;
|
||||||
|
%Docstring
|
||||||
|
Returns list of clipping planes if clipping is enabled, otherwise an empty list.
|
||||||
|
|
||||||
|
.. versionadded:: 3.44
|
||||||
|
%End
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void terrainEntityChanged();
|
void terrainEntityChanged();
|
||||||
|
|||||||
@ -297,6 +297,13 @@ class _3D_EXPORT Qgs3DMapScene : public QObject
|
|||||||
*/
|
*/
|
||||||
void removeSceneEntity( Qgs3DMapSceneEntity *entity ) SIP_SKIP;
|
void removeSceneEntity( Qgs3DMapSceneEntity *entity ) SIP_SKIP;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns list of clipping planes if clipping is enabled, otherwise an empty list.
|
||||||
|
*
|
||||||
|
* \since QGIS 3.44
|
||||||
|
*/
|
||||||
|
QList<QVector4D> clipPlaneEquations() const { return mClipPlanesEquations; };
|
||||||
|
|
||||||
#ifndef SIP_RUN
|
#ifndef SIP_RUN
|
||||||
//! Static function for returning open 3D map scenes
|
//! Static function for returning open 3D map scenes
|
||||||
static std::function<QMap<QString, Qgs3DMapScene *>()> sOpenScenesFunction;
|
static std::function<QMap<QString, Qgs3DMapScene *>()> sOpenScenesFunction;
|
||||||
|
|||||||
@ -1180,6 +1180,15 @@ void Qgs3DMapCanvasWidget::setSceneExtent( const QgsRectangle &extent )
|
|||||||
if ( !extent.isEmpty() )
|
if ( !extent.isEmpty() )
|
||||||
mCanvas->mapSettings()->setExtent( extent );
|
mCanvas->mapSettings()->setExtent( extent );
|
||||||
|
|
||||||
|
if ( !mapCanvas3D()->scene()->clipPlaneEquations().isEmpty() )
|
||||||
|
{
|
||||||
|
if ( !mMapToolClippingPlanes->clippedPolygon().intersects( extent ) )
|
||||||
|
{
|
||||||
|
disableClippingPlanes();
|
||||||
|
mMessageBar->pushInfo( QString(), tr( "Cross-section has been disabled, because it's outside current extent" ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( mMapToolPrevious )
|
if ( mMapToolPrevious )
|
||||||
mMainCanvas->setMapTool( mMapToolPrevious );
|
mMainCanvas->setMapTool( mMapToolPrevious );
|
||||||
else
|
else
|
||||||
|
|||||||
@ -186,3 +186,8 @@ void QgsMapToolClippingPlanes::clearHighLightedArea() const
|
|||||||
{
|
{
|
||||||
mRubberBandPolygon->reset( Qgis::GeometryType::Polygon );
|
mRubberBandPolygon->reset( Qgis::GeometryType::Polygon );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QgsGeometry QgsMapToolClippingPlanes::clippedPolygon() const
|
||||||
|
{
|
||||||
|
return mRubberBandPolygon->asGeometry();
|
||||||
|
}
|
||||||
|
|||||||
@ -49,6 +49,8 @@ class QgsMapToolClippingPlanes : public QgsMapTool
|
|||||||
void clear() const;
|
void clear() const;
|
||||||
//! Removes the tool's rubber band from canvas, which highlights the cross-section.
|
//! Removes the tool's rubber band from canvas, which highlights the cross-section.
|
||||||
void clearHighLightedArea() const;
|
void clearHighLightedArea() const;
|
||||||
|
//! Returns the Geometry of clipped area
|
||||||
|
QgsGeometry clippedPolygon() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void clearRubberBand() const;
|
void clearRubberBand() const;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user