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 | |
---|
19 | //---------------------------------------------------------------- |
---|
20 | |
---|
21 | StdString CZoomAxis::GetName(void) { return StdString("zoom_axis"); } |
---|
22 | StdString CZoomAxis::GetDefName(void) { return StdString("zoom_axis"); } |
---|
23 | ENodeType CZoomAxis::GetType(void) { return eZoomAxis; } |
---|
24 | |
---|
25 | void CZoomAxis::checkValid(CAxis* axisDest) |
---|
26 | { |
---|
27 | int axisIBegin, axisNi, axisGlobalSize; |
---|
28 | int zoom_begin, zoom_end, zoom_size; |
---|
29 | |
---|
30 | axisIBegin = axisDest->begin.getValue(); |
---|
31 | axisNi = axisDest->n.getValue(); |
---|
32 | axisGlobalSize = axisDest->n_glo.getValue(); |
---|
33 | |
---|
34 | zoom_begin = (this->zoom_begin.isEmpty()) ? 0 : this->zoom_begin.getValue() ; |
---|
35 | zoom_size = (this->zoom_size.isEmpty()) ? axisGlobalSize : this->zoom_size.getValue() ; |
---|
36 | zoom_end = (this->zoom_end.isEmpty()) ? (axisGlobalSize - 1) : this->zoom_end.getValue() ; |
---|
37 | |
---|
38 | if (this->zoom_begin.isEmpty()) zoom_begin=zoom_end-zoom_size+1; |
---|
39 | if (this->zoom_size.isEmpty()) zoom_size=zoom_end-zoom_begin+1; |
---|
40 | if (this->zoom_end.isEmpty()) zoom_end=zoom_begin+zoom_size-1; |
---|
41 | |
---|
42 | if (zoom_begin < 0 || zoom_begin > axisGlobalSize - 1 || zoom_end < 0 || zoom_end > axisGlobalSize - 1 |
---|
43 | || zoom_size < 1 || zoom_size > axisGlobalSize || zoom_begin > zoom_end) |
---|
44 | ERROR("CZoomAxis::checkValid(CAxis* axisDest)", |
---|
45 | << "One or more attributes among 'zoom_begin' (" << zoom_begin << "), 'zoom_end' (" << zoom_end << "), 'zoom_size' (" << zoom_size << ") " |
---|
46 | << "of axis transformation [ id = '" << axisDest->getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] are not well specified"); |
---|
47 | |
---|
48 | this->zoom_begin.setValue(zoom_begin) ; |
---|
49 | this->zoom_end.setValue(zoom_end) ; |
---|
50 | this->zoom_size.setValue(zoom_size) ; |
---|
51 | |
---|
52 | } |
---|
53 | |
---|
54 | } |
---|