Commit ceff3c21781d62ba5040a3e5a927bc13933d1098
1 parent
ccb262f4
Added component scale getter
Showing
2 changed files
with
24 additions
and
0 deletions
include/GModelSpatialComposite.hpp
| @@ -82,6 +82,7 @@ public: | @@ -82,6 +82,7 @@ public: | ||
| 82 | double scale = 1.); | 82 | double scale = 1.); |
| 83 | const GModelSpatial* component(const int& index) const; | 83 | const GModelSpatial* component(const int& index) const; |
| 84 | const GModelSpatial* component(const std::string& name) const; | 84 | const GModelSpatial* component(const std::string& name) const; |
| 85 | + double component_scale(const int& index) const; | ||
| 85 | 86 | ||
| 86 | 87 | ||
| 87 | protected: | 88 | protected: |
src/model/GModelSpatialComposite.cpp
| @@ -594,6 +594,29 @@ const GModelSpatial* GModelSpatialComposite::component(const std::string& name) | @@ -594,6 +594,29 @@ const GModelSpatial* GModelSpatialComposite::component(const std::string& name) | ||
| 594 | return m_components[index]; | 594 | return m_components[index]; |
| 595 | } | 595 | } |
| 596 | 596 | ||
| 597 | +/***********************************************************************//** | ||
| 598 | + * @brief Returns scale of spatial component | ||
| 599 | + * | ||
| 600 | + * @param[in] index Index of spatial component [0,...,components()-1]. | ||
| 601 | + * @return Scale. | ||
| 602 | + * | ||
| 603 | + * @exception GException::out_of_range | ||
| 604 | + * Index is out of range. | ||
| 605 | + * | ||
| 606 | + * Returns the scale of a spatial component to the composite model | ||
| 607 | + ***************************************************************************/ | ||
| 608 | +double GModelSpatialComposite::component_scale(const int& index) const | ||
| 609 | +{ | ||
| 610 | + // Check if index is in validity range | ||
| 611 | + if (index < 0 || index >= m_components.size()) { | ||
| 612 | + throw GException::out_of_range(G_COMPONENT_INDEX, "Component Index", | ||
| 613 | + index, m_components.size()); | ||
| 614 | + } | ||
| 615 | + | ||
| 616 | + // Return spatial component | ||
| 617 | + return m_component_scales[index]; | ||
| 618 | +} | ||
| 619 | + | ||
| 597 | 620 | ||
| 598 | /***********************************************************************//** | 621 | /***********************************************************************//** |
| 599 | * @brief Print composite spatial model information | 622 | * @brief Print composite spatial model information |