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


C++ DataNode::GetColor方法代码示例

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


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

示例1: invertNormals

void mitk::SurfaceGLMapper2D::ApplyAllProperties(mitk::BaseRenderer* renderer)
{
  ApplyColorAndOpacityProperties(renderer);

  DataNode * node = GetDataNode();

  if(node == NULL)
  {
    return;
  }

  node->GetBoolProperty("draw normals 2D", m_DrawNormals, renderer);

  // check for color and opacity properties, use it for rendering if they exists
  node->GetColor(m_LineColor, renderer, "color");
  node->GetOpacity(m_LineColor[3], renderer, "opacity");

  bool invertNormals(false);
  node->GetBoolProperty("invert normals", invertNormals, renderer);

  if (!invertNormals)
  {
    node->GetColor(m_FrontSideColor, renderer, "front color");
    node->GetOpacity(m_FrontSideColor[3], renderer, "opacity");

    node->GetColor(m_BackSideColor, renderer, "back color");
    node->GetOpacity(m_BackSideColor[3], renderer, "opacity");

    node->GetFloatProperty( "front normal lenth (px)", m_FrontNormalLengthInPixels, renderer );
    node->GetFloatProperty( "back normal lenth (px)", m_BackNormalLengthInPixels, renderer );
  }
  else
  {
    node->GetColor(m_FrontSideColor, renderer, "back color");
    node->GetOpacity(m_FrontSideColor[3], renderer, "opacity");

    node->GetColor(m_BackSideColor, renderer, "front color");
    node->GetOpacity(m_BackSideColor[3], renderer, "opacity");

    node->GetFloatProperty( "back normal lenth (px)", m_FrontNormalLengthInPixels, renderer );
    node->GetFloatProperty( "front normal lenth (px)", m_BackNormalLengthInPixels, renderer );
  }
}
开发者ID:GHfangxin,项目名称:MITK,代码行数:43,代码来源:mitkSurfaceGLMapper2D.cpp

示例2: GetDataNode

void mitk::VtkMapper::ApplyColorAndOpacityProperties(BaseRenderer *renderer, vtkActor *actor)
{
  float rgba[4] = {1.0f, 1.0f, 1.0f, 1.0f};
  DataNode *node = GetDataNode();

  // check for color prop and use it for rendering if it exists
  node->GetColor(rgba, renderer, "color");
  // check for opacity prop and use it for rendering if it exists
  node->GetOpacity(rgba[3], renderer, "opacity");

  double drgba[4] = {rgba[0], rgba[1], rgba[2], rgba[3]};
  actor->GetProperty()->SetColor(drgba);
  actor->GetProperty()->SetOpacity(drgba[3]);
}
开发者ID:liu3xing3long,项目名称:MITK,代码行数:14,代码来源:mitkVtkMapper.cpp

示例3: if


//.........这里部分代码省略.........
      // bounds
      else if (m_DataStorage.IsNotNull())
      {
        m_SurfaceCreator->SetBoundingBox(m_DataStorage->ComputeVisibleBoundingBox(NULL, "includeInBoundingBox"));
        tubeRadius = sqrt( m_SurfaceCreator->GetBoundingBox()->GetDiagonalLength2() ) / 450.0;
      }

      // Calculate the surface of the Geometry2D
      m_SurfaceCreator->Update();
      Surface *surface = m_SurfaceCreator->GetOutput();

      // Check if there's something to display, otherwise return
      if ( (surface->GetVtkPolyData() == 0 )
        || (surface->GetVtkPolyData()->GetNumberOfCells() == 0) )
        {
        m_ImageAssembly->VisibilityOff();
        return;
      }

      // add a graphical representation of the surface normals if requested
      DataNode* node = this->GetDataNode();
      bool displayNormals = false;
      bool colorTwoSides = false;
      bool invertNormals = false;
      node->GetBoolProperty("draw normals 3D", displayNormals, renderer);
      node->GetBoolProperty("color two sides", colorTwoSides, renderer);
      node->GetBoolProperty("invert normals", invertNormals, renderer);

      //if we want to draw the display normals or render two sides we have to get the colors
      if( displayNormals || colorTwoSides )
      {
        //get colors
        float frontColor[3] = { 0.0, 0.0, 1.0 };
        node->GetColor( frontColor, renderer, "front color" );
        float backColor[3] = { 1.0, 0.0, 0.0 };
        node->GetColor( backColor, renderer, "back color" );

        if ( displayNormals )
        {
          m_NormalsTransformer->SetInput( surface->GetVtkPolyData() );
          m_NormalsTransformer->SetTransform(node->GetVtkTransform(this->GetTimestep()) );

          m_FrontHedgeHog->SetInput( m_NormalsTransformer->GetOutput() );
          m_FrontHedgeHog->SetVectorModeToUseNormal();
          m_FrontHedgeHog->SetScaleFactor( invertNormals ? 1.0 : -1.0 );

          m_FrontNormalsActor->GetProperty()->SetColor( frontColor[0], frontColor[1], frontColor[2] );

          m_BackHedgeHog->SetInput( m_NormalsTransformer->GetOutput() );
          m_BackHedgeHog->SetVectorModeToUseNormal();
          m_BackHedgeHog->SetScaleFactor( invertNormals ? -1.0 : 1.0 );

          m_BackNormalsActor->GetProperty()->SetColor( backColor[0], backColor[1], backColor[2] );

          //if there is no actor added yet, add one
          if ( !m_NormalsActorAdded )
          {
            m_Prop3DAssembly->AddPart( m_FrontNormalsActor );
            m_Prop3DAssembly->AddPart( m_BackNormalsActor );
            m_NormalsActorAdded = true;
          }
        }
        //if we don't want to display normals AND there is an actor added remove the actor
        else if ( m_NormalsActorAdded )
        {
          m_Prop3DAssembly->RemovePart( m_FrontNormalsActor );
开发者ID:cewee,项目名称:MITK,代码行数:67,代码来源:mitkGeometry2DDataVtkMapper3D.cpp


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