ADD_SUBDIRECTORY(tui)
ADD_SUBDIRECTORY(exe)
ENDIF()
+
+INSTALL(FILES MEDCalcConstants.hxx DESTINATION ${SALOME_INSTALL_HEADERS})
--- /dev/null
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// This constant strings are used to specify an attribute name for
+// AttributeParameter attributes associated to a SObject
+#define OBJECT_ID "objectid"
+#define OBJECT_IS_IN_WORKSPACE "isInWorkspace"
+
+static const int NB_TYPE_OF_FIELDS = 4;
+static const char* mapTypeOfFieldLabel[NB_TYPE_OF_FIELDS] =
+ {"ON_CELLS", "ON_NODES", "ON_GAUSS_PT", "ON_GAUSS_NE" };
+
+
+// Used by presentations
+#define FIELD_ID "fieldid"
+#define IS_PRESENTATION "ispresentation"
${PYTHON_INCLUDE_DIRS}
${MEDCOUPLING_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/..
${PROJECT_BINARY_DIR}/idl
)
//
#include "MED.hxx"
-
#include "MEDFactoryClient.hxx"
+#include <MEDCalcConstants.hxx>
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include <SALOMEDS_SObject.hxx>
-
#include <Utils_ExceptHandlers.hxx>
#include <string>
// nothing to do
}
-// Duplicate gui/DatasourceConstants
-#define OBJECT_ID "objectid"
-#define OBJECT_IS_IN_WORKSPACE "isInWorkspace"
-
-// Duplicate gui/XmedDataModel
-static const int NB_TYPE_OF_FIELDS = 4;
-static const char* mapTypeOfFieldLabel[NB_TYPE_OF_FIELDS] =
- {"ON_CELLS", "ON_NODES", "ON_GAUSS_PT", "ON_GAUSS_NE" };
-
MED_ORB::status
MED::addDatasourceToStudy(SALOMEDS::Study_ptr study,
const MEDCALC::DatasourceHandler& datasourceHandler)
soPresentation->SetAttrString("AttributeName", name);
soPresentation->SetAttrString("AttributePixMap", label);
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeParameter_var aParam;
+ anAttr = studyBuilder->FindOrCreateAttribute(soPresentation, "AttributeParameter");
+ aParam = SALOMEDS::AttributeParameter::_narrow(anAttr);
+ aParam->SetInt(FIELD_ID, fieldId);
+ aParam->SetBool(IS_PRESENTATION, true);
+
result = MED_ORB::OP_OK;
return result;
}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/dialogs
${CMAKE_CURRENT_BINARY_DIR}/dialogs
+ ${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_SOURCE_DIR}/../cmp
${CMAKE_CURRENT_SOURCE_DIR}/../../MEDGUI
${PROJECT_BINARY_DIR}/idl
+++ /dev/null
-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// This constant strings are used to specify an attribute name for
-// AttributeParameter attributes associated to a SObject
-#define OBJECT_ID "objectid"
-#define OBJECT_IS_IN_WORKSPACE "isInWorkspace"
// Author : Guillaume Boulant (EDF)
#include "DatasourceController.hxx"
-#include "DatasourceConstants.hxx"
+#include <MEDCalcConstants.hxx>
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
#include "MEDModule.hxx"
#include "QtHelper.hxx"
+#include <MEDCalcConstants.hxx>
#include "SALOME_LifeCycleCORBA.hxx"
#include "QtxPopupMgr.h"
#include <SUIT_Desktop.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
+#include <SUIT_DataBrowser.h>
#include <SalomeApp_Study.h>
+#include <SalomeApp_DataObject.h>
+#include <SalomeApp_DataModel.h>
+
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
+#include <SALOMEDS_SObject.hxx>
+#include <SALOMEDS_Study.hxx>
#ifndef DISABLE_PVVIEWER
#include "PVViewer_ViewModel.h"
#endif
+#include <sstream>
+
//! The only instance of the reference to engine
MED_ORB::MED_Gen_var MEDModule::myEngine;
// call the parent implementation
SalomeApp_Module::initialize( app );
+ if (app && app->desktop()) {
+ connect((QObject*) (getApp()->objectBrowser()->treeView()), SIGNAL(doubleClicked(const QModelIndex&)),
+ this, SLOT(onDblClick(const QModelIndex&)));
+ }
+
// The following initializes the GUI widget and associated actions
this->createModuleWidgets();
this->createModuleActions();
{
return _presentationController->getSelectedColorMap();
}
+
+void
+MEDModule::onDblClick(const QModelIndex& index)
+{
+ DataObjectList dol = getApp()->objectBrowser()->getSelected();
+ if (dol.isEmpty())
+ return;
+ SalomeApp_DataObject* item = dynamic_cast<SalomeApp_DataObject*>(dol[0]);
+ if (!item)
+ return;
+ SalomeApp_DataModel *model = dynamic_cast<SalomeApp_DataModel*>(dataModel());
+ if (!model)
+ return;
+
+ if (item->componentDataType().toStdString() != "MED")
+ return;
+ _PTR(SObject) obj = item->object();
+ _PTR(GenericAttribute) anAttribute;
+
+ if (! obj->FindAttribute(anAttribute, "AttributeName"))
+ return;
+ _PTR(AttributeName) attrName(anAttribute);
+ std::string name = attrName->Value();
+
+ if (! obj->FindAttribute(anAttribute, "AttributeParameter"))
+ return;
+ _PTR(AttributeParameter) attrParam(anAttribute);
+ if (! attrParam->IsSet(IS_PRESENTATION, PT_BOOLEAN)
+ || ! attrParam->GetBool(IS_PRESENTATION)) { // Not a presentation
+ return;
+ }
+ if (!attrParam->IsSet(FIELD_ID, PT_INTEGER))
+ return;
+ int fieldId = attrParam->GetInt(FIELD_ID);
+
+ STDLOG("Presentation edition: NOT IMPLEMENTED YET");
+ STDLOG(" Presention infos:");
+ STDLOG(" - Component: " + item->componentDataType().toStdString());
+ STDLOG(" - Item entry: " + item->entry().toStdString());
+ STDLOG(" - Item name: " + item->name().toStdString());
+ std::ostringstream oss;
+ oss << fieldId;
+ STDLOG(" - Field id: " + oss.str());
+ STDLOG(" - Presentation name: " + name);
+
+}
#include CORBA_CLIENT_HEADER(MED_Gen)
#include CORBA_SERVER_HEADER(MEDPresentationManager)
+#include <QModelIndex>
+
class SalomeApp_Application;
/*!
public slots:
virtual bool activateModule(SUIT_Study* theStudy);
virtual bool deactivateModule(SUIT_Study* theStudy);
+ virtual void onDblClick(const QModelIndex& index);
private:
void createModuleWidgets();
//
#include "PresentationController.hxx"
-#include "DatasourceConstants.hxx"
+#include <MEDCalcConstants.hxx>
#include "MEDModule.hxx"
#include "Basics_Utils.hxx"
#include "QtxActionGroup.h"
//
#include "ProcessingController.hxx"
-#include "DatasourceConstants.hxx"
+#include <MEDCalcConstants.hxx>
#include "MEDFactoryClient.hxx"
#include "MEDModule.hxx"
#include "XmedDataModel.hxx"
#include <Basics_Utils.hxx>
+#include "MEDCalcConstants.hxx"
//
// =================================================================
return &_fieldHandler;
}
-const char * XmedDataObject::mapTypeOfFieldLabel[XmedDataObject::NB_TYPE_OF_FIELDS] =
- {"ON_CELLS", "ON_NODES", "ON_GAUSS_PT", "ON_GAUSS_NE" };
/*!
* This function implements the convention for displaying a fieldname
* characterized by its spatial discretisation type.
// 2 = ON_GAUSS_PT
// 3 = ON_GAUSS_NE
if ( _fieldHandler.type < 0 ||
- _fieldHandler.type >= XmedDataObject::NB_TYPE_OF_FIELDS ) {
+ _fieldHandler.type >= NB_TYPE_OF_FIELDS ) {
return string("UNKNOWN");
}
string label(_fieldHandler.fieldname);
void setFieldHandler(MEDCALC::FieldHandler fieldHandler);
MEDCALC::FieldHandler * getFieldHandler();
- static const int NB_TYPE_OF_FIELDS = 4;
- static const char * mapTypeOfFieldLabel[NB_TYPE_OF_FIELDS];
-
private:
MEDCALC::FieldHandler _fieldHandler;
string _getTypedFieldLabel();
${CMAKE_CURRENT_BINARY_DIR}
${GUI_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/..
+ ${CMAKE_CURRENT_SOURCE_DIR}/../..
${PROJECT_BINARY_DIR}/idl
)
//
#include "DlgChangeUnderlyingMesh.hxx"
-#include "DatasourceConstants.hxx"
+#include <MEDCalcConstants.hxx>
#include <QString>
#include <QMessageBox>
//
#include "DlgInterpolateField.hxx"
-#include "DatasourceConstants.hxx"
+#include <MEDCalcConstants.hxx>
#include <QString>
#include <QMessageBox>