Salome HOME
#54775: No error when load file with parameters
[modules/shaper.git] / src / ModelAPI / ModelAPI_Events.h
index e11ab4b068d11b4fab7f5d214c90ef7e16b929e3..20d90f09cd551802a603c90e0b1e3c44ebd8da4a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2022  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
@@ -119,10 +119,20 @@ MAYBE_UNUSED static const char * EVENT_DOF_OBJECTS = "DoFObjects";
 /// Event ID that requests updates visual attributes for presentations
 MAYBE_UNUSED static const char * EVENT_VISUAL_ATTRIBUTES = "UpdateVisualAttributes";
 
-
 /// Event ID that 1D-fillet failed (comes with ModelAPI_ShapesFailedMessage)
 MAYBE_UNUSED static const char * EVENT_OPERATION_SHAPES_FAILED = "OperationShapesFailed";
 
+MAYBE_UNUSED static const char * EVENT_CHECK_CONSTRAINTS = "CheckConstrains";
+
+MAYBE_UNUSED static const char * EVENT_REMOVE_CONSTRAINTS = "RemoveConstrains";
+
+/// Event ID that license of specified features is checked and valid
+MAYBE_UNUSED static const char * EVENT_FEATURE_LICENSE_VALID = "FeaturesLicenseValid";
+
+/// To send preferences information: create part on init or not
+MAYBE_UNUSED static const char * EVENT_CREATE_PART_ON_START = "CreatePartOnStart";
+
+
 /// Message that feature was changed (used for Object Browser update): moved, updated and deleted
 class MODELAPI_EXPORT ModelAPI_ObjectUpdatedMessage : public Events_MessageGroup
 {
@@ -352,6 +362,45 @@ class ModelAPI_ParameterEvalMessage : public Events_Message
   MODELAPI_EXPORT const std::string& error() const;
 };
 
+class ModelAPI_ImportParametersMessage : public Events_Message
+{
+  std::string myFilename; ///< filename where where parameters are stored
+  std::string myError; ///< error of processing, empty if there is no error
+
+public:
+  /// Static. Returns EventID of the message.
+  MODELAPI_EXPORT static Events_ID& eventId()
+  {
+    static const char* MY_PARAMETER_EVALUATION_EVENT_ID("ImportParametersMessage");
+    static Events_ID anId = Events_Loop::eventByName(MY_PARAMETER_EVALUATION_EVENT_ID);
+    return anId;
+  }
+
+  /// Useful method that creates and sends the event.
+  /// Returns the message, processed, with the resulting fields filled.
+  MODELAPI_EXPORT static std::shared_ptr<ModelAPI_ImportParametersMessage>
+    send(std::string theParameter, const void* theSender)
+  {
+    std::shared_ptr<ModelAPI_ImportParametersMessage> aMessage =
+      std::shared_ptr<ModelAPI_ImportParametersMessage>(
+        new ModelAPI_ImportParametersMessage(eventId(), theSender));
+    aMessage->setFilename(theParameter);
+    Events_Loop::loop()->send(aMessage);
+    return aMessage;
+  }
+
+  /// Creates an empty message
+  MODELAPI_EXPORT ModelAPI_ImportParametersMessage(const Events_ID theID,
+                                                   const void* theSender = 0);
+  /// The virtual destructor
+  MODELAPI_EXPORT virtual ~ModelAPI_ImportParametersMessage();
+
+  /// Returns a filename stored in the message
+  MODELAPI_EXPORT std::string filename() const;
+  /// Sets a filename to the message
+  MODELAPI_EXPORT void setFilename(std::string theFilename);
+};
+
 class ModelAPI_BuildEvalMessage : public Events_Message
 {
   FeaturePtr myParam; ///< parameters that should be evaluated
@@ -618,4 +667,49 @@ private:
   std::list< std::shared_ptr<GeomAPI_Shape> > myShapes;
 };
 
+///Message that sends the constraints to check or remove
+class ModelAPI_CheckConstraintsMessage : public Events_Message
+{
+public:
+  /// Creates an empty message
+  MODELAPI_EXPORT ModelAPI_CheckConstraintsMessage(
+    const Events_ID theID, const void* theSender = 0);
+  /// The virtual destructor
+  MODELAPI_EXPORT virtual ~ModelAPI_CheckConstraintsMessage();
+
+  ///Get list of constrains
+  MODELAPI_EXPORT const std::set<ObjectPtr>& constraints() const;
+
+  ///Set list of constrains
+  MODELAPI_EXPORT void setConstraints(const std::set<ObjectPtr>& theConstraints);
+
+private:
+  std::set<ObjectPtr> myConstraints;
+};
+
+
+/// Message that sends the features which license is checked and valid
+class ModelAPI_FeaturesLicenseValidMessage : public Events_Message
+{
+public:
+  /// Creates an message
+  MODELAPI_EXPORT
+  ModelAPI_FeaturesLicenseValidMessage(const Events_ID theID, const void* theSender = 0);
+  /// Default destructor
+  MODELAPI_EXPORT virtual ~ModelAPI_FeaturesLicenseValidMessage();
+  /// Static. Returns EventID of the message.
+  MODELAPI_EXPORT static Events_ID eventId()
+  {
+    return Events_Loop::eventByName(EVENT_FEATURE_LICENSE_VALID);
+  }
+
+  /// Sets list of features with valid license
+  MODELAPI_EXPORT void setFeatures(const std::set<std::string>& theFeatures);
+  /// Returns list of features with valid license
+  MODELAPI_EXPORT const std::set<std::string>& features() const;
+
+private:
+  std::set<std::string> myFeatures;
+};
+
 #endif