[621] | 1 | #include "zoom_axis.hpp" |
---|
| 2 | #include "type.hpp" |
---|
| 3 | |
---|
| 4 | namespace xios { |
---|
| 5 | |
---|
| 6 | /// ////////////////////// Définitions ////////////////////// /// |
---|
| 7 | |
---|
| 8 | CZoomAxis::CZoomAxis(void) |
---|
| 9 | : CObjectTemplate<CZoomAxis>(), CZoomAxisAttributes(), CTransformation<CAxis>() |
---|
| 10 | { /* Ne rien faire de plus */ } |
---|
| 11 | |
---|
| 12 | CZoomAxis::CZoomAxis(const StdString & id) |
---|
| 13 | : CObjectTemplate<CZoomAxis>(id), CZoomAxisAttributes(), CTransformation<CAxis>() |
---|
| 14 | { /* Ne rien faire de plus */ } |
---|
| 15 | |
---|
| 16 | CZoomAxis::~CZoomAxis(void) |
---|
| 17 | {} |
---|
| 18 | |
---|
[836] | 19 | CTransformation<CAxis>* CZoomAxis::create(const StdString& id, xml::CXMLNode* node) |
---|
| 20 | { |
---|
| 21 | CZoomAxis* zoomAxis = CZoomAxisGroup::get("zoom_axis_definition")->createChild(id); |
---|
| 22 | if (node) zoomAxis->parse(*node); |
---|
| 23 | return static_cast<CTransformation<CAxis>*>(zoomAxis); |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | bool CZoomAxis::registerTrans() |
---|
| 27 | { |
---|
| 28 | return registerTransformation(TRANS_ZOOM_AXIS, CZoomAxis::create); |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | bool CZoomAxis::_dummyRegistered = CZoomAxis::registerTrans(); |
---|
| 32 | |
---|
[621] | 33 | //---------------------------------------------------------------- |
---|
| 34 | |
---|
| 35 | StdString CZoomAxis::GetName(void) { return StdString("zoom_axis"); } |
---|
| 36 | StdString CZoomAxis::GetDefName(void) { return StdString("zoom_axis"); } |
---|
| 37 | ENodeType CZoomAxis::GetType(void) { return eZoomAxis; } |
---|
| 38 | |
---|
| 39 | void CZoomAxis::checkValid(CAxis* axisDest) |
---|
| 40 | { |
---|
[666] | 41 | int axisIBegin, axisNi, axisGlobalSize; |
---|
[787] | 42 | int begin, end, n; |
---|
[621] | 43 | |
---|
[666] | 44 | axisIBegin = axisDest->begin.getValue(); |
---|
| 45 | axisNi = axisDest->n.getValue(); |
---|
| 46 | axisGlobalSize = axisDest->n_glo.getValue(); |
---|
[621] | 47 | |
---|
[787] | 48 | begin = (this->begin.isEmpty()) ? 0 : this->begin.getValue(); |
---|
| 49 | n = (this->n.isEmpty()) ? axisGlobalSize : this->n.getValue(); |
---|
| 50 | end = begin+n-1; |
---|
[621] | 51 | |
---|
[787] | 52 | if (begin < 0 || begin > axisGlobalSize - 1 || end < 0 || end > axisGlobalSize - 1 |
---|
| 53 | || n < 1 || n > axisGlobalSize || begin > end) |
---|
[680] | 54 | ERROR("CZoomAxis::checkValid(CAxis* axisDest)", |
---|
[787] | 55 | << "One or more attributes among 'begin' (" << begin << "), 'end' (" << end << "), 'n' (" << n << ") " |
---|
[680] | 56 | << "of axis transformation [ id = '" << axisDest->getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] are not well specified"); |
---|
[621] | 57 | |
---|
[787] | 58 | this->begin.setValue(begin); |
---|
| 59 | this->n.setValue(n); |
---|
[621] | 60 | |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | } |
---|