本文整理汇总了C++中ArrayT::PushBack方法的典型用法代码示例。如果您正苦于以下问题:C++ ArrayT::PushBack方法的具体用法?C++ ArrayT::PushBack怎么用?C++ ArrayT::PushBack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayT
的用法示例。
在下文中一共展示了ArrayT::PushBack方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Undo
void CommandDeleteT::Undo()
{
wxASSERT(m_Done);
if (!m_Done) return;
ArrayT<MapElementT*> InsertedElems;
for (unsigned long PrimNr=0; PrimNr<m_DeletePrims.Size(); PrimNr++)
{
m_MapDoc.Insert(m_DeletePrims[PrimNr], m_DeletePrimsParents[PrimNr]);
InsertedElems.PushBack(m_DeletePrims[PrimNr]);
}
for (unsigned long EntNr=0; EntNr<m_DeleteEnts.Size(); EntNr++)
{
m_MapDoc.Insert(m_DeleteEnts[EntNr]);
InsertedElems.PushBack(m_DeleteEnts[EntNr]);
}
// Update all observers.
m_MapDoc.UpdateAllObservers_Created(InsertedElems);
// Select the previously selected elements again.
m_CommandSelect->Undo();
m_Done=false;
}
示例2: QuickSortFacesIntoTexNameOrder
void BspTreeBuilderT::QuickSortFacesIntoTexNameOrder()
{
while (ToDoRanges.Size()>=2)
{
const unsigned long LastIndex =ToDoRanges[ToDoRanges.Size()-1]; ToDoRanges.DeleteBack();
const unsigned long FirstIndex=ToDoRanges[ToDoRanges.Size()-1]; ToDoRanges.DeleteBack();
if (FirstIndex<LastIndex)
{
const char* x=FaceChildren[LastIndex]->Material->Name.c_str();
unsigned long i=FirstIndex-1;
for (unsigned long j=FirstIndex; j<=LastIndex-1; j++)
if (_stricmp(FaceChildren[j]->Material->Name.c_str(), x)<0)
{
i++;
std::swap(FaceChildren[i], FaceChildren[j]);
std::swap(FaceNrs[i], FaceNrs[j]);
}
std::swap(FaceChildren[i+1], FaceChildren[LastIndex]);
std::swap(FaceNrs[i+1], FaceNrs[LastIndex]);
i++;
ToDoRanges.PushBack(i+1); ToDoRanges.PushBack(LastIndex);
if (i>0) { ToDoRanges.PushBack(FirstIndex); ToDoRanges.PushBack(i-1); }
}
}
}
示例3: Do
bool CommandDeleteT::Do()
{
wxASSERT(!m_Done);
if (m_Done) return false;
// Deselect any affected elements that are selected.
m_CommandSelect->Do();
ArrayT<MapElementT*> DeletedElems;
for (unsigned long EntNr=0; EntNr<m_DeleteEnts.Size(); EntNr++)
{
m_MapDoc.Remove(m_DeleteEnts[EntNr]);
DeletedElems.PushBack(m_DeleteEnts[EntNr]);
}
for (unsigned long PrimNr=0; PrimNr<m_DeletePrims.Size(); PrimNr++)
{
m_MapDoc.Remove(m_DeletePrims[PrimNr]);
DeletedElems.PushBack(m_DeletePrims[PrimNr]);
}
// Update all observers.
m_MapDoc.UpdateAllObservers_Deleted(DeletedElems);
m_Done=true;
return true;
}
示例4: Init
void CommandDeleteT::Init(const ArrayT<MapElementT*>& DeleteElems)
{
// Split the list of elements into a list of primitives and a list of entities.
// The lists are checked for duplicates and kept free of them as well.
for (unsigned long ElemNr=0; ElemNr<DeleteElems.Size(); ElemNr++)
{
MapElementT* Elem=DeleteElems[ElemNr];
MapPrimitiveT* Prim=dynamic_cast<MapPrimitiveT*>(Elem);
MapEntityT* Ent =dynamic_cast<MapEntityT*>(Elem);
if (Prim)
{
MapEntityT* Parent=dynamic_cast<MapEntityT*>(Prim->GetParent());
if (Parent && IsEntirelyDeleted(Parent, DeleteElems))
{
// If the parent is a regular entity (not the world!) that is entirely deleted anyway,
// add the parent to the records instead of the individual primitive.
if (m_DeleteEnts.Find(Parent)==-1) m_DeleteEnts.PushBack(Parent);
}
else
{
if (m_DeletePrims.Find(Prim)==-1)
{
m_DeletePrims.PushBack(Prim);
m_DeletePrimsParents.PushBack(Prim->GetParent());
}
}
continue;
}
if (Ent)
{
if (m_DeleteEnts.Find(Ent)==-1) m_DeleteEnts.PushBack(Ent);
continue;
}
}
// Build the combined list of all deleted elements in order to unselect them.
ArrayT<MapElementT*> Unselect;
for (unsigned long PrimNr=0; PrimNr<m_DeletePrims.Size(); PrimNr++)
Unselect.PushBack(m_DeletePrims[PrimNr]);
for (unsigned long EntNr=0; EntNr<m_DeleteEnts.Size(); EntNr++)
{
Unselect.PushBack(m_DeleteEnts[EntNr]);
for (unsigned long PrimNr=0; PrimNr<m_DeleteEnts[EntNr]->GetPrimitives().Size(); PrimNr++)
Unselect.PushBack(m_DeleteEnts[EntNr]->GetPrimitives()[PrimNr]);
}
m_CommandSelect=CommandSelectT::Remove(&m_MapDoc, Unselect);
}
示例5: OnContextMenuItemDelete
void InspDlgEntityPropsT::OnContextMenuItemDelete(wxCommandEvent& event)
{
// Just in case the user pressed e.g. CTRL+Q (clear selection) in the meanwhile...
if (LastRightClickedProperty==NULL) return;
// Only handle deletes on properties that are not a category.
if (LastRightClickedProperty->IsCategory()) return;
// Key is not undefined (cannot be deleted).
if (LastRightClickedProperty->GetParent()!=UnDefKeys)
{
wxMessageBox("Only undefined keys can be deleted.");
return;
}
ArrayT<CommandT*> Commands;
for (unsigned long i=0; i<SelectedEntities.Size(); i++)
Commands.PushBack(new CommandDeletePropertyT(*MapDoc, SelectedEntities[i], LastRightClickedProperty->GetName()));
CommandT* MacroCommand=new CommandMacroT(Commands, "Delete Property '"+LastRightClickedProperty->GetName()+"'");
// Note that we also receive the update notification recursively (triggered by command execution in SubmitCommand()).
// This is intentional, or else we had to manually fix the PropMan, CombinedPropInfos, etc. here, which is error-prone.
// The complete recursive update is much less work and 100% safe, because it guarantees that no new bugs are introduced here.
MapDoc->GetHistory().SubmitCommand(MacroCommand);
}
示例6: HandlePGChange
bool EditorChoiceWindowT::HandlePGChange(wxPropertyGridEvent& Event, GuiEditor::ChildFrameT* ChildFrame)
{
if (EditorWindowT::HandlePGChange(Event, ChildFrame)) return true;
const wxPGProperty* Prop =Event.GetProperty();
const wxString PropName=Prop->GetName();
if (PropName=="Choices")
{
ArrayT<std::string> NewStrings;
wxStringTokenizer Tokenizer(Prop->GetValueAsString(), "\r\n");
while (Tokenizer.HasMoreTokens())
NewStrings.PushBack(std::string(Tokenizer.GetNextToken()));
ChildFrame->SubmitCommand(new CommandSetWinPropT< ArrayT<std::string> >(m_GuiDoc, this, PropName, m_Choice->m_Choices, NewStrings));
return true;
}
if (PropName=="DefaultChoice")
{
wxASSERT(m_Choice->GetMemberVar("selectedChoice").Member!=NULL);
ChildFrame->SubmitCommand(new CommandModifyWindowT(m_GuiDoc, m_Choice, PropName, m_Choice->GetMemberVar("selectedChoice"), Prop->GetValue().GetLong()));
return true;
}
return false;
}
示例7: UpdateAllObservers_Modified
void SubjectT::UpdateAllObservers_Modified(IntrusivePtrT<cf::GuiSys::WindowT> Window, WindowModDetailE Detail, const wxString& PropertyName)
{
ArrayT< IntrusivePtrT<cf::GuiSys::WindowT> > Windows;
Windows.PushBack(Window);
UpdateAllObservers_Modified(Windows, Detail, PropertyName);
}
示例8: Add
CommandSelectT* CommandSelectT::Add(GuiDocumentT* GuiDocument, IntrusivePtrT<cf::GuiSys::WindowT> Window)
{
ArrayT< IntrusivePtrT<cf::GuiSys::WindowT> > AddSelection;
AddSelection.PushBack(Window);
return CommandSelectT::Add(GuiDocument, AddSelection);
}
示例9: Remove
CommandSelectT* CommandSelectT::Remove(GuiDocumentT* GuiDocument, IntrusivePtrT<cf::GuiSys::WindowT> Window)
{
ArrayT< IntrusivePtrT<cf::GuiSys::WindowT> > RemoveSelection;
RemoveSelection.PushBack(Window);
return CommandSelectT::Remove(GuiDocument, RemoveSelection);
}
示例10: UpdateAllObservers_Deleted
void SubjectT::UpdateAllObservers_Deleted(IntrusivePtrT<cf::GuiSys::WindowT> Window)
{
ArrayT< IntrusivePtrT<cf::GuiSys::WindowT> > Windows;
Windows.PushBack(Window);
UpdateAllObservers_Deleted(Windows);
}
示例11: Undo
void CommandTransformT::Undo()
{
wxASSERT(m_Done);
if (!m_Done) return;
if (m_DoClone)
{
m_CommandSelect->Undo();
// Remove cloned objects from world again.
for (unsigned long CloneNr=0; CloneNr<m_ClonedElems.Size(); CloneNr++)
m_MapDoc.Remove(m_ClonedElems[CloneNr]);
m_MapDoc.UpdateAllObservers_Deleted(m_ClonedElems);
}
else
{
// Record the previous bounding-boxes for the observer message.
ArrayT<BoundingBox3fT> OldBounds;
for (unsigned long ElemNr=0; ElemNr<m_TransElems.Size(); ElemNr++)
{
OldBounds.PushBack(m_TransElems[ElemNr]->GetBB());
m_TransElems[ElemNr]->Assign(m_OldStates[ElemNr]);
}
m_MapDoc.UpdateAllObservers_Modified(m_TransElems, MEMD_TRANSFORM, OldBounds);
}
m_Done=false;
}
示例12: Do
bool CommandTransformT::Do()
{
wxASSERT(!m_Done);
if (m_Done) return false;
if (m_DoClone)
{
// Insert cloned objects into the document, attaching them to the same parents as the respective source element.
for (unsigned long CloneNr=0; CloneNr<m_ClonedElems.Size(); CloneNr++)
{
MapEntityT* Ent=dynamic_cast<MapEntityT*>(m_ClonedElems[CloneNr]);
if (Ent)
{
m_MapDoc.Insert(Ent);
continue;
}
MapPrimitiveT* ClonedPrim=dynamic_cast<MapPrimitiveT*>(m_ClonedElems[CloneNr]);
MapPrimitiveT* OrigPrim =dynamic_cast<MapPrimitiveT*>(m_TransElems[CloneNr]);
wxASSERT((ClonedPrim==NULL)==(OrigPrim==NULL));
if (ClonedPrim && OrigPrim)
{
m_MapDoc.Insert(ClonedPrim, OrigPrim->GetParent());
continue;
}
// TODO(?): Insert m_ClonedElems[CloneNr] into the same group as m_TransElems[CloneNr]?
}
m_MapDoc.UpdateAllObservers_Created(m_ClonedElems);
m_CommandSelect->Do();
}
else
{
// Record the previous bounding-boxes for the observer message.
ArrayT<BoundingBox3fT> OldBounds;
for (unsigned long ElemNr=0; ElemNr<m_TransElems.Size(); ElemNr++)
{
OldBounds.PushBack(m_TransElems[ElemNr]->GetBB());
switch (m_Mode)
{
case MODE_TRANSLATE: m_TransElems[ElemNr]->TrafoMove(m_Amount); break;
case MODE_ROTATE: m_TransElems[ElemNr]->TrafoRotate(m_RefPoint, m_Amount); break;
case MODE_SCALE: m_TransElems[ElemNr]->TrafoScale(m_RefPoint, m_Amount); break;
case MODE_MATRIX: m_TransElems[ElemNr]->Transform(m_Matrix); break;
}
}
m_MapDoc.UpdateAllObservers_Modified(m_TransElems, MEMD_TRANSFORM, OldBounds);
}
m_Done=true;
return true;
}
示例13:
template<class T> void Polygon3T<T>::GetChoppedUpAlong(const Polygon3T<T>& SplittingPoly, const T EdgeThickness, ArrayT< Polygon3T<T> >& NewPolys) const
{
Polygon3T<T> FragmentPoly=*this;
NewPolys.Clear();
for (unsigned long VertexNr=0; VertexNr<SplittingPoly.Vertices.Size(); VertexNr++)
{
const Plane3T<T> SplitPlane=SplittingPoly.GetEdgePlane(VertexNr, EdgeThickness);
if (FragmentPoly.WhatSideSimple(SplitPlane, EdgeThickness)!=Both) continue;
ArrayT< Polygon3T<T> > SplitResult=FragmentPoly.GetSplits(SplitPlane, EdgeThickness);
FragmentPoly=SplitResult[0];
NewPolys.PushBack(SplitResult[1]);
}
NewPolys.PushBack(FragmentPoly);
}
示例14: UnloadSelectedSubmodels
void SubmodelsListT::UnloadSelectedSubmodels()
{
// We have to make the "detour" via the DelSM array, because unloading any submodel potentially modifies the indices of the rest.
ArrayT<ModelDocumentT::SubmodelT*> DelSM;
for (long SelNr=GetFirstSelected(); SelNr!=-1; SelNr=GetNextSelected(SelNr))
DelSM.PushBack(m_ModelDoc->GetSubmodels()[SelNr]);
for (unsigned long SMNr=0; SMNr<DelSM.Size(); SMNr++)
m_ModelDoc->UnloadSubmodel(m_ModelDoc->GetSubmodels().Find(DelSM[SMNr]));
m_ModelDoc->UpdateAllObservers_SubmodelsChanged();
}
示例15: Undo
void CommandDeletePropertyT::Undo()
{
wxASSERT(m_Done);
if (!m_Done) return;
m_Entity->GetProperties().InsertAt(m_Index, m_PropBackup);
ArrayT<MapElementT*> MapElements;
MapElements.PushBack(m_Entity);
m_MapDoc.UpdateAllObservers_Modified(MapElements, MEMD_ENTITY_PROPERTY_CREATED, m_PropBackup.Key);
m_Done=false;
}