void CoreWindow::setRestriction_Plane () { Data::Graph * currentGraph = Manager::GraphManager::getInstance()->getActiveGraph(); if (currentGraph != NULL) { osg::Vec3 position = viewerWidget->getPickHandler()->getSelectionCenter(true); osg::ref_ptr<Data::Node> node1 = currentGraph->addRestrictionNode (QString ("plane_node_1"), position); osg::ref_ptr<Data::Node> node2 = currentGraph->addRestrictionNode (QString ("plane_node_2"), position + osg::Vec3f (10, 0, 0)); osg::ref_ptr<Data::Node> node3 = currentGraph->addRestrictionNode (QString ("plane_node_3"), position + osg::Vec3f (0, 10, 0)); Layout::RestrictionRemovalHandler_RestrictionNodesRemover::NodesListType restrictionNodes; restrictionNodes.push_back (node1); restrictionNodes.push_back (node2); restrictionNodes.push_back (node3); setRestrictionToSelectedNodes ( QSharedPointer<Layout::ShapeGetter> ( new Layout::ShapeGetter_Plane_ByThreeNodes (node1, node2, node3) ), currentGraph, QSharedPointer<Layout::RestrictionRemovalHandler_RestrictionNodesRemover> ( new Layout::RestrictionRemovalHandler_RestrictionNodesRemover ( *currentGraph, restrictionNodes ) ) ); } }
void CoreWindow::setRestriction_Sphere () { Data::Graph * currentGraph = Manager::GraphManager::getInstance()->getActiveGraph(); if (currentGraph != NULL) { osg::Vec3 position = viewerWidget->getPickHandler()->getSelectionCenter(true); osg::ref_ptr<Data::Node> centerNode = currentGraph->addRestrictionNode (QString ("center"), position); osg::ref_ptr<Data::Node> surfaceNode = currentGraph->addRestrictionNode (QString ("surface"), position + osg::Vec3f (10, 0, 0)); Layout::RestrictionRemovalHandler_RestrictionNodesRemover::NodesListType restrictionNodes; restrictionNodes.push_back (centerNode); restrictionNodes.push_back (surfaceNode); setRestrictionToSelectedNodes ( QSharedPointer<Layout::ShapeGetter> ( new Layout::ShapeGetter_Sphere_ByTwoNodes (centerNode, surfaceNode) ), currentGraph, QSharedPointer<Layout::RestrictionRemovalHandler_RestrictionNodesRemover> ( new Layout::RestrictionRemovalHandler_RestrictionNodesRemover ( *currentGraph, restrictionNodes ) ) ); } }