OpenWalnut  1.5.0dev
WFiberActionRemoveFiber.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WFIBERACTIONREMOVEFIBER_H
26 #define WFIBERACTIONREMOVEFIBER_H
27 
28 #include <memory>
29 #include <string>
30 
31 #include <osg/Geode>
32 
33 #include "../WFiberHandler.h"
34 #include "WFiberAction.h"
35 
36 
37 /**
38  * The action when removing a fiber.
39  */
41 {
42 public:
43  /**
44  * A shared_ptr to this class.
45  */
46  typedef std::shared_ptr< WFiberActionRemoveFiber > SPtr;
47 
48  /**
49  * Creates this action.
50  * \param name The name of the fiber.
51  * \param position The position of this fiber in the fibers vector.
52  * \param fiber The fiber that was removed.
53  * \param hidden If the fiber was hidden.
54  * \param fiberHandler The WFiberHandler of the action.
55  */
56  WFiberActionRemoveFiber( std::string name, size_t position, WFiberHandler::PCFiber fiber, bool hidden, WFiberHandler* fiberHandler );
57 
58  /**
59  * Empty destructor.
60  */
62 
63  /**
64  * Undos this action.
65  */
66  virtual void undo();
67 
68  /**
69  * Redos this action.
70  */
71  virtual void redo();
72 
73 private:
74  /**
75  * The name of the fiber.
76  */
77  std::string m_name;
78 
79  /**
80  * The position of this fiber in the fibers vector.
81  */
82  size_t m_position;
83 
84  /**
85  * The fiber that was removed.
86  */
88 
89  /**
90  * Whether the fiber is hidden.
91  */
92  bool m_hidden;
93 
94  /**
95  * The WFiberHandler of the action.
96  */
98 };
99 
100 #endif // WFIBERACTIONREMOVEFIBER_H
The action when removing a fiber.
WFiberHandler * m_fiberHandler
The WFiberHandler of the action.
std::shared_ptr< WFiberActionRemoveFiber > SPtr
A shared_ptr to this class.
size_t m_position
The position of this fiber in the fibers vector.
WFiberActionRemoveFiber(std::string name, size_t position, WFiberHandler::PCFiber fiber, bool hidden, WFiberHandler *fiberHandler)
Creates this action.
std::string m_name
The name of the fiber.
WFiberHandler::PCFiber m_fiber
The fiber that was removed.
bool m_hidden
Whether the fiber is hidden.
~WFiberActionRemoveFiber()
Empty destructor.
virtual void redo()
Redos this action.
virtual void undo()
Undos this action.
Super class for the actions.
Definition: WFiberAction.h:36
Handles the fibers of the WMPointsConnector.
Definition: WFiberHandler.h:48
std::vector< osg::Vec3 > PCFiber
Vector of 3D vectors, representing points.
Definition: WFiberHandler.h:63