source: XIOS/trunk/src/node/zoom_axis.cpp @ 621

Last change on this file since 621 was 621, checked in by mhnguyen, 9 years ago

Implementing generic transformation algorithm (local commit)

+) Change a little bit to make sure everything work in order

Test
+) test_new_features passe with inverse

File size: 2.0 KB
Line 
1#include "zoom_axis.hpp"
2#include "type.hpp"
3
4namespace 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    StdSize axisIBegin, axisNi, axisSize;
28    StdSize zoom_begin,zoom_end, zoom_size;
29
30    axisIBegin = axisDest->ibegin.getValue();
31    axisNi     = axisDest->ni.getValue();
32    axisSize   = axisDest->size.getValue();
33
34    zoom_begin = (this->zoom_begin.isEmpty()) ?  0 : this->zoom_begin.getValue() ;
35    zoom_size  = (this->zoom_size.isEmpty()) ?  axisSize : this->zoom_size.getValue() ;
36    zoom_end   = (this->zoom_end.isEmpty()) ?  (axisSize - 1) : this->zoom_end.getValue() ;
37
38    if (this->zoom_begin.isEmpty()) zoom_begin=zoom_end-zoom_size+1 ;
39    if (this->zoom_end.isEmpty()) zoom_end=zoom_begin+zoom_size-1 ;
40    if (this->zoom_size.isEmpty()) zoom_size=zoom_end-zoom_begin+1 ;
41
42    if ((zoom_begin < 0) || (zoom_begin > axisSize-1) || (zoom_end<0) || (zoom_end>axisSize-1) || (zoom_size<1) || (zoom_size>axisSize) || (zoom_begin>zoom_end))
43      ERROR("CZoomAxis::checkAttributes(void)",
44            << "One or more attributes among <zoom_begin>, <zoom_end>, <zoom_size> of axis transformation [ id = '" << axisDest->getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] are not well specified");
45
46    this->zoom_begin.setValue(zoom_begin) ;
47    this->zoom_end.setValue(zoom_end) ;
48    this->zoom_size.setValue(zoom_size) ;
49
50  }
51
52}
Note: See TracBrowser for help on using the repository browser.