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

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

Implementing transformation algorithm: zoom axis (local commit)

+) Implement zoom axis: zoomed points are points not masked
+) Correct some minor bugs

Test
+) Ok with normal cases: zoom in the last of transformation list
+) There is still a bug in case of zoom then 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    int axisIBegin, axisNi, axisSize;
28    int 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_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 > 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.