本文整理汇总了C++中ShapeList::IndexOf方法的典型用法代码示例。如果您正苦于以下问题:C++ ShapeList::IndexOf方法的具体用法?C++ ShapeList::IndexOf怎么用?C++ ShapeList::IndexOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShapeList
的用法示例。
在下文中一共展示了ShapeList::IndexOf方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsAncestor
bool wxSFShapeBase::IsAncestor(wxSFShapeBase *child)
{
ShapeList lstChildren;
GetChildShapes( NULL, lstChildren, sfRECURSIVE );
return ( lstChildren.IndexOf(child) != wxNOT_FOUND );
}
示例2: IsDescendant
bool wxSFShapeBase::IsDescendant(wxSFShapeBase *parent)
{
ShapeList lstChildren;
if( parent ) parent->GetChildShapes( NULL, lstChildren, sfRECURSIVE );
return ( lstChildren.IndexOf(this) != wxNOT_FOUND );
}
示例3: 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);
}
}
示例4: _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();
}
}
}
示例5: _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();
}
}
}
示例6: _OnKey
void wxSFShapeBase::_OnKey(int key)
{
if(!m_pParentManager)return;
wxSFShapeCanvas *pCanvas = GetShapeManager()->GetShapeCanvas();
if(!pCanvas)return;
if( m_fVisible && m_fActive )
{
double dx = 1, dy = 1;
bool fRefreshAll = false;
wxRect prevBB;
if( pCanvas->ContainsStyle(wxSFShapeCanvas::sfsGRID_USE) )
{
dx = pCanvas->GetGrid().x;
dy = pCanvas->GetGrid().y;
}
ShapeList lstSelection;
pCanvas->GetSelectedShapes(lstSelection);
if((lstSelection.GetCount() > 1) && (lstSelection.IndexOf(this) != wxNOT_FOUND))
{
fRefreshAll = true;
}
if(!fRefreshAll)
{
GetCompleteBoundingBox(prevBB, bbSELF | bbCONNECTIONS | bbCHILDREN | bbSHADOW);
}
if(this->OnKey(key))
{
switch(key)
{
case WXK_LEFT:
if(ContainsStyle(sfsPOSITION_CHANGE))this->MoveBy(-dx, 0);
break;
case WXK_RIGHT:
if(ContainsStyle(sfsPOSITION_CHANGE))this->MoveBy(dx, 0);
break;
case WXK_UP:
if(ContainsStyle(sfsPOSITION_CHANGE))this->MoveBy(0, -dy);
break;
case WXK_DOWN:
if(ContainsStyle(sfsPOSITION_CHANGE))this->MoveBy(0, dy);
break;
}
}
if(!fRefreshAll)
{
wxRect currBB;
GetCompleteBoundingBox(currBB, bbSELF | bbCONNECTIONS | bbCHILDREN | bbSHADOW);
prevBB.Union(currBB);
Refresh(prevBB, sfDELAYED);
}
else
pCanvas->Refresh(false);
}
}