25 #include "../controller/SelectOperation.h"
26 #include "../controller/DeselectOperation.h"
28 bool scene3D::SceneSelectionManager::createOperations =
true;
39 if (SceneSelectionManager::createOperations)
41 std::shared_ptr<std::vector<controller::OperationPtr> > operations(
new std::vector<controller::OperationPtr>());
47 operations->push_back(operation);
52 std::shared_ptr<std::vector<controller::OperationPtr> > operations(
new std::vector<controller::OperationPtr>());
68 if (SceneSelectionManager::createOperations)
70 std::shared_ptr<std::vector<controller::OperationPtr> > operations(
new std::vector<controller::OperationPtr>());
76 operations->push_back(operation);
81 std::shared_ptr<std::vector<controller::OperationPtr> > operations(
new std::vector<controller::OperationPtr>());
90 SoFullPath* p = (SoFullPath*)pick->getPath();
93 for (
int i = 0; i < p->getLength(); i++)
95 SoNode* n = p->getNode(i);
97 if (n->isOfType(SoTransformManip::getClassTypeId()))
110 for (
int i = 0; i < p->getLength(); i++)
112 SoNode* n = p->getNode(i);
114 if (n->isOfType(SceneObject::getClassTypeId()))
126 scene->selectionRootNode->setPickFilterCallback(
pickFilterCB, scene.get());
133 std::vector<scene3D::SceneObjectPtr> selectedObjects;
135 if (
ScenePtr scene = this->scene.lock())
137 for (
int i = 0; i < scene->selectionRootNode->getNumSelected(); i++)
139 SoPath* objectPath = scene->selectionRootNode->getPath(i);
143 SoNode* objectNode = objectPath->getNodeFromTail(0);
145 if (objectNode->isOfType(SceneObject::getClassTypeId()))
152 return selectedObjects;
157 if (
ScenePtr scene = this->scene.lock())
160 for (
int i = 0; i < scene->selectionRootNode->getNumSelected(); i++)
162 SoPath* objectPath = scene->selectionRootNode->getPath(i);
164 if (objectPath->containsNode(
object.get()))
176 if (
ScenePtr scene = this->scene.lock())
180 if (SceneSelectionManager::createOperations)
182 SceneSelectionManager::createOperations =
false;
183 scene->selectionRootNode->select(
object.get());
185 SceneSelectionManager::createOperations =
true;
189 scene->selectionRootNode->select(
object.get());
196 if (
ScenePtr scene = this->scene.lock())
200 if (SceneSelectionManager::createOperations)
202 SceneSelectionManager::createOperations =
false;
203 scene->selectionRootNode->deselect(
object.get());
205 SceneSelectionManager::createOperations =
true;
209 scene->selectionRootNode->select(
object.get());
218 this->addToSelection(
object);
226 this->removeFromSelection(
object);
230 void scene3D::SceneSelectionManager::storeHistory()
232 this->historySelected = this->getAllSelected();
235 void scene3D::SceneSelectionManager::restoreHistory()
239 this->addToSelection(
object);
245 if (
ScenePtr scene = this->scene.lock())
247 scene->selectionRootNode->deselectAll();
253 if (
ScenePtr scene = this->scene.lock())
256 if (scene->selectionRootNode->getNumSelected() > 0)
258 SoPath* objectPath = scene->selectionRootNode->getPath(scene->selectionRootNode->getNumSelected() - 1);
262 SoNode* objectNode = objectPath->getNodeFromTail(0);
273 SceneSelectionManager::createOperations = enable;
278 return SceneSelectionManager::createOperations;