GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/gepetto/viewer/roadmap-viewer.h Lines: 0 25 0.0 %
Date: 2020-05-14 11:23:33 Branches: 0 8 0.0 %

Line Branch Exec Source
1
//
2
//  roadmap-viewer.h
3
//  gepetto-viewer
4
//
5
//  Created by Pierre Fernbach in april 2015.
6
//  Copyright (c) 2015 LAAS-CNRS. All rights reserved.
7
//
8
9
#ifndef GEPETTO_VIEWER_ROADMAPVIEWER_HH
10
#define GEPETTO_VIEWER_ROADMAPVIEWER_HH
11
12
#include <OpenThreads/Mutex>
13
14
#include <gepetto/viewer/node.h>
15
#include <gepetto/viewer/group-node.h>
16
#include <gepetto/viewer/leaf-node-xyzaxis.h>
17
#include <gepetto/viewer/leaf-node-line.h>
18
19
namespace gepetto {
20
namespace viewer {
21
22
    DEF_CLASS_SMART_PTR(RoadmapViewer)
23
24
    class RoadmapViewer : public Node
25
    {
26
    private:
27
        /**
28
         \brief List of all child graphical object
29
         */
30
        std::list<LeafNodeXYZAxisPtr_t> list_nodes_;
31
        std::list<LeafNodeLinePtr_t> list_edges_;
32
33
        /** Associated weak pointer */
34
        RoadmapViewerWeakPtr weak_ptr_;
35
        // ---
36
        float radiusSphere_;
37
        float sizeAxis_;
38
        osgVector4 colorNode_;
39
        osgVector4 colorEdge_;
40
        /** Initialize weak_ptr */
41
        void initWeakPtr(RoadmapViewerWeakPtr other_weak_ptr);
42
43
    protected:
44
        /**
45
         \brief Default constructor
46
         */
47
        RoadmapViewer (const std::string& name,const osgVector4& colorNode,float radiusSphere,float sizeAxis,const osgVector4& colorEdge);
48
49
        /** Copy constructor */
50
        RoadmapViewer (const RoadmapViewer& other);
51
52
    public:
53
        /** Static method which create a new box defined by the half_axis vector
54
         */
55
       static RoadmapViewerPtr_t create(const std::string& name,const osgVector4& colorNode,float radiusSphere,float sizeAxis,const osgVector4& colorEdge);
56
57
        /** Static method for creating a clone of box other with the copy constructor
58
         */
59
        static RoadmapViewerPtr_t createCopy(RoadmapViewerPtr_t other);
60
61
        /** Proceed to a clonage of the current object defined by the copy constructor
62
         */
63
        virtual RoadmapViewerPtr_t clone(void) const;
64
65
        /** Return a shared pointer of the current object
66
         */
67
        RoadmapViewerPtr_t self(void) const;
68
69
        bool addNode(osgVector3 position, osgQuat quat, ::OpenThreads::Mutex& mtx);
70
71
        bool addEdge(osgVector3 from, osgVector3 to, ::OpenThreads::Mutex& mtx);
72
73
        virtual void removeAllChildren();
74
75
        /**
76
         \brief Virtual method for setting the visibility mode of the object : visible or not visible
77
         \param visibilitymode state
78
         */
79
        virtual void setVisibilityMode (const VisibilityMode& visibility_state);
80
81
        /**
82
         \brief Virtual method for setting the lighting mode of the object : influence by light or not
83
         \param lightingmode state
84
         */
85
        virtual void setLightingMode (const LightingMode& lighting_state);
86
87
        /**
88
         \brief Virtual method for setting the wireframe mode of the object : visible or not
89
         \param wireframemode state
90
         */
91
        virtual void setWireFrameMode (const WireFrameMode& wireframe_state);
92
93
        virtual size_t getNumOfNodes() const
94
        {
95
          return list_nodes_.size();
96
        }
97
98
        virtual size_t getNumOfEdges() const
99
        {
100
          return list_edges_.size();
101
        }
102
103
        virtual LeafNodeXYZAxisPtr_t getNode(size_t i) const
104
        {
105
           std::list<LeafNodeXYZAxisPtr_t>::const_iterator it = list_nodes_.begin();
106
           if (list_nodes_.size() > i)
107
           {
108
               std::advance(it, (long)i);
109
           }
110
           return *it;
111
        }
112
113
        virtual LeafNodeLinePtr_t getEdge(size_t i) const
114
        {
115
           std::list<LeafNodeLinePtr_t>::const_iterator it = list_edges_.begin();
116
           if (list_edges_.size() > i)
117
           {
118
               std::advance(it, (long)i);
119
           }
120
           return *it;
121
        }
122
123
        virtual float getRadiusSphere() const {
124
            return radiusSphere_;
125
        }
126
127
        virtual float getSizeAxis() const {
128
            return sizeAxis_;
129
        }
130
131
        virtual osgVector4 getColorNode() const{
132
            return colorNode_;
133
        }
134
135
        virtual osgVector4 getColorEdge() const{
136
            return colorEdge_;
137
        }
138
139
        void setColorNode(const osgVector4& color);
140
141
        void setColorEdge(const osgVector4& color);
142
143
        void setColor (const osgVector4& color) {
144
            setColorEdge (color);
145
        }
146
147
    }; //class
148
149
} /* namespace viewer */
150
} /* namespace gepetto */
151
152
#endif