rangecontrol.cpp

Go to the documentation of this file.
00001 /* ====================================================================================
00002 The definition of the range control window class.
00003 
00004 Written by Michael R. Greason, ADNET, 23 August 2007.
00005 ==================================================================================== */
00006 /*
00007                         Fetch header files.
00008 */
00009 #include <iostream>
00010 #include "rangecontrol.h"
00011 #include "healpixmap.h"
00012 
00013 using namespace std;
00014 /* ------------------------------------------------------------------------------------
00015 The class constructor.
00016 
00017 Arguments:
00018         parent - The parent wiget/window.
00019 
00020 Written by Michael R. Greason, ADNET, 23 August 2007.
00021 ------------------------------------------------------------------------------------ */
00022 RangeControl::RangeControl(QWidget *parent) : QWidget(parent) 
00023 {
00024         setupUi(this);
00025 
00026         //setWindowTitle(tr("Range Control"));
00027 
00028         //setVisible(false);
00029 
00030         map = 0;
00031         proj=Spherical;
00032         fld=I;
00033         rigging = riggingSelect->currentText().toInt();
00034         pv = Off;
00035 
00036         connect(histogramWidget,SIGNAL(newRange(float,float)),this,SLOT(updateTexture(float,float)));
00037 
00038 };
00039 
00040 /* ------------------------------------------------------------------------------------
00041 'init'
00042 
00043 Arguments:
00044         map:    Pointer to Healpix map to use
00045 
00046 Written by Nicholas Phillips 8/11/08
00047 ------------------------------------------------------------------------------------ */
00048 void RangeControl::init(Skymap *map_)
00049 {
00050         map = map_;
00051         fieldSelect->clear();
00052         fields.clear();
00053         if( map->has_Temperature() ) {
00054                 fieldSelect->addItem("Temperature");
00055                 fields.push_back(I);
00056         }
00057         if( map->has_Polarization() ) {
00058                 fieldSelect->addItem("Q Polarization");
00059                 fields.push_back(Q);
00060                 fieldSelect->addItem("U Polarization");
00061                 fields.push_back(U);
00062                 fieldSelect->addItem("P Polarization");
00063                 fields.push_back(P);
00064         }
00065         else if( (fld==Q) || (fld==U) || (fld==P) )
00066                 fld = I;
00067         if( map->has_Nobs() ) {
00068                 fieldSelect->addItem("Num Obs");
00069                 fields.push_back(Nobs);
00070         }
00071         else if( fld == Nobs )
00072                 fld = I;
00073 
00074         polarVectorBox->setEnabled(map->has_Polarization());
00075         pv = Off;
00076         
00077         histogramWidget->set(map,fld);
00078 
00079         return;
00080 }
00081 
00082 
00083 /* ------------------------------------------------------------------------------------
00084 'on_projectionSelect_activated'
00085         auto-connected slot to handle a change in the selected projection.
00086         All that happens is the change is recorded and signaled
00087 
00088 Written by Nicholas Phillips 8/11/08
00089 ------------------------------------------------------------------------------------ */
00090 void RangeControl::on_projectionSelect_activated(int)
00091 {
00092         Projection newproj = projectionSelect->currentText() == "3D Sphere" ? Spherical : Mollweide;
00093         if( newproj == proj ) return;
00094         proj = newproj;
00095         emit changeProjRigging();
00096 }
00097 void RangeControl::setProjection(Projection newproj)
00098 {
00099         if( newproj == proj ) return;
00100         proj = newproj;
00101         projectionSelect->setCurrentIndex(proj == Spherical ? 0 : 1);
00102         emit changeProjRigging();
00103 
00104 }
00105 /* ------------------------------------------------------------------------------------
00106 'on_riggingSelect_activated'
00107         auto-connected slot to handle a change in the desired sphere rigging size
00108         All that happens is the change is recorded and signaled
00109 
00110 Written by Nicholas Phillips 8/11/08
00111 ------------------------------------------------------------------------------------ */
00112 void RangeControl::on_riggingSelect_activated(int)
00113 {
00114         int newrigging = riggingSelect->currentText().toInt();
00115         if( newrigging == rigging ) return;
00116         rigging = newrigging;
00117         emit changeProjRigging();
00118 
00119 }
00120 /* ------------------------------------------------------------------------------------
00121 'on_fieldSelect_activated'
00122         auto-connected slot to handle a change in the selected display field
00123 Arguments:
00124 
00125 Written by Nicholas Phillips 8/11/08
00126 ------------------------------------------------------------------------------------ */
00127 void RangeControl::on_fieldSelect_activated(int i)
00128 {
00129         if( fields[i] == fld )
00130                 return;
00131         fld = fields[i];
00132         histogramWidget->set(map,fld);
00133         emit changeFieldInfo();
00134 }
00135 /* ------------------------------------------------------------------------------------
00136 'setField'
00137         External request for a change in the selected map field. Assumes a valid field
00138         was requested.
00139 Arguments:
00140         newfld:         The new display field to use
00141 
00142 Written by Nicholas Phillips 8/11/08
00143 ------------------------------------------------------------------------------------ */
00144 void RangeControl::setField(Field newfld)
00145 {
00146         if( newfld == fld ) return;
00147         fld = newfld;
00148         for(int i = 0; i < fieldSelect->count();i++) {
00149                 if( fields[i] == fld ) {
00150                         fieldSelect->setCurrentIndex(i);
00151                         break;
00152                 }
00153         }
00154         histogramWidget->set(map,fld);
00155         emit changeFieldInfo();
00156 }
00157 /* ------------------------------------------------------------------------------------
00158 'on_colorSelect_activated'
00159         auto-connected slot to handle a change in the selected color table
00160 Arguments:
00161 
00162 Written by Nicholas Phillips 8/11/08
00163 ------------------------------------------------------------------------------------ */
00164 void RangeControl::on_colorSelect_activated(int)
00165 {
00166         int i = colorSelect->currentIndex();
00167         histogramWidget->set(ctl[i]);
00168         emit reTextureNeeded();
00169 }
00170 /* ------------------------------------------------------------------------------------
00171 'on_colorSelect_activated'
00172         auto-connected slot to handle a change in the selected color table
00173 Arguments:
00174 
00175 Written by Nicholas Phillips 8/11/08
00176 ------------------------------------------------------------------------------------ */
00177 void RangeControl::on_polarVectorBox_clicked(bool v)
00178 {
00179         pv = v ? On : Off;
00180         emit changePolVect();
00181 }
00182 /* ------------------------------------------------------------------------------------
00183 'setPolarVect'
00184         External request for a change as to whether the polarization are shown.
00185 Arguments:
00186         newpv:          The new state
00187 
00188 Written by Nicholas Phillips 8/11/08
00189 ------------------------------------------------------------------------------------ */
00190 void RangeControl::setPolarVect(PolVectors newpv)
00191 {
00192         if( newpv == pv ) return;
00193         pv = newpv;
00194         polarVectorBox->setChecked(pv == On);
00195         emit changePolVect();
00196 }
00197 /* ------------------------------------------------------------------------------------
00198 'updateTexture'
00199         change the state and signal a need to retexture
00200 Arguments:
00201 
00202 Written by Nicholas Phillips 8/11/08
00203 ------------------------------------------------------------------------------------ */
00204 void RangeControl::updateTexture(float lower, float upper)
00205 {
00206         minv = lower;
00207         maxv = upper;
00208         emit reTextureNeeded();
00209 }
00210 /* ------------------------------------------------------------------------------------
00211 'getColorTable' returns the currently selected color table from its comboBox.
00212 
00213 Arguments:
00214         None.
00215 
00216 Returned:
00217         rigging - The current rigging.
00218 
00219 Written by Michael R. Greason, ADNET, 23 August 2007.
00220 ------------------------------------------------------------------------------------ */
00221 ColorTable* RangeControl::getColorTable (void) const
00222 {
00223         int i = colorSelect->currentIndex();
00224         return ctl[i];
00225 }
00226 

Generated on Fri Feb 6 15:32:42 2009 for Skyviewer by  doxygen 1.4.7