void caGraphics::setForm(Form form) { thisForm = form; setPropertyVisible(arrowsize, false); setPropertyVisible(arrowmode, false); setPropertyVisible(startangle, false); setPropertyVisible(spanangle, false); setPropertyVisible(tiltangle, true); switch (form) { case Rectangle: case Circle: case Triangle: case Line: break; case Arc: setPropertyVisible(startangle, true); setPropertyVisible(spanangle, true); setPropertyVisible(tiltangle, false); break; case Arrow: setPropertyVisible(arrowsize, true); setPropertyVisible(arrowmode, true); break; } update(); }
void SingleCellSimulationViewInformationSolversWidget::initialize(const QString &pFileName, CellMLSupport::CellmlFileRuntime *pRuntime, SingleCellSimulationViewSimulationData *pSimulationData) { // Make sure that we have a CellML file runtime if (!pRuntime) return; // Retrieve and initialise our GUI state setGuiState(mGuiStates.contains(pFileName)? mGuiStates.value(pFileName): mDefaultGuiState); // Make sure that the CellML file runtime is valid if (pRuntime->isValid()) { // Show/hide the ODE/DAE solver information if (mOdeSolverData) setPropertyVisible(mOdeSolverData->solversProperty(), pRuntime->needOdeSolver()); if (mDaeSolverData) setPropertyVisible(mDaeSolverData->solversProperty(), pRuntime->needDaeSolver()); // Show/hide the NLA solver information if (mNlaSolverData) setPropertyVisible(mNlaSolverData->solversProperty(), pRuntime->needNlaSolver()); // Retranslate ourselves so that the property names get properly set retranslateUi(); } // Set the unit of our different properties, if needed QString voiUnit = pRuntime->variableOfIntegration()->unit(); setPropertiesUnit(mOdeSolverData, voiUnit); setPropertiesUnit(mDaeSolverData, voiUnit); setPropertiesUnit(mNlaSolverData, voiUnit); // Initialise our simulation's NLA solver's properties, so that we can then // properly reset our simulation the first time round if (mNlaSolverData) { pSimulationData->setNlaSolverName(mNlaSolverData->solversListProperty()->value()->text(), false); foreach (Core::Property *property, mNlaSolverData->solversProperties().value(pSimulationData->nlaSolverName())) pSimulationData->addNlaSolverProperty(property->name()->text(), (property->value()->type() == Core::PropertyItem::Integer)? Core::PropertyEditorWidget::integerPropertyItem(property->value()): Core::PropertyEditorWidget::doublePropertyItem(property->value()), false); } }
bool SingleCellSimulationViewInformationSolversWidget::doSolverChanged(SingleCellSimulationViewInformationSolversWidgetData *pSolverData, const QString &pSolverName, const bool &pForceHandling) { // By default, we don't handle the change in the list property bool res = false; // Check whether the list property that got changed is the one we are after if ( (pSolverData->solversListProperty() == currentProperty()) || pForceHandling) { // It is the list property we are after or we want to force the // handling, so update our result res = true; // Go through the different properties for the given type of solver and // show/hide whatever needs showing/hiding for (QMap<QString, Core::Properties>::ConstIterator iter = pSolverData->solversProperties().constBegin(), iterEnd = pSolverData->solversProperties().constEnd(); iter != iterEnd; ++iter) { bool propertyVisible = !iter.key().compare(pSolverName); foreach (Core::Property *property, iter.value()) setPropertyVisible(property, propertyVisible); } } // Return our result return res; }
void caCalc::setVariableType(varType vartype) { thisVarType = vartype; if(vartype == vector) { setPropertyVisible(calcabcd, false); setPropertyVisible(channela, false); setPropertyVisible(channelb, false); setPropertyVisible(channelc, false); setPropertyVisible(channeld, false); setPropertyVisible(initialvalue, false); setPropertyVisible(pvlist, true); } else { setPropertyVisible(calcabcd, true); setPropertyVisible(channela, true); setPropertyVisible(channelb, true); setPropertyVisible(channelc, true); setPropertyVisible(channeld, true); setPropertyVisible(initialvalue, true); setPropertyVisible(pvlist, false); } }
void caWaterfallPlot::setColormap(colormap const &map) { thisColormap = map; setPropertyVisible(customcolormap, false); setPropertyVisible(discretecolormap, false); // A color bar on the right axis QwtScaleWidget *rightAxis = plot->axisWidget(QwtPlot::yRight); rightAxis->setTitle("Intensity"); rightAxis->setColorBarEnabled(true); plot->setAxisScale(QwtPlot::yRight, thisIntensityMin, thisIntensityMax); plot->enableAxis(QwtPlot::yRight); switch (map) { case grey: d_spectrogram->setColorMap(new ColorMap_Grey()); rightAxis->setColorMap(QwtInterval(thisIntensityMin, thisIntensityMax), new ColorMap_Grey()); thisColormap = grey; break; case spectrum_wavelength: d_spectrogram->setColorMap(new ColorMap_Wavelength()); rightAxis->setColorMap(QwtInterval(thisIntensityMin, thisIntensityMax), new ColorMap_Wavelength()); thisColormap = spectrum_wavelength; break; case spectrum_hot: d_spectrogram->setColorMap(new ColorMap_Hot()); rightAxis->setColorMap(QwtInterval(thisIntensityMin, thisIntensityMax), new ColorMap_Hot()); thisColormap = spectrum_hot; break; case spectrum_heat: d_spectrogram->setColorMap(new ColorMap_Heat()); rightAxis->setColorMap(QwtInterval(thisIntensityMin, thisIntensityMax), new ColorMap_Heat()); thisColormap = spectrum_heat; break; case spectrum_jet: d_spectrogram->setColorMap(new ColorMap_Jet()); rightAxis->setColorMap(QwtInterval(thisIntensityMin, thisIntensityMax), new ColorMap_Jet()); thisColormap = spectrum_jet; break; case spectrum_custom: { int *colorIndexes=NULL; setPropertyVisible(customcolormap, true); setPropertyVisible(discretecolormap, true); // user has the possibility to input its own colormap with discrete QtColors from 2 t0 18 // when nothing given, fallback to default colormap if(thisCustomMap.count() > 2) { colorIndexes=(int *) malloc(thisCustomMap.count()*sizeof(int)); // get the discrete colors for(int i=0; i< thisCustomMap.count(); i++) { bool ok; int index = thisCustomMap.at(i).toInt(&ok); if(ok) colorIndexes[i] = index; else colorIndexes[i] = 2; // black if(colorIndexes[i] < 2) colorIndexes[i] = 2; if(colorIndexes[i] > 18) colorIndexes[i] = 18; } // create colormap ColorMap_Custom * colormap = new ColorMap_Custom(); colormap->initColormap(colorIndexes, thisCustomMap.count(), thisDiscreteMap); d_spectrogram->setColorMap(colormap); rightAxis->setColorMap(QwtInterval(thisIntensityMin, thisIntensityMax), colormap); free(colorIndexes); thisColormap = spectrum_custom; } else { d_spectrogram->setColorMap(new ColorMap_Wavelength()); rightAxis->setColorMap(QwtInterval(thisIntensityMin, thisIntensityMax), new ColorMap_Wavelength()); thisColormap = spectrum_wavelength; } } break; default: d_spectrogram->setColorMap(new ColorMap_Wavelength()); rightAxis->setColorMap(QwtInterval(thisIntensityMin, thisIntensityMax), new ColorMap_Wavelength()); thisColormap = spectrum_wavelength; break; } myReplot(); }