21 : m_SelectedControlPoint(-1),
22 m_PreviewControlPointVisible(false),
23 m_FigurePlaced(false),
24 m_PlaneGeometry(nullptr),
25 m_PolyLineUpToDate(false),
26 m_HelperLinesUpToDate(false),
27 m_FeaturesUpToDate(false),
32 m_DisplaySize.first = 0.0;
33 m_DisplaySize.second = 0;
51 m_PlaneGeometry(other.m_PlaneGeometry),
52 m_PolyLineUpToDate(other.m_PolyLineUpToDate),
53 m_HelperLinesUpToDate(other.m_HelperLinesUpToDate),
54 m_FeaturesUpToDate(other.m_FeaturesUpToDate),
55 m_Features(other.m_Features),
56 m_FeaturesMTime(other.m_FeaturesMTime),
57 m_DisplaySize(other.m_DisplaySize)
60 for (
unsigned long i = 0; i < other.m_HelperPolyLinesToBePainted->Size(); ++i)
74 return m_PlaneGeometry;
80 if (closed !=
nullptr)
134 m_PolyLineUpToDate =
false;
135 m_HelperLinesUpToDate =
false;
136 m_FeaturesUpToDate =
false;
150 bool controlPointSetCorrectly =
false;
151 if (createIfDoesNotExist)
162 controlPointSetCorrectly =
true;
167 controlPointSetCorrectly =
true;
174 if (controlPointSetCorrectly)
176 m_PolyLineUpToDate =
false;
177 m_HelperLinesUpToDate =
false;
178 m_FeaturesUpToDate =
false;
181 return controlPointSetCorrectly;
249 itkExceptionMacro(<<
"GetControlPoint(): Invalid index!");
261 itkExceptionMacro(<<
"GetWorldControlPoint(): Invalid index!");
267 if (index >
m_PolyLines.size() || !m_PolyLineUpToDate)
270 m_PolyLineUpToDate =
true;
283 for (std::vector<PolyLineType>::size_type i = 0; i <
m_PolyLines.size(); i++)
287 m_PolyLineUpToDate =
false;
291 double mmPerDisplayUnit,
292 unsigned int displayHeight)
299 if (!m_HelperLinesUpToDate || m_DisplaySize.first != mmPerDisplayUnit || m_DisplaySize.second != displayHeight)
302 m_HelperLinesUpToDate =
true;
305 m_DisplaySize.first = mmPerDisplayUnit;
306 m_DisplaySize.second = displayHeight;
312 return helperPolyLine;
317 for (std::vector<PolyLineType>::size_type i = 0; i <
m_HelperPolyLines.size(); i++)
321 m_HelperLinesUpToDate =
false;
328 return m_Features.size();
333 return indexOfPolylinePoint;
338 if (index < m_Features.size())
340 return m_Features[index].Name.c_str();
350 if (index < m_Features.size())
352 return m_Features[index].Unit.c_str();
362 if (index < m_Features.size())
364 return m_Features[index].Quantity;
374 if (index < m_Features.size())
376 return m_Features[index].Active;
386 if (index < m_Features.size())
388 return m_Features[index].Visible;
398 if (index < m_Features.size())
400 m_Features[index].Visible = visible;
406 if (!m_FeaturesUpToDate || !m_PolyLineUpToDate)
408 if (!m_PolyLineUpToDate)
415 m_FeaturesUpToDate =
true;
423 Superclass::UpdateOutputInformation();
453 if (m_PlaneGeometry ==
nullptr)
462 if (indexPoint[0] < bounds[0])
464 indexPoint[0] = bounds[0];
466 if (indexPoint[0] > bounds[1])
468 indexPoint[0] = bounds[1];
470 if (indexPoint[1] < bounds[2])
472 indexPoint[1] = bounds[2];
474 if (indexPoint[1] > bounds[3])
476 indexPoint[1] = bounds[3];
480 m_PlaneGeometry->
IndexToWorld(indexPoint, constrainedPoint);
482 return constrainedPoint;
487 unsigned int index = m_Features.size();
489 Feature newFeature(featureName, unitName);
490 m_Features.push_back(newFeature);
497 if (index < m_Features.size())
499 m_Features[index].Name = featureName;
505 if (index < m_Features.size())
507 m_Features[index].Unit = unitName;
513 if (index < m_Features.size())
515 m_Features[index].Quantity = quantity;
521 if (index < m_Features.size())
523 m_Features[index].Active =
true;
529 if (index < m_Features.size())
531 m_Features[index].Active =
false;
538 geometry2D->Initialize();
543 timeGeometry->Initialize(geometry2D, timeSteps);
549 Superclass::PrintSelf(os, indent);
550 os << indent << this->GetNameOfClass() <<
":\n";
553 os << indent <<
"This figure is closed\n";
555 os << indent <<
"This figure is not closed\n";
559 os << indent <<
"Control points:" << std::endl;
564 os << indent.GetNextIndent() << i <<
": " <<
m_ControlPoints.at(i) << std::endl;
566 os << indent <<
"Geometry:\n";
572 if (!m_PolyLineUpToDate)
575 m_PolyLineUpToDate =
true;
608 ControlPointListType::iterator iter;
613 m_PolyLineUpToDate =
false;
614 m_HelperLinesUpToDate =
false;
615 m_FeaturesUpToDate =
false;
640 m_PolyLineUpToDate =
false;
644 MITK_ERROR <<
"Tried to add point to PolyLine " << index + 1 <<
", although only " <<
m_PolyLines.size()
654 m_HelperLinesUpToDate =
false;
704 while (itThis != itEnd)
706 if (itThis->size() != itOther->size())
710 auto itLineThis = itThis->begin();
711 auto itLineEnd = itThis->end();
712 auto itLineOther = itOther->begin();
714 while (itLineThis != itLineEnd)
718 ScalarType delta = fabs(p1[0] - p2[0]) + fabs(p1[1] - p2[1]);
738 MITK_ERROR <<
"Number of Features is Different";
743 auto itThis = m_Features.begin();
744 auto itEnd = m_Features.end();
745 auto itOther = other.m_Features.begin();
747 while (itThis != itEnd)
749 if ((itThis->Quantity - itOther->Quantity) > .001)
751 MITK_ERROR <<
"Quantity is Different" << itThis->Quantity <<
"/" << itOther->Quantity;
754 if (itThis->Unit.compare(itOther->Unit) != 0)
756 MITK_ERROR <<
"Unit is Different" << itThis->Unit <<
"/" << itOther->Unit;
759 if (itThis->Name.compare(itOther->Name) != 0)
761 MITK_ERROR <<
"Name of Measure is Different " << itThis->Name <<
"/ " << itOther->Name;
780 return leftHandSide.
Equals(rightHandSide);
Base of all data objects.
virtual void SetGeometry(BaseGeometry *aGeometry3D)
Set the BaseGeometry of the data, which will be referenced (not copied!). Assumes the data object has...
virtual void SetTimeGeometry(TimeGeometry *geometry)
Set the TimeGeometry of the data, which will be referenced (not copied!).
virtual bool Map(const mitk::Point3D &pt3d_mm, mitk::Point2D &pt2d_mm) const
Project a 3D point given in mm (pt3d_mm) onto the 2D geometry. The result is a 2D point in mm (pt2d_m...
virtual void IndexToWorld(const Point2D &pt_units, Point2D &pt_mm) const
void SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Add new or change existent property.
virtual T GetValue() const
const mitk::TimeGeometry * GetTimeGeometry() const
Return the TimeGeometry of the data as const pointer.
virtual void WorldToIndex(const Point2D &pt_mm, Point2D &pt_units) const
mitk::BaseProperty::Pointer GetProperty(const char *propertyKey) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList, and set it to this, respectively;.
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.
MITKCORE_EXPORT const ScalarType eps
Describes a two-dimensional, rectangular plane.
void Update()
Updates the geometry.
mitk::BaseGeometry * GetGeometry(int t=0) const
Return the geometry, which is a TimeGeometry, of the data as non-const pointer.
const BoundsArrayType GetBounds() const
BoundingBoxType::BoundsArrayType BoundsArrayType