00001 00012 #include "BinaryTransform.h" 00013 00014 #include "UnaryTransform.h" 00015 00016 #include <cassert> 00017 00022 BinaryTransform::BinaryTransform () 00023 { 00024 m_name = "nil"; 00025 00026 m_needs_grid = false; 00027 m_needs_x_ticks = true; 00028 m_needs_y_ticks = true; 00029 m_is_periodic = false; 00030 00031 m_z = 0; 00032 } 00033 00034 BinaryTransform::BinaryTransform ( UnaryTransform * z, 00035 bool is_periodic, 00036 bool needs_grid, 00037 bool needs_x_ticks, 00038 bool needs_y_ticks ) 00039 { 00040 m_z = z; 00041 m_name = m_z->name(); 00042 00043 m_needs_grid = needs_grid; 00044 m_needs_x_ticks = needs_x_ticks; 00045 m_needs_y_ticks = needs_y_ticks; 00046 m_is_periodic = is_periodic; 00047 00048 } 00049 00050 BinaryTransform::BinaryTransform ( const BinaryTransform & t ) 00051 : TransformBase ( t ) 00052 { 00053 00054 if ( t.m_z == 0 ){ 00055 m_z = 0; 00056 return; 00057 } 00058 00059 assert ( t.m_z ); 00060 00061 #ifdef CLONE_DEFECT 00062 m_z = dynamic_cast < UnaryTransform * > ( t.m_z->clone () ); 00063 #else 00064 m_z = t.m_z->clone (); 00065 #endif 00066 00067 m_needs_grid = t.needsGrid(); 00068 m_needs_x_ticks = t.needsXTicks(); 00069 m_needs_y_ticks = t.needsYTicks(); 00070 m_is_periodic = t.isPeriodic(); 00071 00072 } 00073 00074 BinaryTransform::~BinaryTransform () 00075 { 00076 delete m_z; 00077 } 00078 00079 double BinaryTransform::aspectRatio () const 00080 { 00081 return 0.0; 00082 } 00083 00084 TransformBase * BinaryTransform::zTransform () const 00085 { 00086 return m_z; 00087 } 00088 00089 void 00090 BinaryTransform:: 00091 setZTransform ( TransformBase * transform ) 00092 { 00093 UnaryTransform * t = dynamic_cast < UnaryTransform * > ( transform ); 00094 00095 m_z = t; 00096 } 00097 00098 void BinaryTransform::transformZ ( double & z ) const 00099 { 00100 assert ( m_z ); 00101 m_z->transform ( z ); 00102 } 00103 00104 void BinaryTransform::inverseTransformZ ( double & z ) const 00105 { 00106 assert ( m_z ); 00107 m_z->inverseTransform ( z ); 00108 } 00109 00110 const Range & BinaryTransform::limitZ () const 00111 { 00112 assert ( m_z ); 00113 return m_z->limits(); 00114 } 00115 00116 bool BinaryTransform::needsGrid() const 00117 { 00118 return m_needs_grid; 00119 } 00120 00121 void BinaryTransform::setNeedsGrid( bool needs_grid ) 00122 { 00123 m_needs_grid = needs_grid; 00124 } 00125 00126 bool BinaryTransform::needsXTicks() const 00127 { 00128 return m_needs_x_ticks; 00129 } 00130 00131 void BinaryTransform::setNeedsXTicks( bool needs_x_ticks ) 00132 { 00133 m_needs_x_ticks = needs_x_ticks; 00134 } 00135 00136 bool BinaryTransform::needsYTicks() const 00137 { 00138 return m_needs_y_ticks; 00139 } 00140 00141 void BinaryTransform::setNeedsYTicks( bool needs_y_ticks ) 00142 { 00143 m_needs_y_ticks = needs_y_ticks; 00144 } 00145 00146 bool BinaryTransform::isPeriodic() const 00147 { 00148 return m_is_periodic; 00149 }