本文整理汇总了C++中LayerPtr::Initialize方法的典型用法代码示例。如果您正苦于以下问题:C++ LayerPtr::Initialize方法的具体用法?C++ LayerPtr::Initialize怎么用?C++ LayerPtr::Initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayerPtr
的用法示例。
在下文中一共展示了LayerPtr::Initialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnNewLayer
///////////////////////////////////////////////////////////////////////////////
// Called when the "New Layer" button is clicked on the toolbar. Creates an
// un-doable command that adds a layer to the scene (thereby adding it to this
// control).
//
void LayersPanel::OnNewLayer( wxCommandEvent& event )
{
if ( m_Scene )
{
LayerPtr layer = new Layer();
layer->SetOwner( m_Scene );
layer->Initialize();
m_Scene->Push( new SceneNodeExistenceCommand( ExistenceActions::Add, m_Scene, layer ) );
m_Scene->Execute( false );
}
}
示例2: OnNewLayerFromSelection
///////////////////////////////////////////////////////////////////////////////
// Called when the "New Layer From Selection" button is clicked on the toolbar.
//
void LayersPanel::OnNewLayerFromSelection( wxCommandEvent& dummyEvt )
{
if ( m_Scene )
{
if(IsSelectionValid() == false)
{
return;
}
BatchUndoCommandPtr batch = new BatchUndoCommand ();
LayerPtr layer = new Layer();
layer->SetOwner( m_Scene );
layer->Initialize();
// Generate a name for this layer
GenerateLayerName(layer);
batch->Push( new SceneNodeExistenceCommand( ExistenceActions::Add, m_Scene, layer ) );
// Step 2: add all the selected items to the layer
const OS_ObjectDumbPtr& selection = m_Scene->GetSelection().GetItems();
OS_ObjectDumbPtr::Iterator itr = selection.Begin();
OS_ObjectDumbPtr::Iterator end = selection.End();
for ( ; itr != end; ++itr )
{
//If the element is a supported type
if( *itr )
{
SceneNode* node = Reflect::SafeCast< SceneNode >( *itr );
if ( node )
{
batch->Push( new DependencyCommand( DependencyCommand::Connect, layer, node ) );
}
}
}
m_Scene->Push( batch );
m_Scene->Execute( false );
}
}