本文整理汇总了C++中ShapeList::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ ShapeList::Append方法的具体用法?C++ ShapeList::Append怎么用?C++ ShapeList::Append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShapeList
的用法示例。
在下文中一共展示了ShapeList::Append方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAssignedConnections
void wxSFDiagramManager::GetAssignedConnections(wxSFShapeBase* parent, wxClassInfo* shapeInfo, wxSFShapeBase::CONNECTMODE mode, ShapeList& lines)
{
wxSFLineShape* pLine;
if( parent->GetId() == -1 ) return;
SerializableList lstLines;
// lines are children of root item only so we have not to search recursively...
GetRootItem()->GetChildren( shapeInfo, lstLines );
if( !lstLines.IsEmpty() )
{
SerializableList::compatibility_iterator node = lstLines.GetFirst();
while(node)
{
pLine = (wxSFLineShape*)node->GetData();
switch(mode)
{
case wxSFShapeBase::lineSTARTING:
if( pLine->GetSrcShapeId() == parent->GetId() ) lines.Append(pLine);
break;
case wxSFShapeBase::lineENDING:
if( pLine->GetTrgShapeId() == parent->GetId() ) lines.Append(pLine);
break;
case wxSFShapeBase::lineBOTH:
if( ( pLine->GetSrcShapeId() == parent->GetId() ) ||
( pLine->GetTrgShapeId() == parent->GetId() ) ) lines.Append(pLine);
break;
}
node = node->GetNext();
}
}
}
示例2: OnDnDStart
void DbViewerPanel::OnDnDStart(wxTreeEvent& event)
{
ShapeList lstDnD;
lstDnD.DeleteContents(true);
DbItem* item = (DbItem*)m_treeDatabases->GetItemData(event.GetItem());
ErdPanel* pPanel = wxDynamicCast(m_mgr->GetActivePage(), ErdPanel);
if(item != NULL) {
if(pPanel) {
Table* table = wxDynamicCast(item->GetData(), Table);
if(table) {
table = (Table*)table->Clone();
wxSFShapeBase* pShape = new dndTableShape(table);
lstDnD.Append(pShape);
pPanel->GetCanvas()->DoDragDrop(lstDnD);
}
View* view = wxDynamicCast(item->GetData(), View);
if(view) {
view = (View*)view->Clone();
wxSFShapeBase* pShape = new dndTableShape(view);
lstDnD.Append(pShape);
pPanel->GetCanvas()->DoDragDrop(lstDnD);
}
}
}
}
示例3: FindTransWithIdenticalActions
void udStateChartOptimizer::FindTransWithIdenticalActions(ShapeList& transitions, ShapeList& sublist)
{
sublist.Clear();
ShapeList::compatibility_iterator node = transitions.GetFirst();
if( !node ) return;
udTransElementItem *pTransElement;
wxSFLineShape *pTrans = (wxSFLineShape*)node->GetData();
wxString sActions, sTemplate = ((udTransElementItem*)pTrans->GetUserData())->GetActionsString();
sTemplate.Replace(wxT(" "), wxT(""));
while(node)
{
pTrans = (wxSFLineShape*)node->GetData();
pTransElement = (udTransElementItem*)pTrans->GetUserData();
sActions = pTransElement->GetActionsString();
sActions.Replace(wxT(" "), wxT(""));
if( sActions == sTemplate )
{
node = node->GetNext();
transitions.DeleteObject(pTrans);
sublist.Append(pTrans);
}
else
node = node->GetNext();
}
}
示例4: RemoveShape
void wxSFDiagramManager::RemoveShape(wxSFShapeBase* shape, bool refresh)
{
if(shape)
{
wxSFShapeBase *pParent = shape->GetParentShape();
// remove connected lines (to all children)
ShapeList lstChildren;
ShapeList lstConnections;
ShapeList lstRemovedConnections;
// get all shape's children
shape->GetChildShapes(sfANY, lstChildren, sfRECURSIVE);
lstChildren.Append(shape);
// retrieve all assigned lines
ShapeList::compatibility_iterator snode = lstChildren.GetFirst();
while(snode)
{
GetAssignedConnections(snode->GetData(), CLASSINFO(wxSFLineShape), wxSFShapeBase::lineBOTH, lstConnections);
snode = snode->GetNext();
}
// remove all assigne lines
ShapeList::compatibility_iterator node = lstConnections.GetFirst();
while(node)
{
// one connection may be used by the parent and also by his child
if(lstRemovedConnections.IndexOf(node->GetData()) == wxNOT_FOUND)
{
lstRemovedConnections.Append(node->GetData());
RemoveShape(node->GetData(), false);
}
node = node->GetNext();
}
// remove the shape also from m_lstCurrentShapes list
if( m_pShapeCanvas ) m_pShapeCanvas->RemoveFromTemporaries( shape );
// remove the shape
RemoveItem(shape);
if( pParent ) pParent->Update();
if( refresh && m_pShapeCanvas ) m_pShapeCanvas->Refresh(false);
}
}
示例5: GetShapesInside
void wxSFDiagramManager::GetShapesInside(const wxRect& rct, ShapeList& shapes)
{
shapes.Clear();
wxSFShapeBase* pShape;
ShapeList lstShapes;
GetShapes(CLASSINFO(wxSFShapeBase), lstShapes);
ShapeList::compatibility_iterator node = lstShapes.GetFirst();
while(node)
{
pShape = node->GetData();
if(pShape->IsVisible() && pShape->IsActive() && pShape->Intersects(rct))shapes.Append(pShape);
node = node->GetNext();
}
}
示例6: GetShapesAtPosition
void wxSFDiagramManager::GetShapesAtPosition(const wxPoint& pos, ShapeList& shapes)
{
shapes.Clear();
wxSFShapeBase *pShape;
ShapeList lstShapes;
GetShapes(CLASSINFO(wxSFShapeBase), lstShapes);
ShapeList::compatibility_iterator node = lstShapes.GetFirst();
while(node)
{
pShape = node->GetData();
if(pShape->IsVisible() && pShape->IsActive() && pShape->Contains(pos))shapes.Append(pShape);
node = node->GetNext();
}
}
示例7: FindTransWithIdenticalTarget
void udStateChartOptimizer::FindTransWithIdenticalTarget(ShapeList& transitions, ShapeList& sublist)
{
sublist.Clear();
ShapeList::compatibility_iterator node = transitions.GetFirst();
if( !node ) return;
wxSFLineShape *pTrans = (wxSFLineShape*)node->GetData();
int nTrgId = pTrans->GetTrgShapeId();
while(node)
{
pTrans = (wxSFLineShape*)node->GetData();
if( pTrans->GetTrgShapeId() == nTrgId )
{
node = node->GetNext();
transitions.DeleteObject(pTrans);
sublist.Append(pTrans);
}
else
node = node->GetNext();
}
}
示例8: _GetNeighbours
void wxSFShapeBase::_GetNeighbours(ShapeList& neighbours, wxClassInfo *shapeInfo, CONNECTMODE condir, bool direct)
{
//wxASSERT(m_pParentManager);
if( m_pParentManager )
{
if( m_lstProcessed.IndexOf(this) != wxNOT_FOUND )return;
ShapeList lstConnections;
wxSFLineShape *pLine;
wxSFShapeBase *pOposite = NULL;
GetAssignedConnections(shapeInfo, condir, lstConnections);
// find oposite shpes in direct branches
ShapeList::compatibility_iterator node = lstConnections.GetFirst();
while(node)
{
pLine = (wxSFLineShape*)node->GetData();
switch(condir)
{
case lineSTARTING:
pOposite = GetShapeManager()->FindShape(pLine->GetTrgShapeId());
break;
case lineENDING:
pOposite = GetShapeManager()->FindShape(pLine->GetSrcShapeId());
break;
case lineBOTH:
{
if(GetId() == pLine->GetSrcShapeId())pOposite = GetShapeManager()->FindShape(pLine->GetTrgShapeId());
else
pOposite = GetShapeManager()->FindShape(pLine->GetSrcShapeId());
}
}
// add oposite shape to the list (if applicable)
if(pOposite && !pOposite->IsKindOf(CLASSINFO(wxSFLineShape)) && ( neighbours.IndexOf(pOposite) == wxNOT_FOUND )) neighbours.Append(pOposite);
// find next shapes
if( !direct && pOposite )
{
// in the case of indirect branches we must differentiate between connections
// and ordinary shapes
m_lstProcessed.Append(this);
if( pOposite->IsKindOf(CLASSINFO(wxSFLineShape)) )
{
pLine = (wxSFLineShape*)pOposite;
switch(condir)
{
case lineSTARTING:
{
pOposite = GetShapeManager()->FindShape( pLine->GetSrcShapeId() );
if( pOposite->IsKindOf(CLASSINFO(wxSFLineShape)) )pOposite->_GetNeighbours(neighbours, shapeInfo, condir, direct);
else if( neighbours.IndexOf(pOposite) == wxNOT_FOUND )neighbours.Append(pOposite);
}
break;
case lineENDING:
{
pOposite = GetShapeManager()->FindShape( pLine->GetTrgShapeId() );
if( pOposite->IsKindOf(CLASSINFO(wxSFLineShape)) )pOposite->_GetNeighbours(neighbours, shapeInfo, condir, direct);
else if( neighbours.IndexOf(pOposite) == wxNOT_FOUND )neighbours.Append(pOposite);
}
break;
case lineBOTH:
{
pOposite = GetShapeManager()->FindShape( pLine->GetSrcShapeId() );
if( pOposite->IsKindOf(CLASSINFO(wxSFLineShape)) )pOposite->_GetNeighbours(neighbours, shapeInfo, condir, direct);
else if( neighbours.IndexOf(pOposite) == wxNOT_FOUND )neighbours.Append(pOposite);
pOposite = GetShapeManager()->FindShape( pLine->GetTrgShapeId() );
if( pOposite->IsKindOf(CLASSINFO(wxSFLineShape)) )pOposite->_GetNeighbours(neighbours, shapeInfo, condir, direct);
else if( neighbours.IndexOf(pOposite) == wxNOT_FOUND )neighbours.Append(pOposite);
}
break;
}
}
else
pLine->_GetNeighbours(neighbours, shapeInfo, condir, direct);
}
node = node->GetNext();
}
}
}
示例9: _GetCompleteBoundingBox
void wxSFShapeBase::_GetCompleteBoundingBox(wxRect &rct, int mask)
{
//wxASSERT(m_pParentManager);
if(!m_pParentManager)return;
if( m_lstProcessed.IndexOf(this) != wxNOT_FOUND )return;
else
m_lstProcessed.Append(this);
ShapeList lstChildren;
//SerializableList lstConnections;
// firts, get bounding box of the current shape
if(mask & bbSELF)
{
if(rct.IsEmpty())rct = this->GetBoundingBox().Inflate( abs(m_nHBorder), abs(m_nVBorder) );
else
rct.Union(this->GetBoundingBox().Inflate( abs(m_nHBorder), abs(m_nVBorder)) );
// add also shadow offset if neccessary
if( (mask & bbSHADOW) && (m_nStyle & sfsSHOW_SHADOW) && GetParentCanvas() )
{
wxRealPoint nOffset = GetParentCanvas()->GetShadowOffset();
if( nOffset.x < 0 )
{
rct.SetX(rct.GetX() + (int)nOffset.x);
rct.SetWidth(rct.GetWidth() - (int)nOffset.x);
}
else
rct.SetWidth(rct.GetWidth() + (int)nOffset.x);
if( nOffset.y < 0 )
{
rct.SetY(rct.GetY() + (int)nOffset.y);
rct.SetHeight(rct.GetHeight() - (int)nOffset.y);
}
else
rct.SetHeight(rct.GetHeight() + (int)nOffset.y);;
}
}
else
mask |= bbSELF;
// get list of all connection lines assigned to the shape and find their child shapes
if(mask & bbCONNECTIONS)
{
wxSFShapeBase *pLine;
ShapeList lstLines;
GetAssignedConnections( CLASSINFO(wxSFLineShape), lineBOTH, lstLines );
ShapeList::compatibility_iterator node = lstLines.GetFirst();
while(node)
{
pLine = node->GetData();
//rct.Union(pLine->GetBoundingBox());
lstChildren.Append(pLine);
// get children of the connections
pLine->GetChildShapes(sfANY, lstChildren);
node = node->GetNext();
}
}
// get children of this shape
if(mask & bbCHILDREN)
{
this->GetChildShapes(sfANY, lstChildren, sfNORECURSIVE);
// now, call this function for all children recursively...
ShapeList::compatibility_iterator node = lstChildren.GetFirst();
while(node)
{
node->GetData()->_GetCompleteBoundingBox(rct, mask);
node = node->GetNext();
}
}
}