Example #1
0
BOOL COrnament::PositionChanged(CPropertyState* pState) const
{
	COrnamentState* pCurrent = CurrentState();
	COrnamentState* pCompare = StateType(pState);
	
	if (!PropertySet(pState))
	{
		return FALSE;
	}

	return
		(pState == NULL)
	|| (pCurrent->m_cpPosition != pCompare->m_cpPosition);
}
Example #2
0
BOOL COrnament::SizeChanged(CPropertyState* pState) const
{
	COrnamentState* pCurrent = CurrentState();
	COrnamentState* pCompare = StateType(pState);
	
	if (!PropertySet(pState))
	{
		return FALSE;
	}

	return
		(pState == NULL)
	|| (pCurrent->m_dwStyle						!= pCompare->m_dwStyle)
	|| (pCurrent->m_czExtent					!= pCompare->m_czExtent);
}
Example #3
0
void StateWidget::AcceptState()
{
    if(edited==NULL)
    {
        emit reportError(QString("Please, select a state to edit, edit it and then press OK."));
        return;
    }
    if ( !StateNameOK())
    {
        return;
    }
    BaseState * toInsertState = StateWidgets[tmpWidget]->getStateObject();
    if(toInsertState==NULL)
        return;
    toInsertState->setName(this->stateNameEdit->text());
    toInsertState->setType(StateType(stateTypeCombo->currentIndex()));
    toInsertState->setParameters(paramEdit->text());
    OKButton->setDisabled(true);
    BaseState * tmp = edited;
    edited = NULL;
    emit ReplaceState(tmp, toInsertState);
}
Example #4
0
Analysis::RetType Analysis_State::Setup(ArgList& analyzeArgs, DataSetList* datasetlist, DataFileList* DFLin, int debugIn)
{
  debug_ = debugIn;
  masterDSL_ = datasetlist;
  DataFile* outfile = DFLin->AddDataFile( analyzeArgs.GetStringKey("out"), analyzeArgs );
  curveOut_ = DFLin->AddDataFile( analyzeArgs.GetStringKey("curveout"), analyzeArgs );
  stateOut_ = DFLin->AddCpptrajFile( analyzeArgs.GetStringKey("stateout"), "State Output",
                                     DataFileList::TEXT, true);
  transOut_ = DFLin->AddCpptrajFile( analyzeArgs.GetStringKey("transout"), "Transitions Output",
                                     DataFileList::TEXT, true);
  normalize_ = analyzeArgs.hasKey("norm");
  // Get definitions of states if present.
  // Define states as 'state <#>,<dataset>,<min>,<max>'
  std::string state_arg = analyzeArgs.GetStringKey("state");
  if (!state_arg.empty()) {
    while (!state_arg.empty()) {
      // Expect form <#>,<dataset>
      ArgList argtmp(state_arg, ",");
      if (argtmp.Nargs() != 4) {
        mprinterr("Error: Malformed state argument '%s': expect <ID>,<dataset>,<min>,<max>\n",
                  state_arg.c_str());
        return Analysis::ERR;
      }
      std::string state_id = argtmp.GetStringNext();
      // TODO: Check duplicate names
      if (state_id.empty()) {
        mprinterr("Error: In state argument, could not get ID.\n");
        return Analysis::ERR;
      }
      DataSet* ds = datasetlist->GetDataSet( argtmp.GetStringNext() );
      if (ds == 0) return Analysis::ERR;
      if (ds->Ndim() != 1) {
        mprinterr("Error: Only 1D data sets allowed.\n");
        return Analysis::ERR;
      }
      double min = argtmp.getNextDouble(0.0);
      double max = argtmp.getNextDouble(0.0);
      if (max < min) {
        mprinterr("Error: max value cannot be less than min.\n");
        return Analysis::ERR;
      }
      States_.push_back( StateType(state_id, (DataSet_1D*)ds, min, max) );
      state_arg = analyzeArgs.GetStringKey("state");
    }
  }
  if (States_.empty()) {
    mprinterr("Error: No states defined.\n");
    return Analysis::ERR;
  }
  state_data_ = datasetlist->AddSet(DataSet::INTEGER, analyzeArgs.GetStringKey("name"), "State");
  if (state_data_ == 0) return Analysis::ERR;
  if (outfile != 0) outfile->AddDataSet( state_data_ );

  mprintf("    STATE: The following states have been set up:\n");
  for (StateArray::const_iterator state = States_.begin(); state != States_.end(); ++state)
    mprintf("\t%u: %20s %12.4f <= %-20s < %12.4f\n", state - States_.begin(), state->DS().legend(),
            state->Min(), state->id(), state->Max());
  mprintf("\tState data set: %s\n", state_data_->legend());
  if (outfile != 0)
    mprintf("\tStates vs time output to file '%s'\n", outfile->DataFilename().full());
  if (curveOut_ != 0)
    mprintf("\tCurves output to file '%s'\n", curveOut_->DataFilename().full());
  mprintf("\tState output to file '%s'\n", stateOut_->Filename().full());
  mprintf("\tTransitions output to file '%s'\n", transOut_->Filename().full());
  if (normalize_)
    mprintf("\tCurves will be normalized to 1.0\n");

  return Analysis::OK;
}