#ifndef MYNODEVISITOR_H #define MYNODEVISITOR_H #include #include #include #include // 深度优先的访问器 class myNodeVisitor : public osg::NodeVisitor { public: myNodeVisitor(); void setPoints(osg::ref_ptr _vertexArray) {vertexArray = _vertexArray;} void setBoundaryList(QList> _boundaryList){ boundaryList = _boundaryList; } virtual void apply(osg::Geode &node) override; virtual void apply(osg::Group &node) override; virtual void apply(osg::PagedLOD &node) override; bool pointInPolygon(osg::Vec3& point); int pointsNearVertex(osg::Vec3& point); private: osgUtil::Optimizer::TextureVisitor* tv = new osgUtil::Optimizer::TextureVisitor(true, false, false, false, false, false); osgDB::ReaderWriter::Options* opt = new osgDB::ReaderWriter::Options; QString workingDir; QString newFileName; // 记录点位是否被修改,从而缩减计算量 bool affected = false; bool childAffected = false; osg::ref_ptr vertexArray; QList> boundaryList; }; #endif // MYNODEVISITOR_H