1  | 
     | 
     | 
    //  | 
    
    
    2  | 
     | 
     | 
    //  leaf-node-cone.h  | 
    
    
    3  | 
     | 
     | 
    //  gepetto-viewer  | 
    
    
    4  | 
     | 
     | 
    //  | 
    
    
    5  | 
     | 
     | 
    //  Created by Justin Carpentier, Mathieu Geisert in November 2014.  | 
    
    
    6  | 
     | 
     | 
    //  Copyright (c) 2014 LAAS-CNRS. All rights reserved.  | 
    
    
    7  | 
     | 
     | 
    //  | 
    
    
    8  | 
     | 
     | 
     | 
    
    
    9  | 
     | 
     | 
    #ifndef GEPETTO_VIEWER_LEAFNODECONE_HH  | 
    
    
    10  | 
     | 
     | 
    #define GEPETTO_VIEWER_LEAFNODECONE_HH  | 
    
    
    11  | 
     | 
     | 
     | 
    
    
    12  | 
     | 
     | 
    #include <gepetto/viewer/node-drawable.h>  | 
    
    
    13  | 
     | 
     | 
     | 
    
    
    14  | 
     | 
     | 
    namespace gepetto { | 
    
    
    15  | 
     | 
     | 
    namespace viewer { | 
    
    
    16  | 
     | 
     | 
    DEF_CLASS_SMART_PTR(LeafNodeCone)  | 
    
    
    17  | 
     | 
     | 
     | 
    
    
    18  | 
     | 
     | 
    /** Implementation of the Cone GraphicalObject in OSG render */  | 
    
    
    19  | 
     | 
     | 
    class LeafNodeCone : public NodeDrawable { | 
    
    
    20  | 
     | 
     | 
     private:  | 
    
    
    21  | 
     | 
     | 
      /** Associated weak pointer */  | 
    
    
    22  | 
     | 
     | 
      LeafNodeConeWeakPtr weak_ptr_;  | 
    
    
    23  | 
     | 
     | 
     | 
    
    
    24  | 
     | 
     | 
      /** Associated Cone Shape */  | 
    
    
    25  | 
     | 
     | 
      ::osg::ConeRefPtr cone_ptr_;  | 
    
    
    26  | 
     | 
     | 
     | 
    
    
    27  | 
     | 
     | 
      void init();  | 
    
    
    28  | 
     | 
     | 
     | 
    
    
    29  | 
     | 
     | 
      /* Default constructor */  | 
    
    
    30  | 
     | 
     | 
      LeafNodeCone(const std::string& name, const float& radius,  | 
    
    
    31  | 
     | 
     | 
                   const float& height);  | 
    
    
    32  | 
     | 
     | 
      LeafNodeCone(const std::string& name, const float& radius,  | 
    
    
    33  | 
     | 
     | 
                   const float& height, const osgVector4& color);  | 
    
    
    34  | 
     | 
     | 
     | 
    
    
    35  | 
     | 
     | 
      /* Copy constructor */  | 
    
    
    36  | 
     | 
     | 
      LeafNodeCone(const LeafNodeCone& other);  | 
    
    
    37  | 
     | 
     | 
     | 
    
    
    38  | 
     | 
     | 
      /** Initialize weak_ptr */  | 
    
    
    39  | 
     | 
     | 
      void initWeakPtr(LeafNodeConeWeakPtr other_weak_ptr);  | 
    
    
    40  | 
     | 
     | 
     | 
    
    
    41  | 
     | 
     | 
     protected:  | 
    
    
    42  | 
     | 
     | 
     public:  | 
    
    
    43  | 
     | 
     | 
      /** Static method which create a new box defined by the half_axis vector  | 
    
    
    44  | 
     | 
     | 
       */  | 
    
    
    45  | 
     | 
     | 
      static LeafNodeConePtr_t create(const std::string& name, const float& radius,  | 
    
    
    46  | 
     | 
     | 
                                      const float& height);  | 
    
    
    47  | 
     | 
     | 
      static LeafNodeConePtr_t create(const std::string& name, const float& radius,  | 
    
    
    48  | 
     | 
     | 
                                      const float& height, const osgVector4& color);  | 
    
    
    49  | 
     | 
     | 
     | 
    
    
    50  | 
     | 
     | 
      /** Static method for creating a clone of box other with the copy constructor  | 
    
    
    51  | 
     | 
     | 
       */  | 
    
    
    52  | 
     | 
     | 
      static LeafNodeConePtr_t createCopy(LeafNodeConePtr_t other);  | 
    
    
    53  | 
     | 
     | 
     | 
    
    
    54  | 
     | 
     | 
      /** Proceed to a clonage of the current object defined by the copy constructor  | 
    
    
    55  | 
     | 
     | 
       */  | 
    
    
    56  | 
     | 
     | 
      virtual LeafNodeConePtr_t clone(void) const;  | 
    
    
    57  | 
     | 
     | 
     | 
    
    
    58  | 
     | 
     | 
      /** Copy  | 
    
    
    59  | 
     | 
     | 
       \brief Proceed to a copy of the currend object as clone  | 
    
    
    60  | 
     | 
     | 
       */  | 
    
    
    61  | 
     | 
     | 
      virtual LeafNodeConePtr_t copy() const { return clone(); } | 
    
    
    62  | 
     | 
     | 
     | 
    
    
    63  | 
     | 
     | 
      /** Return a shared pointer of the current object  | 
    
    
    64  | 
     | 
     | 
       */  | 
    
    
    65  | 
     | 
     | 
      LeafNodeConePtr_t self(void) const;  | 
    
    
    66  | 
     | 
     | 
     | 
    
    
    67  | 
     | 
     | 
      /** Fix the new radius of the cone  | 
    
    
    68  | 
     | 
     | 
       * Note : radius must be positive scalar  | 
    
    
    69  | 
     | 
     | 
       */  | 
    
    
    70  | 
     | 
     | 
      virtual void setRadius(const float& radius);  | 
    
    
    71  | 
     | 
     | 
     | 
    
    
    72  | 
     | 
     | 
      float getRadius() const { return cone_ptr_->getRadius(); } | 
    
    
    73  | 
     | 
     | 
     | 
    
    
    74  | 
     | 
     | 
      /** Fix the new jeight of the cone  | 
    
    
    75  | 
     | 
     | 
       * Note : radius must be positive scalar  | 
    
    
    76  | 
     | 
     | 
       */  | 
    
    
    77  | 
     | 
     | 
      virtual void setHeight(const float& height);  | 
    
    
    78  | 
     | 
     | 
     | 
    
    
    79  | 
     | 
     | 
      float getHeight() const { return cone_ptr_->getHeight(); } | 
    
    
    80  | 
     | 
     | 
     | 
    
    
    81  | 
     | 
     | 
      SCENE_VIEWER_ACCEPT_VISITOR;  | 
    
    
    82  | 
     | 
     | 
     | 
    
    
    83  | 
     | 
     | 
      /** Destructor */  | 
    
    
    84  | 
     | 
     | 
      virtual ~LeafNodeCone();  | 
    
    
    85  | 
     | 
     | 
    };  | 
    
    
    86  | 
     | 
     | 
    } /* namespace viewer */  | 
    
    
    87  | 
     | 
     | 
    } /* namespace gepetto */  | 
    
    
    88  | 
     | 
     | 
     | 
    
    
    89  | 
     | 
     | 
    #endif /* GEPETTO_VIEWER_LEAFNODECONE_HH */  |