mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
Add base class for QgsMapLayerElevationProperties
Base class for storage of map layer elevation properties.
This commit is contained in:
parent
775320e095
commit
7c964f1d41
@ -1360,6 +1360,13 @@ should be canceled.
|
||||
Returns the layer's temporal properties. This may be ``None``, depending on the layer type.
|
||||
|
||||
.. versionadded:: 3.14
|
||||
%End
|
||||
|
||||
virtual QgsMapLayerElevationProperties *elevationProperties();
|
||||
%Docstring
|
||||
Returns the layer's elevation properties. This may be ``None``, depending on the layer type.
|
||||
|
||||
.. versionadded:: 3.18
|
||||
%End
|
||||
|
||||
public slots:
|
||||
|
@ -0,0 +1,80 @@
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/core/qgsmaplayerelevationproperties.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class QgsMapLayerElevationProperties : QObject
|
||||
{
|
||||
%Docstring
|
||||
Base class for storage of map layer elevation properties.
|
||||
|
||||
QgsMapLayerElevationProperties exposes user-configurable settings for controlling
|
||||
how an individual QgsMapLayer behaves with relation to z values or elevations.
|
||||
|
||||
.. versionadded:: 3.18
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgsmaplayerelevationproperties.h"
|
||||
%End
|
||||
public:
|
||||
|
||||
enum Flag
|
||||
{
|
||||
FlagDontInvalidateCachedRendersWhenRangeChanges
|
||||
};
|
||||
typedef QFlags<QgsMapLayerElevationProperties::Flag> Flags;
|
||||
|
||||
|
||||
QgsMapLayerElevationProperties( QObject *parent /TransferThis/ );
|
||||
%Docstring
|
||||
Constructor for QgsMapLayerElevationProperties, with the specified ``parent`` object.
|
||||
%End
|
||||
|
||||
virtual QDomElement writeXml( QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context ) = 0;
|
||||
%Docstring
|
||||
Writes the properties to a DOM ``element``, to be used later with :py:func:`~QgsMapLayerElevationProperties.readXml`.
|
||||
|
||||
.. seealso:: :py:func:`readXml`
|
||||
%End
|
||||
|
||||
virtual bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) = 0;
|
||||
%Docstring
|
||||
Reads the elevation properties from a DOM ``element`` previously written by :py:func:`~QgsMapLayerElevationProperties.writeXml`.
|
||||
|
||||
.. seealso:: :py:func:`writeXml`
|
||||
%End
|
||||
|
||||
virtual bool isVisibleInZRange( const QgsDoubleRange &range ) const;
|
||||
%Docstring
|
||||
Returns ``True`` if the layer should be visible and rendered for the specified z ``range``.
|
||||
%End
|
||||
|
||||
virtual QgsMapLayerElevationProperties::Flags flags() const;
|
||||
%Docstring
|
||||
Returns flags associated to the elevation properties.
|
||||
%End
|
||||
|
||||
signals:
|
||||
|
||||
void changed();
|
||||
%Docstring
|
||||
Emitted when the elevation properties have changed.
|
||||
%End
|
||||
};
|
||||
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/core/qgsmaplayerelevationproperties.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
@ -115,6 +115,7 @@
|
||||
%Include auto_generated/qgsmaplayerstore.sip
|
||||
%Include auto_generated/qgsmaplayerstyle.sip
|
||||
%Include auto_generated/qgsmaplayerstylemanager.sip
|
||||
%Include auto_generated/qgsmaplayerelevationproperties.sip
|
||||
%Include auto_generated/qgsmaplayertemporalproperties.sip
|
||||
%Include auto_generated/qgsmaprenderercache.sip
|
||||
%Include auto_generated/qgsmaprenderercustompainterjob.sip
|
||||
|
@ -329,6 +329,7 @@ set(QGIS_CORE_SRCS
|
||||
qgsmapdecoration.cpp
|
||||
qgsmaphittest.cpp
|
||||
qgsmaplayer.cpp
|
||||
qgsmaplayerelevationproperties.cpp
|
||||
qgsmaplayerlegend.cpp
|
||||
qgsmaplayermodel.cpp
|
||||
qgsmaplayerproxymodel.cpp
|
||||
@ -932,6 +933,7 @@ set(QGIS_CORE_HDRS
|
||||
qgsmaplayerstore.h
|
||||
qgsmaplayerstyle.h
|
||||
qgsmaplayerstylemanager.h
|
||||
qgsmaplayerelevationproperties.h
|
||||
qgsmaplayertemporalproperties.h
|
||||
qgsmaprenderercache.h
|
||||
qgsmaprenderercustompainterjob.h
|
||||
|
@ -48,6 +48,7 @@ class QgsMapLayerStyleManager;
|
||||
class QgsProject;
|
||||
class QgsStyleEntityVisitorInterface;
|
||||
class QgsMapLayerTemporalProperties;
|
||||
class QgsMapLayerElevationProperties;
|
||||
|
||||
class QDomDocument;
|
||||
class QKeyEvent;
|
||||
@ -1228,6 +1229,13 @@ class CORE_EXPORT QgsMapLayer : public QObject
|
||||
*/
|
||||
virtual QgsMapLayerTemporalProperties *temporalProperties() { return nullptr; }
|
||||
|
||||
/**
|
||||
* Returns the layer's elevation properties. This may be NULLPTR, depending on the layer type.
|
||||
*
|
||||
* \since QGIS 3.18
|
||||
*/
|
||||
virtual QgsMapLayerElevationProperties *elevationProperties() { return nullptr; }
|
||||
|
||||
public slots:
|
||||
|
||||
/**
|
||||
|
28
src/core/qgsmaplayerelevationproperties.cpp
Normal file
28
src/core/qgsmaplayerelevationproperties.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
/***************************************************************************
|
||||
qgsmaplayerelevationproperties.cpp
|
||||
---------------
|
||||
begin : November 2020
|
||||
copyright : (C) 2020 by Nyall Dawson
|
||||
email : nyall dot dawson dot com
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgsmaplayerelevationproperties.h"
|
||||
|
||||
QgsMapLayerElevationProperties::QgsMapLayerElevationProperties( QObject *parent )
|
||||
: QObject( parent )
|
||||
{
|
||||
}
|
||||
|
||||
bool QgsMapLayerElevationProperties::isVisibleInZRange( const QgsDoubleRange & ) const
|
||||
{
|
||||
return true;
|
||||
}
|
93
src/core/qgsmaplayerelevationproperties.h
Normal file
93
src/core/qgsmaplayerelevationproperties.h
Normal file
@ -0,0 +1,93 @@
|
||||
/***************************************************************************
|
||||
qgsmaplayerelevationproperties.h
|
||||
---------------
|
||||
begin : November 2020
|
||||
copyright : (C) 2020 by Nyall Dawson
|
||||
email : nyall dot dawson dot com
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef QGSMAPLAYERELEVATIONPROPERTIES_H
|
||||
#define QGSMAPLAYERELEVATIONPROPERTIES_H
|
||||
|
||||
#include "qgis_core.h"
|
||||
#include "qgis_sip.h"
|
||||
#include "qgsreadwritecontext.h"
|
||||
#include "qgsrange.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QDomElement>
|
||||
|
||||
/**
|
||||
* \class QgsMapLayerElevationProperties
|
||||
* \ingroup core
|
||||
* Base class for storage of map layer elevation properties.
|
||||
*
|
||||
* QgsMapLayerElevationProperties exposes user-configurable settings for controlling
|
||||
* how an individual QgsMapLayer behaves with relation to z values or elevations.
|
||||
*
|
||||
* \since QGIS 3.18
|
||||
*/
|
||||
class CORE_EXPORT QgsMapLayerElevationProperties : public QObject
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Flags attached to the elevation property.
|
||||
*/
|
||||
enum Flag
|
||||
{
|
||||
FlagDontInvalidateCachedRendersWhenRangeChanges = 1 //!< Any cached rendering will not be invalidated when z range context is modified.
|
||||
};
|
||||
Q_DECLARE_FLAGS( Flags, Flag )
|
||||
|
||||
/**
|
||||
* Constructor for QgsMapLayerElevationProperties, with the specified \a parent object.
|
||||
*/
|
||||
QgsMapLayerElevationProperties( QObject *parent SIP_TRANSFERTHIS );
|
||||
|
||||
/**
|
||||
* Writes the properties to a DOM \a element, to be used later with readXml().
|
||||
*
|
||||
* \see readXml()
|
||||
*/
|
||||
virtual QDomElement writeXml( QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context ) = 0;
|
||||
|
||||
/**
|
||||
* Reads the elevation properties from a DOM \a element previously written by writeXml().
|
||||
*
|
||||
* \see writeXml()
|
||||
*/
|
||||
virtual bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) = 0;
|
||||
|
||||
/**
|
||||
* Returns TRUE if the layer should be visible and rendered for the specified z \a range.
|
||||
*/
|
||||
virtual bool isVisibleInZRange( const QgsDoubleRange &range ) const;
|
||||
|
||||
/**
|
||||
* Returns flags associated to the elevation properties.
|
||||
*/
|
||||
virtual QgsMapLayerElevationProperties::Flags flags() const { return QgsMapLayerElevationProperties::Flags(); }
|
||||
|
||||
signals:
|
||||
|
||||
/**
|
||||
* Emitted when the elevation properties have changed.
|
||||
*/
|
||||
void changed();
|
||||
};
|
||||
|
||||
#endif // QGSMAPLAYERELEVATIONPROPERTIES_H
|
Loading…
x
Reference in New Issue
Block a user