示例#1
0
SurfaceROI* RenderView3D::InitializeSurfaceROI( int posX, int posY )
{
  double pos[3];
  vtkProp* prop = this->PickProp( posX, posY, pos );
  if ( !prop )
  {
    return NULL;
  }

  LayerCollection* lc_surf = MainWindow::GetMainWindow()->GetLayerCollection( "Surface" );
  LayerSurface* surf = NULL;
  for ( int i = 0; i < lc_surf->GetNumberOfLayers(); i++ )
  {
    LayerSurface* temp = (LayerSurface*)lc_surf->GetLayer(i);
    if ( temp->HasProp( prop ) )
    {
      surf = temp;
      break;
    }
  }

  if ( !surf )
  {
    return false;
  }

  lc_surf->SetActiveLayer( surf );
  SurfaceROI* roi = surf->GetSurfaceROI();
  if ( roi )
  {
    roi->InitializeOutline(pos);
  }
  return roi;
}
示例#2
0
void RenderView3D::AddSurfaceROIPoint( int posX, int posY )
{
  LayerSurface* surf = (LayerSurface*)MainWindow::GetMainWindow()->GetActiveLayer( "Surface" );
  if ( surf )
  {
    double pos[3];
    vtkProp* prop = this->PickProp( posX, posY, pos );
    if ( !prop || !surf->HasProp( prop ) )
    {
      return;
    }

    surf->GetSurfaceROI()->AddPoint( pos );
    RequestRedraw();
  }
}