mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-05 00:04:40 -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:
|
||||
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:
|
||||
void terrainEntityChanged();
|
||||
|
||||
@ -297,6 +297,13 @@ class _3D_EXPORT Qgs3DMapScene : public QObject
|
||||
*/
|
||||
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
|
||||
//! Static function for returning open 3D map scenes
|
||||
static std::function<QMap<QString, Qgs3DMapScene *>()> sOpenScenesFunction;
|
||||
|
||||
@ -1180,6 +1180,15 @@ void Qgs3DMapCanvasWidget::setSceneExtent( const QgsRectangle &extent )
|
||||
if ( !extent.isEmpty() )
|
||||
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 )
|
||||
mMainCanvas->setMapTool( mMapToolPrevious );
|
||||
else
|
||||
|
||||
@ -186,3 +186,8 @@ void QgsMapToolClippingPlanes::clearHighLightedArea() const
|
||||
{
|
||||
mRubberBandPolygon->reset( Qgis::GeometryType::Polygon );
|
||||
}
|
||||
|
||||
QgsGeometry QgsMapToolClippingPlanes::clippedPolygon() const
|
||||
{
|
||||
return mRubberBandPolygon->asGeometry();
|
||||
}
|
||||
|
||||
@ -49,6 +49,8 @@ class QgsMapToolClippingPlanes : public QgsMapTool
|
||||
void clear() const;
|
||||
//! Removes the tool's rubber band from canvas, which highlights the cross-section.
|
||||
void clearHighLightedArea() const;
|
||||
//! Returns the Geometry of clipped area
|
||||
QgsGeometry clippedPolygon() const;
|
||||
|
||||
private:
|
||||
void clearRubberBand() const;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user