#include "MEDPresentationScalarMap.hxx"
#include "MEDPresentationContour.hxx"
#include "MEDPresentationSlices.hxx"
+#include "MEDPresentationPointSprite.hxx"
+#include "MEDPresentationVectorField.hxx"
+#include "MEDPresentationDeflectionShape.hxx"
#include "MEDWidgetHelperMeshView.hxx"
#include "MEDWidgetHelperScalarMap.hxx"
#include "MEDWidgetHelperContour.hxx"
#include "MEDWidgetHelperSlices.hxx"
+#include "MEDWidgetHelperPointSprite.hxx"
+#include "MEDWidgetHelperVectorField.hxx"
+#include "MEDWidgetHelperDeflectionShape.hxx"
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
label = tr("LAB_DELETE_PRESENTATION");
tooltip = tr("TIP_DELETE_PRESENTATION");
- icon = tr(_getIconName("ICO_DELETE_PRESENTATION").c_str());
+ icon = tr("ICO_DELETE_PRESENTATION");
actionId = _salomeModule->createStandardAction(label,this, SLOT(onDeletePresentation()),icon,tooltip);
// _salomeModule->createTool(actionId, presentationToolbarId);
// _salomeModule->action(actionId)->setIconVisibleInMenu(true);
_salomeModule->createMenu(actionId, presentationMenuId);
- //
- // Actions for popup menu only
- //
// Low level PARAVIS dump
label = tr("LAB_PARAVIS_DUMP");
- //icon = tr("ICO_DATASOURCE_EXPAND_FIELD");
+ tooltip = tr("TIP_PARAVIS_DUMP");
actionId = _salomeModule->createStandardAction(label,this,SLOT(onParavisDump()),"");
- _salomeModule->addActionInPopupMenu(actionId);
+ _salomeModule->createMenu(actionId, presentationMenuId);
+ //
+ // Actions for popup menu only
+ //
}
-MEDCALC::MEDPresentationViewMode
+MEDCALC::ViewModeType
PresentationController::getSelectedViewMode() const
{
if (_salomeModule->action(OPTIONS_VIEW_MODE_REPLACE_ID)->isChecked()) {
return MEDCALC::VIEW_MODE_REPLACE;
}
-MEDCALC::MEDPresentationColorMap
+MEDCALC::ColorMapType
PresentationController::getSelectedColorMap() const
{
return _widgetPresentationParameters->getColorMap();
}
-MEDCALC::MEDPresentationScalarBarRange
+MEDCALC::ScalarBarRangeType
PresentationController::getSelectedScalarBarRange() const
{
return _widgetPresentationParameters->getScalarBarRange();
QString
PresentationController::getViewModePython() const
{
- MEDCALC::MEDPresentationViewMode viewMode = getSelectedViewMode();
+ MEDCALC::ViewModeType viewMode = getSelectedViewMode();
switch(viewMode) {
case MEDCALC::VIEW_MODE_REPLACE: return "MEDCALC.VIEW_MODE_REPLACE";
case MEDCALC::VIEW_MODE_OVERLAP: return "MEDCALC.VIEW_MODE_OVERLAP";
QString
PresentationController::getColorMapPython() const
{
- MEDCALC::MEDPresentationColorMap colorMap = getSelectedColorMap();
+ MEDCALC::ColorMapType colorMap = 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";
QString
PresentationController::getScalarBarRangePython() const
{
- MEDCALC::MEDPresentationScalarBarRange colorMap = getSelectedScalarBarRange();
+ MEDCALC::ScalarBarRangeType colorMap = getSelectedScalarBarRange();
switch(colorMap) {
case MEDCALC::SCALAR_BAR_ALL_TIMESTEPS: return "MEDCALC.SCALAR_BAR_ALL_TIMESTEPS";
case MEDCALC::SCALAR_BAR_CURRENT_TIMESTEP: return "MEDCALC.SCALAR_BAR_CURRENT_TIMESTEP";
QString
PresentationController::getMeshModePython(const int mode) const
{
- MEDCALC::MEDPresentationMeshMode mod = static_cast<MEDCALC::MEDPresentationMeshMode>(mode);
+ MEDCALC::MeshModeType mod = static_cast<MEDCALC::MeshModeType>(mode);
switch(mod) {
case MEDCALC::MESH_MODE_WIREFRAME: return "MEDCALC.MESH_MODE_WIREFRAME";
case MEDCALC::MESH_MODE_SURFACE: return "MEDCALC.MESH_MODE_SURFACE";
QString
PresentationController::getSliceOrientationPython(const int orientation) const
{
- MEDCALC::MEDPresentationSliceOrientation orient = static_cast<MEDCALC::MEDPresentationSliceOrientation>(orientation);
+ MEDCALC::SliceOrientationType orient = static_cast<MEDCALC::SliceOrientationType>(orientation);
switch(orient) {
case MEDCALC::SLICE_NORMAL_TO_X: return "MEDCALC.SLICE_NORMAL_TO_X";
case MEDCALC::SLICE_NORMAL_TO_Y: return "MEDCALC.SLICE_NORMAL_TO_Y";
QString scalarBarRange = getScalarBarRangePython();
MEDCALC::FieldHandler* fieldHandler = event->fieldHandler;
QStringList commands;
+
+ // [ABN] using event mechanism for all this is awkward? TODO: direct implementation in each
+ // dedicated widget helper class?
+
if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_MESH_VIEW ) {
commands += QString("presentation_id = medcalc.MakeMeshView(accessField(%1), viewMode=%2)").arg(fieldHandler->id).arg(viewMode);
commands += QString("presentation_id");
}
else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_CONTOUR ) {
commands += QString("presentation_id = medcalc.MakeContour(accessField(%1), viewMode=%2, scalarBarRange=%3, colorMap=%4)")
- .arg(fieldHandler->id).arg(viewMode).arg(scalarBarRange).arg(colorMap);
+ .arg(fieldHandler->id).arg(viewMode).arg(scalarBarRange).arg(colorMap);
commands += QString("presentation_id");
}
- // else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_VECTOR_FIELD ) {
- // commands += QString("presentation_id = medcalc.MakeVectorField(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
- // commands += QString("presentation_id");
- // }
- else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_SLICES ) {
+ else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_SLICES ) {
commands += QString("presentation_id = medcalc.MakeSlices(accessField(%1), viewMode=%2, scalarBarRange=%3, colorMap=%4)")
- .arg(fieldHandler->id).arg(viewMode).arg(scalarBarRange).arg(colorMap);
+ .arg(fieldHandler->id).arg(viewMode).arg(scalarBarRange).arg(colorMap);
commands += QString("presentation_id");
- }
- // else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_DEFLECTION_SHAPE ) {
- // commands += QString("presentation_id = medcalc.MakeDeflectionShape(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
- // commands += QString("presentation_id");
- // }
- // else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_POINT_SPRITE ) {
- // commands += QString("presentation_id = medcalc.MakePointSprite(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
- // commands += QString("presentation_id");
- // }
+ }
+ else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_VECTOR_FIELD ) {
+ commands += QString("presentation_id = medcalc.MakeVectorField(accessField(%1), viewMode=%2, scalarBarRange=%3, colorMap=%4)")
+ .arg(fieldHandler->id).arg(viewMode).arg(scalarBarRange).arg(colorMap);
+ commands += QString("presentation_id");
+ }
+ else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_POINT_SPRITE ) {
+ commands += QString("presentation_id = medcalc.MakePointSprite(accessField(%1), viewMode=%2, scalarBarRange=%3, colorMap=%4)")
+ .arg(fieldHandler->id).arg(viewMode).arg(scalarBarRange).arg(colorMap);
+ commands += QString("presentation_id");
+ }
+ else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_DEFLECTION_SHAPE ) {
+ commands += QString("presentation_id = medcalc.MakeDeflectionShape(accessField(%1), viewMode=%2, scalarBarRange=%3, colorMap=%4)")
+ .arg(fieldHandler->id).arg(viewMode).arg(scalarBarRange).arg(colorMap);
+ commands += QString("presentation_id");
+ }
+
- // [ABN] using event mechanism for this is awkward? TODO: direct implementation in each
- // dedicated widget helper class?
else if ( event->eventtype == PresentationEvent::EVENT_CHANGE_COMPONENT ) {
std::string typ = getPresTypeFromWidgetHelper(event->presentationId);
commands += QString("params = medcalc.Get%1Parameters(%2)").arg(QString::fromStdString(typ)).arg(event->presentationId);
std::map<int, MEDWidgetHelper *>::const_iterator it =_presHelperMap.find(presId);
if (it != _presHelperMap.end())
return (*it).second;
- MEDWidgetHelper * wh;
+ MEDWidgetHelper * wh = 0;
if (type == MEDPresentationMeshView::TYPE_NAME)
wh = new MEDWidgetHelperMeshView(this, _presManager, presId, name, _widgetPresentationParameters);
else if (type == MEDPresentationScalarMap::TYPE_NAME)
else if (type == MEDPresentationContour::TYPE_NAME)
wh = new MEDWidgetHelperContour(this, _presManager, presId, name, _widgetPresentationParameters);
else if (type == MEDPresentationSlices::TYPE_NAME)
- wh = new MEDWidgetHelperSlices(this, _presManager, presId, name, _widgetPresentationParameters);
+ wh = new MEDWidgetHelperSlices(this, _presManager, presId, name, _widgetPresentationParameters);
+ else if (type == MEDPresentationVectorField::TYPE_NAME)
+ wh = new MEDWidgetHelperVectorField(this, _presManager, presId, name, _widgetPresentationParameters);
+ else if (type == MEDPresentationPointSprite::TYPE_NAME)
+ wh = new MEDWidgetHelperPointSprite(this, _presManager, presId, name, _widgetPresentationParameters);
+ else if (type == MEDPresentationDeflectionShape::TYPE_NAME)
+ wh = new MEDWidgetHelperDeflectionShape(this, _presManager, presId, name, _widgetPresentationParameters);
else
{
- STDLOG("findOrCreateWidgetHelper(): NOT IMPLEMENTED !!!");
+ const char * msg ="findOrCreateWidgetHelper(): NOT IMPLEMENTED !!!";
+ STDLOG(msg);
}
_presHelperMap[presId] = wh;
return wh;
_presManager->activateView(presId);
// Update widgets parameters
_currentWidgetHelper = findOrCreateWidgetHelper(_presManager, presId, presType.toStdString(), presName.toStdString());
- _currentWidgetHelper->udpateWidget();
+ _currentWidgetHelper->updateWidget(true);
}
}
continue;
std::string dump(_presManager->getParavisDump(presId));
- std::cerr << "#====== ParaVis dump =============== " << std::endl;
+ std::cerr << "#====== ParaVis dump (presentation " << presId << ") =====" << std::endl;
std::cerr << dump;
- std::cerr << "#====== End of ParaVis dump ======== " << std::endl;
+ std::cerr << "#====== End of ParaVis dump =============== " << std::endl;
break; // stop at the first one
}
oss.str().c_str(), type.c_str(),ico.c_str(), presentationId);
- // MEDCALC::MEDPresentationViewMode viewMode = MEDFactoryClient::getPresentationManager()->getPresentationViewMode(presentationId);
+ // MEDCALC::ViewModeType viewMode = MEDFactoryClient::getPresentationManager()->getPresentationViewMode(presentationId);
//
// // Remove sibling presentations if view mode is set to REPLACE
// if (viewMode == MEDCALC::VIEW_MODE_REPLACE) {
STDLOG("Removing pres " << (*lstModule)[i] << " from OB.");
// Presentation in module but not in manager anymore: to be deleted from OB:
updateTreeViewForPresentationRemoval((*lstModule)[i]);
+ onPresentationSelected(-1, "", ""); // make sure param widget is hidden
}
}
}
else if ( event->type == MEDCALC::EVENT_REMOVE_PRESENTATION ) {
updateTreeViewForPresentationRemoval(event->presentationId);
+ // Hide parameter widget if necessary:
+ onPresentationSelected(-1, "", "");
+ }
+ else if ( event->type == MEDCALC::EVENT_MODIFY_PRESENTATION ) {
+ // Update parameter widget if shown:
+ if(_currentWidgetHelper)
+ _currentWidgetHelper->updateWidget(false);
}
}