Skip to content

Commit

Permalink
Node experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 15, 2023
1 parent f4c9083 commit db2aded
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,61 @@




class QgsTiledMeshNode
{
%Docstring(signature="appended")
*************************************************************************

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. *

**************************************************************************
%End

%TypeHeaderCode
#include "qgstiledmeshdataprovider.h"
%End
public:

QgsTiledMeshNode();
%Docstring
Constructor for an invalid node.
%End

QgsTiledMeshNode( const QgsTiledMeshNode &other );

QgsTiledMeshNode( QgsTiledMeshNode *parent );
%Docstring
Constructor for a valid node.
%End

bool isValid() const;
%Docstring
Returns ``True`` if the node is valid.
%End

bool operator==( QgsTiledMeshNode other ) const;

QgsTiledMeshNode *parentNode() const;
%Docstring
Returns the parent of the node.
%End

QList< QgsTiledMeshNode * > children() const;
%Docstring
Returns the child nodes.
%End

const QgsAbstractTiledMeshNodeBoundingVolume *boundingVolume() const;
%Docstring
Returns the bounding volume for the node.
%End

};

class QgsTiledMeshDataProvider: QgsDataProvider
{
%Docstring(signature="appended")
Expand Down
31 changes: 31 additions & 0 deletions src/core/tiledmesh/qgstiledmeshdataprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "qgstiledmeshdataprovider.h"
#include "qgsthreadingutils.h"
#include "qgstiledmeshboundingvolume.h"

QgsTiledMeshDataProvider::QgsTiledMeshDataProvider(
const QString &uri,
Expand Down Expand Up @@ -47,3 +48,33 @@ QString QgsTiledMeshDataProvider::htmlMetadata() const

return QString();
}

QgsTiledMeshNode::QgsTiledMeshNode( const QgsTiledMeshNode &other )
: mParent( other.mParent )
{
for ( const QgsTiledMeshNode *node : other.mChildren )
{
// clone
}
mBoundingVolume.reset( other.mBoundingVolume ? other.mBoundingVolume->clone() : nullptr );
}

bool QgsTiledMeshNode::isValid() const
{

}

const QgsAbstractTiledMeshNodeBoundingVolume *QgsTiledMeshNode::boundingVolume() const
{
return mBoundingVolume.get();
}

QgsTiledMeshNode &QgsTiledMeshNode::operator=( const QgsTiledMeshNode &other )
{
mParent = other.mParent;
for ( const QgsTiledMeshNode *node : other.mChildren )
{
// clone
}
mBoundingVolume.reset( other.mBoundingVolume ? other.mBoundingVolume->clone() : nullptr );
}
51 changes: 51 additions & 0 deletions src/core/tiledmesh/qgstiledmeshdataprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,57 @@
#include "qgsdataprovider.h"
#include "qgis.h"

class QgsAbstractTiledMeshNodeBoundingVolume;

class CORE_EXPORT QgsTiledMeshNode
{
public:

/**
* Constructor for an invalid node.
*/
QgsTiledMeshNode();

QgsTiledMeshNode( const QgsTiledMeshNode &other );
QgsTiledMeshNode &operator=( const QgsTiledMeshNode &other );

/**
* Constructor for a valid node.
*/
QgsTiledMeshNode( QgsTiledMeshNode *parent );

/**
* Returns TRUE if the node is valid.
*/
bool isValid() const;

bool operator==( QgsTiledMeshNode other ) const
{
return false;
}

/**
* Returns the parent of the node.
*/
QgsTiledMeshNode *parentNode() const { return mParent; }

/**
* Returns the child nodes.
*/
QList< QgsTiledMeshNode * > children() const { return mChildren; }

/**
* Returns the bounding volume for the node.
*/
const QgsAbstractTiledMeshNodeBoundingVolume *boundingVolume() const;

private:
QgsTiledMeshNode *mParent = nullptr;
QList< QgsTiledMeshNode * > mChildren;
std::unique_ptr< QgsAbstractTiledMeshNodeBoundingVolume > mBoundingVolume;

};

/**
* \ingroup core
* \brief Base class for data providers for QgsTiledMeshLayer
Expand Down

0 comments on commit db2aded

Please sign in to comment.