root/OpenSceneGraph/trunk/src/osgPlugins/dot/BaseDotVisitor.h @ 13041

Revision 13041, 2.3 kB (checked in by robert, 3 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13#pragma once
14#ifndef __DOTBASEVISITOR_H__
15#define __DOTBASEVISITOR_H__
16
17#ifndef __cplusplus
18#error "this is a c++ - header!"
19#endif
20
21#include <sstream>
22
23#include <osg/NodeVisitor>
24#include <osg/Drawable>
25#include <osg/Group>
26#include <osg/Geode>
27#include <osg/ref_ptr>
28
29#include <osgDB/Options>
30
31namespace osgDot {
32
33  class BaseDotVisitor : public osg::NodeVisitor {
34  public:
35    typedef std::map< osg::Object*, int > ObjectMap;
36
37  public:
38    BaseDotVisitor();
39
40    virtual ~BaseDotVisitor();
41
42    void setOptions(const osgDB::Options* options);
43
44    bool run( osg::Node& root, std::ostream* ostream );
45
46    virtual void apply(osg::Node& node);
47
48    virtual void apply(osg::Geode& node);
49
50    virtual void apply(osg::Group& node);
51
52
53  protected:
54
55    void handleNodeAndTraverse(osg::Node& node, int id);
56
57    virtual void handle(osg::Node& node, int id);
58    virtual void handle(osg::Geode& node, int id);
59    virtual void handle(osg::Group& node, int id);
60    virtual void handle(osg::StateSet& stateset, int id);
61    virtual void handle(osg::Drawable& drawable, int id);
62
63    virtual void handle(osg::Node& node, osg::StateSet& stateset, int parentID, int childID);
64    virtual void handle(osg::Group& parent, osg::Node& child, int parentID, int childID);
65    virtual void handle(osg::Geode& geode, osg::Drawable& drawable, int parentID, int childID);
66    virtual void handle(osg::Drawable& drawable, osg::StateSet& stateset, int parentID, int childID );
67
68    osg::ref_ptr<osgDB::Options> _options;
69
70    std::string       _rankdir;
71
72    std::stringstream _nodes;
73    std::stringstream _edges;
74
75  private:
76    bool getOrCreateId( osg::Object* object, int& id );
77
78    ObjectMap _objectMap;
79
80  };
81
82} // namespace osgDot
83
84#endif // __DOTBASEVISITOR_H__
Note: See TracBrowser for help on using the browser.