当前位置: 首页>>代码示例>>C++>>正文


C++ Pointer::GetMapper方法代码示例

本文整理汇总了C++中datanode::Pointer::GetMapper方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::GetMapper方法的具体用法?C++ Pointer::GetMapper怎么用?C++ Pointer::GetMapper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在datanode::Pointer的用法示例。


在下文中一共展示了Pointer::GetMapper方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

/*!
\brief PrepareMapperQueue iterates the datatree

PrepareMapperQueue iterates the datatree in order to find mappers which shall be rendered. Also, it sortes the mappers
wrt to their layer.
*/
void mitk::VtkPropRenderer::PrepareMapperQueue()
{
  // variable for counting LOD-enabled mappers
  m_NumberOfVisibleLODEnabledMappers = 0;

  // Do we have to update the mappers ?
  if (m_LastUpdateTime < GetMTime() || m_LastUpdateTime < this->GetCurrentWorldPlaneGeometry()->GetMTime())
  {
    Update();
  }
  else if (m_MapperID >= 1 && m_MapperID < 6)
    Update();

  // remove all text properties before mappers will add new ones
  m_TextRenderer->RemoveAllViewProps();

  for (unsigned int i = 0; i < m_TextCollection.size(); i++)
  {
    m_TextCollection[i]->Delete();
  }
  m_TextCollection.clear();

  // clear priority_queue
  m_MappersMap.clear();

  int mapperNo = 0;

  // DataStorage
  if (m_DataStorage.IsNull())
    return;

  DataStorage::SetOfObjects::ConstPointer allObjects = m_DataStorage->GetAll();

  for (DataStorage::SetOfObjects::ConstIterator it = allObjects->Begin(); it != allObjects->End(); ++it)
  {
    const DataNode::Pointer node = it->Value();
    if (node.IsNull())
      continue;
    const mitk::Mapper::Pointer mapper = node->GetMapper(m_MapperID);

    if (mapper.IsNull())
      continue;

    bool visible = true;
    node->GetVisibility(visible, this, "visible");

    // The information about LOD-enabled mappers is required by RenderingManager
    if (mapper->IsLODEnabled(this) && visible)
    {
      ++m_NumberOfVisibleLODEnabledMappers;
    }
    // mapper without a layer property get layer number 1
    int layer = 1;
    node->GetIntProperty("layer", layer, this);
    int nr = (layer << 16) + mapperNo;
    m_MappersMap.insert(std::pair<int, Mapper *>(nr, mapper));
    mapperNo++;
  }
}
开发者ID:Cdebus,项目名称:MITK,代码行数:65,代码来源:mitkVtkPropRenderer.cpp

示例2:

void mitk::VtkPropRenderer::ReleaseGraphicsResources(vtkWindow* /*renWin*/)
{
  if( m_DataStorage.IsNull() )
    return;

  DataStorage::SetOfObjects::ConstPointer allObjects = m_DataStorage->GetAll();
  for (DataStorage::SetOfObjects::const_iterator iter = allObjects->begin(); iter != allObjects->end(); ++iter)
  {
    DataNode::Pointer node = *iter;
    if ( node.IsNull() )
      continue;

      Mapper * mapper = node->GetMapper(m_MapperID);

      if (mapper)
      {
        VtkMapper* vtkmapper = dynamic_cast<VtkMapper*>( mapper );

       if(vtkmapper)
         vtkmapper->ReleaseGraphicsResources(this);
      }
   }
}
开发者ID:GHfangxin,项目名称:MITK,代码行数:23,代码来源:mitkVtkPropRenderer.cpp

示例3: PickObject

mitk::DataNode *
    mitk::VtkPropRenderer::PickObject( const Point2D &displayPosition, Point3D &worldPosition ) const
{
  if ( m_VtkMapperPresent )
  {
    m_CellPicker->InitializePickList();

    // Iterate over all DataStorage objects to determine all vtkProps intended
    // for picking
    DataStorage::SetOfObjects::ConstPointer allObjects = m_DataStorage->GetAll();
    for ( DataStorage::SetOfObjects::ConstIterator it = allObjects->Begin();
    it != allObjects->End();
    ++it )
    {
      DataNode *node = it->Value();
      if ( node == NULL )
        continue;

      bool pickable = false;
      node->GetBoolProperty( "pickable", pickable );
      if ( !pickable )
        continue;

      VtkMapper *mapper = dynamic_cast < VtkMapper * >  ( node->GetMapper( m_MapperID ) );
      if ( mapper == NULL )
        continue;

      vtkProp *prop = mapper->GetVtkProp( (mitk::BaseRenderer *)this );
      if ( prop == NULL )
        continue;

      m_CellPicker->AddPickList( prop );
    }

    // Do the picking and retrieve the picked vtkProp (if any)
    m_CellPicker->PickFromListOn();
    m_CellPicker->Pick( displayPosition[0], displayPosition[1], 0.0, m_VtkRenderer );
    m_CellPicker->PickFromListOff();

    vtk2itk( m_CellPicker->GetPickPosition(), worldPosition );
    vtkProp *prop = m_CellPicker->GetViewProp();

    if ( prop == NULL )
    {
      return NULL;
    }

    // Iterate over all DataStorage objects to determine if the retrieved
    // vtkProp is owned by any associated mapper.
    for ( DataStorage::SetOfObjects::ConstIterator it = allObjects->Begin();
    it != allObjects->End();
    ++it)
    {
      DataNode::Pointer node = it->Value();
      if ( node.IsNull() )
        continue;

      mitk::Mapper * mapper = node->GetMapper( m_MapperID );
      if ( mapper == NULL)
        continue;

      mitk::VtkMapper * vtkmapper = dynamic_cast< VtkMapper * >(mapper);

      if(vtkmapper){
        //if vtk-based, then ...
       if ( vtkmapper->HasVtkProp( prop, const_cast< mitk::VtkPropRenderer * >( this ) ) )
       {
          return node;
       }
      }
    }

    return NULL;
  }
  else
  {
    return Superclass::PickObject( displayPosition, worldPosition );
  }
};
开发者ID:GHfangxin,项目名称:MITK,代码行数:79,代码来源:mitkVtkPropRenderer.cpp


注:本文中的datanode::Pointer::GetMapper方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。