本文整理汇总了C++中DataNode::GetData方法的典型用法代码示例。如果您正苦于以下问题:C++ DataNode::GetData方法的具体用法?C++ DataNode::GetData怎么用?C++ DataNode::GetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataNode
的用法示例。
在下文中一共展示了DataNode::GetData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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();
if (mTime > localStorage->m_LastMTime)
{
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();
vtkIdType baseIndex = 0;
for (size_t i = 0; i < numPolyLines; ++i)
{
PolyLine polyLine = planarFigure->GetPolyLine(i);
vtkIdType numPoints = polyLine.size();
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());
}
vtkSmartPointer<vtkPolyLine> line = vtkSmartPointer<vtkPolyLine>::New();
vtkIdList* pointIds = line->GetPointIds();
if (planarFigure->IsClosed() && numPoints > 2)
{
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);
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputData(polyData);
localStorage->m_Actor->SetMapper(mapper);
}
this->ApplyColorAndOpacityProperties(renderer, localStorage->m_Actor);
this->ApplyPlanarFigureProperties(renderer, localStorage->m_Actor);
}
示例2: nodeUIDGen
//.........这里部分代码省略.........
++iter)
{
DataNode* node = iter->GetPointer();
if (node)
{
TiXmlElement* nodeElement = new TiXmlElement("node");
std::string filenameHint( node->GetName() );
filenameHint = itksys::SystemTools::MakeCindentifier(filenameHint.c_str()); // escape filename <-- only allow [A-Za-z0-9_], replace everything else with _
// store dependencies
UIDMapType::iterator searchUIDIter = nodeUIDs.find(node);
if ( searchUIDIter != nodeUIDs.end() )
{
// store this node's ID
nodeElement->SetAttribute("UID", searchUIDIter->second.c_str() );
}
SourcesMapType::iterator searchSourcesIter = sourceUIDs.find(node);
if ( searchSourcesIter != sourceUIDs.end() )
{
// store all source IDs
for ( std::list<std::string>::iterator sourceUIDIter = searchSourcesIter->second.begin();
sourceUIDIter != searchSourcesIter->second.end();
++sourceUIDIter )
{
TiXmlElement* uidElement = new TiXmlElement("source");
uidElement->SetAttribute("UID", sourceUIDIter->c_str() );
nodeElement->LinkEndChild( uidElement );
}
}
// store basedata
if ( BaseData* data = node->GetData() )
{
//std::string filenameHint( node->GetName() );
bool error(false);
TiXmlElement* dataElement( SaveBaseData( data, filenameHint, error ) ); // returns a reference to a file
if (error)
{
m_FailedNodes->push_back( node );
}
// store basedata properties
PropertyList* propertyList = data->GetPropertyList();
if (propertyList && !propertyList->IsEmpty() )
{
TiXmlElement* baseDataPropertiesElement( SavePropertyList( propertyList, filenameHint + "-data") ); // returns a reference to a file
dataElement->LinkEndChild( baseDataPropertiesElement );
}
nodeElement->LinkEndChild( dataElement );
}
// store all renderwindow specific propertylists
const RenderingManager::RenderWindowVector& allRenderWindows( RenderingManager::GetInstance()->GetAllRegisteredRenderWindows() );
for ( RenderingManager::RenderWindowVector::const_iterator rw = allRenderWindows.begin();
rw != allRenderWindows.end();
++rw)
{
if (vtkRenderWindow* renderWindow = *rw)
{
std::string renderWindowName( mitk::BaseRenderer::GetInstance(renderWindow)->GetName() );
BaseRenderer* renderer = mitk::BaseRenderer::GetInstance(renderWindow);
PropertyList* propertyList = node->GetPropertyList(renderer);
if ( propertyList && !propertyList->IsEmpty() )