00001 00042 #include "aiconfigzone.hpp" 00043 00044 using namespace AiFractals; 00045 00046 AiConfigZone::AiConfigZone(QWidget * parent) 00047 :QWidget( parent ) 00048 { 00049 //~ init 00050 QLabel * lblZoneWidth = new QLabel( tr("Zone Width :") ); 00051 QLabel * lblZoneHeight = new QLabel( tr("Zone Height :") ); 00052 QLabel * lblZoneMinX = new QLabel( tr("Zone Min X :") ); 00053 QLabel * lblZoneMinY = new QLabel( tr("Zone Min Y :") ); 00054 QLabel * lblImageWidth = new QLabel( tr("Image Width (px) :") ); 00055 QLabel * lblImageHeight = new QLabel( tr("Image Height (px) :") ); 00056 QLabel * lblIterations = new QLabel( tr("Iterations :") ); 00057 00058 m_zoneWidth = new QDoubleSpinBox(); 00059 m_zoneHeight = new QDoubleSpinBox(); 00060 m_zoneMinX = new QDoubleSpinBox(); 00061 m_zoneMinY = new QDoubleSpinBox(); 00062 m_imageWidth = new QSpinBox(); 00063 m_imageHeight = new QSpinBox(); 00064 m_iterations = new QSpinBox(); 00065 QVBoxLayout * layout = new QVBoxLayout(); 00066 00067 //~setup 00068 m_zoneWidth->setDecimals(9); 00069 m_zoneHeight->setDecimals(9); 00070 m_zoneMinX->setDecimals(9); 00071 m_zoneMinY->setDecimals(9); 00072 00073 m_zoneWidth->setRange(-9999.,9999.); 00074 m_zoneHeight->setRange(-9999.,9999.); 00075 m_zoneMinX->setRange(-9999.,9999.); 00076 m_zoneMinY->setRange(-9999.,9999.); 00077 m_imageWidth->setRange(-9999,9999); 00078 m_imageHeight->setRange(-9999,9999); 00079 m_iterations->setRange(1,99); 00080 m_iterations->setMinimum( 1 ); 00081 00082 layout->addWidget( lblZoneWidth ); 00083 layout->addWidget( m_zoneWidth ); 00084 layout->addWidget( lblZoneHeight ); 00085 layout->addWidget( m_zoneHeight ); 00086 layout->addWidget( lblZoneMinX ); 00087 layout->addWidget( m_zoneMinX ); 00088 layout->addWidget( lblZoneMinY ); 00089 layout->addWidget( m_zoneMinY ); 00090 layout->addWidget( lblImageWidth ); 00091 layout->addWidget( m_imageWidth ); 00092 layout->addWidget( lblImageHeight ); 00093 layout->addWidget( m_imageHeight ); 00094 layout->addWidget( lblIterations ); 00095 layout->addWidget( m_iterations ); 00096 00097 this->setLayout( layout ); 00098 00099 } 00100 00101 const double AiConfigZone::getZoneWidth() const 00102 { 00103 return m_zoneWidth->value(); 00104 } 00105 00106 void AiConfigZone::setZoneWidth( double w ) 00107 { 00108 m_zoneWidth->setValue( w ); 00109 } 00110 00111 const double AiConfigZone::getZoneHeight() const 00112 { 00113 return m_zoneHeight->value(); 00114 } 00115 00116 void AiConfigZone::setZoneHeight( double h ) 00117 { 00118 m_zoneHeight->setValue( h ); 00119 } 00120 00121 const double AiConfigZone::getZoneMinX() const 00122 { 00123 return m_zoneMinX->value(); 00124 } 00125 00126 void AiConfigZone::setZoneMinX( double x ) 00127 { 00128 m_zoneMinX->setValue( x ); 00129 } 00130 00131 const double AiConfigZone::getZoneMinY() const 00132 { 00133 return m_zoneMinY->value(); 00134 } 00135 00136 void AiConfigZone::setZoneMinY( double y ) 00137 { 00138 m_zoneMinY->setValue( y ); 00139 } 00140 00141 const int AiConfigZone::getImageWidth() const 00142 { 00143 return m_imageWidth->value(); 00144 } 00145 00146 void AiConfigZone::setImageWidth( int w ) 00147 { 00148 m_imageWidth->setValue( w ); 00149 } 00150 00151 const int AiConfigZone::getImageHeight() const 00152 { 00153 return m_imageHeight->value(); 00154 } 00155 00156 void AiConfigZone::setImageHeight( int h ) 00157 { 00158 m_imageHeight->setValue( h ); 00159 } 00160 00161 const int AiConfigZone::getIterations() const 00162 { 00163 return m_iterations->value(); 00164 } 00165 00166 void AiConfigZone::setIterations( int i ) 00167 { 00168 m_iterations->setValue( i ); 00169 } 00170 00171 AiConfigZone::~AiConfigZone() 00172 { 00173 if( m_zoneWidth != NULL ) 00174 { 00175 delete m_zoneWidth; 00176 } 00177 if( m_zoneHeight != NULL ) 00178 { 00179 delete m_zoneHeight; 00180 } 00181 if( m_zoneMinX != NULL ) 00182 { 00183 delete m_zoneMinX; 00184 } 00185 if( m_zoneMinY != NULL ) 00186 { 00187 delete m_zoneMinY; 00188 } 00189 if( m_imageWidth != NULL ) 00190 { 00191 delete m_imageWidth; 00192 } 00193 if( m_imageHeight != NULL ) 00194 { 00195 delete m_imageHeight; 00196 } 00197 if( m_iterations != NULL ) 00198 { 00199 delete m_iterations; 00200 } 00201 }