本文整理汇总了C++中proportionaltimegeometry::Pointer::UpdateBoundingBox方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::UpdateBoundingBox方法的具体用法?C++ Pointer::UpdateBoundingBox怎么用?C++ Pointer::UpdateBoundingBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类proportionaltimegeometry::Pointer
的用法示例。
在下文中一共展示了Pointer::UpdateBoundingBox方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: indexForUnlabeledTimeStep
//.........这里部分代码省略.........
}
int numberOfTimeSteps = 0;
if (TIXML_SUCCESS != timeGeometryElement->QueryIntAttribute("NumberOfTimeSteps", &numberOfTimeSteps))
{
MITK_WARN << "<ProportionalTimeGeometry> found without NumberOfTimeSteps attribute. Counting...";
}
// might be missing!
TimePointType firstTimePoint;
std::string firstTimePoint_s;
TimePointType stepDuration;
std::string stepDuration_s;
try
{
if (TIXML_SUCCESS == timeGeometryElement->QueryStringAttribute("FirstTimePoint", &firstTimePoint_s))
{
firstTimePoint = boost::lexical_cast<double>(firstTimePoint_s);
}
else
{
firstTimePoint = -std::numeric_limits<TimePointType>::max();
}
if (TIXML_SUCCESS == timeGeometryElement->QueryStringAttribute("StepDuration", &stepDuration_s))
{
stepDuration = boost::lexical_cast<double>(stepDuration_s);
}
else
{
stepDuration = std::numeric_limits<TimePointType>::infinity();
}
}
catch (boost::bad_lexical_cast &e)
{
MITK_ERROR << "Could not parse string as number: " << e.what();
return nullptr;
}
// list of all geometries with their time steps
std::multimap<TimeStepType, BaseGeometry::Pointer> allReadGeometries;
int indexForUnlabeledTimeStep(-1);
for (TiXmlElement *currentElement = timeGeometryElement->FirstChildElement(); currentElement != nullptr;
currentElement = currentElement->NextSiblingElement())
{
// different geometries could have been inside a ProportionalTimeGeometry.
// By now, we only support Geometry3D
std::string tagName = currentElement->Value();
if (tagName == "Geometry3D")
{
Geometry3D::Pointer restoredGeometry = Geometry3DToXML::FromXML(currentElement);
if (restoredGeometry.IsNotNull())
{
int timeStep(-1);
if (TIXML_SUCCESS != currentElement->QueryIntAttribute("TimeStep", &timeStep))
{
timeStep = indexForUnlabeledTimeStep--; // decrement index for next one
MITK_WARN << "Found <Geometry3D> without 'TimeStep' attribute in <ProportionalTimeGeometry>. No guarantees "
"on order anymore.";
}
if (allReadGeometries.count(static_cast<TimeStepType>(timeStep)) > 0)
{
MITK_WARN << "Found <Geometry3D> tags with identical 'TimeStep' attribute in <ProportionalTimeGeometry>. No "
"guarantees on order anymore.";
}
allReadGeometries.insert(std::make_pair(static_cast<TimeStepType>(timeStep), restoredGeometry.GetPointer()));
}
}
else
{
MITK_WARN << "Found unsupported tag <" << tagName << "> inside <ProportionalTimeGeometry>. Ignoring.";
}
}
// now add all BaseGeometries that were read to a new instance
// of ProportionalTimeGeometry
ProportionalTimeGeometry::Pointer newTimeGeometry = ProportionalTimeGeometry::New();
newTimeGeometry->SetFirstTimePoint(firstTimePoint);
newTimeGeometry->SetStepDuration(stepDuration);
newTimeGeometry->ReserveSpaceForGeometries(allReadGeometries.size());
TimeStepType t(0);
for (auto entry : allReadGeometries)
{
// We add items with newly assigned time steps.
// This avoids great confusion when a file contains
// bogus numbers.
newTimeGeometry->SetTimeStepGeometry(entry.second, t++);
}
// Need to re-calculate global bounding box.
// This is neither stored in a file, nor done by SetTimeStepGeometry
newTimeGeometry->UpdateBoundingBox();
return newTimeGeometry;
}