本文整理汇总了C++中ShapeList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ ShapeList::begin方法的具体用法?C++ ShapeList::begin怎么用?C++ ShapeList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShapeList
的用法示例。
在下文中一共展示了ShapeList::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnShowComments
void DatabaseCanvas::OnShowComments(wxCommandEvent &WXUNUSED(event))
{
ShapeList list;
m_showComments = !m_showComments;
m_pManager.GetShapes( CLASSINFO( CommentFieldShape ), list );
for( ShapeList::iterator it = list.begin(); it != list.end(); ++it )
{
CommentFieldShape *shape = wxDynamicCast( (*it), CommentFieldShape );
if( m_showComments )
{
shape->SetText( const_cast<Field *>( shape->GetFieldForComment() )->GetComment() );
}
else
{
shape->SetText( wxEmptyString );
}
}
Refresh();
list.clear();
m_pManager.GetShapes( CLASSINFO( CommentTableShape ), list );
for( ShapeList::iterator it = list.begin(); it != list.end(); ++it )
{
CommentTableShape *shape = wxDynamicCast( (*it), CommentTableShape );
if( m_showComments )
{
shape->SetText( const_cast<DatabaseTable *>( shape->GetDatabaseTable() )->GetComment() );
}
else
{
shape->SetText( wxEmptyString );
}
}
Refresh();
}
示例2: ProcessElement
void udCPPClassElementProcessor::ProcessElement(wxSFShapeBase *element)
{
// check existing parent generator
wxASSERT(m_pParentGenerator);
if(!m_pParentGenerator) return;
wxASSERT(element);
if(!element) return;
udClassElementItem *pClass = (udClassElementItem*) udPROJECT::GetDiagramElement( element, udfOMIT_LINKS );
if( !pClass || !pClass->IsGenerated() ) return;
udClassAlgorithm *pAlg = (udClassAlgorithm*) m_pParentGenerator->GetActiveAlgorithm();
// check whether the class is already processed
if( pAlg->GetProcessedElements().IndexOf(element) != wxNOT_FOUND ) return;
// process child classes recursivelly first
ShapeList lstBases;
umlClassDiagram::GetOuterClasses( (umlClassItem*)element, lstBases );
for( ShapeList::iterator it = lstBases.begin(); it != lstBases.end(); ++it )
{
ProcessElement( *it );
}
switch( pAlg->GetGenMode() )
{
case udGenerator::genDECLARATION:
ProcessClassDeclaration( element );
break;
case udGenerator::genDEFINITION:
ProcessClassDefinition( element );
break;
default:
break;
}
// process template bindings
ShapeList lstConnections;
element->GetShapeManager()->GetAssignedConnections( element, CLASSINFO(umlTemplateBindItem), wxSFShapeBase::lineSTARTING, lstConnections );
for( ShapeList::iterator it = lstConnections.begin(); it != lstConnections.end(); ++it )
{
udElementProcessor *pProcessor = pAlg->GetElementProcessor((*it)->GetClassInfo()->GetClassName());
if(pProcessor)
{
pProcessor->ProcessElement(*it);
}
}
// set the state as processes
pAlg->GetProcessedElements().Append(element);
}
示例3: GetBoundingBox
wxRect wxSFLayoutAlgorithm::GetBoundingBox(const ShapeList& shapes)
{
wxRect rctBB;
for( ShapeList::const_iterator it = shapes.begin(); it != shapes.end(); ++ it )
{
wxSFShapeBase *pShape = *it;
if( it == shapes.begin() ) rctBB = pShape->GetBoundingBox();
else
rctBB.Union( pShape->GetBoundingBox() );
}
return rctBB;
}
示例4: DoLayout
void wxSFLayoutMesh::DoLayout(ShapeList& shapes)
{
int i = 0, cols = floor( sqrt( (float)shapes.GetCount() ) );
double roffset, coffset, maxh = -m_HSpace;
roffset = coffset = 0;
wxRealPoint nStart = GetTopLeft( shapes );
for( ShapeList::iterator it = shapes.begin(); it != shapes.end(); ++ it )
{
wxSFShapeBase *pShape = *it;
if( i++ % cols == 0 )
{
coffset = 0;
roffset += maxh + m_HSpace;
maxh = 0;
}
pShape->MoveTo( nStart.x + coffset, nStart.y + roffset );
wxRect rctBB = pShape->GetBoundingBox();
coffset += rctBB.GetWidth() + m_VSpace;
if( rctBB.GetHeight() > maxh ) maxh = rctBB.GetHeight();
}
}
示例5: OnInit
void TableSettings::OnInit(wxInitDialogEvent& event)
{
m_textName->SetValue( m_pTable->GetName() );
// fill database data types
wxArrayString* pDbTypes = m_pDbAdapter->GetDbTypes();
if( pDbTypes ) {
wxArrayString choices;
for (unsigned int i = 0; i < pDbTypes->GetCount(); ++i) {
choices.Add( pDbTypes->Item(i) );
}
m_dvColumns->DeleteColumn( m_dvColumns->GetColumn(1) );
m_dvColumns->InsertColumn( 1, new wxDataViewColumn( _("Type"), new wxDataViewChoiceRenderer( choices, wxDATAVIEW_CELL_EDITABLE, wxDVR_DEFAULT_ALIGNMENT), 1, -2, wxALIGN_LEFT));
pDbTypes->Clear();
delete pDbTypes;
}
// fill referenced tables
ShapeList tables;
m_choiceRefTable->Append( wxT("") );
m_pDiagramManager->GetShapes( CLASSINFO(ErdTable), tables );
for( ShapeList::iterator it = tables.begin(); it != tables.end(); ++it ) {
Table *t = (Table*) (*it)->GetUserData();
if( t && t->GetName() != m_pTable->GetName() ) m_choiceRefTable->Append( t->GetName() );
}
UpdateView();
event.Skip();
}
示例6: ProcessNode
void wxSFLayoutHorizontalTree::ProcessNode(wxSFShapeBase* node, double x)
{
wxASSERT( node );
if( node )
{
node->MoveTo( x, m_nMinY );
wxRect rctBB = node->GetBoundingBox();
if( rctBB.GetHeight() > m_nCurrMaxHeight ) m_nCurrMaxHeight = rctBB.GetHeight();
ShapeList lstNeighbours;
node->GetNeighbours( lstNeighbours, CLASSINFO(wxSFShapeBase), wxSFShapeBase::lineSTARTING );
if( lstNeighbours.IsEmpty() )
{
m_nMinY += m_nCurrMaxHeight + m_VSpace;
}
else
{
for( ShapeList::iterator it = lstNeighbours.begin(); it != lstNeighbours.end(); ++it )
{
if( ! (*it)->GetParentShape() ) ProcessNode( *it, x + rctBB.GetWidth() + m_HSpace );
}
}
}
}
示例7: GetRefTable
Table* TableSettings::GetRefTable(const wxString& name)
{
ShapeList tables;
m_pDiagramManager->GetShapes( CLASSINFO(ErdTable), tables );
for( ShapeList::iterator it = tables.begin(); it != tables.end(); ++it ) {
Table *t = (Table*) (*it)->GetUserData();
if( t->GetName() == name ) return t;
}
return NULL;
}
示例8: IsTableDisplayed
bool DatabaseCanvas::IsTableDisplayed(const std::wstring &name)
{
ShapeList listShapes;
m_pManager.GetShapes( CLASSINFO( MyErdTable ), listShapes );
bool found = false;
for( ShapeList::iterator it = listShapes.begin(); it != listShapes.end() && !found; ++it )
{
if( dynamic_cast<MyErdTable *>( (*it) )->GetTableName() == name )
found = true;
}
return found;
}
示例9: RefteshTotalData
void shapeGroup::RefteshTotalData()
{
ShapeList TMPShapeList = SG_ShapeData;
ShapeList::iterator SG_ShapeData_Iterator = TMPShapeList.begin();
SG_Size = TMPShapeList.size();
const int VAOSize = SG_Size * 12;
const int ItemSize = SG_Size * 20;
GLfloat* SG_TmpTotalData = (GLfloat*)malloc(sizeof(GLfloat) * ItemSize);
if (SG_TmpTotalData == nullptr)
{
std::cout << "[Warning]Can't malloc(" << sizeof(GLfloat) * ItemSize << ")" << std::endl;
return;
}
//start to copy
for (int LoopShapeNumber = 0; LoopShapeNumber < SG_Size; LoopShapeNumber++)
{
//VAO
SG_TmpTotalData[LoopShapeNumber * 12 + 0] = SG_ShapeData_Iterator->Shape->VAO_Data[0] + SG_ShapeData_Iterator->Location[0];
SG_TmpTotalData[LoopShapeNumber * 12 + 1] = SG_ShapeData_Iterator->Shape->VAO_Data[1] + SG_ShapeData_Iterator->Location[1];
SG_TmpTotalData[LoopShapeNumber * 12 + 2] = SG_ShapeData_Iterator->Shape->VAO_Data[2] + SG_ShapeData_Iterator->Location[2];
SG_TmpTotalData[LoopShapeNumber * 12 + 3] = SG_ShapeData_Iterator->Shape->VAO_Data[3] + SG_ShapeData_Iterator->Location[0];
SG_TmpTotalData[LoopShapeNumber * 12 + 4] = SG_ShapeData_Iterator->Shape->VAO_Data[4] + SG_ShapeData_Iterator->Location[1];
SG_TmpTotalData[LoopShapeNumber * 12 + 5] = SG_ShapeData_Iterator->Shape->VAO_Data[5] + SG_ShapeData_Iterator->Location[2];
SG_TmpTotalData[LoopShapeNumber * 12 + 6] = SG_ShapeData_Iterator->Shape->VAO_Data[6] + SG_ShapeData_Iterator->Location[0];
SG_TmpTotalData[LoopShapeNumber * 12 + 7] = SG_ShapeData_Iterator->Shape->VAO_Data[7] + SG_ShapeData_Iterator->Location[1];
SG_TmpTotalData[LoopShapeNumber * 12 + 8] = SG_ShapeData_Iterator->Shape->VAO_Data[8] + SG_ShapeData_Iterator->Location[2];
SG_TmpTotalData[LoopShapeNumber * 12 + 9] = SG_ShapeData_Iterator->Shape->VAO_Data[9] + SG_ShapeData_Iterator->Location[0];
SG_TmpTotalData[LoopShapeNumber * 12 + 10] = SG_ShapeData_Iterator->Shape->VAO_Data[10] + SG_ShapeData_Iterator->Location[1];
SG_TmpTotalData[LoopShapeNumber * 12 + 11] = SG_ShapeData_Iterator->Shape->VAO_Data[11] + SG_ShapeData_Iterator->Location[2];
//TexturePos
for (int i = 0; i < 8; i++)
{
SG_TmpTotalData[VAOSize + LoopShapeNumber * 8 + i] = SG_ShapeData_Iterator->Shape->TexturePos_Data[i];
}
SG_ShapeData_Iterator++;
}
SG_TotalData = SG_TmpTotalData;
SG_NeedRefreshBuffer = true;
SG_IsRefreshingData = false;
}
示例10: GetShapesExtent
wxSize wxSFLayoutAlgorithm::GetShapesExtent(const ShapeList& shapes)
{
int nTotalWidth = 0, nTotalHeight = 0;
for( ShapeList::const_iterator it = shapes.begin(); it != shapes.end(); ++ it )
{
wxRect rctBB = (*it)->GetBoundingBox();
nTotalWidth += rctBB.GetWidth();
nTotalHeight += rctBB.GetHeight();
}
return wxSize( nTotalWidth, nTotalHeight );
}
示例11: GetShapesCenter
wxRealPoint wxSFLayoutAlgorithm::GetShapesCenter(const ShapeList& shapes)
{
wxRealPoint nCenter;
for( ShapeList::const_iterator it = shapes.begin(); it != shapes.end(); ++ it )
{
nCenter = nCenter + (*it)->GetAbsolutePosition();
}
nCenter.x /= shapes.GetCount();
nCenter.y /= shapes.GetCount();
return nCenter;
}
示例12: GetTopLeft
wxRealPoint wxSFLayoutAlgorithm::GetTopLeft(const ShapeList& shapes)
{
double startx = INT_MAX, starty = INT_MAX;
for( ShapeList::const_iterator it = shapes.begin(); it != shapes.end(); ++ it )
{
wxSFShapeBase *pShape = *it;
wxRealPoint nPos = pShape->GetAbsolutePosition();
if( nPos.x < startx ) startx = nPos.x;
if( nPos.y < starty ) starty = nPos.y;
}
return wxRealPoint( startx, starty );
}
示例13: init
void Entity::init(const ShapeList & list, const MassProperties mass, const Transform t){
std::vector< ::std::pair<size_t, Transform> > shapes;
size_t compound;
//Create the shapes
for_each(list.begin(), list.end(), [&](const ShapeList::value_type & shape){
switch(shape.first.type){
case E_CAPSULE:
case E_SPHERE:
case E_BOX:
case E_PLANE:
{
size_t s = createShape(
shape.first.type,
Math::Vec4ToVec3(shape.first.data),
Math::VecLast(shape.first.data)
);
Transform t = shape.second;
::std::pair<size_t, Transform> p(s,t);
shapes.push_back(p);
}
break;
case E_MESH:
{
size_t s = createShape(
shape.first.type,
shape.first.rawMesh
);
Transform t = shape.second;
::std::pair<size_t, Transform> p(s,t);
shapes.push_back(p);
}
break;
default:
{
throw "Not valid shape type!";
}
}
});
//Got a list of shapes, make the compound shape
compound = _world->compoundShapes(shapes);
//Put it back on with the compound object first
_shape_index.push_back(compound);
for_each(shapes.begin(),shapes.end(),[&](decltype(shapes)::value_type s){
_shape_index.push_back(s.first);
});
//create body
makeBody(t, mass);
}
示例14: AddQuickQueryFields
void DatabaseCanvas::AddQuickQueryFields(const wxString &tbl, std::vector<Field *> &quickSelectFields, bool quickSelect)
{
ShapeList shapes;
m_pManager.GetShapes( CLASSINFO( FieldShape ), shapes );
for( ShapeList::iterator it = shapes.begin (); it != shapes.end (); ++it )
{
auto fld = wxDynamicCast( (*it), FieldShape );
auto fieldName = wxDynamicCast( (*it), FieldShape )->GetField()->GetFieldName();
auto found = false;
for( std::vector<Field *>::iterator it2 = quickSelectFields.begin(); it2 < quickSelectFields.end() && !false; ++it2 )
{
if( (*it2)->GetFieldName() == fieldName )
{
found = true;
(*it)->Select( true );
dynamic_cast<DrawingView *>( m_view )->AddFieldToQuery( *fld, fld->IsSelected(), tbl.ToStdWstring(), quickSelect );
}
}
}
Refresh();
}
示例15: ProcessClassDeclaration
void udCPPClassElementProcessor::ProcessClassDeclaration(wxSFShapeBase* element)
{
udLanguage *pLang = m_pParentGenerator->GetActiveLanguage();
udClassAlgorithm *pAlg = (udClassAlgorithm*) m_pParentGenerator->GetActiveAlgorithm();
// get base classes if exists
ShapeList lstBases;
umlClassDiagram::GetBaseClasses( (umlClassItem*)element, lstBases );
int nTemplateIndex = 0;
wxString sBases;
for( ShapeList::iterator it = lstBases.begin(); it != lstBases.end(); ++it )
{
if( it != lstBases.begin() ) sBases << wxT(", ");
sBases << pLang->MakeValidIdentifier( udPROJECT::GetDiagramElement(*it)->GetName() );
// add template parameter if exists
umlClassTemplateItem *pTemplate = wxDynamicCast( *it, umlClassTemplateItem );
if( pTemplate )
{
// find corespondent template binding connection
ShapeList lstConnections;
element->GetShapeManager()->GetAssignedConnections( element, CLASSINFO(umlTemplateBindItem), wxSFShapeBase::lineSTARTING, lstConnections );
if( !lstConnections.IsEmpty() )
{
// append bind type to the base name
udTemplateBindElementItem *pBindElement = wxDynamicCast( udPROJECT::GetDiagramElement( lstConnections.Item(nTemplateIndex)->GetData() ), udTemplateBindElementItem );
if( pBindElement )
{
sBases << wxT("<") << pBindElement->GetBindType() << wxT(">");
}
}
nTemplateIndex++;
}
}
udClassElementItem *pClass = (udClassElementItem*) udPROJECT::GetDiagramElement(element);
//generate comment if requested
pLang->WriteCodeBlocks( udGenerator::GetComment( pClass, pLang) );
// write template definition if needed
udClassTemplateElementItem *pClassTempl = wxDynamicCast( pClass, udClassTemplateElementItem );
if( pClassTempl )
{
pLang->WriteCodeBlocks( wxT("template <typename ") + pClassTempl->GetTemplateName() + wxT(">") );
}
// generate class declaration
pLang->ClassDeclCmd( pLang->MakeValidIdentifier( pClass->GetName() ), sBases );
pLang->BeginCmd();
// declare class members
int nAccessType = 0;
wxClassInfo *pPrevType;
SerializableList lstMembers;
ShapeList lstAssocs;
while( pLang->GetAccessTypeString( (udLanguage::ACCESSTYPE) nAccessType ) != wxEmptyString )
{
pLang->WriteCodeBlocks( pLang->GetAccessTypeString( (udLanguage::ACCESSTYPE) nAccessType ) + wxT(":") );
pLang->IncIndentation();
lstMembers.Clear();
lstAssocs.Clear();
pPrevType = NULL;
// process associations
umlClassDiagram::GetClassAssociations( (umlClassItem*) element, CLASSINFO(wxSFLineShape), wxSFLineShape::lineSTARTING, (udLanguage::ACCESSTYPE) nAccessType, lstAssocs );
for( ShapeList::iterator it = lstAssocs.begin(); it != lstAssocs.end(); ++it )
{
udElementProcessor *pProcessor = pAlg->GetElementProcessor( (*it)->GetClassInfo()->GetClassName() );
if( pProcessor ) pProcessor->ProcessElement( *it );
}
// process class members
umlClassDiagram::GetClassMembers( (umlClassItem*) element, CLASSINFO(udMemberDataLinkItem), (udLanguage::ACCESSTYPE) nAccessType, lstMembers);
umlClassDiagram::GetClassMembers( (umlClassItem*) element, CLASSINFO(udMemberFunctionLinkItem), (udLanguage::ACCESSTYPE) nAccessType, lstMembers);
for( SerializableList::iterator it = lstMembers.begin(); it != lstMembers.end(); ++it )
{
if( pPrevType && ((*it)->GetClassInfo() != pPrevType) ) pLang->NewLine();
// generate comment
pLang->WriteCodeBlocks( udGenerator::GetComment( ((udCodeLinkItem*)*it)->GetOriginal(), pLang ) );
// generate function decl
pLang->WriteCodeBlocks( ((udCodeLinkItem*)*it)->ToString( udCodeItem::cfDECLARATION, pLang ) );
pPrevType = (*it)->GetClassInfo();
}
nAccessType++;
pLang->DecIndentation();
pLang->NewLine();
}
//.........这里部分代码省略.........