![]() ![]() |
||
Steps: 1. Create new shape with: void CDynaGraphView::OnFoAddNewpage() { // TODO: Add your command handler code here CFORoundRectShape * pNode1 = NULL; if(m_pCurRunModelHitShape != NULL) { if(m_pCurRunModelHitShape->IsKindOf(RUNTIME_CLASS(CFOLinkShape))) { CFOLinkShape *pLink = (CFOLinkShape *)(m_pCurRunModelHitShape); pNode1 = (CFORoundRectShape *)pLink->GetFromPort()->GetParentComp(); } else { pNode1 = (CFORoundRectShape *)m_pCurRunModelHitShape; } } else { AfxMessageBox(_T("Please select a root node for adding at first!"), MB_OK|MB_ICONINFORMATION); return; } CFORoundRectShape * pNode2 = CreateNode(); m_pCurRunModelHitShape = pNode1; if(pNode1 != NULL && pNode2 != NULL) { switch(theApp.m_nLinkType) { case 0: { AddLinkShapeNoUndo(pNode1, pNode2, FO_COMP_LINK, 1); } break; case 1: { AddLinkShapeNoUndo(pNode1, pNode2, FO_COMP_UPRIGHTLINK, 1); } break; case 2: { AddLinkShapeNoUndo(pNode1, pNode2, FO_COMP_BEZIERLINK, 1); } break; } if(theApp.m_bHorz) { AfxGetApp()->BeginWaitCursor(); CFOPHorzLayout layout1; layout1.m_nLayerSpace = 160; layout1.Initialize(GetCurrentModel(), *GetCurrentModel()->GetFormObjects()); layout1.DoLayout(); AfxGetApp()->EndWaitCursor(); } else { AfxGetApp()->BeginWaitCursor(); CFOPVertLayout layout1; layout1.m_nLayerSpace = 160; layout1.Initialize(GetCurrentModel(), *GetCurrentModel()->GetFormObjects()); layout1.DoLayout(); AfxGetApp()->EndWaitCursor(); } CMainFrame *pParent = STATIC_DOWNCAST(CMainFrame,AfxGetMainWnd()); ASSERT_VALID(pParent); // if(pParent->IsWindowVisible()) { pParent->m_wndTableBar.InitShapes(GetCurrentModel()); } } } 2. Layout nodes: void CNewVisualProxy::GenerateDefaultPorts(CArray<FOP_PortScale,FOP_PortScale>* mpSpot) { mpSpot->RemoveAll(); FOP_PortScale m_Scale; m_Scale.xScale = 0.5; m_Scale.yScale = 0.5; mpSpot->SetSize(1); mpSpot->SetAt(0,m_Scale); }
|
Copyright ?1998-2007 UCanCode.Net Software, all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.
Please direct your questions or comments to webmaster@ucancode.com