MedEventType type;
long dataId;
string filename;
+ long presentationId;
};
interface MEDEventListener: SALOME::GenericObj {
#include <PyInterp_Utils.h>
#include <iostream>
+MEDPresentation::MEDPresentation(MEDCALC::FieldHandler* fieldHdl, std::string name)
+ : _fieldHandler(fieldHdl), _pipeline(0), _display(0), _properties()
+{
+ setProperty("name", name);
+}
+
void MEDPresentation::generatePipeline()
{
// Might be more complicated in the future:
protected:
- MEDPresentation(MEDCALC::FieldHandler* fieldHdl):
- _fieldHandler(fieldHdl), _pipeline(0), _display(0), _properties()
- {}
+ MEDPresentation(MEDCALC::FieldHandler* fieldHdl, std::string name);
void generatePipeline();
virtual void internalGeneratePipeline() = 0;
{
public:
MEDPresentationScalarMap(MEDCALC::FieldHandler* fieldHdl, bool wireframe) :
- MEDPresentation(fieldHdl),
+ MEDPresentation(fieldHdl, "MEDPresentationScalarMap"),
_isWireframe(wireframe)
{}
virtual ~MEDPresentationScalarMap() {}
// Datasource controller
// ==============================================================
//
-DatasourceController::DatasourceController(StandardApp_Module * salomeModule) {
+DatasourceController::DatasourceController(StandardApp_Module * salomeModule)
+ : _fieldSeriesEntries()
+{
STDLOG("Creating a DatasourceController");
_salomeModule = salomeModule;
_studyEditor = new SALOME_AppStudyEditor(_salomeModule->getApp());
_studyEditor->setIcon(soDatasource,tr("ICO_DATASOURCE").toStdString().c_str());
_studyEditor->setParameterInt(soDatasource,OBJECT_ID,datasourceHandler->id);
-
// We can add the meshes as children of the datasource
MEDCALC::MeshHandlerList * meshHandlerList =
MEDFactoryClient::getDataManager()->getMeshList(datasourceHandler->id);
for(CORBA::ULong iFieldseries=0; iFieldseries<fieldseriesHandlerList->length(); iFieldseries++) {
MEDCALC::FieldseriesHandler fieldseriesHandler = (*fieldseriesHandlerList)[iFieldseries];
SALOMEDS::SObject_var soFieldseries = _studyEditor->newObject(soMesh);
+ _fieldSeriesEntries[fieldseriesHandler.id] = soFieldseries->GetID();
std::string label(fieldseriesHandler.name);
label +=" ("+std::string(XmedDataObject::mapTypeOfFieldLabel[fieldseriesHandler.type])+")";
_studyEditor->setIcon(soFieldseries,tr("ICO_DATASOURCE_FIELD").toStdString().c_str());
_studyEditor->setParameterInt(soFieldseries,OBJECT_ID,fieldseriesHandler.id);
_studyEditor->setParameterBool(soFieldseries,OBJECT_IS_IN_WORKSPACE,false);
- //std::cout << "soFieldseries.GetIOR(): " << soFieldseries._retn()->GetIOR() << std::endl;
- //std::cout << _studyEditor->findObject(soFieldseries._retn()->GetIOR())->GetIOR() << std::endl;
- std::cout << "soFieldseries.GetName(): " << soFieldseries._retn()->GetName() << std::endl;
-
}
}
}
void
-DatasourceController::updateTreeViewWithNewPresentation(long presentationId)
+DatasourceController::updateTreeViewWithNewPresentation(long fieldId, long presentationId)
{
if (presentationId < 0) {
+ std::cerr << "Unknown presentation\n";
return;
}
- std::string name = MEDFactoryClient::getPresentationManager()->getPresentationProperty(presentationId, "name");
+ if (_fieldSeriesEntries.find(fieldId) == _fieldSeriesEntries.end()) {
+ std::cerr << "Field not found\n";
+ return;
+ }
+ std::string entry = _fieldSeriesEntries[fieldId];
+ SALOMEDS::SObject_ptr soFieldseries = _studyEditor->findObject(entry.c_str());
+ if (soFieldseries->IsNull()) {
+ std::cerr << "Entry not found\n";
+ return;
+ }
+ std::string name = MEDFactoryClient::getPresentationManager()->getPresentationProperty(presentationId, "name");
+ SALOMEDS::SObject_var soPresentation = _studyEditor->newObject(soFieldseries);
+ _studyEditor->setName(soPresentation, tr(name.c_str()).toStdString().c_str());
+ _studyEditor->setIcon(soPresentation, tr("ICO_MED_PRESENTATION").toStdString().c_str());
}
void DatasourceController::OnAddDatasource()
_salomeModule->updateObjBrowser(true);
}
else if ( event->type == MEDCALC::EVENT_ADD_PRESENTATION ) {
- this->updateTreeViewWithNewPresentation(event->dataId);
+ this->updateTreeViewWithNewPresentation(event->dataId, event->presentationId);
_salomeModule->updateObjBrowser(true);
}
}
void visualize(DatasourceEvent::EventType);
void addDatasource(const char* filename);
void updateTreeViewWithNewDatasource(const MEDCALC::DatasourceHandler*);
- void updateTreeViewWithNewPresentation(long presentationId);
+ void updateTreeViewWithNewPresentation(long fieldId, long presentationId);
private:
StandardApp_Module * _salomeModule;
SALOME_AppStudyEditor * _studyEditor;
+ std::map<long, std::string> _fieldSeriesEntries;
DlgChangeUnderlyingMesh * _dlgChangeUnderlyingMesh;
DlgInterpolateField * _dlgInterpolateField;
<TS version="2.0" language="en_US">
<context>
<name>@default</name>
+ <message>
+ <source>ICO_MED_PRESENTATION</source>
+ <translation>pqAppIcon16.png</translation>
+ </message>
<message>
<source>ICO_IMPORT_MED</source>
<translation>datasource_add.png</translation>
<TS version="2.0">
<context>
<name>DatasourceController</name>
+ <message>
+ <source>MEDPresentationScalarMap</source>
+ <translation>Scalar Map</translation>
+ </message>
<message>
<location filename="MEDCALC/gui/DatasourceController.cxx" line="45"/>
<source>LAB_ADD_DATA_SOURCE</source>
<TS version="2.0">
<context>
<name>DatasourceController</name>
+ <message>
+ <source>MEDPresentationScalarMap</source>
+ <translation>Carte scalaire</translation>
+ </message>
<message>
<location filename="MEDCALC/gui/DatasourceController.cxx" line="45"/>
<source>LAB_ADD_DATA_SOURCE</source>
MEDCalc_small.png
workspace_clean.png
workspace_save.png
+ pqAppIcon16.png
)
INSTALL(FILES ${MED_RESOURCES_FILES} DESTINATION ${SALOME_MED_INSTALL_RES_DATA})
# that they could be used in another context than the FieldProxy instances
import MEDCALC
-def __notifyGui(eventType, dataId=-1, filename=""):
- medEvent = MEDCALC.MedEvent(eventType, dataId, filename)
+def __notifyGui(eventType, dataId=-1, filename="", presentationId=-1):
+ medEvent = MEDCALC.MedEvent(eventType, dataId, filename, presentationId)
if not eventListenerIsRunning(): return
# Notify the GUI of the update event
meta-data have changed so it could update the gui
presentations of this field.
"""
- __notifyGui(MEDCALC.EVENT_UPDATE_FIELD,fieldId)
+ __notifyGui(MEDCALC.EVENT_UPDATE_FIELD, dataId=fieldId)
#
def notifyGui_putInWorkspace(fieldId):
- __notifyGui(MEDCALC.EVENT_PUT_IN_WORKSPACE,fieldId)
+ __notifyGui(MEDCALC.EVENT_PUT_IN_WORKSPACE, dataId=fieldId)
#
def notifyGui_removeFromWorkspace(fieldId):
- __notifyGui(MEDCALC.EVENT_REMOVE_FROM_WORKSPACE, fieldId)
+ __notifyGui(MEDCALC.EVENT_REMOVE_FROM_WORKSPACE, dataId=fieldId)
def notifyGui_cleanWorkspace():
__notifyGui(MEDCALC.EVENT_CLEAN_WORKSPACE)
#
def notifyGui_addDatasource(filename):
- __notifyGui(MEDCALC.EVENT_ADD_DATASOURCE, -1, filename)
+ __notifyGui(MEDCALC.EVENT_ADD_DATASOURCE, filename=filename)
#
-def notifyGui_addPresentation(presentation_id):
- __notifyGui(MEDCALC.EVENT_ADD_PRESENTATION, presentation_id)
+def notifyGui_addPresentation(fieldId, presId):
+ __notifyGui(MEDCALC.EVENT_ADD_PRESENTATION, dataId=fieldId, presentationId=presId)
#
params = MEDCALC.ScalarMapParameters(proxy.id, viewMode)
presentation_id = __manager.makeScalarMap(params)
- notifyGui_addPresentation(presentation_id)
+ notifyGui_addPresentation(proxy.id, presentation_id)
#
def MakeIsoSurface():