Пример #1
0
    /**
     * @brief Return parameters used for all bands
     *
     * Method creates keyword vectors of band specific parameters
     * used in the photometric correction.
     *
     * @author Kris Becker - 2/22/2010
     *
     * @param pvl Output PVL container write keywords
     */
    void Hillier::Report ( PvlContainer &pvl ) {
        pvl.addComment("I/F = mu0/(mu0+mu) * F(phase)");
                pvl.addComment(" where:");
                pvl.addComment("  mu0 = cos(incidence)");
                pvl.addComment("  mu = cos(incidence)");
                pvl.addComment("  F(phase) = B0*exp(-B1*phase) + A0 + A1*phase + A2*phase^2 + A3*phase^3 + A4*phase^4");

                pvl += PvlKeyword("Algorithm", "Hillier");
                pvl += PvlKeyword("IncRef", toString(_iRef), "degrees");
                pvl += PvlKeyword("EmaRef", toString(_eRef), "degrees");
                pvl += PvlKeyword("PhaRef", toString(_gRef), "degrees");
                PvlKeyword units("HillierUnits");
                PvlKeyword phostd("PhotometricStandard");
                PvlKeyword bbc("BandBinCenter");
                PvlKeyword bbct("BandBinCenterTolerance");
                PvlKeyword bbn("BandNumber");
                PvlKeyword b0("B0");
                PvlKeyword b1("B1");
                PvlKeyword a0("A0");
                PvlKeyword a1("A1");
                PvlKeyword a2("A2");
                PvlKeyword a3("A3");
                PvlKeyword a4("A4");
                for (unsigned int i = 0; i < _bandpho.size(); i++) {
                    Parameters &p = _bandpho[i];
                    units.addValue(p.units);
                    phostd.addValue(toString(p.phoStd));
                    bbc.addValue(toString(p.wavelength));
                    bbct.addValue(toString(p.tolerance));
                    bbn.addValue(toString(p.band));
                    b0.addValue(toString(p.b0));
                    b1.addValue(toString(p.b1));
                    a0.addValue(toString(p.a0));
                    a1.addValue(toString(p.a1));
                    a2.addValue(toString(p.a2));
                    a3.addValue(toString(p.a3));
                    a4.addValue(toString(p.a4));
                }
                pvl += units;
                pvl += phostd;
                pvl += bbc;
                pvl += bbct;
                pvl += bbn;
                pvl += b0;
                pvl += b1;
                pvl += a0;
                pvl += a1;
                pvl += a2;
                pvl += a3;
                pvl += a4;
                return;
            }
void
QvisLegendAttributesInterface::UpdateControls()
{
    // Set the manage layout bit.
    manageLayout->blockSignals(true);
    manageLayout->setChecked(GetBool(LEGEND_MANAGE_POSITION));
    manageLayout->blockSignals(false);

    // Set the start position.
    positionEdit->setPosition(annot->GetPosition()[0], annot->GetPosition()[1]);
    positionEdit->setEnabled(!GetBool(LEGEND_MANAGE_POSITION));
    positionLabel->setEnabled(!GetBool(LEGEND_MANAGE_POSITION));

    // Set the spinbox values for the width and height.  The 0.5 is added
    // to avoid numeric issues converting back and forth between float and
    // integer.
    int w(int(annot->GetPosition2()[0] * WIDTH_HEIGHT_PRECISION + 0.5f));
    widthSpinBox->blockSignals(true);
    widthSpinBox->setValue(w);
    widthSpinBox->blockSignals(false);

    int h(int(annot->GetPosition2()[1] * WIDTH_HEIGHT_PRECISION + 0.5f));
    heightSpinBox->blockSignals(true);
    heightSpinBox->setValue(h);
    heightSpinBox->blockSignals(false);

    // Set the orientation.  
    orientationComboBox->blockSignals(true);
    if (GetBool(LEGEND_ORIENTATION0))
    {
        if (GetBool(LEGEND_ORIENTATION1))
            orientationComboBox->setCurrentIndex(3);
        else
            orientationComboBox->setCurrentIndex(2);
    }
    else
    {
        if (GetBool(LEGEND_ORIENTATION1))
            orientationComboBox->setCurrentIndex(1);
        else
            orientationComboBox->setCurrentIndex(0);
    }
    orientationComboBox->blockSignals(false);

    int type = annot->GetIntAttribute3();
    //
    tickControl->blockSignals(true);
    tickControl->setChecked(GetBool(LEGEND_CONTROL_TICKS));
    tickControl->blockSignals(false);

    numTicksSpinBox->blockSignals(true);
    numTicksSpinBox->setEnabled(type == LEGEND_TYPE_VARIABLE && 
                                GetBool(LEGEND_CONTROL_TICKS));
    numTicksLabel->setEnabled(type == LEGEND_TYPE_VARIABLE &&
                              GetBool(LEGEND_CONTROL_TICKS));
    numTicksSpinBox->setValue(annot->GetIntAttribute2());
    numTicksSpinBox->blockSignals(false);

    minMaxCheckBox->blockSignals(true);
    minMaxCheckBox->setChecked(GetBool(LEGEND_MINMAX_INCLUSIVE));
    minMaxCheckBox->setEnabled(type == LEGEND_TYPE_VARIABLE &&
                               GetBool(LEGEND_CONTROL_TICKS));
    minMaxCheckBox->blockSignals(false);

    QString temp;
    int size;
    if (type == LEGEND_TYPE_VARIABLE)
    {
        doubleVector sv = annot->GetDoubleVector1();
        size = (int)sv.size();
        ResizeSuppliedLabelsList(size);
        QString fmt(formatString->text());
        suppliedLabels->horizontalHeaderItem(0)->setText(tr("Values"));
        for (int i = 0; i < size; ++i)
        {
            temp.sprintf(fmt.toStdString().c_str(), sv[i]);
            suppliedLabels->item(i, 0)->setText(temp.simplified());
            suppliedLabels->item(i, 0)->setFlags(
                     Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
        }
    }
    else 
    {
        stringVector sv = annot->GetStringVector2();
        size = (int)sv.size();
        ResizeSuppliedLabelsList(size);
        suppliedLabels->horizontalHeaderItem(0)->setText(tr("Computed values"));
        suppliedLabels->resizeColumnToContents(0);
        for (int i = 0; i < size; ++i)
        {
            suppliedLabels->item(i, 0)->setText(sv[i].c_str());
            suppliedLabels->item(i, 0)->setFlags(Qt::NoItemFlags);
        }
    }
 
    stringVector sl = annot->GetStringVector1();
    size = (int)sl.size();
    for (int i = 0; i < suppliedLabels->rowCount(); ++i)
    {
        if (i < size)
            suppliedLabels->item(i, 1)->setText(sl[i].c_str());
        else 
            suppliedLabels->item(i, 1)->setText("");
    }

    drawLabelsComboBox->blockSignals(true);
    int dv = GetBool(LEGEND_DRAW_VALUES) ? 1 : 0;
    int dl = GetBool(LEGEND_DRAW_LABELS) ? 2 : 0;
    drawLabelsComboBox->setCurrentIndex(dv+dl);
    drawLabelsComboBox->blockSignals(false);

    suppliedLabels->setEnabled(!GetBool(LEGEND_CONTROL_TICKS));
    addRowButton->setEnabled(type == LEGEND_TYPE_VARIABLE &&
                             !GetBool(LEGEND_CONTROL_TICKS));
    deleteRowButton->setEnabled(type == LEGEND_TYPE_VARIABLE &&
                               !GetBool(LEGEND_CONTROL_TICKS));

    //
    // Set the text color. If we're using the foreground color for the text
    // color then make the button be white and only let the user change the 
    // opacity.
    //
#ifdef TEXT_OPACITY_SUPPORTED
    textColorOpacity->blockSignals(true);
#endif
    QColor tc(annot->GetTextColor().Red(),
              annot->GetTextColor().Green(),
              annot->GetTextColor().Blue());
    textColorButton->setButtonColor(tc);
#ifdef TEXT_OPACITY_SUPPORTED
    textColorOpacity->setGradientColor(tc);
    textColorOpacity->setValue(annot->GetTextColor().Alpha());
    textColorOpacity->blockSignals(false);
    textColorOpacity->setEnabled(!annot->GetUseForegroundForTextColor());
#endif
    textColorButton->setEnabled(!annot->GetUseForegroundForTextColor());
    textColorLabel->setEnabled(!annot->GetUseForegroundForTextColor());

    // Set the bounding box color.
    drawBoundingBoxCheckBox->blockSignals(true);
    drawBoundingBoxCheckBox->setChecked(GetBool(LEGEND_DRAW_BOX));
    drawBoundingBoxCheckBox->blockSignals(false);
    boundingBoxOpacity->blockSignals(true);
    QColor bbc(annot->GetColor1().Red(),
               annot->GetColor1().Green(),
               annot->GetColor1().Blue());
    boundingBoxColorButton->setButtonColor(bbc);
    boundingBoxColorButton->setEnabled(GetBool(LEGEND_DRAW_BOX));
    boundingBoxOpacity->setEnabled(GetBool(LEGEND_DRAW_BOX));
    boundingBoxOpacity->setGradientColor(bbc);
    boundingBoxOpacity->setValue(annot->GetColor1().Alpha());
    boundingBoxOpacity->blockSignals(false);

    // Set the format string
    const stringVector &annotText = annot->GetText();
    if(annotText.size() > 0)
        formatString->setText(annotText[0].c_str());
    else
        formatString->setText("");

    // Set the "draw labels" box.
    drawTitleCheckBox->blockSignals(true);
    drawTitleCheckBox->setChecked(GetBool(LEGEND_DRAW_TITLE));
    drawTitleCheckBox->blockSignals(false);

    // Set the "draw labels" box.
    drawMinmaxCheckBox->blockSignals(true);
    drawMinmaxCheckBox->setChecked(GetBool(LEGEND_DRAW_MINMAX));
    drawMinmaxCheckBox->blockSignals(false);

    // Set the font height
    fontHeight->setText(QString().sprintf("%g", annot->GetDoubleAttribute1()));

    // Set the use foreground color check box.
    useForegroundColorCheckBox->blockSignals(true);
    useForegroundColorCheckBox->setChecked(annot->GetUseForegroundForTextColor());
    useForegroundColorCheckBox->blockSignals(false);

    // Set the font family
    fontFamilyComboBox->blockSignals(true);
    fontFamilyComboBox->setCurrentIndex(int(annot->GetFontFamily()));
    fontFamilyComboBox->blockSignals(false);

    // Set the bold check box.
    boldCheckBox->blockSignals(true);
    boldCheckBox->setChecked(annot->GetFontBold());
    boldCheckBox->blockSignals(false);

    // Set the italic check box.
    italicCheckBox->blockSignals(true);
    italicCheckBox->setChecked(annot->GetFontItalic());
    italicCheckBox->blockSignals(false);

    // Set the shadow check box.
    shadowCheckBox->blockSignals(true);
    shadowCheckBox->setChecked(annot->GetFontShadow());
    shadowCheckBox->blockSignals(false);
}
Пример #3
0
void dipi0(int plt=0, int cut=2, int run=1, int opt=4){
    printf("plt=%d cut=%d run=%d opt=%d\n",plt,cut,run,opt);
    OPT=opt;
    RUN=run;
    openCanvas();  
    if(plt==1 || plt==0) bbc(1);
    if(plt==2 || plt==0) bbc(2);
    if(plt==3 || plt==0) bbc(3);
    if(plt==4 || plt==0) {plot("bbce",11,cut,c1); plot("bbce",13,cut,c2); plot("bbce",12,cut,c3);}
    if(plt==5 || plt==0) {plot("m0",11,cut,c1);   plot("m0",13,cut,c2);  plot("m0",12,cut,c3);}
    if(plt==6 || plt==0) {plot("m1",11,cut,c1);   plot("m1",13,cut,c2);  plot("m1",12,cut,c3);}
    if(plt==7 || plt==0) {plot("m2",11,cut,c1);   plot("m2",13,cut,c2);  plot("m2",12,cut,c3);}
    if(plt==8 || plt==0) {plot("z1",11,cut,c1);   plot("z1",13,cut,c2);  plot("z1",12,cut,c3);}
    if(plt==9 || plt==0) {plot("z2",11,cut,c1);   plot("z2",13,cut,c2);  plot("z2",12,cut,c3);}
    if(plt==10|| plt==0) {plot("phi0",11,cut,c1); plot("phi0",13,cut,c2);plot("phi0",12,cut,c3);}
    if(plt==11|| plt==0) {plot("phi1",11,cut,c1); plot("phi1",13,cut,c2);plot("phi1",12,cut,c3);}
    if(plt==12|| plt==0) {plot("phi2",11,cut,c1); plot("phi2",13,cut,c2);plot("phi2",12,cut,c3);}
    if(plt==13|| plt==0) {plot("eta1",11,cut,c1); plot("eta1",13,cut,c2);plot("eta1",12,cut,c3);}
    if(plt==14|| plt==0) {plot("eta2",11,cut,c1); plot("eta2",13,cut,c2);plot("eta2",12,cut,c3);}
    if(plt==15|| plt==0) {plot("dphi",11,cut,c1); plot("dphi",13,cut,c2);plot("dphi",12,cut,c3);}
    if(plt==16|| plt==0) {plot("phi1dphi",11,cut,c1); plot("phi1dphi",13,cut,c2);plot("phi1dphi",12,cut,c3);}
    if(plt==17|| plt==0) {plot("mix",11,cut,c1); plot("mix",13,cut,c2);plot("mix",12,cut,c3);}

    if(plt==20 || plt==0){plot("mall",11,cut,c1);   plot("mall",13,cut,c2); plot("mall",12,cut,c3);}
    if(plt==21 || plt==0){plot("z12",11,cut,c1);    plot("z12",13,cut,c2);  plot("z12",12,cut,c3);}

    if(plt==30|| plt==0){comp(11,4,2,c1);   comp(13,4,2,c2);  comp(12,4,2,c3);}
    if(plt==31|| plt==0){comp(20,2,1,c1);}

    if(plt==40 || plt==0) {plot("norm",11,cut,c1,2); plot("norm",13,cut,c2,2); plot("norm",12,cut,c3,2);}
    if(plt==41 || plt==0) {
	plot("norm",11,cut,c1,1,-1,-1,0.00,4); 
	plot("norm",13,cut,c2,1,-1,-1,0.00,4); 
	plot("norm",12,cut,c3,1,-1,-1,0.00,4);
    }
    if(plt==42 || plt==0) {
	plot("corr",11,cut,c1,1,-1,-1,0.00,4); 
	plot("corr",13,cut,c2,1,-1,-1,0.00,4); 
	plot("corr",12,cut,c3,1,-1,-1,0.00,4);
    }

    if(plt==50) mix(run,cut,3,1);
    if(plt==51) mix(11,12,4,2);
    if(plt==52) mix(12,16,2,0);
    if(plt==53) mix(11,2,3,1);
    if(plt==54) mix(12,16,3,1);
    if(plt==55) mix(13,16,3,1);
    if(plt==56) mix(13,2,2,2);
    

    if(plt==100 || plt==0){
	plot("norm",11,2,c1,1,2,0,0.1);
	plot("norm",12,2,c2,1,2,0,0.1);
	plot("norm",12,3,c2,1,2,0,0.1);
	plot("norm",12,4,c2,1,2,0,0.1);
	plot("norm",12,5,c2,1,2,0,0.1);
	plot("norm",12,15,c2,1,2,0,0.1);
	plot("norm",12,16,c2,1,2,0,0.1);
    }
    if(plt==101 || plt==0){
	plot("norm",11,2,c1,1,3,1,0.012);
	plot("norm",11,3,c1,1,3,1,0.012);
	plot("norm",11,4,c1,1,3,1,0.012);
	plot("norm",11,5,c1,1,3,1,0.012);
	plot("norm",11,15,c1,1,3,1,0.012);
	plot("norm",12,2,c2,1,3,1,0.012);
	plot("norm",12,3,c2,1,3,1,0.012);
	plot("norm",12,4,c2,1,3,1,0.012);
	plot("norm",12,5,c2,1,3,1,0.012);
	plot("norm",12,15,c2,1,3,1,0.012);
	plot("norm",12,16,c2,1,3,1,0.012);
	plot("norm",13,2,c2,1,3,1,0.012);
	plot("norm",13,3,c2,1,3,1,0.012);
	plot("norm",13,4,c2,1,3,1,0.012);
	plot("norm",13,5,c2,1,3,1,0.012);
	plot("norm",13,15,c2,1,3,1,0.012);
	plot("norm",13,16,c2,1,3,1,0.012);
    }
    if(plt==102 || plt==0){
	plot("norm",11,2,c1,1,4,2,0.002);
	plot("norm",12,2,c2,1,4,2,0.002);
	plot("norm",12,3,c2,1,4,2,0.002);
	plot("norm",12,4,c2,1,4,2,0.002);
	plot("norm",12,5,c2,1,4,2,0.002);
	plot("norm",12,15,c2,1,4,2,0.002);
	plot("norm",12,16,c2,1,4,2,0.002);
    }
    if(plt==103 || plt==0){
	plot("norm",11,2,c1,1,5,3,0.0005);
	plot("norm",12,2,c2,1,5,3,0.0005);
	plot("norm",12,3,c2,1,5,3,0.0005);
	plot("norm",12,4,c2,1,5,3,0.0005);
	plot("norm",12,5,c2,1,5,3,0.0005);
	plot("norm",12,15,c2,1,5,3,0.0005);
	plot("norm",12,16,c2,1,5,3,0.0005);
    }
    if(plt==110 || plt==0){
	plot("norm",11,2,c1,1,3,1,0.012);
	plot("norm",11,6,c2,1,3,1,0.012);
	plot("norm",12,2,c1,1,3,1,0.012);
	plot("norm",12,6,c2,1,3,1,0.012);
	plot("norm",15,2,c1,1,3,1,0.012);
	plot("norm",15,6,c2,1,3,1,0.012);
	plot("norm",11,2,c1,1,4,2,0.002);
	plot("norm",11,6,c2,1,4,2,0.002);
	plot("norm",12,2,c1,1,4,2,0.002);
	plot("norm",12,6,c2,1,4,2,0.002);
	plot("norm",15,2,c1,1,4,2,0.002);
	plot("norm",15,6,c2,1,4,2,0.002);
    }
    if(plt==111 || plt==0){
	plot("norm",11,12,c1,1,3,1,0.012);
	plot("norm",11,13,c2,1,3,1,0.012);
	plot("norm",15,12,c1,1,3,1,0.012);
	plot("norm",15,13,c2,1,3,1,0.012);
	plot("norm",12,12,c1,1,3,1,0.012);
	plot("norm",12,13,c2,1,3,1,0.012);
	plot("norm",11,12,c1,1,4,2,0.002);
	plot("norm",11,13,c2,1,4,2,0.002);
	plot("norm",15,12,c1,1,4,2,0.002);
	plot("norm",15,13,c2,1,4,2,0.002);
	plot("norm",12,12,c1,1,4,2,0.002);
	plot("norm",12,13,c2,1,4,2,0.002);
    }
    if(plt==112 || plt==0){
	plot("norm",11,9,c1,1,3,1,0.012);
	plot("norm",11,10,c2,1,3,1,0.012);
	plot("norm",11,11,c2,1,3,1,0.012);
	plot("norm",12,9,c1,1,3,1,0.012);
	plot("norm",12,10,c2,1,3,1,0.012);
	plot("norm",12,11,c2,1,3,1,0.012);
    }


    if(plt==200){
	bbc();
	for(int c=0; c<NCUT; c++){
	    plot("mall",11,c,c1);   plot("mall",12,c,c2);
	    plot("z12", 11,c,c1);   plot("z12", 12,c,c2);
	    plot("norm",11,c,c1);   plot("norm",12,c,c2);
	}
    }
}