Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
dba0570d
Commit
dba0570d
authored
Mar 04, 2021
by
Robin Eschbach
Browse files
[DOC
#41
] added documentation
parent
4321ff00
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
217 additions
and
1 deletion
+217
-1
src/modules/pointConnector/WClickHandler.cpp
src/modules/pointConnector/WClickHandler.cpp
+1
-1
src/modules/pointConnector/WFiberHandler.h
src/modules/pointConnector/WFiberHandler.h
+39
-0
src/modules/pointConnector/action/WActionHandler.h
src/modules/pointConnector/action/WActionHandler.h
+31
-0
src/modules/pointConnector/action/WFiberAction.h
src/modules/pointConnector/action/WFiberAction.h
+15
-0
src/modules/pointConnector/action/WFiberActionAddFiber.h
src/modules/pointConnector/action/WFiberActionAddFiber.h
+31
-0
src/modules/pointConnector/action/WFiberActionAddVertex.h
src/modules/pointConnector/action/WFiberActionAddVertex.h
+30
-0
src/modules/pointConnector/action/WFiberActionRemoveFiber.h
src/modules/pointConnector/action/WFiberActionRemoveFiber.h
+35
-0
src/modules/pointConnector/action/WFiberActionRemoveVertex.h
src/modules/pointConnector/action/WFiberActionRemoveVertex.h
+35
-0
No files found.
src/modules/pointConnector/WClickHandler.cpp
View file @
dba0570d
...
...
@@ -31,7 +31,7 @@ WClickHandler::WClickHandler( WMPointConnector* connector ):
bool
WClickHandler
::
handle
(
const
osgGA
::
GUIEventAdapter
&
ea
,
osgGA
::
GUIActionAdapter
&
aa
)
{
osgViewer
::
Viewer
*
viewer
=
dynamic_cast
<
osgViewer
::
Viewer
*>
(
&
aa
);
osgViewer
::
Viewer
*
viewer
=
dynamic_cast
<
osgViewer
::
Viewer
*
>
(
&
aa
);
if
(
ea
.
getEventType
()
==
osgGA
::
GUIEventAdapter
::
RELEASE
&&
ea
.
getButton
()
!=
osgGA
::
GUIEventAdapter
::
MIDDLE_MOUSE_BUTTON
)
{
...
...
src/modules/pointConnector/WFiberHandler.h
View file @
dba0570d
...
...
@@ -86,6 +86,7 @@ public:
/**
* Adds a vertex to the currently selected fiber.
* \param vertex The vertex to add.
* \param fiberIdx The index of the fiber to add the vertex to.
* \param silent Whether or not this should add to the undo stack.
*/
void
addVertexToFiber
(
osg
::
Vec3
vertex
,
size_t
fiberIdx
,
bool
silent
=
false
);
...
...
@@ -93,6 +94,7 @@ public:
/**
* Adds a vertex to the currently selected fiber.
* \param vertex The vertex to add.
* \param fiberIdx The index of the fiber to add the vertex to.
* \param position The position where to add the vertex.
* \param silent Whether or not this should add to the undo stack.
*/
...
...
@@ -101,16 +103,38 @@ public:
/**
* Removes a vertex from the currently selected fiber.
* \param vertex The vertex to remove.
* \param fiberIdx The index of the fiber to remove the vertex from.
* \param silent Whether or not this should add to the undo stack.
*/
void
removeVertexFromFiber
(
osg
::
Vec3
vertex
,
size_t
fiberIdx
,
bool
silent
=
false
);
/**
* Adds a new fiber.
* \param name The name of the fiber.
* \param silent Whether or not this should add to the undo stack.
*/
void
addFiber
(
std
::
string
name
,
bool
silent
=
false
);
/**
* Adds a new or an old fiber at a specific position.
* \param name The name of the fiber.
* \param position The position of the fiber.
* \param silent Whether or not this should add to the undo stack.
* \param fiber The fiber to add.
*/
void
addFiberAt
(
std
::
string
name
,
size_t
position
,
bool
silent
=
false
,
PCFiber
fiber
=
PCFiber
()
);
/**
* Removes a fiber at an index in the fibers vector.
* \param idx The index of the fiber.
* \param silent Whether or not this should add to the undo stack.
*/
void
removeFiber
(
size_t
idx
,
bool
silent
=
false
);
/**
* Selects a fiber by its index in the fibers vector.
* \param idx The index of the fiber.
*/
void
selectFiber
(
size_t
idx
);
/**
...
...
@@ -123,8 +147,14 @@ public:
*/
PCFiberListSPtr
getFibers
();
/**
* \return WMPointConnector* The WMPointConnector this belongs to
*/
WMPointConnector
*
getPointConnector
();
/**
* \return size_t The currently selected fiber.
*/
size_t
getSelectedFiber
();
private:
...
...
@@ -169,10 +199,19 @@ private:
*/
WPropTrigger
m_addFiber
;
/**
* Property (button) to remove a Fiber.
*/
WPropTrigger
m_removeFiber
;
/**
* Property (button) to undo the last action.
*/
WPropTrigger
m_undoTrigger
;
/**
* Property (button) to redo the last action.
*/
WPropTrigger
m_redoTrigger
;
/**
...
...
src/modules/pointConnector/action/WActionHandler.h
View file @
dba0570d
...
...
@@ -29,26 +29,57 @@
#include "WFiberAction.h"
/**
* Handles undo and redo action.
*/
class
WActionHandler
{
public:
/**
* A shared_ptr to this class.
*/
typedef
boost
::
shared_ptr
<
WActionHandler
>
SPtr
;
/**
* Creates the undo and redo vectors.
*/
WActionHandler
();
/**
* Clears the vectors for destruction.
*/
~
WActionHandler
();
/**
* Pushes an action to the undo vector and clears the redo vector.
* \param action The ation to push.
*/
void
pushAction
(
WFiberAction
::
SPtr
action
);
/**
* Undos the last action and pushes it to the redo vector.
*/
void
undo
();
/**
* Redos the last action and pushes it to the undo vector.
*/
void
redo
();
private:
/**
* A shared_ptr to a vector of an action.
*/
typedef
boost
::
shared_ptr
<
std
::
vector
<
WFiberAction
::
SPtr
>
>
ActionStack
;
/**
* The undo vector.
*/
ActionStack
m_undo
;
/**
* The redo vector.
*/
ActionStack
m_redo
;
};
...
...
src/modules/pointConnector/action/WFiberAction.h
View file @
dba0570d
...
...
@@ -27,15 +27,30 @@
#include <boost/shared_ptr.hpp>
/**
* Super class for the actions.
*/
class
WFiberAction
{
public:
/**
* A shared_ptr to this class.
*/
typedef
boost
::
shared_ptr
<
WFiberAction
>
SPtr
;
/**
* Empty virtual destructor.
*/
virtual
~
WFiberAction
();
/**
* Undos this action.
*/
virtual
void
undo
()
=
0
;
/**
* Redos this action.
*/
virtual
void
redo
()
=
0
;
};
...
...
src/modules/pointConnector/action/WFiberActionAddFiber.h
View file @
dba0570d
...
...
@@ -33,23 +33,54 @@
#include "WFiberAction.h"
#include "../WFiberHandler.h"
/**
* The action when adding a fiber.
*/
class
WFiberActionAddFiber
:
public
WFiberAction
{
public:
/**
* A shared_ptr to this class.
*/
typedef
boost
::
shared_ptr
<
WFiberActionAddFiber
>
SPtr
;
/**
* Creates this action.
* \param name The name of the fiber.
* \param position The position of this fiber in the fibers vector.
* \param fiberHandler The WFiberHandler of the action.
*/
WFiberActionAddFiber
(
std
::
string
name
,
size_t
position
,
WFiberHandler
*
fiberHandler
);
/**
* Empty destructor.
*/
~
WFiberActionAddFiber
();
/**
* Undos this action.
*/
virtual
void
undo
();
/**
* Redos this action.
*/
virtual
void
redo
();
private:
/**
* The name of the fiber.
*/
std
::
string
m_name
;
/**
* The position of this fiber in the fibers vector.
*/
size_t
m_position
;
/**
* The WFiberHandler of the action.
*/
WFiberHandler
*
m_fiberHandler
;
};
...
...
src/modules/pointConnector/action/WFiberActionAddVertex.h
View file @
dba0570d
...
...
@@ -31,23 +31,53 @@
#include "WFiberAction.h"
#include "../WFiberHandler.h"
/**
* The action when adding a Vertex.
*/
class
WFiberActionAddVertex
:
public
WFiberAction
{
public:
/**
* A shared_ptr to this class.
*/
typedef
boost
::
shared_ptr
<
WFiberActionAddVertex
>
SPtr
;
/**
* Creates this action.
* \param vertex The vertex to add.
* \param fiberIdx The index of the fiber this vertex was added to.
* \param fiberHandler The WFiberHandler of the action.
*/
WFiberActionAddVertex
(
osg
::
Vec3
vertex
,
size_t
fiberIdx
,
WFiberHandler
*
fiberHandler
);
/**
* Empty destructor.
*/
~
WFiberActionAddVertex
();
/**
* Undos this action.
*/
virtual
void
undo
();
/**
* Redos this action.
*/
virtual
void
redo
();
private:
/**
* The vertex to add.
*/
osg
::
Vec3
m_vertex
;
/**
* The index of the fiber this vertex was added to.
*/
size_t
m_fiberIdx
;
/**
* The WFiberHandler of the action.
*/
WFiberHandler
*
m_fiberHandler
;
};
...
...
src/modules/pointConnector/action/WFiberActionRemoveFiber.h
View file @
dba0570d
...
...
@@ -33,25 +33,60 @@
#include "WFiberAction.h"
#include "../WFiberHandler.h"
/**
* The action when removing a fiber.
*/
class
WFiberActionRemoveFiber
:
public
WFiberAction
{
public:
/**
* A shared_ptr to this class.
*/
typedef
boost
::
shared_ptr
<
WFiberActionRemoveFiber
>
SPtr
;
/**
* Creates this action.
* \param name The name of the fiber.
* \param position The position of this fiber in the fibers vector.
* \param fiber The fiber that was removed.
* \param fiberHandler The WFiberHandler of the action.
*/
WFiberActionRemoveFiber
(
std
::
string
name
,
size_t
position
,
WFiberHandler
::
PCFiber
fiber
,
WFiberHandler
*
fiberHandler
);
/**
* Empty destructor.
*/
~
WFiberActionRemoveFiber
();
/**
* Undos this action.
*/
virtual
void
undo
();
/**
* Redos this action.
*/
virtual
void
redo
();
private:
/**
* The name of the fiber.
*/
std
::
string
m_name
;
/**
* The position of this fiber in the fibers vector.
*/
size_t
m_position
;
/**
* The fiber that was removed.
*/
WFiberHandler
::
PCFiber
m_fiber
;
/**
* The WFiberHandler of the action.
*/
WFiberHandler
*
m_fiberHandler
;
};
...
...
src/modules/pointConnector/action/WFiberActionRemoveVertex.h
View file @
dba0570d
...
...
@@ -33,25 +33,60 @@
#include "WFiberAction.h"
#include "../WFiberHandler.h"
/**
* The action when adding a Vertex.
*/
class
WFiberActionRemoveVertex
:
public
WFiberAction
{
public:
/**
* A shared_ptr to this class.
*/
typedef
boost
::
shared_ptr
<
WFiberActionRemoveVertex
>
SPtr
;
/**
* Creates this action.
* \param vertex The vertex to add.
* \param fiberIdx The index of the fiber this vertex was added to.
* \param position The position of the vertex in the vertices vector.
* \param fiberHandler The WFiberHandler of the action.
*/
WFiberActionRemoveVertex
(
osg
::
Vec3
vertex
,
size_t
fiberIdx
,
size_t
position
,
WFiberHandler
*
fiberHandler
);
/**
* Empty destructor.
*/
~
WFiberActionRemoveVertex
();
/**
* Undos this action.
*/
virtual
void
undo
();
/**
* Redos this action.
*/
virtual
void
redo
();
private:
/**
* The vertex to add.
*/
osg
::
Vec3
m_vertex
;
/**
* The index of the fiber this vertex was added to.
*/
size_t
m_fiberIdx
;
/**
* The position of the vertex in the vertices vector.
*/
size_t
m_position
;
/**
* The WFiberHandler of the action.
*/
WFiberHandler
*
m_fiberHandler
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment