void wxSFLineShape::OnEndHandle(wxSFShapeHandle& handle) { // update percentual offset of the line's ending points wxSFShapeBase *pParent = GetParentCanvas()->GetShapeUnderCursor(); if( pParent ) { wxRect bbRect = pParent->GetBoundingBox(); switch( handle.GetType() ) { case wxSFShapeHandle::hndLINESTART: if( !m_fStandAlone && ( pParent->GetId() == m_nSrcShapeId ) ) { m_nSrcOffset.x = double(handle.GetPosition().x - bbRect.GetLeft()) / bbRect.GetWidth(); m_nSrcOffset.y = double(handle.GetPosition().y - bbRect.GetTop()) / bbRect.GetHeight(); } break; case wxSFShapeHandle::hndLINEEND: if( !m_fStandAlone && ( pParent->GetId() == m_nTrgShapeId ) ) { m_nTrgOffset.x = double(handle.GetPosition().x - bbRect.GetLeft()) / bbRect.GetWidth(); m_nTrgOffset.y = double(handle.GetPosition().y - bbRect.GetTop()) / bbRect.GetHeight(); } break; default: break; } } wxSFShapeBase::OnEndHandle(handle); }
void wxSFLineShape::OnHandle(wxSFShapeHandle& handle) { switch(handle.GetType()) { case wxSFShapeHandle::hndLINECTRL: { wxXS::RealPointList::compatibility_iterator node = m_lstPoints.Item(handle.GetId()); if(node) { wxRealPoint* pt = node->GetData(); pt->x = handle.GetPosition().x; pt->y = handle.GetPosition().y; } } break; case wxSFShapeHandle::hndLINEEND: { m_nUnfinishedPoint = handle.GetPosition(); if( m_fStandAlone ) m_nTrgPoint = Conv2RealPoint( handle.GetPosition() ); } break; case wxSFShapeHandle::hndLINESTART: { m_nUnfinishedPoint = handle.GetPosition(); if( m_fStandAlone ) m_nSrcPoint = Conv2RealPoint( handle.GetPosition() ); } break; default: break; } wxSFShapeBase::OnHandle( handle ); }
//************************************************** void wxSFBotLineShape::OnEndHandle(wxSFShapeHandle& handle) { wxSFShapeBase *pParent = GetParentCanvas()->GetShapeUnderCursor(); if( pParent ) { wxPoint lpos = /*wxSFShapeCanvas::DP2LP(*/handle.GetPosition()/*)*/; wxRect bbRect = pParent->GetBoundingBox(); int centr = bbRect.GetPosition().x + (bbRect.GetWidth()/2); switch( handle.GetType() ) { case wxSFShapeHandle::hndLINESTART: if( pParent->GetId() == m_nSrcShapeId ) { if(pParent->IsKindOf(CLASSINFO(wxSFIfShape))) { wxSFIfShape *ifShape = (wxSFIfShape*)pParent; wxSFBotLineShape* pLine; ShapeList m_lstLines; if(GetShapeManager()->GetShapes(CLASSINFO(wxSFBotLineShape), m_lstLines)) { ShapeList::compatibility_iterator node = m_lstLines.GetFirst(); while(node) { pLine = (wxSFBotLineShape*)node->GetData(); if(lpos.x <= centr) //True { if( (ifShape->GetId() == pLine->GetSrcShapeId()) && (pLine->GetCondition() == 1) ) return; } else if(lpos.x > centr) //False { if( (ifShape->GetId() == pLine->GetSrcShapeId()) && (pLine->GetCondition() == 0) ) return; } node = node->GetNext(); } } if(lpos.x <= centr) //True { SetCondition(1); } else if(lpos.x > centr) //False { SetCondition(0); } } } break; case wxSFShapeHandle::hndLINEEND: if( pParent->GetId() == m_nTrgShapeId ) { if(pParent->IsKindOf(CLASSINFO(wxSFIfShape))) { wxSFIfShape *ifShape = (wxSFIfShape*)pParent; wxSFBotLineShape* pLine; ShapeList m_lstLines; if(GetShapeManager()->GetShapes(CLASSINFO(wxSFBotLineShape), m_lstLines)) { ShapeList::compatibility_iterator node = m_lstLines.GetFirst(); while(node) { pLine = (wxSFBotLineShape*)node->GetData(); if( pLine->GetTrgShapeId() == pParent->GetId() ) return; node = node->GetNext(); } } } wxSFShapeBase* pSourceShape = GetShapeManager()->FindShape(m_nSrcShapeId); if(pSourceShape->IsKindOf(CLASSINFO(wxSFCycle))) { //if(pSourceShape = pShapeUnder->GetParentShape()) // return; } else { if(!pSourceShape->GetParentShape()) if(pParent->GetParentShape()) return; if(pSourceShape->GetParentShape()) if(!pParent->GetParentShape()) return; if(pSourceShape->GetParentShape()) if(pParent->GetParentShape()) if(pParent->GetParentShape() != pSourceShape->GetParentShape()) return; } if( !LineCanConnect(pParent) ) return; } break; default: break; } } wxSFLineShape::OnEndHandle(handle); }