cmd += std::string("__view1.ResetCamera();");
return cmd;
}
+
+std::string
+MEDPresentation::getColorMapCommand(MEDCALC::MEDPresentationColorMap colorMap)
+{
+ switch(colorMap) {
+ case MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW: return "Blue to Red Rainbow";
+ case MEDCALC::COLOR_MAP_COOL_TO_WARM: return "Cool to Warm";
+ }
+}
MEDPresentation(MEDPresentation::TypeID fieldHandlerId, std::string name);
std::string getRenderViewCommand(MEDCALC::MEDPresentationViewMode viewMode);
+ std::string getColorMapCommand(MEDCALC::MEDPresentationColorMap colorMap);
virtual void internalGeneratePipeline() = 0;
PyObject * getPythonObjectFromMain(const char * var);
void pushInternal(PyObject * obj, PyObject * disp = NULL);
+ MEDPresentation::TypeID getID() { return _fieldHandlerId; }
+
private:
void generatePipeline(); // reserved to friend class MEDPresentationManager
cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));");
cmd += std::string("__disp1.SetScalarBarVisibility(__view1, True);");
cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();");
+ cmd += std::string("__lut = pvs.GetColorTransferFunction('")+_fieldName+std::string("');");
+ cmd += std::string("__lut.ApplyPreset('")+getColorMapCommand(_params.colorMap)+std::string("',True);");
cmd += std::string("pvs.Render();");
//std::cerr << "Python command:" << std::endl;
{
return _presentationController->getSelectedViewMode();
}
+
+MEDCALC::MEDPresentationColorMap
+MEDModule::getSelectedColorMap()
+{
+ return _presentationController->getSelectedColorMap();
+}
const QString& rule="client='ObjectBrowser'");
MEDCALC::MEDPresentationViewMode getSelectedViewMode();
+ MEDCALC::MEDPresentationColorMap getSelectedColorMap();
inline SALOME_AppStudyEditor* getStudyEditor() { return _studyEditor; }
<source>LAB_COLOR_MAP</source>
<translation>Color map:</translation>
</message>
- <message>
- <source>LAB_BLUE_TO_RED</source>
- <translation>Blue to red rainbow</translation>
- </message>
- <message>
- <source>LAB_COOL_TO_WARM</source>
- <translation>Cool to warm</translation>
- </message>
</context>
<context>
<name>DlgAlias</name>
<source>LAB_VIEW_MODE_SPLIT_VIEW</source>
<translation>Split</translation>
</message>
+ <message>
+ <source>LAB_BLUE_TO_RED</source>
+ <translation>Blue to red rainbow</translation>
+ </message>
+ <message>
+ <source>LAB_COOL_TO_WARM</source>
+ <translation>Cool to warm</translation>
+ </message>
</context>
</TS>
return _widgetPresentationParameters->getViewMode();
}
+MEDCALC::MEDPresentationColorMap
+PresentationController::getSelectedColorMap()
+{
+ return _widgetPresentationParameters->getColorMap();
+}
+
void
PresentationController::visualize(PresentationEvent::EventType eventType)
{
void createActions();
MEDCALC::MEDPresentationViewMode getSelectedViewMode();
+ MEDCALC::MEDPresentationColorMap getSelectedColorMap();
signals:
void presentationSignal(const PresentationEvent*);
_consoleDriver->exec(commands);
}
-QString
-WorkspaceController::_getViewMode() {
- MEDCALC::MEDPresentationViewMode viewMode = _salomeModule->getSelectedViewMode();
- switch(viewMode) {
- case MEDCALC::VIEW_MODE_REPLACE: return "MEDCALC.VIEW_MODE_REPLACE";
- case MEDCALC::VIEW_MODE_OVERLAP: return "MEDCALC.VIEW_MODE_OVERLAP";
- case MEDCALC::VIEW_MODE_NEW_LAYOUT: return "MEDCALC.VIEW_MODE_NEW_LAYOUT";
- case MEDCALC::VIEW_MODE_SPLIT_VIEW: return "MEDCALC.VIEW_MODE_SPLIT_VIEW";
- }
-}
-
/**
* This slot can process the event coming from the
* DatasourceController. The connection between the datasource signal
STDLOG("The event "<<event->eventtype<<" is not implemented yet");
}
}
+
+QString
+WorkspaceController::_getViewMode()
+{
+ MEDCALC::MEDPresentationViewMode viewMode = _salomeModule->getSelectedViewMode();
+ switch(viewMode) {
+ case MEDCALC::VIEW_MODE_REPLACE: return "MEDCALC.VIEW_MODE_REPLACE";
+ case MEDCALC::VIEW_MODE_OVERLAP: return "MEDCALC.VIEW_MODE_OVERLAP";
+ case MEDCALC::VIEW_MODE_NEW_LAYOUT: return "MEDCALC.VIEW_MODE_NEW_LAYOUT";
+ case MEDCALC::VIEW_MODE_SPLIT_VIEW: return "MEDCALC.VIEW_MODE_SPLIT_VIEW";
+ }
+}
+
+QString
+WorkspaceController::_getColorMap()
+{
+ MEDCALC::MEDPresentationColorMap colorMap = _salomeModule->getSelectedColorMap();
+ switch(colorMap) {
+ case MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW: return "MEDCALC.COLOR_MAP_BLUE_TO_RED_RAINBOW";
+ case MEDCALC::COLOR_MAP_COOL_TO_WARM: return "MEDCALC.COLOR_MAP_COOL_TO_WARM";
+ }
+}
+
/**
* This slot can process the event coming from the
* DatasourceController. The connection between the datasource signal
QString viewMode = _getViewMode();
//QString displayedInfo = ; // from PresentationController combobox
//QString scalarBarRange = ; // from PresentationController spinbox
- //QString colorMap = ; // from PresentationController combobox
+ QString colorMap = _getColorMap();
MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
QStringList commands;
- commands += QString("medcalc.MakeScalarMap(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
+ commands += QString("medcalc.MakeScalarMap(accessField(%1), %2, colorMap=%3)").arg(fieldHandler->id).arg(viewMode).arg(colorMap);
_consoleDriver->exec(commands);
}
else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_CONTOUR ) {
void _removeItemList(QStringList itemNameIdList);
void _viewItemList(QStringList itemNameIdList);
QString _getViewMode();
+ QString _getColorMap();
private:
XmedConsoleDriver* _consoleDriver;
return this->ui.doubleSpinBoxMaxVal->value();
}
-std::string
+MEDCALC::MEDPresentationColorMap
WidgetPresentationParameters::getColorMap()
{
- return this->ui.comboBoxColorMap->currentText().toStdString();
+ QString colorMap = this->ui.comboBoxColorMap->currentText();
+ if (colorMap == tr("LAB_BLUE_TO_RED")) {
+ return MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW;
+ }
+ else if (colorMap == tr("LAB_COOL_TO_WARM")) {
+ return MEDCALC::COLOR_MAP_COOL_TO_WARM;
+ }
}
double getScalarBarTimestep();
double getScalarBarMinVal();
double getScalarBarMaxVal();
- std::string getColorMap();
+ MEDCALC::MEDPresentationColorMap getColorMap();
private:
Ui_WidgetPresentationParameters ui; // instance of the class defined in ui_WidgetPresentationParameters.h