예제 #1
0
파일: analyze.c 프로젝트: Scorbie/ptbtest
int placeNewPerturbor(LifeList *seed, LifeList *perturbs,
                       Cell *placed, int nplaced, int newperturb,
                       int initialGen, int finalGen, Cell *aligns) {
  int i, j;
  int  nconv, nold, naligns, nelim;

  copyLifeList(perturbs+newperturb, &thisperturb);

  copyLifeList(&thisperturb, &spread1);
  spread(&spread1, 1);

  copyLifeList(&spread1, &spread2);
  spread(&spread2, 1);

  removeLifeList(&spread2, &spread1, 0);

  copyLifeList(seed, &cells);

  setupPerturbors(perturbs, placed, nplaced, &perturbcells, &cells);

  naligns=0;
  for (i=0; i<finalGen; i++) {

    nconv=convolve(spread2.cellList, spread2.ncells,
                   cells.cellList, cells.ncells,
                   &convolution, &scratch1, &scratch2,
                   makeWorkSpace);

    makeWorkSpace(spread1.ncells*cells.ncells);
    nold=convolve(spread1.cellList, spread1.ncells,
                  cells.cellList, cells.ncells,
                  &oldAlignments, &scratch1, &scratch2,
                  makeWorkSpace);

    nconv=subtractLists(oldAlignments, nold, convolution, nconv);

    nconv=subtractLists(aligns, naligns, convolution, nconv);

    setValues(convolution, nconv, i);

    nelim=0;
    for (j=0; j<nconv; j++) {
      copyLifeList(&cells, &tmp);
      intersectLifeLists(&tmp, &spread2, convolution[j].position);

      if (interact(&tmp, &thisperturb, convolution[j].position)) {
        convolution[nelim++]=convolution[j];
      }
    }

    makeWorkSpace(nelim + naligns);
    naligns=combineLists(convolution, nelim, aligns, naligns, scratch1);
    copyList(scratch1, naligns, aligns, 0);
    
    if (i == 0) {
        setValues(oldAlignments, nold, -1);
        makeWorkSpace(nold + naligns);
        naligns=combineLists(oldAlignments, nold, aligns, naligns, scratch1);
        copyList(scratch1, naligns, aligns, 0);
    }

    generate(&cells);

    if (broken(cells.cellList, cells.ncells,
               perturbcells.cellList, perturbcells.ncells))
      break;
  }

  naligns=removeLessThan(aligns, naligns, initialGen);
  return naligns;
}
예제 #2
0
Location::Location(double x, double y, double z) {
    setValues(x, y, z);
}
예제 #3
0
파일: cmykfw.cpp 프로젝트: gyuris/scribus
void CMYKChoose::selModel(const QString& mod)
{
	disconnect( CyanSp, SIGNAL( valueChanged(double) ), this, SLOT( setValSLiders(double) ) );
	disconnect( MagentaSp, SIGNAL( valueChanged(double) ), this, SLOT( setValSLiders(double) ) );
	disconnect( YellowSp, SIGNAL( valueChanged(double) ), this, SLOT( setValSLiders(double) ) );
	disconnect( BlackSp, SIGNAL( valueChanged(double) ), this, SLOT( setValSLiders(double) ) );
	disconnect( CyanSL, SIGNAL( valueChanged(int) ), this, SLOT( setValueS(int) ) );
	disconnect( MagentaSL, SIGNAL( valueChanged(int) ), this, SLOT( setValueS(int) ) );
	disconnect( YellowSL, SIGNAL( valueChanged(int) ), this, SLOT( setValueS(int) ) );
	disconnect( BlackSL, SIGNAL( valueChanged(int) ), this, SLOT( setValueS(int) ) );
	disconnect( CyanSL, SIGNAL( valueChanged(int) ), this, SLOT( setColor() ) );
	disconnect( MagentaSL, SIGNAL( valueChanged(int) ), this, SLOT( setColor() ) );
	disconnect( YellowSL, SIGNAL( valueChanged(int) ), this, SLOT( setColor() ) );
	disconnect( BlackSL, SIGNAL( valueChanged(int) ), this, SLOT( setColor() ) );
	isHLC = false;
	if (mod == tr("CMYK"))
	{
		Wsave = false;
		CyanSL->setMaximum( 100 * 1000.0);
		CyanSL->setMinimum( 0 * 1000.0 );
		CyanSL->setSingleStep(1 * 1000.0);
		CyanSL->setPageStep(10 * 1000.0);

		MagentaSL->setMaximum( 100 * 1000.0 );
		MagentaSL->setMinimum( 0 * 1000.0 );
		MagentaSL->setSingleStep(1 * 1000.0);
		MagentaSL->setPageStep(10 * 1000.0);

		YellowSL->setMaximum( 100 * 1000.0 );
		YellowSL->setMinimum( 0 * 1000.0 );
		YellowSL->setSingleStep(1 * 1000.0);
		YellowSL->setPageStep(10 * 1000.0);

		BlackSL->setMaximum( 100 * 1000.0);
		BlackSL->setMinimum( 0 * 1000.0);
		BlackSL->setSingleStep(1 * 1000.0);
		BlackSL->setPageStep(10 * 1000.0);

		CyanSp->setMaximum( 100 );
		CyanSp->setMinimum( 0 );
		CyanSp->setDecimals(1);
		CyanSp->setSingleStep(1);
		CyanSp->setSuffix( tr(" %"));

		MagentaSp->setMaximum( 100);
		MagentaSp->setMinimum( 0 );
		MagentaSp->setDecimals(1);
		MagentaSp->setSingleStep(1);
		MagentaSp->setSuffix( tr(" %"));

		YellowSp->setMaximum( 100 );
		YellowSp->setMinimum( 0 );
		YellowSp->setDecimals(1);
		YellowSp->setSingleStep(1);
		YellowSp->setSuffix( tr(" %"));

		BlackSp->setDecimals(1);
		
		CyanT->setText( tr("C:"));
		MagentaT->setText( tr("M:"));
		YellowT->setText( tr("Y:"));
		BlackSL->show();
		BlackSp->show();
		BlackT->show();
		if (Farbe.getColorModel() != colorModelCMYK)
			Farbe = ScColorEngine::convertToModel(Farbe, m_doc, colorModelCMYK);
		CyanSL->setPalette(sliderPix(180));
		MagentaSL->setPalette(sliderPix(300));
		YellowSL->setPalette(sliderPix(60));
		BlackSL->setPalette(sliderBlack());
		ColorMap->drawMode = 0;
		setValues();
	}
	else if ((mod == tr("Web Safe RGB")) || (mod == tr("RGB")))
	{
		Wsave = false;
		CyanSL->setMaximum( 255 * 1000.0 );
		CyanSL->setMinimum( 0 * 1000.0 );
		CyanSL->setSingleStep(1 * 1000.0);
		CyanSL->setPageStep(1 * 1000.0);

		MagentaSL->setMaximum( 255 * 1000.0 );
		MagentaSL->setMinimum( 0 * 1000.0 );
		MagentaSL->setSingleStep(1 * 1000.0);
		MagentaSL->setPageStep(1 * 1000.0);

		YellowSL->setMaximum( 255 * 1000.0 );
		YellowSL->setMinimum( 0 * 1000.0 );
		YellowSL->setSingleStep(1 * 1000.0);
		YellowSL->setPageStep(1 * 1000.0);

		CyanSp->setSingleStep(1);
		CyanSp->setMaximum( 255 );
		CyanSp->setMinimum( 0 );
		CyanSp->setDecimals(0);
		CyanSp->setSuffix("");

		MagentaSp->setSingleStep(1);
		MagentaSp->setMaximum( 255 );
		MagentaSp->setMinimum( 0 );
		MagentaSp->setDecimals(0);
		MagentaSp->setSuffix("");

		YellowSp->setSingleStep(1);
		YellowSp->setMaximum( 255 );
		YellowSp->setMinimum( 0 );
		YellowSp->setDecimals(0);
		YellowSp->setSuffix("");
		
		CyanT->setText( tr("R:"));
		MagentaT->setText( tr("G:"));
		YellowT->setText( tr("B:"));
		BlackSL->hide();
		BlackSp->hide();
		BlackT->hide();
		if (mod == tr("Web Safe RGB"))
		{
			Wsave = true;
			CyanSL->setSingleStep(51 * 1000.0);
			MagentaSL->setSingleStep(51 * 1000.0);
			YellowSL->setSingleStep(51 * 1000.0);
			CyanSL->setPageStep(51 * 1000.0);
			MagentaSL->setPageStep(51 * 1000.0);
			YellowSL->setPageStep(51 * 1000.0);
			CyanSp->setSingleStep(51);
			MagentaSp->setSingleStep(51);
			YellowSp->setSingleStep(51);
		}
		if (Farbe.getColorModel() != colorModelRGB)
			Farbe = ScColorEngine::convertToModel(Farbe, m_doc, colorModelRGB);
		CyanSL->setPalette(sliderPix(0));
		MagentaSL->setPalette(sliderPix(120));
		YellowSL->setPalette(sliderPix(240));
		ColorMap->drawMode = 0;
		setValues();
	}
	else if (mod == tr("Lab"))
	{
		Wsave = false;
		CyanSL->setSingleStep(1 * 1000.0);
		CyanSL->setPageStep(10 * 1000.0);
		CyanSL->setMaximum( 100 * 1000.0 );
		CyanSL->setMinimum( 0 * 1000.0 );
		MagentaSL->setSingleStep(1 * 1000.0);
		MagentaSL->setPageStep(10 * 1000.0);
		MagentaSL->setMaximum( 128 * 1000.0 );
		MagentaSL->setMinimum( -128 * 1000.0 );
		YellowSL->setSingleStep(1 * 1000.0);
		YellowSL->setPageStep(10 * 1000.0);
		YellowSL->setMaximum( 128 * 1000.0 );
		YellowSL->setMinimum( -128 * 1000.0 );

		CyanSp->setDecimals(2);
		CyanSp->setSingleStep(1);
		CyanSp->setMaximum( 100 );
		CyanSp->setSuffix( tr(""));

		MagentaSp->setDecimals(2);
		MagentaSp->setSingleStep(1);
		MagentaSp->setMaximum( 128);
		MagentaSp->setMinimum( -128 );
		MagentaSp->setSuffix("");

		YellowSp->setDecimals(2);
		YellowSp->setMaximum( 128 );
		YellowSp->setMinimum( -128 );
		YellowSp->setSingleStep(1);
		YellowSp->setSuffix("");

		CyanT->setText( tr("L:"));
		MagentaT->setText( tr("a:"));
		YellowT->setText( tr("b:"));

		BlackSL->hide();
		BlackSp->hide();
		BlackT->hide();
		if (Farbe.getColorModel() != colorModelLab)
			Farbe = ScColorEngine::convertToModel(Farbe, m_doc, colorModelLab);
		CyanSL->setPalette(sliderPix(0));
		MagentaSL->setPalette(sliderPix(120));
		YellowSL->setPalette(sliderPix(240));
		setValues();
		ColorMap->drawMode = 1;
		ColorMap->drawPalette(CyanSp->value() * 2.55);
		ColorMap->setMark(MagentaSp->value(), YellowSp->value());
	}
	else if (mod == tr("HLC"))
	{
		Wsave = false;
		CyanSL->setSingleStep(1 * 1000.0);
		CyanSL->setPageStep(10 * 1000.0);
		CyanSL->setMaximum( 360 * 1000.0 );
		CyanSL->setMinimum( 0 * 1000.0 );
		MagentaSL->setSingleStep(1 * 1000.0);
		MagentaSL->setPageStep(10 * 1000.0);
		MagentaSL->setMaximum( 100 * 1000.0 );
		MagentaSL->setMinimum( 0 * 1000.0 );
		YellowSL->setSingleStep(1 * 1000.0);
		YellowSL->setPageStep(10 * 1000.0);
		YellowSL->setMaximum( 128 * 1000.0 );
		YellowSL->setMinimum( 0 * 1000.0 );

		CyanSp->setDecimals(2);
		CyanSp->setSingleStep(1);
		CyanSp->setMaximum( 360 );
		CyanSp->setSuffix( tr(""));

		MagentaSp->setDecimals(2);
		MagentaSp->setSingleStep(1);
		MagentaSp->setMaximum( 100);
		MagentaSp->setMinimum( 0 );
		MagentaSp->setSuffix("");

		YellowSp->setDecimals(2);
		YellowSp->setMaximum( 128 );
		YellowSp->setMinimum( 0 );
		YellowSp->setSingleStep(1);
		YellowSp->setSuffix("");

		CyanT->setText( tr("H:"));
		MagentaT->setText( tr("L:"));
		YellowT->setText( tr("C:"));

		BlackSL->hide();
		BlackSp->hide();
		BlackT->hide();
		if (Farbe.getColorModel() != colorModelLab)
			Farbe = ScColorEngine::convertToModel(Farbe, m_doc, colorModelLab);
		isHLC = true;
		CyanSL->setPalette(sliderPix(0));
		MagentaSL->setPalette(sliderPix(120));
		YellowSL->setPalette(sliderPix(240));
		setValues();
		ColorMap->drawMode = 2;
		double L, a, b;
		Farbe.getLab(&L, &a, &b);
		ColorMap->drawPalette(L * 2.55);
		ColorMap->setMark(a, b);
	}
	imageN.fill( ScColorEngine::getDisplayColor(Farbe, m_doc) );
	if (ScColorEngine::isOutOfGamut(Farbe, m_doc))
		paintAlert(alertIcon, imageN, 2, 2, false);
	NewC->setPixmap( imageN );
	NewC->setToolTip( "<qt>" + tr( "If color management is enabled, a triangle warning indicator is a warning that the color maybe outside of the color gamut of the current printer profile selected. What this means is the color may not print exactly as indicated on screen. More hints about gamut warnings are in the online help under Color Management." ) + "</qt>");
	OldC->setToolTip( "<qt>" + tr( "If color management is enabled, a triangle warning indicator is a warning that the color maybe outside of the color gamut of the current printer profile selected. What this means is the color may not print exactly as indicated on screen. More hints about gamut warnings are in the online help under Color Management." ) + "</qt>");

	connect( CyanSp, SIGNAL( valueChanged(double) ), this, SLOT( setValSLiders(double) ) );
	connect( MagentaSp, SIGNAL( valueChanged(double) ), this, SLOT( setValSLiders(double) ) );
	connect( YellowSp, SIGNAL( valueChanged(double) ), this, SLOT( setValSLiders(double) ) );
	connect( BlackSp, SIGNAL( valueChanged(double) ), this, SLOT( setValSLiders(double) ) );
	connect( CyanSL, SIGNAL( valueChanged(int) ), this, SLOT( setValueS(int) ) );
	connect( MagentaSL, SIGNAL( valueChanged(int) ), this, SLOT( setValueS(int) ) );
	connect( YellowSL, SIGNAL( valueChanged(int) ), this, SLOT( setValueS(int) ) );
	connect( BlackSL, SIGNAL( valueChanged(int) ), this, SLOT( setValueS(int) ) );
	connect( CyanSL, SIGNAL( valueChanged(int) ), this, SLOT( setColor() ) );
	connect( MagentaSL, SIGNAL( valueChanged(int) ), this, SLOT( setColor() ) );
	connect( YellowSL, SIGNAL( valueChanged(int) ), this, SLOT( setColor() ) );
	connect( BlackSL, SIGNAL( valueChanged(int) ), this, SLOT( setColor() ) );
}
예제 #4
0
PackableArray3<ElementPackableType, ElementPlainType>::PackableArray3( const ElementPlainType& x, const ElementPlainType& y, const ElementPlainType& z )
{
    setValues( x, y, z );
}
예제 #5
0
// ############### SET VALUES ##########################################################################################
void GenericVector::setValues(const std::vector<double> &values)
{
    ROS_ASSERT(values.size() >= N_JOINTS);

    setValues(&values.front());
}
예제 #6
0
void Generator::processStart()
{
    setValues();
}
예제 #7
0
Options::Options(QWidget *parent)
    : KDialogBase(Tabbed, i18n("Options"), Ok | Cancel, Ok, parent, 0, false){

    fRemote = false;

    DCache = dc = opts->DCache;
    PCache = pc = opts->PCache;
    privCmd = prc = opts->privCmd;

    if (DCache >= Opts::SESSION) {
      cacheObj::clearDCache(); // clear dir caches if needed
    }
    if (PCache >= Opts::SESSION) {
      cacheObj::clearPCache(); // clear package caches if needed
    }

    {
      QVBox *page = addVBoxPage(i18n("&Types"));

      framet = new QGroupBox(1,Qt::Horizontal,i18n("Handle Package Type"), page);

      hh =  new QGroupBox(1,Qt::Horizontal,i18n("Remote Host"),framet);
      huse = new QCheckBox(i18n("Use remote host (Debian APT only):"),hh);
      connect(huse,  SIGNAL(clicked()), this, SLOT(useRemote()));
      hosts = new KComboBox( true, hh, "combo" );
      KCompletion *comp = hosts->completionObject();
      connect(hosts,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)));
      connect(hosts,SIGNAL(returnPressed()),this,SLOT(insHosts()));
      hosts->setMaxCount(20);
      hosts->setDuplicatesEnabled(false);
      hosts->setInsertionPolicy(QComboBox::AtTop);
      //      hosts->setInsertionPolicy(QComboBox::NoInsertion);
      hosts->setTrapReturnKey(true);

      int i;
      QString msgStr;
      for (i = 0; i < kpinterfaceN; i++)  {
	if (kpinterface[i]) {
	  if (kpinterface[i]->hasProgram) {
	    msgStr = kpinterface[i]->name;
	  } else {
	    msgStr = kpinterface[i]->name;
	    msgStr = i18n("%1: %2 not found")
	      .arg(kpinterface[i]->name)
	      .arg(kpinterface[i]->errExe);
	  }
	  packageBox[i] = new QGroupBox(2,Qt::Horizontal,msgStr, framet, "box");
	  packageHandle[i] =  new QCheckBox(i18n("Enable"), packageBox[i]);
	  connect(packageHandle[i], SIGNAL(clicked()), this, SLOT(scanLocates()));
	  locate[i] = new QPushButton(i18n("Location of Packages"),packageBox[i]);
	  connect(locate[i], SIGNAL(clicked()), kpinterface[i], SLOT(setLocation()));
	} else {
	  packageHandle[i] =  0;
	}
      }
    }

    {
      QVBox *page = addVBoxPage(i18n("Cac&he"));

      bc = new QButtonGroup(page);
      bc->setTitle(i18n("Cache Remote Package Folders"));
      connect( bc, SIGNAL(clicked(int)), SLOT(PDCache(int)) );

      QVBoxLayout* vc = new QVBoxLayout( bc, 15, 10, "vc");
      vc->addSpacing( bc->fontMetrics().height() );

      dcache[0] = new QRadioButton(i18n("Always"),bc);
      vc->addWidget(dcache[0]);

      dcache[1] = new QRadioButton(i18n("During a session"),bc);
      vc->addWidget(dcache[1]);

      dcache[2] = new QRadioButton(i18n("Never"),bc);
      vc->addWidget(dcache[2]);

      bp = new QButtonGroup(page);
      bp->setTitle(i18n("Cache Remote Package Files"));
      connect( bp, SIGNAL(clicked(int)), SLOT(PPCache(int)) );

      QVBoxLayout* vp = new QVBoxLayout( bp, 15, 10, "vp");
      vp->addSpacing( bp->fontMetrics().height() );

      pcache[0] = new QRadioButton(i18n("Always"),bp);
      vp->addWidget(pcache[0]);

      pcache[1] = new QRadioButton(i18n("During a session"),bp);
      vp->addWidget(pcache[1]);

      pcache[2] = new QRadioButton(i18n("Never"),bp);
      vp->addWidget(pcache[2]);

      QGroupBox* cd = new QGroupBox (1, Qt::Horizontal, i18n("Cache Folder"), page) ;
      cd->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Fixed) ;

      cachedir = new KURLRequester("", cd, "cachedir");
    }

    {
      QWidget *page = addVBoxPage(i18n("&Misc"));
      QVBoxLayout *vf = new QVBoxLayout(page);

      //      vf->setSpacing(KDialog::spacingHint());
      vf->setMargin(0);

      bs = new QButtonGroup(page);
      bs->setTitle(i18n("Execute Privileged Commands Using"));
      connect( bs, SIGNAL(clicked(int)), SLOT(PPrivs(int)) );
      
      QVBoxLayout* vs = new QVBoxLayout( bs, 15, 10, "bs");
      vs->addSpacing( bs->fontMetrics().height() );
      
      privs[0] = new QRadioButton(i18n("su command"),bs);
      vs->addWidget(privs[0]);
      
      privs[1] = new QRadioButton(i18n("sudo command"),bs);
      vs->addWidget(privs[1]);
      
      privs[2] = new QRadioButton(i18n("ssh command"),bs);
      vs->addWidget(privs[2]);
      
      valid = new QCheckBox(i18n("Verify file list"), page, "valid");
      vf->addWidget(valid,0,AlignLeft);

      pkgRead = new QCheckBox(i18n("Read information from all local package files"), page, "pkgr");
      vf->addWidget(pkgRead,0,AlignLeft);

      vf->addSpacing(100);
    }

    connect( this, SIGNAL(okClicked()), SLOT(apply_slot()) );
    connect( this, SIGNAL(closeClicked()), SLOT(cancel_slot()) );
    connect( this, SIGNAL(cancelClicked()), SLOT(cancel_slot()) );

    setValues();

}
예제 #8
0
void QXYSelector::setXValue( int _xPos )
{
  setValues(_xPos, d->yPos);
}
예제 #9
0
void QXYSelector::setYValue( int _yPos )
{
  setValues(d->xPos, _yPos);
}
예제 #10
0
/**
 * Konstruktor fuer direkte Wertzuweisung.
 * \param x X-Koordinate
 * \param y Y-Koordinate
 * \param z Z-Koordinate
 */
Vector::Vector(float x, float y, float z)
{
  setValues(x, y, z);
}
예제 #11
0
KSSLCertBox::KSSLCertBox(QWidget *parent, const char *name, WFlags f) : QScrollView(parent, name, f)
{
    _frame = 0L;
    setBackgroundMode(QWidget::PaletteButton);
    setValues(QString::null, 0L);
}
예제 #12
0
void EnumStyleEdit::defaultButton( WWindow * )
//--------------------------------------------
{
    setValues( _default );
}
예제 #13
0
 CommaSeparatedListOfPositiveIntegers::CommaSeparatedListOfPositiveIntegers( const std::set<int>& values )
 :myValues()
 {
     setValues( values );
 }
예제 #14
0
void OptionsDlg::accept()
{
    setValues();

    QDialog::accept();
}
예제 #15
0
파일: filter.cpp 프로젝트: inphos42/osmpbf
void KeyMultiValueTagFilter::setValues(const std::unordered_set<std::string> & values)
{
	setValues(values.cbegin(), values.cend());
}
예제 #16
0
	/*======================================================================================
	BlackScholesGreeks 
	=======================================================================================*/
    BlackScholesGreeks::BlackScholesGreeks(double premium, double delta, double gamma, double theta, double vega, double rho) 
    {
        setValues(premium, delta, gamma, theta, vega, rho);
    }
예제 #17
0
파일: filter.cpp 프로젝트: inphos42/osmpbf
void KeyMultiValueTagFilter::setValues(std::initializer_list<std::string> l)
{
	setValues(l.begin(), l.end());
}
예제 #18
0
SavedMenuItem::SavedMenuItem(MenuItem *menuItem)
{
   mParamName = menuItem->getPrompt();
   setValues(menuItem);
}
예제 #19
0
void Options::cancel_slot()
{
  //  kdDebug() << "Cancel\n";
  opts->readSettings();
  setValues();
}
예제 #20
0
MathApp::MathApp(QWidget *parent) {
    factorController_.control(new Factor());
    ui.setupUi(this);

    QIntValidator *validator = new QIntValidator(-2147483647, 2147483646, this);
    ui.productLineEdit->setValidator(validator);
    ui.sumLineEdit->setValidator(validator);
    /*ui.aLineEdit->setValidator(validator);
    ui.bLineEdit->setValidator(validator);
    ui.cLineEdit->setValidator(validator);*/

	ui.factorSolveButton->setEnabled(false);
    //ui.rootsSolveButton->setEnabled(false);

    connect(ui.factorSolveButton, SIGNAL(clicked()), this, SLOT(factorSolveClicked()));
    connect(ui.productLineEdit, SIGNAL(returnPressed()), this, SLOT(factorSolveClicked()));
    connect(ui.sumLineEdit, SIGNAL(returnPressed()), this, SLOT(factorSolveClicked()));

    connect(this, SIGNAL(factorGiveNumbers(QString, QString)), &factorController_, SLOT(setValues(QString, QString)));

    connect(ui.productLineEdit, SIGNAL(textEdited(QString)), this, SLOT(checkFactorLineEditEmpty()));
    connect(ui.sumLineEdit, SIGNAL(textEdited(QString)), this, SLOT(checkFactorLineEditEmpty()));

    /*connect(ui.aLineEdit, SIGNAL(textEdited(QString)), this, SLOT(checkRootsLineEditEmpty()));
    connect(ui.bLineEdit, SIGNAL(textEdited(QString)), this, SLOT(checkRootsLineEditEmpty()));
    connect(ui.cLineEdit, SIGNAL(textEdited(QString)), this, SLOT(checkRootsLineEditEmpty()));*/

    //connect(ui.rootsSolveButton, SIGNAL(clicked()), this, SLOT(rootsSolveClicked()));


    connect(&factorController_, SIGNAL(solution(QString)), this, SLOT(factorPrintText(QString)));
}
예제 #21
0
void perturbEnum(LifeList *seed, LifeList *perturbs, int nperturbs, int depth,
           int maxDepth, int mingen, int maxgencurr, int maxgenall, int maxvanish) {
int i, naligns;
int iperturb, thisgen;


   for (iperturb=0; iperturb<nperturbs; iperturb++) {

     if(depth == 0 && maxDepth > 1)
        fprintf(stderr, "Working with perturber #%d\n", iperturb+1);

     copyLifeList(seed, reaction+depth);
     setValues(reaction[depth].cellList, reaction[depth].ncells, 1);

     naligns=placeNewPerturbor(reaction+depth, perturbs,
                               perturbPlace, depth, iperturb,
                               mingen, maxgencurr, aligns);

     setupPerturbors(perturbs, perturbPlace, depth,
                     &justPerturbs, reaction+depth);


     for (thisgen=0; thisgen<mingen; thisgen++) generate(reaction+depth);

     for (; thisgen<maxgencurr; thisgen++) {
       for (i=0; i<naligns; i++) {
         int j;
         int tvanish = maxvanish;

         int oldcount;
         assert((aligns-alignstore)+i < 100000);
         if (aligns[i].value==thisgen &&
             (depth<=0 || ptbPrecedes(perturbGen[depth-1],
                          perturbPlace[depth-1].value,
                          perturbPlace[depth-1].position,
                          thisgen, iperturb, aligns[i].position))
             ) {
           copyLifeList(reaction+depth, &tmp);

           justPerturbs.ncells=0;
           for (j=0; j<depth; j++) {
               mergeLifeLists(&justPerturbs, perturbs+perturbPlace[j].value,
                                             perturbPlace[j].position);
           }

           mergeLifeLists(&tmp, perturbs+iperturb, aligns[i].position);

           oldcount=justPerturbs.ncells;
           mergeLifeLists(&justPerturbs, perturbs+iperturb,
                                              aligns[i].position);

           // if (iperturb==8) printf("chose a block %d %d\n", perturbs[iperturb].ncells, countGreaterThan(perturbs[iperturb].cellList, perturbs[iperturb].ncells, 1)  );

           if ( countGreaterThan(perturbs[iperturb].cellList,
                                perturbs[iperturb].ncells, 1) ==
                                perturbs[iperturb].ncells) tvanish--;

           if (tvanish>=0 &&
             oldcount+perturbs[iperturb].ncells == justPerturbs.ncells &&
               survives(&tmp, &justPerturbs, 0, 15)) {

             if (depth >= maxDepth) {
               if (restored(&tmp, &justPerturbs, 0, 50)) {
               copyLifeList(seed, &tmp);
               mergeLifeLists(&tmp, &justPerturbs, 0);
               makeString(tmp.cellList, tmp.ncells, out);
//               outTr(perturbPlace[0].position);
//               outTr(perturbPlace[1].position);
//               outTr(aligns[i].position);
               printf("%s %d\n", out, thisgen);
/*
               printf("%d %d %d ", perturbPlace[0].position,
                                  perturbPlace[0].value,
                                  perturbGen[0]);
               printf("%d %d %d\n", aligns[i].position,
                                  iperturb,
                                  aligns[i].value);
*/
               fflush(stdout);
               }
             } else {
               perturbPlace[depth].position= aligns[i].position;
               perturbPlace[depth].value= iperturb;
               perturbGen[depth]= thisgen;
               aligns+=naligns;
               perturbEnum(seed, perturbs, nperturbs, depth+1, maxDepth,
                           thisgen, maxgenall, maxgenall, tvanish);
               aligns-=naligns;
             }
           }
         }
       }
       generate(reaction+depth);
     }
   }
}
예제 #22
0
void AltLangStrEdit::reset()
{
    setValues(KExiv2::AltLangMap());
}
예제 #23
0
void MemberFilterDlg::defaultButton( WWindow * )
//----------------------------------------------
{
    setValues( _default );
}
예제 #24
0
void AltLangStrEdit::slotDeleteValue()
{
    d->values.remove(d->currentLanguage);
    setValues(d->values);
    emit signalValueDeleted(d->currentLanguage);
}
예제 #25
0
bool SrvKinematicsPlugin::initialize(const std::string &robot_description,
  const std::string& group_name,
  const std::string& base_frame,
  const std::vector<std::string>& tip_frames,
  double search_discretization)
{
  bool debug = false;

  ROS_INFO_STREAM_NAMED("srv","SrvKinematicsPlugin initializing");

  setValues(robot_description, group_name, base_frame, tip_frames, search_discretization);

  ros::NodeHandle private_handle("~");
  rdf_loader::RDFLoader rdf_loader(robot_description_);
  const boost::shared_ptr<srdf::Model> &srdf = rdf_loader.getSRDF();
  const boost::shared_ptr<urdf::ModelInterface>& urdf_model = rdf_loader.getURDF();

  if (!urdf_model || !srdf)
  {
    ROS_ERROR_NAMED("srv","URDF and SRDF must be loaded for SRV kinematics solver to work."); // TODO: is this true?
    return false;
  }

  robot_model_.reset(new robot_model::RobotModel(urdf_model, srdf));

  joint_model_group_ = robot_model_->getJointModelGroup(group_name);
  if (!joint_model_group_)
    return false;

  if (debug)
  {
    std::cout << std::endl << "Joint Model Variable Names: ------------------------------------------- " << std::endl;
    const std::vector<std::string> jm_names = joint_model_group_->getVariableNames();
    std::copy(jm_names.begin(), jm_names.end(), std::ostream_iterator<std::string>(std::cout, "\n"));
    std::cout << std::endl;
  }

  // Get the dimension of the planning group
  dimension_ = joint_model_group_->getVariableCount(); 
  ROS_INFO_STREAM_NAMED("srv","Dimension planning group '" << group_name << "': " << dimension_
    << ". Active Joints Models: " << joint_model_group_->getActiveJointModels().size()
    << ". Mimic Joint Models: " << joint_model_group_->getMimicJointModels().size());

  // Copy joint names
  for (std::size_t i=0; i < joint_model_group_->getJointModels().size(); ++i)
  {
    ik_group_info_.joint_names.push_back(joint_model_group_->getJointModelNames()[i]);
  }

  if (debug)
  {
    ROS_ERROR_STREAM_NAMED("temp","tip links available:");
    std::copy(tip_frames_.begin(), tip_frames_.end(), std::ostream_iterator<std::string>(std::cout, "\n"));
  }

  // Make sure all the tip links are in the link_names vector
  for (std::size_t i = 0; i < tip_frames_.size(); ++i)
  {
    if(!joint_model_group_->hasLinkModel(tip_frames_[i]))
    {
      ROS_ERROR_NAMED("srv","Could not find tip name '%s' in joint group '%s'", tip_frames_[i].c_str(), group_name.c_str());
      return false;
    }
    ik_group_info_.link_names.push_back(tip_frames_[i]);
  }

  // Choose what ROS service to send IK requests to
  ROS_DEBUG_STREAM_NAMED("srv","Looking for ROS service name on rosparm server at location: " <<
    private_handle.getNamespace() << "/" << group_name_ << "/kinematics_solver_service_name");
  std::string ik_service_name;
  private_handle.param(group_name_ + "/kinematics_solver_service_name", ik_service_name, std::string("solve_ik"));

  // Setup the joint state groups that we need
  robot_state_.reset(new robot_state::RobotState(robot_model_));
  robot_state_->setToDefaultValues();

  // Create the ROS service client
  ros::NodeHandle nonprivate_handle("");
  ik_service_client_ = boost::make_shared<ros::ServiceClient>(nonprivate_handle.serviceClient
                       <moveit_msgs::GetPositionIK>(ik_service_name));
  if (!ik_service_client_->waitForExistence(ros::Duration(0.1))) // wait 0.1 seconds, blocking
    ROS_WARN_STREAM_NAMED("srv","Unable to connect to ROS service client with name: " << ik_service_client_->getService());
  else
    ROS_INFO_STREAM_NAMED("srv","Service client started with ROS service name: " << ik_service_client_->getService());

  active_ = true;
  ROS_DEBUG_NAMED("srv","ROS service-based kinematics solver initialized");
  return true;
}
예제 #26
0
void WidgetIOProperties::createIOProperties()
{
    ui->mainLayout->setColumnMinimumWidth(0, 150);
    ui->optionLayout->setColumnMinimumWidth(0, 150);

    QString lang = Utils::GetLocale();
    QString rsc = QString(":/doc/%1/io_doc.json").arg(lang);

    QFile f(rsc);
    if (!f.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        QMessageBox::warning(this, tr("Error"), tr("Failed to load IO documentation from %1").arg(rsc));
        return;
    }
    QJsonParseError jerr;
    QJsonDocument jdoc = QJsonDocument::fromJson(f.readAll(), &jerr);
    if (jerr.error != QJsonParseError::NoError ||
        !jdoc.isObject())
    {
        QMessageBox::warning(this, tr("Error"), tr("Failed to parse JSON IO documentation from %1").arg(rsc));
        return;
    }

    QString iotype = QString::fromUtf8(params["type"].c_str());
    QJsonObject jobj = jdoc.object();
    for (auto it = jobj.begin();it != jobj.end();it++)
        jobj.insert(it.key().toLower(), it.value());

    QJsonObject jobjAlias;
    if (!jobj.contains(iotype))
    {
        //Search in aliases
        bool aliasfound = false;
        for (auto it = jobj.constBegin();it != jobj.constEnd();it++)
        {
            QJsonObject o = it.value().toObject();
            QJsonArray jalias = o["alias"].toArray();
            for (int i = 0;i < jalias.size();i++)
            {
                if (jalias.at(i).toString() == iotype)
                {
                    aliasfound = true;
                    jobjAlias = o;
                }
            }
        }

        if (!aliasfound)
        {
            QMessageBox::warning(this, tr("Error"), tr("IO type %1 is not found in %2").arg(iotype).arg(rsc));
            return;
        }
    }

    QJsonObject jioobj;
    if (jobjAlias.isEmpty())
        jioobj = jobj[iotype].toObject();
    else
        jioobj = jobjAlias;
    ui->labelTitle->setText(iotype);
    ui->labelDesc->setText(jioobj["description"].toString());

    int rowMain = 0, rowOption = 0;

    QJsonArray jparams = jioobj["parameters"].toArray();
    for (int i = 0;i < jparams.size();i++)
    {
        QJsonObject jparam = jparams[i].toObject();

        QGridLayout *layout = jparam["mandatory"].toString() == "true"?ui->mainLayout:ui->optionLayout;
        int row = jparam["mandatory"].toBool()?rowMain:rowOption;

        QLabel *title = new QLabel(jparam["name"].toString());
        layout->addWidget(title, row, 0);

        QPushButton *revert = new QPushButton();
        revert->setIcon(QIcon(":/img/document-revert.png"));
        revert->setToolTip(tr("Revert modification"));
        layout->addWidget(revert, row, 1);
        hider.hide(revert);

        QString pvalue;
        string prop = jparam["name"].toString().toUtf8().constData();
        if (params.Exists(prop))
            pvalue = QString::fromUtf8(params[prop].c_str());
        else
            pvalue = jparam["default"].toString();

        if (jparam["type"].toString() == "string")
        {
            QLineEdit *w = new QLineEdit();
            w->setEnabled(jparam["readonly"].toString() != "true" && editable);
            w->setText(pvalue);
            layout->addWidget(w, row, 2);

            UiObject uiObject;
            uiObject.type = UiObjectType::LineEdit;
            uiObject.lineEdit = w;
            uiObjectMap[prop] = uiObject;

            connect(w, &QLineEdit::textChanged, [=]()
            {
                updateChangedParam(prop, w->text(), pvalue, title, revert);
            });

            connect(revert, &QPushButton::clicked, [=]()
            {
                w->setText(pvalue);
            });
        }
        else if (jparam["type"].toString() == "bool")
        {
            QCheckBox *w = new QCheckBox();
            w->setEnabled(jparam["readonly"].toString() != "true" && editable);
            w->setChecked(pvalue == "true");
            layout->addWidget(w, row, 2);

            UiObject uiObject;
            uiObject.type = UiObjectType::CheckBox;
            uiObject.checkBox = w;
            uiObjectMap[prop] = uiObject;

            connect(w, &QCheckBox::stateChanged, [=]()
            {
                updateChangedParam(prop, w->isChecked()?"true":"false", pvalue, title, revert);
            });

            connect(revert, &QPushButton::clicked, [=]()
            {
                w->setChecked(pvalue == "true");
            });
        }
        else if (jparam["type"].toString() == "int")
        {
            QSpinBox *w = new QSpinBox();
            w->setEnabled(jparam["readonly"].toString() != "true" && editable);
            if (!jparam["min"].toString().isEmpty())
                w->setMinimum(jparam["min"].toString().toInt());
            else
                w->setMinimum(-999999999);
            if (!jparam["max"].toString().isEmpty())
                w->setMaximum(jparam["max"].toString().toInt());
            else
                w->setMaximum(999999999);
            w->setValue(pvalue.toInt());
            layout->addWidget(w, row, 2);

            UiObject uiObject;
            uiObject.type = UiObjectType::SpinBox;
            uiObject.spinBox = w;
            uiObjectMap[prop] = uiObject;

            connect(w, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [=]()
            {
                updateChangedParam(prop, QString("%1").arg(w->value()), pvalue.isEmpty()?"0":pvalue, title, revert);
            });

            connect(revert, &QPushButton::clicked, [=]()
            {
                w->setValue(pvalue.toInt());
            });
        }
        else if (jparam["type"].toString() == "float")
        {
            QDoubleSpinBox *w = new QDoubleSpinBox();
            w->setEnabled(jparam["readonly"].toString() != "true" && editable);
            if (!jparam["min"].toString().isEmpty())
                w->setMinimum(jparam["min"].toString().toDouble());
            else
                w->setMinimum(-999999999.0);
            if (!jparam["max"].toString().isEmpty())
                w->setMaximum(jparam["max"].toString().toDouble());
            else
                w->setMaximum(999999999.0);
            w->setValue(pvalue.toDouble());
            layout->addWidget(w, row, 2);
            w->setDecimals(3);

            UiObject uiObject;
            uiObject.type = UiObjectType::DoubleSpinBox;
            uiObject.doubleSpinBox = w;
            uiObjectMap[prop] = uiObject;

            connect(w, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), [=]()
            {
                updateChangedParam(prop, QString("%1").arg(w->value()), pvalue.isEmpty()?"0":pvalue, title, revert);
            });

            connect(revert, &QPushButton::clicked, [=]()
            {
                w->setValue(pvalue.toDouble());
            });
        }
        else if (jparam["type"].toString() == "list")
        {
            QComboBox *w = new QComboBox();
            int defIndex = 0;
            w->setEnabled(jparam["readonly"].toString() != "true" && editable);

            //fill combobox with values, if no value, set editable to true
            QJsonObject jvalues = jparam["list_value"].toObject();
            if (jvalues.empty())
                w->setEditable(true);
            else
            {
                w->setEditable(false);
                for (auto it = jvalues.begin();it != jvalues.end();it++)
                {
                    w->addItem(it.value().toString(), it.key());
                    if (it.key() == pvalue)
                    {
                        defIndex = w->count() - 1;
                        w->setCurrentIndex(defIndex);
                    }
                }
            }

            layout->addWidget(w, row, 2);

            UiObject uiObject;
            uiObject.type = UiObjectType::ComboBox;
            uiObject.comboBox = w;
            uiObjectMap[prop] = uiObject;

            if (w->isEditable())
            {
                connect(w, &QComboBox::currentTextChanged, [=]()
                {
                    updateChangedParam(prop, w->currentText(), pvalue, title, revert);
                });
            }
            else
            {
                connect(w, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=]()
                {
                    updateChangedParam(prop, w->currentData().toString(), pvalue, title, revert);
                });
            }

            connect(revert, &QPushButton::clicked, [=]()
            {
                if (w->isEditable())
                    w->setEditText(pvalue);
                else
                    w->setCurrentIndex(defIndex);
            });
        }

        QPushButton *help = new QPushButton();
        help->setIcon(QIcon(":/img/icon_unkown.png"));
        help->setFlat(true);
        layout->addWidget(help, row, 3);

        if((i==0)&&(entryHelper != nullptr))
        {
            QPushButton *entryHelperButton = new QPushButton();
            entryHelperButton->setIcon(QIcon(":/img/icon_entry_helper.png"));
            entryHelperButton->setFlat(true);
            layout->addWidget(entryHelperButton, row, 4);
            connect(entryHelperButton, &QPushButton::clicked,  [=]()
            {
                if (entryHelper->exec() == QDialog::Accepted)
                    setValues(entryHelper->getParams());
            });
        }

        //avoid copy the QJsonObject in the lambda
        QString helpInfo = jparam["description"].toString();

        connect(help, &QPushButton::clicked, [=]()
        {
            if (balloonTip)
                delete balloonTip;

            balloonTip = new BalloonTip(QPixmap(":/img/icon_unkown.png"), title->text(), helpInfo, 800, help);
            balloonTip->setArrowPosition(BalloonTip::TopLeft);
            balloonTip->move(QCursor::pos());
            balloonTip->show();
        });

        if (jparam["mandatory"].toBool())
            rowMain++;
        else
            rowOption++;
    }
}
void
GUIDialog_EditViewport::setOldValues(Position& lookFrom, Position& lookAt) {
    setValues(lookFrom, lookAt);
    myOldLookFrom = lookFrom;
    myOldLookAt = lookAt;
}
예제 #28
0
EditStyle::EditStyle(Score* s, QWidget* parent)
   : QDialog(parent)
      {
      setupUi(this);
      setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
      cs     = s;
      lstyle = *s->style();
      setModal(true);

      chordDescriptionFileButton->setIcon(*icons[fileOpen_ICON]);

      stemGroups[0] = new QButtonGroup(this);
      stemGroups[0]->addButton(voice1Up);
      stemGroups[0]->addButton(voice1Down);

      stemGroups[1] = new QButtonGroup(this);
      stemGroups[1]->addButton(voice2Up);
      stemGroups[1]->addButton(voice2Down);

      stemGroups[2] = new QButtonGroup(this);
      stemGroups[2]->addButton(voice3Up);
      stemGroups[2]->addButton(voice3Down);

      stemGroups[3] = new QButtonGroup(this);
      stemGroups[3]->addButton(voice4Up);
      stemGroups[3]->addButton(voice4Down);

      pageList->setCurrentRow(0);

      articulationTable->verticalHeader()->setVisible(false);
      articulationTable->setSelectionBehavior(QAbstractItemView::SelectRows);
      QStringList headers;
      headers << tr("Symbol") << tr("Anchor");
      articulationTable->setHorizontalHeaderLabels(headers);
      articulationTable->setColumnWidth(0, 200);
      articulationTable->setColumnWidth(1, 180);
      articulationTable->setRowCount(ARTICULATIONS);

      for (int i = 0; i < ARTICULATIONS; ++i) {
            ArticulationInfo* ai = &Articulation::articulationList[i];

            QPixmap ct = sym2pixmap(&symbols[0][ai->upSym], 3.0);
            QIcon icon(ct);
            QTableWidgetItem* item = new QTableWidgetItem(icon, qApp->translate("articulation", qPrintable(ai->name)));

            item->setFlags(item->flags() & ~Qt::ItemIsEditable);
            articulationTable->setItem(i, 0, item);

            QComboBox* cb = new QComboBox();
            cb->addItem(tr("TopStaff"), A_TOP_STAFF);
            cb->addItem(tr("BottomStaff"), A_BOTTOM_STAFF);
            cb->addItem(tr("Chord"), A_CHORD);
            articulationTable->setCellWidget(i, 1, cb);
            }
      QButtonGroup* bg = new QButtonGroup(this);
      bg->addButton(editEvenHeaderL, 0);
      bg->addButton(editEvenHeaderC, 1);
      bg->addButton(editEvenHeaderR, 2);
      bg->addButton(editOddHeaderL,  3);
      bg->addButton(editOddHeaderC,  4);
      bg->addButton(editOddHeaderR,  5);

      bg->addButton(editEvenFooterL, 6);
      bg->addButton(editEvenFooterC, 7);
      bg->addButton(editEvenFooterR, 8);
      bg->addButton(editOddFooterL,  9);
      bg->addButton(editOddFooterC, 10);
      bg->addButton(editOddFooterR, 11);

      // figured bass init
      QList<QString> fbFontNames = FiguredBass::fontNames();
      foreach(const QString& family, fbFontNames)
            comboFBFont->addItem(family);
      comboFBFont->setCurrentIndex(0);
      connect(comboFBFont, SIGNAL(currentIndexChanged(int)), SLOT(on_comboFBFont_currentIndexChanged(int)));

      setValues();
      connect(buttonBox, SIGNAL(clicked(QAbstractButton*)), SLOT(buttonClicked(QAbstractButton*)));
      connect(chordDescriptionFileButton, SIGNAL(clicked()), SLOT(selectChordDescriptionFile()));

      connect(hideEmptyStaves, SIGNAL(clicked(bool)), dontHideStavesInFirstSystem, SLOT(setEnabled(bool)));

      connect(bg, SIGNAL(buttonClicked(int)), SLOT(editTextClicked(int)));
      }
//----------------------
void tmVisThreshC1_MixtureModeling2::setIndex(int i) {
	index = i;
	setValues();
}
예제 #30
0
void StkFreeVerb::processStart()
{
    m_pFreeVerb->clear();
    setValues();
}