Commit ceff3c21781d62ba5040a3e5a927bc13933d1098
1 parent
ccb262f4
Added component scale getter
Showing
2 changed files
with
24 additions
and
0 deletions
include/GModelSpatialComposite.hpp
src/model/GModelSpatialComposite.cpp
| ... | ... | @@ -594,6 +594,29 @@ const GModelSpatial* GModelSpatialComposite::component(const std::string& name) |
| 594 | 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 | 622 | * @brief Print composite spatial model information | ... | ... |