diff options
| author | jtx <javier.arraiza@marker.es> | 2013-03-22 10:53:13 +0000 |
|---|---|---|
| committer | jtx <javier.arraiza@marker.es> | 2013-03-22 10:53:13 +0000 |
| commit | 040f59a8c297ded96fc20318c5eb4985958d346c (patch) | |
| tree | a030e228d274beb3c7c255ef3c27cd9eb374a25f /src/ui/tool/node.cpp | |
| parent | Fixing node fault (diff) | |
| parent | Enabling Mesh (diff) | |
| download | inkscape-040f59a8c297ded96fc20318c5eb4985958d346c.tar.gz inkscape-040f59a8c297ded96fc20318c5eb4985958d346c.zip | |
Adding mesh
(bzr r11950.4.4)
Diffstat (limited to 'src/ui/tool/node.cpp')
| -rw-r--r-- | src/ui/tool/node.cpp | 58 |
1 files changed, 26 insertions, 32 deletions
diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 93b45bde7..3e4fbd508 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -110,15 +110,9 @@ Handle::Handle(NodeSharedData const &data, Geom::Point const &initial_pos, Node _handle_colors, data.handle_group), _parent(parent), _handle_line(ControlManager::getManager().createControlLine(data.handle_line_group)), - _degenerate(true),controlBsplineSteps(2) + _degenerate(true) { setVisible(false); - std::string strPathManipulatorName = "PathManipulator"; - if(std::string(typeid(_pm()).name()) == strPathManipulatorName) - isBSpline = _pm().isBSpline; - else - //Esto no es cierto realmente pero evita que casque al crear nodos - isBSpline = false; } Handle::~Handle() @@ -145,11 +139,10 @@ void Handle::move(Geom::Point const &new_pos) Handle *towards = node_towards ? node_towards->handleAwayFrom(_parent) : NULL; Handle *towards_second = node_towards ? node_towards->handleToward(_parent) : NULL; //BSpline - bool isBSpline = false; double pos = 0; Handle *h = NULL; Handle *h2 = NULL; - if(isBSpline){ + if(_pm().isBSpline){ typedef ControlPointSelection::Set Set; Set &nodes = _parent->_selection.allPoints(); for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { @@ -193,7 +186,7 @@ void Handle::move(Geom::Point const &new_pos) } setPosition(new_pos); //BSpline - if(isBSpline){ + if(_pm().isBSpline){ h = this; setPosition(_pm().BSplineHandleReposition(h)); pos = _pm().BSplineHandlePosition(h); @@ -232,7 +225,7 @@ void Handle::move(Geom::Point const &new_pos) } setPosition(new_pos); //BSpline - if(isBSpline){ + if(_pm().isBSpline){ h = this; setPosition(_pm().BSplineHandleReposition(h)); pos = _pm().BSplineHandlePosition(h); @@ -329,7 +322,7 @@ bool Handle::_eventHandler(SPEventContext *event_context, GdkEvent *event) //BSpline void Handle::handle_2button_press(){ - if(isBSpline){ + if(_pm().isBSpline){ Handle *h = NULL; Handle *h2 = NULL; double pos = 0; @@ -391,7 +384,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) } new_pos = result; //BSpline - if(isBSpline){ + if(_pm().isBSpline){ Handle *h = NULL; double pos = 0; h = this; @@ -403,7 +396,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) } std::vector<Inkscape::SnapCandidatePoint> unselected; - if (snap && ( (!held_control(*event) && isBSpline) || !isBSpline)) { + if (snap && ( (!held_control(*event) && _pm().isBSpline) || !_pm().isBSpline)) { ControlPointSelection::Set &nodes = _parent->_selection.allPoints(); for (ControlPointSelection::Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { Node *n = static_cast<Node*>(*i); @@ -585,12 +578,6 @@ Node::Node(NodeSharedData const &data, Geom::Point const &initial_pos) : _handles_shown(false) { // NOTE we do not set type here, because the handles are still degenerate - std::string strPathManipulatorName = "PathManipulator"; - if(std::string(typeid(_pm()).name()) == strPathManipulatorName) - isBSpline = _pm().isBSpline; - else - //Esto no es cierto realmente pero evita que casque al crear nodos - isBSpline = false; } Node const *Node::_next() const @@ -636,7 +623,7 @@ void Node::move(Geom::Point const &new_pos) Node *n = this; Node * nextNode = n->nodeToward(n->front()); Node * prevNode = n->nodeToward(n->back()); - if(isBSpline){ + if(_pm().isBSpline){ if(prevNode) prevPos = _pm().BSplineHandlePosition(prevNode->front()); pos = _pm().BSplineHandlePosition(n->front()); @@ -648,7 +635,7 @@ void Node::move(Geom::Point const &new_pos) //BSpline End setPosition(new_pos); //BSpline - if(isBSpline){ + if(_pm().isBSpline){ if(prevNode) prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),prevPos)); if(nextNode) @@ -662,7 +649,7 @@ void Node::move(Geom::Point const &new_pos) // with the segment _fixNeighbors(old_pos, new_pos); //BSpline - if(isBSpline){ + if(_pm().isBSpline){ Handle* front = &_front; Handle* back = &_back; _front.setPosition(_pm().BSplineHandleReposition(front,pos)); @@ -866,21 +853,28 @@ void Node::setType(NodeType type, bool update_handles) break; default: break; } + //BSpline + bool isBSpline = false; + try { + isBSpline = nodeList().subpathList().pm().isBSpline; + } + catch( char * str ) { + } + if(isBSpline){ + Handle* front = &_front; + Handle* back = &_back; + double pos = _pm().BSplineHandlePosition(front); + _front.setPosition(_pm().BSplineHandleReposition(front,pos)); + _back.setPosition(_pm().BSplineHandleReposition(back,pos)); + } + //BSpline End } _type = type; _setControlType(nodeTypeToCtrlType(_type)); updateState(); - //BSpline - if(isBSpline){ - Handle* front = &_front; - Handle* back = &_back; - double pos = _pm().BSplineHandlePosition(front); - _front.setPosition(_pm().BSplineHandleReposition(front,pos)); - _back.setPosition(_pm().BSplineHandleReposition(back,pos)); - } - //BSpline End + } void Node::pickBestType() |
