PeriDyno 1.0.0
Loading...
Searching...
No Matches
PointPickerNode.cpp
Go to the documentation of this file.
1#include "PointPickerNode.h"
5
6namespace dyno
7{
9
10 template<typename TDataType>
12 :Node()
13 {
14 auto pointInteractor = std::make_shared<PointInteraction<TDataType>>();
15
16 this->inTopology()->connect(pointInteractor->inInitialPointSet());
17
18 this->varInteractionRadius()->connect(pointInteractor->varInteractionRadius());
19
20 this->statePointIndex()->connect(pointInteractor->outPointIndex());
21
22 this->varToggleIndexOutput()->connect(pointInteractor->varToggleIndexOutput());
23
25
26 this->graphicsPipeline()->pushModule(pointInteractor);
27
28 auto pointRender1 = std::make_shared<GLPointVisualModule>();
29 this->varPointSelectedSize()->connect(pointRender1->varPointSize());
30 pointRender1->setColor(Color(1.0f, 0.0f, 0.0f));
31 this->pointInteractor->outSelectedPointSet()->connect(pointRender1->inPointSet());
32 this->graphicsPipeline()->pushModule(pointRender1);
33
34 auto pointRender2 = std::make_shared<GLPointVisualModule>();
35 this->varPointOtherSize()->connect(pointRender2->varPointSize());
36 pointRender2->setColor(Color(0.0f, 0.0f, 1.0f));
37 this->pointInteractor->outOtherPointSet()->connect(pointRender2->inPointSet());
38 this->graphicsPipeline()->pushModule(pointRender2);
39
40 this->varInteractionRadius()->setRange(0.001f , 0.2f);
41 this->varInteractionRadius()->setValue(0.01f);
42 this->varPointSelectedSize()->setRange(0.0f, 0.1f);
43 this->varPointOtherSize()->setRange(0.0f,0.1f);
44
45 auto callback2 = std::make_shared<FCallBackFunc>(std::bind(&PointPickerNode<TDataType>::changePickingType, this));
46
47 this->varPickingType()->attach(callback2);
48
49 auto callback3 = std::make_shared<FCallBackFunc>(std::bind(&PointPickerNode<TDataType>::changeMultiSelectionType, this));
50
51 this->varMultiSelectionType()->attach(callback3);
52
53 this->pointInteractor->outPointIndex()->allocate();
54 }
55
56 template<typename TDataType>
60
61 template<typename TDataType>
63 {
64 return "Interaction";
65 }
66
67 template<typename TDataType>
69 {
70// this->inTopology()->getDataPtr()->update();
71 this->pointInteractor->outPointIndex()->allocate();
72
73 this->pointInteractor->outOtherPointSet()->setDataPtr(std::make_shared<PointSet<TDataType>>());
74 this->pointInteractor->outSelectedPointSet()->setDataPtr(std::make_shared<PointSet<TDataType>>());
75 this->pointInteractor->outOtherPointSet()->getDataPtr()->copyFrom(this->inTopology()->getData());
76 }
77
78 template<typename TDataType>
80 {
81 if (this->varPickingType()->getValue() == PickingTypeSelection::Click)
82 {
83 this->pointInteractor->varPointPickingType()->getDataPtr()->setCurrentKey(0);
84 }
85 else if (this->varPickingType()->getValue() == PickingTypeSelection::Drag)
86 {
87 this->pointInteractor->varPointPickingType()->getDataPtr()->setCurrentKey(1);
88 }
89 else if (this->varPickingType()->getValue() == PickingTypeSelection::Both)
90 {
91 this->pointInteractor->varPointPickingType()->getDataPtr()->setCurrentKey(2);
92 }
94 }
95
96 template<typename TDataType>
98 {
99 if (this->varMultiSelectionType()->getValue() == MultiSelectionType::OR)
100 {
101 this->pointInteractor->varMultiSelectionType()->getDataPtr()->setCurrentKey(0);
102 }
103 else if (this->varMultiSelectionType()->getValue() == MultiSelectionType::XOR)
104 {
105 this->pointInteractor->varMultiSelectionType()->getDataPtr()->setCurrentKey(1);
106 }
107 else if (this->varMultiSelectionType()->getValue() == MultiSelectionType::C)
108 {
109 this->pointInteractor->varMultiSelectionType()->getDataPtr()->setCurrentKey(2);
110 }
111 }
112
114}
#define DEFINE_CLASS(name)
Definition Object.h:140
#define IMPLEMENT_TCLASS(name, T1)
Definition Object.h:103
std::shared_ptr< GraphicsPipeline > graphicsPipeline()
Definition Node.cpp:320
std::shared_ptr< PointInteraction< TDataType > > pointInteractor
void resetStates() override
A PointSet stores the coordinates for a set of independent points.
Definition PointSet.h:8
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25