本文整理汇总了C++中DataNode::GetBoolProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ DataNode::GetBoolProperty方法的具体用法?C++ DataNode::GetBoolProperty怎么用?C++ DataNode::GetBoolProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataNode
的用法示例。
在下文中一共展示了DataNode::GetBoolProperty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDataNode
bool mitk::GPUVolumeMapper3D::IsRenderable(mitk::BaseRenderer* renderer)
{
if(!GetDataNode())
return false;
DataNode* node = GetDataNode();
bool visible = true;
node->GetVisibility(visible, renderer, "visible");
if(!visible) return false;
bool value = false;
if(!node->GetBoolProperty("volumerendering",value,renderer))
return false;
if(!value)
return false;
mitk::Image *input = const_cast< mitk::Image * >( this->GetInput() );
if ( !input || !input->IsInitialized() )
return false;
vtkImageData *inputData = input->GetVtkImageData( this->GetTimestep() );
if(inputData==NULL)
return false;
return true;
}
示例2:
void mitk::SimulationVtkMapper3D::ApplySimulationProperties(BaseRenderer* renderer)
{
DataNode* node = this->GetDataNode();
bool showBehaviorModels;
bool showForceFields;
bool showInteractionForceFields;
bool showBoundingCollisionModels;
bool showCollisionModels;
bool showMechanicalMappings;
bool showMappings;
bool showNormals;
bool showWireFrame;
bool showVisualModels;
node->GetBoolProperty("Simulation.Behavior.Behavior Models", showBehaviorModels, renderer);
node->GetBoolProperty("Simulation.Behavior.Force Fields", showForceFields, renderer);
node->GetBoolProperty("Simulation.Behavior.Interactions", showInteractionForceFields, renderer);
node->GetBoolProperty("Simulation.Collision.Bounding Trees", showBoundingCollisionModels, renderer);
node->GetBoolProperty("Simulation.Collision.Collision Models", showCollisionModels, renderer);
node->GetBoolProperty("Simulation.Mapping.Mechanical Mappings", showMechanicalMappings, renderer);
node->GetBoolProperty("Simulation.Mapping.Visual Mappings", showMappings, renderer);
node->GetBoolProperty("Simulation.Options.Normals", showNormals, renderer);
node->GetBoolProperty("Simulation.Options.Wire Frame", showWireFrame, renderer);
node->GetBoolProperty("Simulation.Visual.Visual Models", showVisualModels, renderer);
Simulation* simulation = static_cast<Simulation*>(this->GetData());
sofa::component::visualmodel::VisualStyle::SPtr visualStyle;
simulation->GetRootNode()->get(visualStyle);
sofa::core::visual::DisplayFlags* displayFlags = visualStyle->displayFlags.beginEdit();
displayFlags->setShowBehaviorModels(showBehaviorModels);
displayFlags->setShowForceFields(showForceFields);
displayFlags->setShowInteractionForceFields(showInteractionForceFields);
displayFlags->setShowBoundingCollisionModels(showBoundingCollisionModels);
displayFlags->setShowCollisionModels(showCollisionModels);
displayFlags->setShowMechanicalMappings(showMechanicalMappings);
displayFlags->setShowMappings(showMappings);
displayFlags->setShowNormals(showNormals);
displayFlags->setShowWireFrame(showWireFrame);
displayFlags->setShowVisualModels(showVisualModels);
visualStyle->displayFlags.endEdit();
}
示例3: 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 );
}
}
示例4: if
//.........这里部分代码省略.........
m_SurfaceCreatorBoundingBox->ComputeBoundingBox();
m_SurfaceCreator->SetBoundingBox( m_SurfaceCreatorBoundingBox );
tubeRadius = referenceGeometry->GetDiagonalLength() / 450.0;
}
// If no reference geometry is available, clip with the current global
// 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 )
{
示例5: 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 );
}
};
示例6:
void mitk::PlanarFigureVtkMapper3D::GenerateDataForRenderer(BaseRenderer* renderer)
{
typedef PlanarFigure::PolyLineType PolyLine;
DataNode* node = this->GetDataNode();
if (node == NULL)
return;
PlanarFigure* planarFigure = dynamic_cast<PlanarFigure*>(node->GetData());
if (planarFigure == NULL || !planarFigure->IsPlaced())
return;
LocalStorage* localStorage = m_LocalStorageHandler.GetLocalStorage(renderer);
unsigned long mTime = planarFigure->GetMTime();
bool fillPf = false;
bool refresh = false;
node->GetBoolProperty("planarfigure.3drendering.fill", fillPf);
if (m_FillPf!=fillPf)
{
m_FillPf = fillPf;
refresh = true;
}
if (mTime > localStorage->m_LastMTime || refresh)
{
localStorage->m_LastMTime = mTime;
const PlaneGeometry* planeGeometry = dynamic_cast<const PlaneGeometry*>(planarFigure->GetPlaneGeometry());
const AbstractTransformGeometry* abstractTransformGeometry = dynamic_cast<const AbstractTransformGeometry*>(planarFigure->GetPlaneGeometry());
if (planeGeometry == NULL && abstractTransformGeometry == NULL)
return;
size_t numPolyLines = planarFigure->GetPolyLinesSize();
if (numPolyLines == 0)
return;
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkCellArray> cells = vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkCellArray> polygons = vtkSmartPointer<vtkCellArray>::New();
vtkIdType baseIndex = 0;
for (size_t i = 0; i < numPolyLines; ++i)
{
PolyLine polyLine = planarFigure->GetPolyLine(i);
vtkIdType numPoints = polyLine.size();
vtkSmartPointer<vtkPolygon> polygon = vtkSmartPointer<vtkPolygon>::New();
if (numPoints < 2)
continue;
PolyLine::const_iterator polyLineEnd = polyLine.end();
for (PolyLine::const_iterator polyLineIt = polyLine.begin(); polyLineIt != polyLineEnd; ++polyLineIt)
{
Point3D point;
planeGeometry->Map(*polyLineIt, point);
points->InsertNextPoint(point.GetDataPointer());
vtkIdType id = polygon->GetPoints()->InsertNextPoint(point[0], point[1], point[2] );
polygon->GetPointIds()->InsertNextId(id);
}
vtkSmartPointer<vtkPolyLine> line = vtkSmartPointer<vtkPolyLine>::New();
vtkIdList* pointIds = line->GetPointIds();
if (planarFigure->IsClosed() && numPoints > 2)
{
polygons->InsertNextCell(polygon);
pointIds->SetNumberOfIds(numPoints + 1);
pointIds->SetId(numPoints, baseIndex);
}
else
{
pointIds->SetNumberOfIds(numPoints);
}
for (vtkIdType j = 0; j < numPoints; ++j)
pointIds->SetId(j, baseIndex + j);
cells->InsertNextCell(line);
baseIndex += points->GetNumberOfPoints();
}
vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();
polyData->SetPoints(points);
polyData->SetLines(cells);
if (m_FillPf)
polyData->SetPolys(polygons);
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputData(polyData);
//.........这里部分代码省略.........