Example #1
0
ParamStore *ParamSet::GetParamsNew(BoxOut *boxout)
{ 
	int i;
	double value;
	ParamCon *pcon;
	wxString text;

	//if(boxout->diagbox) boxout->diagbox->textbox->AppendText(text.Format("%s get params\n", boxout->name));

	for(i=0; i<numparams; i++) {
		pcon = con[i];
		value = pcon->GetValue();
		//boxout->diagbox->Write(text.Format("param %s type %d value %.4f\n", con[i]->name, con[i]->type, value));
		if(value < pcon->min) {
			value = pcon->oldvalue;
			pcon->SetValue(value);
			//SetStatus(text.Format("Parameter \'%s\' out of range", con->label->GetLabel()));
			//mainwin->diagbox->Write(text.Format("Parameter \'%s\' out of range, min %.2f max %.2f\n", con->label->GetLabel(), con->min, con->max));
		}
		if(value > pcon->max) {
			value = pcon->oldvalue;
			pcon->SetValue(value);
			//SetStatus(text.Format("Parameter %s out of range", con->label->GetLabel()));
		}
		//boxout->diagbox->Write(text.Format("param %s type %d value %.4f\n", con[i]->name, con[i]->type, value));
		(*paramstore)[con[i]->name] = value;
		pcon->oldvalue = value;
	}
	return paramstore;
}
Example #2
0
ParamStore *ParamBox::GetParams(ParamStore *pstore)
{ 
	double value;
	ParamCon *con;
	wxString text;

	//SetStatus("");

	//if(mainwin->diagnostic) mod->diagbox->textbox->AppendText(text.Format("%s get params\n", boxname));

	if(pstore == NULL) pstore = modparams;
	for(i=0; i<paramset->numparams; i++) {
		con = paramset->con[i];
		value = con->GetValue();
		if(value < con->min) {
			//value = con->min;
			value = con->oldvalue;
			con->SetValue(value);
			if(con->label) {
				SetStatus(text.Format("Parameter \'%s\' out of range", con->label->GetLabel()));
				mainwin->diagbox->Write(text.Format("Parameter \'%s\' out of range, min %.2f max %.2f\n", con->label->GetLabel(), con->min, con->max));
			}
		}
		if(value > con->max) {
			//value = con->max;
			value = con->oldvalue;
			con->SetValue(value);
			if(con->label) SetStatus(text.Format("Parameter %s out of range", con->label->GetLabel()));
		}
		//paramset->con[i]->numbox->GetValue().ToDouble(&((*pstore)[paramset->con[i]->name]));
		(*pstore)[paramset->con[i]->name] = value;
		con->oldvalue = value;
	}

	return pstore;
}