/** ** ** @RDE_HEADER@ ** Node visitor for GeometryModel. ** $Id$ ** $HeadURL$ ** $Author$ ** ** ----------------------------------------------------------------------------------------------- ** ** Hardware-Environment: Intel-PC ** Software-Environment: Windows 7, Qt 5.4. ArcGIS 10.2.5 ** ** Language ........: C++ 11 ** ** ----------------------------------------------------------------------------------------------- ** ** Author ...........: Jörg Turla, SPD G, Tel. 3132 ** ** ----------------------------------------------------------------------------------------------- ** ** Notes .........: ** ** 07.07.2016, JT : First edition for use with Qt5 ** ** ----------------------------------------------------------------------------------------------- */ #pragma once #include "geometry_model.h" namespace SituationMap { /** GeometryNopdeVisitor implements visitor pattern to traverse geoemtry model tree. The apply function will be called for each node in geometry model. */ class GEOMETRYMODEL_EXPORT GeometryNodeVisitor { public: explicit GeometryNodeVisitor(GeometryModel *geoModel); virtual ~GeometryNodeVisitor() = default; GeometryNodeVisitor(const GeometryNodeVisitor &) = delete; /** Traversing the complete geometry model */ bool traverse(); /** Traversing the sub-tree of node. Coming in deepth first. */ bool traverse(GeometryModel::Node node); protected: /** For each node the apply function will be called. If apply returns false the traversal is aborted. In other case if return value is true the traversel is continued. @param geoModel Pointer to geometry model @param node Node of geometry model @param nodeType Type of node @return false to abort traversael otherwise true */ virtual bool apply(GeometryModel *geoModel, const GeometryModel::Node &node, GeometryModel::PrimitiveType nodeType) = 0; GeometryModel *m_geometryModel; }; // GeometryNodeVisitor } // namespace SituationMap