SHAPER  9.12.0
ModelAPI_Events.h
1 // Copyright (C) 2014-2023 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef MODELAPI_EVENTS_H_
21 #define MODELAPI_EVENTS_H_
22 
23 #include <ModelAPI.h>
24 #include <ModelAPI_Object.h>
25 #include <ModelAPI_Feature.h>
26 #include <ModelAPI_Attribute.h>
27 #include <Events_MessageGroup.h>
28 #include <Events_Loop.h>
29 
30 #include <memory>
31 #include <string>
32 #include <set>
33 #include <map>
34 
35 
36 class ModelAPI_Document;
38 class GeomAPI_Pnt2d;
39 class GeomAPI_Shape;
40 
41 #if defined __GNUC__ || defined __clang__
42 #define MAYBE_UNUSED __attribute__((unused))
43 #else
44 #define MAYBE_UNUSED
45 #endif
46 
48 MAYBE_UNUSED static const char * EVENT_OBJECT_CREATED = "ObjectCreated";
50 MAYBE_UNUSED static const char * EVENT_OBJECT_UPDATED = "ObjectUpdated";
52 MAYBE_UNUSED static const char * EVENT_OBJECT_DELETED = "ObjectDeleted";
54 MAYBE_UNUSED static const char * EVENT_OBJECT_RENAMED = "ObjectRenamed";
56 MAYBE_UNUSED static const char * EVENT_OBJECT_MOVED = "ObjectsMoved";
58 MAYBE_UNUSED static const char * EVENT_OBJECT_TO_REDISPLAY = "ObjectsToRedisplay";
60 MAYBE_UNUSED static const char * EVENT_PLUGIN_LOADED = "PluginLoaded";
62 MAYBE_UNUSED static const char * EVENT_DOCUMENT_CHANGED = "CurrentDocumentChanged";
64 MAYBE_UNUSED static const char * EVENT_DOCUMENTS_CLOSED = "AllDocumentsClosed";
65 
68 MAYBE_UNUSED static const char * EVENT_ORDER_UPDATED = "OrderUpdated";
70 MAYBE_UNUSED static const char * EVENT_UPDATE_SELECTION = "UpdateSelection";
71 
73 MAYBE_UNUSED static const char * EVENT_FEATURE_STATE_REQUEST = "FeatureStateRequest";
75 MAYBE_UNUSED static const char * EVENT_FEATURE_STATE_RESPONSE = "FeatureStateResponse";
76 
78 MAYBE_UNUSED static const char * EVENT_UPDATE_VIEWER_BLOCKED = "UpdateViewerBlocked";
80 MAYBE_UNUSED static const char * EVENT_UPDATE_VIEWER_UNBLOCKED = "UpdateViewerUnblocked";
81 
83 MAYBE_UNUSED static const char * EVENT_EMPTY_AIS_PRESENTATION = "EmptyAISPresentation";
85 MAYBE_UNUSED static const char * EVENT_EMPTY_OPERATION_PRESENTATION = "EmptyOperationPresentation";
87 MAYBE_UNUSED static const char * EVENT_PREVIEW_BLOCKED = "PreviewBlocked";
89 MAYBE_UNUSED static const char * EVENT_PREVIEW_REQUESTED = "PreviewRequested";
91 MAYBE_UNUSED static const char * EVENT_AUTOMATIC_RECOMPUTATION_DISABLE
92  = "DisableAutomaticRecomputation";
94 MAYBE_UNUSED static const char * EVENT_AUTOMATIC_RECOMPUTATION_ENABLE
95  = "EnableAutomaticRecomputation";
96 
98 MAYBE_UNUSED static const char * EVENT_SOLVER_FAILED = "SolverFailed";
100 MAYBE_UNUSED static const char * EVENT_SOLVER_REPAIRED = "SolverRepaired";
101 
103 MAYBE_UNUSED static const char * EVENT_SKETCH_FULLY_CONSTRAINED = "SketchFullyConstrainted";
105 MAYBE_UNUSED static const char * EVENT_SKETCH_UNDER_CONSTRAINED = "SketchUnderConstrainted";
107 MAYBE_UNUSED static const char * EVENT_SKETCH_OVER_CONSTRAINED = "SketchOverConstrainted";
108 
110 MAYBE_UNUSED static const char * EVENT_STABILITY_CHANGED = "StabilityChanged";
111 
113 MAYBE_UNUSED static const char * EVENT_SKETCH_PREPARED = "SketchPrepared";
114 
116 MAYBE_UNUSED static const char * EVENT_GET_DOF_OBJECTS = "GetDoFObjects";
117 
119 MAYBE_UNUSED static const char * EVENT_DOF_OBJECTS = "DoFObjects";
120 
122 MAYBE_UNUSED static const char * EVENT_VISUAL_ATTRIBUTES = "UpdateVisualAttributes";
123 
125 MAYBE_UNUSED static const char * EVENT_OPERATION_SHAPES_FAILED = "OperationShapesFailed";
126 
127 MAYBE_UNUSED static const char * EVENT_CHECK_CONSTRAINTS = "CheckConstrains";
128 
129 MAYBE_UNUSED static const char * EVENT_REMOVE_CONSTRAINTS = "RemoveConstrains";
130 
132 MAYBE_UNUSED static const char * EVENT_FEATURE_LICENSE_VALID = "FeaturesLicenseValid";
133 
135 MAYBE_UNUSED static const char * EVENT_CREATE_PART_ON_START = "CreatePartOnStart";
136 
137 
140 {
141  protected:
143  ModelAPI_ObjectUpdatedMessage(const Events_ID theID, const void* theSender = 0);
146 
147  public:
149  virtual const std::set<ObjectPtr>& objects() const = 0;
150 
152  virtual std::shared_ptr<Events_MessageGroup> newEmpty() = 0;
153 
155  virtual void Join(const std::shared_ptr<Events_MessageGroup>& theJoined) = 0;
156 };
157 
160 {
161 protected:
163  ModelAPI_ObjectDeletedMessage(const Events_ID theID, const void* theSender = 0);
166 
167 public:
169  virtual const std::list<std::pair<std::shared_ptr<ModelAPI_Document>, std::string> >&
170  groups() const = 0;
171 
173  virtual std::shared_ptr<Events_MessageGroup> newEmpty() = 0;
174 
176  virtual const Events_ID messageId() = 0;
177 
179  virtual void Join(const std::shared_ptr<Events_MessageGroup>& theJoined) = 0;
180 };
181 
183 class MODELAPI_EXPORT ModelAPI_OrderUpdatedMessage : public Events_Message
184 {
185 protected:
187  ModelAPI_OrderUpdatedMessage(const Events_ID theID, const void* theSender = 0);
189  virtual ~ModelAPI_OrderUpdatedMessage();
190 
191 public:
193  virtual std::shared_ptr<ModelAPI_Feature> reordered() = 0;
194 
196  virtual const Events_ID messageId() = 0;
197 };
198 
200 class MODELAPI_EXPORT ModelAPI_EventCreator
201 {
202 public:
203  virtual ~ModelAPI_EventCreator() {}
204 
206  virtual void sendUpdated(const ObjectPtr& theObject, const Events_ID& theEvent,
207  const bool isGroupped = true) const = 0;
209  virtual void sendUpdated(const std::list<ObjectPtr>& theObjects, const Events_ID& theEvent,
210  const bool isGroupped = true) const = 0;
212  virtual void sendDeleted(const std::shared_ptr<ModelAPI_Document>& theDoc,
213  const std::string& theGroup) const = 0;
215  virtual void sendReordered(const std::shared_ptr<ModelAPI_Feature>& theReordered) const = 0;
216 
218  static const ModelAPI_EventCreator* get();
219 
221  static void set(const ModelAPI_EventCreator* theCreator);
222 };
223 
226 {
227 public:
229  MODELAPI_EXPORT ModelAPI_FeatureStateMessage(const Events_ID theID, const void* theSender = 0);
231  MODELAPI_EXPORT virtual ~ModelAPI_FeatureStateMessage();
232 
234  MODELAPI_EXPORT std::shared_ptr<ModelAPI_Feature> feature() const;
236  MODELAPI_EXPORT void setFeature(std::shared_ptr<ModelAPI_Feature>& theFeature);
237  // For response
239  MODELAPI_EXPORT bool hasState(const std::string& theFeatureId) const;
241  MODELAPI_EXPORT bool state(const std::string& theFeatureId, bool theDefault = false) const;
243  MODELAPI_EXPORT void setState(const std::string& theFeatureId, bool theValue);
245  MODELAPI_EXPORT std::list<std::string> features() const;
246 
247  private:
249  std::shared_ptr<ModelAPI_Feature> myCurrentFeature;
251  std::map<std::string, bool> myFeatureState;
252 };
253 
256 {
257  DocumentPtr myDocument;
258 
259  public:
261  MODELAPI_EXPORT ModelAPI_DocumentCreatedMessage(const Events_ID theID, const void* theSender = 0);
263  MODELAPI_EXPORT virtual ~ModelAPI_DocumentCreatedMessage();
265  MODELAPI_EXPORT static Events_ID eventId()
266  {
267  static const char * MY_DOCUMENT_CREATED_EVENT_ID("DocumentCreated");
268  return Events_Loop::eventByName(MY_DOCUMENT_CREATED_EVENT_ID);
269  }
270 
272  MODELAPI_EXPORT DocumentPtr document() const;
274  MODELAPI_EXPORT void setDocument(DocumentPtr theDocument);
275 };
276 
279 {
280  AttributePtr myAttribute;
281 
282  public:
284  MODELAPI_EXPORT static Events_ID& eventId()
285  {
286  static const char * MY_ATTRIBUTE_EVALUATION_EVENT_ID("AttributeEvaluationRequest");
287  static Events_ID anId = Events_Loop::eventByName(MY_ATTRIBUTE_EVALUATION_EVENT_ID);
288  return anId;
289  }
290 
292  MODELAPI_EXPORT static void send(AttributePtr theAttribute, const void* theSender)
293  {
294  std::shared_ptr<ModelAPI_AttributeEvalMessage> aMessage =
295  std::shared_ptr<ModelAPI_AttributeEvalMessage>(
296  new ModelAPI_AttributeEvalMessage(eventId(), theSender));
297  aMessage->setAttribute(theAttribute);
298  Events_Loop::loop()->send(aMessage);
299  }
300 
302  MODELAPI_EXPORT ModelAPI_AttributeEvalMessage(const Events_ID theID, const void* theSender = 0);
304  MODELAPI_EXPORT virtual ~ModelAPI_AttributeEvalMessage();
305 
307  MODELAPI_EXPORT AttributePtr attribute() const;
309  MODELAPI_EXPORT void setAttribute(AttributePtr theAttribute);
310 };
311 
314 {
315  FeaturePtr myParam;
316  bool myIsProcessed;
318  std::list<std::shared_ptr<ModelAPI_ResultParameter> > myParamsList;
319  double myResult;
320  std::string myError;
321 
322  public:
324  MODELAPI_EXPORT static Events_ID& eventId()
325  {
326  static const char * MY_PARAMETER_EVALUATION_EVENT_ID("ParameterEvaluationRequest");
327  static Events_ID anId = Events_Loop::eventByName(MY_PARAMETER_EVALUATION_EVENT_ID);
328  return anId;
329  }
330 
333  MODELAPI_EXPORT static std::shared_ptr<ModelAPI_ParameterEvalMessage>
334  send(FeaturePtr theParameter, const void* theSender)
335  {
336  std::shared_ptr<ModelAPI_ParameterEvalMessage> aMessage =
337  std::shared_ptr<ModelAPI_ParameterEvalMessage>(
338  new ModelAPI_ParameterEvalMessage(eventId(), theSender));
339  aMessage->setParameter(theParameter);
340  Events_Loop::loop()->send(aMessage);
341  return aMessage;
342  }
343 
345  MODELAPI_EXPORT ModelAPI_ParameterEvalMessage(const Events_ID theID, const void* theSender = 0);
347  MODELAPI_EXPORT virtual ~ModelAPI_ParameterEvalMessage();
348 
350  MODELAPI_EXPORT FeaturePtr parameter() const;
352  MODELAPI_EXPORT void setParameter(FeaturePtr theParam);
354  MODELAPI_EXPORT void setResults(
355  const std::list<std::shared_ptr<ModelAPI_ResultParameter> >& theParamsList,
356  const double theResult, const std::string& theError);
358  MODELAPI_EXPORT bool isProcessed();
360  MODELAPI_EXPORT const std::list<std::shared_ptr<ModelAPI_ResultParameter> >& params() const;
362  MODELAPI_EXPORT const double& result() const;
364  MODELAPI_EXPORT const std::string& error() const;
365 };
366 
368 {
369  std::string myFilename;
370  std::string myError;
371 
372 public:
374  MODELAPI_EXPORT static Events_ID& eventId()
375  {
376  static const char* MY_PARAMETER_EVALUATION_EVENT_ID("ImportParametersMessage");
377  static Events_ID anId = Events_Loop::eventByName(MY_PARAMETER_EVALUATION_EVENT_ID);
378  return anId;
379  }
380 
383  MODELAPI_EXPORT static std::shared_ptr<ModelAPI_ImportParametersMessage>
384  send(std::string theParameter, const void* theSender)
385  {
386  std::shared_ptr<ModelAPI_ImportParametersMessage> aMessage =
387  std::shared_ptr<ModelAPI_ImportParametersMessage>(
388  new ModelAPI_ImportParametersMessage(eventId(), theSender));
389  aMessage->setFilename(theParameter);
390  Events_Loop::loop()->send(aMessage);
391  return aMessage;
392  }
393 
395  MODELAPI_EXPORT ModelAPI_ImportParametersMessage(const Events_ID theID,
396  const void* theSender = 0);
398  MODELAPI_EXPORT virtual ~ModelAPI_ImportParametersMessage();
399 
401  MODELAPI_EXPORT std::string filename() const;
403  MODELAPI_EXPORT void setFilename(std::string theFilename);
404 };
405 
407 {
408  FeaturePtr myParam;
409  bool myIsProcessed;
410  std::string myError;
412  std::list<std::shared_ptr<ModelAPI_ResultParameter> > myParamsList;
413 
414  public:
416  MODELAPI_EXPORT static Events_ID& eventId()
417  {
418  static const char * MY_BUILD_EVALUATION_EVENT_ID("BuildEvaluationRequest");
419  static Events_ID anId = Events_Loop::eventByName(MY_BUILD_EVALUATION_EVENT_ID);
420  return anId;
421  }
422 
425  MODELAPI_EXPORT static std::shared_ptr<ModelAPI_BuildEvalMessage>
426  send(FeaturePtr theParameter, const void* theSender)
427  {
428  std::shared_ptr<ModelAPI_BuildEvalMessage> aMessage =
429  std::shared_ptr<ModelAPI_BuildEvalMessage>(
430  new ModelAPI_BuildEvalMessage(eventId(), theSender));
431  aMessage->setParameter(theParameter);
432  Events_Loop::loop()->send(aMessage);
433  return aMessage;
434  }
435 
437  MODELAPI_EXPORT ModelAPI_BuildEvalMessage(const Events_ID theID, const void* theSender = 0);
439  MODELAPI_EXPORT virtual ~ModelAPI_BuildEvalMessage();
440 
442  MODELAPI_EXPORT FeaturePtr parameter() const;
444  MODELAPI_EXPORT void setParameter(FeaturePtr theParam);
446  MODELAPI_EXPORT void setResults(
447  const std::list<std::shared_ptr<ModelAPI_ResultParameter> >& theParamsList,
448  const std::string& theError);
450  MODELAPI_EXPORT const std::list<std::shared_ptr<ModelAPI_ResultParameter> >& params() const;
452  MODELAPI_EXPORT bool isProcessed();
453 
455  MODELAPI_EXPORT const std::string& error() const;
456 };
457 
460 {
461  std::wstring myExpression;
462  std::wstring myParamName;
463  std::list<std::pair<int, int> > myPositions;
464 
465 public:
467  MODELAPI_EXPORT static Events_ID& eventId()
468  {
469  static const char * MY_COMPUTE_POSITIOND_EVENT_ID("ComputePositionsRequest");
470  static Events_ID anId = Events_Loop::eventByName(MY_COMPUTE_POSITIOND_EVENT_ID);
471  return anId;
472  }
473 
476  MODELAPI_EXPORT static std::shared_ptr<ModelAPI_ComputePositionsMessage>
477  send(const std::wstring& theExpression, const std::wstring& theParameter, const void* theSender)
478  {
479  std::shared_ptr<ModelAPI_ComputePositionsMessage> aMessage =
480  std::shared_ptr<ModelAPI_ComputePositionsMessage>(
481  new ModelAPI_ComputePositionsMessage(eventId(), theSender));
482  aMessage->set(theExpression, theParameter);
483  Events_Loop::loop()->send(aMessage);
484  return aMessage;
485  }
486 
488  MODELAPI_EXPORT ModelAPI_ComputePositionsMessage(
489  const Events_ID theID, const void* theSender = 0);
491  MODELAPI_EXPORT virtual ~ModelAPI_ComputePositionsMessage();
492 
494  MODELAPI_EXPORT const std::wstring& expression() const;
496  MODELAPI_EXPORT const std::wstring& parameter() const;
498  MODELAPI_EXPORT void set(const std::wstring& theExpression, const std::wstring& theParameter);
500  MODELAPI_EXPORT void setPositions(const std::list<std::pair<int, int> >& thePositions);
502  MODELAPI_EXPORT const std::list<std::pair<int, int> >& positions() const;
503 };
504 
507 {
508  ObjectPtr myObject;
509  std::wstring myOldName;
510  std::wstring myNewName;
511 
512  public:
514  MODELAPI_EXPORT static Events_ID& eventId()
515  {
516  static const char * MY_OBJECT_RENAMED_EVENT_ID("ObjectRenamed");
517  static Events_ID anId = Events_Loop::eventByName(MY_OBJECT_RENAMED_EVENT_ID);
518  return anId;
519  }
520 
522  MODELAPI_EXPORT static void send(ObjectPtr theObject,
523  const std::wstring& theOldName,
524  const std::wstring& theNewName,
525  const void* theSender);
526 
528  MODELAPI_EXPORT ModelAPI_ObjectRenamedMessage(const Events_ID theID, const void* theSender = 0);
530  MODELAPI_EXPORT virtual ~ModelAPI_ObjectRenamedMessage();
531 
533  MODELAPI_EXPORT ObjectPtr object() const;
535  MODELAPI_EXPORT void setObject(ObjectPtr theObject);
537  MODELAPI_EXPORT std::wstring oldName() const;
539  MODELAPI_EXPORT void setOldName(const std::wstring& theOldName);
541  MODELAPI_EXPORT std::wstring newName() const;
543  MODELAPI_EXPORT void setNewName(const std::wstring& theNewName);
544 };
545 
548 {
549  ObjectPtr myObject;
550 
551  public:
553  MODELAPI_EXPORT static Events_ID& eventId()
554  {
555  static const char * MY_EVENT_ID("ReplaceParameter");
556  static Events_ID anId = Events_Loop::eventByName(MY_EVENT_ID);
557  return anId;
558  }
559 
561  MODELAPI_EXPORT static void send(ObjectPtr theObject,
562  const void* theSender);
563 
565  MODELAPI_EXPORT
566  ModelAPI_ReplaceParameterMessage(const Events_ID theID, const void* theSender = 0);
568  MODELAPI_EXPORT virtual ~ModelAPI_ReplaceParameterMessage();
569 
571  MODELAPI_EXPORT ObjectPtr object() const;
573  MODELAPI_EXPORT void setObject(ObjectPtr theObject);
574 };
575 
578 {
579 public:
581  MODELAPI_EXPORT ModelAPI_SolverFailedMessage(const Events_ID theID, const void* theSender = 0);
583  MODELAPI_EXPORT virtual ~ModelAPI_SolverFailedMessage();
584 
586  MODELAPI_EXPORT void setObjects(const std::set<ObjectPtr>& theObjects);
588  MODELAPI_EXPORT const std::set<ObjectPtr>& objects() const;
589 
591  void dof(const int theDOF) { myDOF = theDOF; }
593  const int& dof() const { return myDOF; }
594 
595 private:
596  std::set<ObjectPtr> myObjects;
597  int myDOF;
598 };
599 
603 {
604  ObjectPtr myMovedObject;
605  AttributePtr myMovedAttribute;
606  int myMovedPointIndex;
607 
608  std::shared_ptr<GeomAPI_Pnt2d> myOriginalPosition;
609  std::shared_ptr<GeomAPI_Pnt2d> myCurrentPosition;
610 
611 public:
612  MODELAPI_EXPORT ModelAPI_ObjectMovedMessage(const void* theSender = 0);
613 
615  MODELAPI_EXPORT void setMovedObject(const ObjectPtr& theMovedObject);
619  MODELAPI_EXPORT void setMovedAttribute(const AttributePtr& theMovedAttribute,
620  const int thePointIndex = -1);
621 
623  ObjectPtr movedObject() const
624  { return myMovedObject; }
626  AttributePtr movedAttribute() const
627  { return myMovedAttribute; }
629  int movedPointIndex() const
630  { return myMovedPointIndex; }
631 
633  MODELAPI_EXPORT void setOriginalPosition(double theX, double theY);
635  MODELAPI_EXPORT void setOriginalPosition(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
637  const std::shared_ptr<GeomAPI_Pnt2d>& originalPosition() const
638  { return myOriginalPosition; }
639 
641  MODELAPI_EXPORT void setCurrentPosition(double theX, double theY);
643  MODELAPI_EXPORT void setCurrentPosition(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
645  const std::shared_ptr<GeomAPI_Pnt2d>& currentPosition() const
646  { return myCurrentPosition; }
647 };
648 
651 {
652 public:
654  MODELAPI_EXPORT ModelAPI_ShapesFailedMessage(const Events_ID theID, const void* theSender = 0);
656  MODELAPI_EXPORT virtual ~ModelAPI_ShapesFailedMessage();
658  MODELAPI_EXPORT static Events_ID eventId()
659  {
660  return Events_Loop::eventByName(EVENT_OPERATION_SHAPES_FAILED);
661  }
662 
664  MODELAPI_EXPORT void setShapes(const std::list< std::shared_ptr<GeomAPI_Shape> >& theVertices);
666  MODELAPI_EXPORT const std::list< std::shared_ptr<GeomAPI_Shape> >& shapes() const;
667 
668 private:
669  std::list< std::shared_ptr<GeomAPI_Shape> > myShapes;
670 };
671 
674 {
675 public:
677  MODELAPI_EXPORT ModelAPI_CheckConstraintsMessage(
678  const Events_ID theID, const void* theSender = 0);
680  MODELAPI_EXPORT virtual ~ModelAPI_CheckConstraintsMessage();
681 
683  MODELAPI_EXPORT const std::set<ObjectPtr>& constraints() const;
684 
686  MODELAPI_EXPORT void setConstraints(const std::set<ObjectPtr>& theConstraints);
687 
688 private:
689  std::set<ObjectPtr> myConstraints;
690 };
691 
692 
695 {
696 public:
698  MODELAPI_EXPORT
699  ModelAPI_FeaturesLicenseValidMessage(const Events_ID theID, const void* theSender = 0);
701  MODELAPI_EXPORT virtual ~ModelAPI_FeaturesLicenseValidMessage();
703  MODELAPI_EXPORT static Events_ID eventId()
704  {
705  return Events_Loop::eventByName(EVENT_FEATURE_LICENSE_VALID);
706  }
707 
709  MODELAPI_EXPORT void setFeatures(const std::set<std::string>& theFeatures);
711  MODELAPI_EXPORT const std::set<std::string>& features() const;
712 
713 private:
714  std::set<std::string> myFeatures;
715 };
716 
717 #endif
Identifier of the event kind.
Definition: Events_Message.h:36
static EVENTS_EXPORT Events_Loop * loop()
! Returns the main object of the loop, one per application.
Definition: Events_Loop.cpp:26
EVENTS_EXPORT void send(const std::shared_ptr< Events_Message > &theMessage, bool isGroup=true)
Allows to send an event.
Definition: Events_Loop.cpp:66
static EVENTS_EXPORT Events_ID eventByName(const char *theName)
Returns the unique event by the given name.
Definition: Events_Loop.cpp:33
Message that allows to group messages and send them later as a group of messages.
Definition: Events_MessageGroup.h:34
Message for communication between sender and listener of event.
Definition: Events_Message.h:65
2D point defined by two coordinates
Definition: GeomAPI_Pnt2d.h:36
Interface to the topological shape object.
Definition: GeomAPI_Shape.h:43
Message that attribute text should be evaluated in the attribute value.
Definition: ModelAPI_Events.h:279
static MODELAPI_EXPORT Events_ID & eventId()
Static. Returns EventID of the message.
Definition: ModelAPI_Events.h:284
virtual MODELAPI_EXPORT ~ModelAPI_AttributeEvalMessage()
The virtual destructor.
Definition: ModelAPI_Events.cpp:129
static MODELAPI_EXPORT void send(AttributePtr theAttribute, const void *theSender)
Useful method that creates and sends the AttributeEvalMessage event.
Definition: ModelAPI_Events.h:292
MODELAPI_EXPORT AttributePtr attribute() const
Returns a document stored in the message.
Definition: ModelAPI_Events.cpp:132
MODELAPI_EXPORT void setAttribute(AttributePtr theAttribute)
Sets an attribute to the message.
Definition: ModelAPI_Events.cpp:137
MODELAPI_EXPORT ModelAPI_AttributeEvalMessage(const Events_ID theID, const void *theSender=0)
Creates an empty message.
Definition: ModelAPI_Events.cpp:124
Definition: ModelAPI_Events.h:407
static MODELAPI_EXPORT Events_ID & eventId()
Static. Returns EventID of the message.
Definition: ModelAPI_Events.h:416
MODELAPI_EXPORT const std::list< std::shared_ptr< ModelAPI_ResultParameter > > & params() const
Returns the results of processing: list of parameters found in the expression.
Definition: ModelAPI_Events.cpp:241
static MODELAPI_EXPORT std::shared_ptr< ModelAPI_BuildEvalMessage > send(FeaturePtr theParameter, const void *theSender)
Useful method that creates and sends the event.
Definition: ModelAPI_Events.h:426
MODELAPI_EXPORT void setParameter(FeaturePtr theParam)
Sets a parameter to the message.
Definition: ModelAPI_Events.cpp:226
MODELAPI_EXPORT const std::string & error() const
Returns the interpreter error (empty if no error)
Definition: ModelAPI_Events.cpp:251
MODELAPI_EXPORT FeaturePtr parameter() const
Returns a parameter stored in the message.
Definition: ModelAPI_Events.cpp:221
MODELAPI_EXPORT ModelAPI_BuildEvalMessage(const Events_ID theID, const void *theSender=0)
Creates an empty message.
Definition: ModelAPI_Events.cpp:213
MODELAPI_EXPORT bool isProcessed()
Returns true if the expression is processed.
Definition: ModelAPI_Events.cpp:246
MODELAPI_EXPORT void setResults(const std::list< std::shared_ptr< ModelAPI_ResultParameter > > &theParamsList, const std::string &theError)
Sets the results of processing.
Definition: ModelAPI_Events.cpp:231
virtual MODELAPI_EXPORT ~ModelAPI_BuildEvalMessage()
The virtual destructor.
Definition: ModelAPI_Events.cpp:218
Message that sends the constraints to check or remove.
Definition: ModelAPI_Events.h:674
MODELAPI_EXPORT ModelAPI_CheckConstraintsMessage(const Events_ID theID, const void *theSender=0)
Creates an empty message.
Definition: ModelAPI_Events.cpp:475
MODELAPI_EXPORT const std::set< ObjectPtr > & constraints() const
Get list of constrains.
Definition: ModelAPI_Events.cpp:485
MODELAPI_EXPORT void setConstraints(const std::set< ObjectPtr > &theConstraints)
Set list of constrains.
Definition: ModelAPI_Events.cpp:490
virtual MODELAPI_EXPORT ~ModelAPI_CheckConstraintsMessage()
The virtual destructor.
Definition: ModelAPI_Events.cpp:481
Message to ask compute the positions of parameters in the expression.
Definition: ModelAPI_Events.h:460
MODELAPI_EXPORT void set(const std::wstring &theExpression, const std::wstring &theParameter)
Sets an expression and parameter needed for computation.
Definition: ModelAPI_Events.cpp:274
virtual MODELAPI_EXPORT ~ModelAPI_ComputePositionsMessage()
The virtual destructor.
Definition: ModelAPI_Events.cpp:261
static MODELAPI_EXPORT Events_ID & eventId()
Static. Returns EventID of the message.
Definition: ModelAPI_Events.h:467
static MODELAPI_EXPORT std::shared_ptr< ModelAPI_ComputePositionsMessage > send(const std::wstring &theExpression, const std::wstring &theParameter, const void *theSender)
Useful method that creates and sends the AttributeEvalMessage event Returns the message,...
Definition: ModelAPI_Events.h:477
MODELAPI_EXPORT const std::wstring & parameter() const
Returns a parameter name stored in the message.
Definition: ModelAPI_Events.cpp:269
MODELAPI_EXPORT const std::list< std::pair< int, int > > & positions() const
Returns the results of processing: position start and end indices.
Definition: ModelAPI_Events.cpp:287
MODELAPI_EXPORT ModelAPI_ComputePositionsMessage(const Events_ID theID, const void *theSender=0)
Creates an empty message.
Definition: ModelAPI_Events.cpp:256
MODELAPI_EXPORT const std::wstring & expression() const
Returns an expression stored in the message.
Definition: ModelAPI_Events.cpp:264
MODELAPI_EXPORT void setPositions(const std::list< std::pair< int, int > > &thePositions)
Sets the results of processing.
Definition: ModelAPI_Events.cpp:281
Message that document (Part, PartSet) was created.
Definition: ModelAPI_Events.h:256
MODELAPI_EXPORT DocumentPtr document() const
Returns a document stored in the message.
Definition: ModelAPI_Events.cpp:114
MODELAPI_EXPORT ModelAPI_DocumentCreatedMessage(const Events_ID theID, const void *theSender=0)
Creates an empty message.
Definition: ModelAPI_Events.cpp:106
virtual MODELAPI_EXPORT ~ModelAPI_DocumentCreatedMessage()
The virtual destructor.
Definition: ModelAPI_Events.cpp:111
static MODELAPI_EXPORT Events_ID eventId()
Static. Returns EventID of the message.
Definition: ModelAPI_Events.h:265
MODELAPI_EXPORT void setDocument(DocumentPtr theDocument)
Sets a document to the message.
Definition: ModelAPI_Events.cpp:119
Document for internal data structure of any object storage.
Definition: ModelAPI_Document.h:52
Allows to create ModelAPI messages.
Definition: ModelAPI_Events.h:201
virtual void sendDeleted(const std::shared_ptr< ModelAPI_Document > &theDoc, const std::string &theGroup) const =0
creates deleted message and sends to the loop
virtual void sendReordered(const std::shared_ptr< ModelAPI_Feature > &theReordered) const =0
creates reordered message and sends to the loop
virtual void sendUpdated(const std::list< ObjectPtr > &theObjects, const Events_ID &theEvent, const bool isGroupped=true) const =0
creates created, updated or moved messages with the objects collection and sends to the loop
virtual void sendUpdated(const ObjectPtr &theObject, const Events_ID &theEvent, const bool isGroupped=true) const =0
creates created, updated or moved messages and sends to the loop
Contains the state information about the feature: is it enabled or disabled.
Definition: ModelAPI_Events.h:226
MODELAPI_EXPORT bool hasState(const std::string &theFeatureId) const
Returns true if feature has specific state.
Definition: ModelAPI_Events.cpp:77
MODELAPI_EXPORT ModelAPI_FeatureStateMessage(const Events_ID theID, const void *theSender=0)
Creates an empty message.
Definition: ModelAPI_Events.cpp:57
MODELAPI_EXPORT bool state(const std::string &theFeatureId, bool theDefault=false) const
Returns true if feature is enabled.
Definition: ModelAPI_Events.cpp:82
MODELAPI_EXPORT std::list< std::string > features() const
Returns all feature IDs with states.
Definition: ModelAPI_Events.cpp:95
MODELAPI_EXPORT void setFeature(std::shared_ptr< ModelAPI_Feature > &theFeature)
Stores the feature this message is related to.
Definition: ModelAPI_Events.cpp:72
virtual MODELAPI_EXPORT ~ModelAPI_FeatureStateMessage()
The virtual destructor.
Definition: ModelAPI_Events.cpp:64
MODELAPI_EXPORT void setState(const std::string &theFeatureId, bool theValue)
Stores the feature state.
Definition: ModelAPI_Events.cpp:90
MODELAPI_EXPORT std::shared_ptr< ModelAPI_Feature > feature() const
Returns the feature this message is related to.
Definition: ModelAPI_Events.cpp:67
Message that sends the features which license is checked and valid.
Definition: ModelAPI_Events.h:695
MODELAPI_EXPORT void setFeatures(const std::set< std::string > &theFeatures)
Sets list of features with valid license.
Definition: ModelAPI_Events.cpp:505
MODELAPI_EXPORT const std::set< std::string > & features() const
Returns list of features with valid license.
Definition: ModelAPI_Events.cpp:510
MODELAPI_EXPORT ModelAPI_FeaturesLicenseValidMessage(const Events_ID theID, const void *theSender=0)
Creates an message.
Definition: ModelAPI_Events.cpp:497
virtual MODELAPI_EXPORT ~ModelAPI_FeaturesLicenseValidMessage()
Default destructor.
Definition: ModelAPI_Events.cpp:502
static MODELAPI_EXPORT Events_ID eventId()
Static. Returns EventID of the message.
Definition: ModelAPI_Events.h:703
Definition: ModelAPI_Events.h:368
MODELAPI_EXPORT void setFilename(std::string theFilename)
Sets a filename to the message.
Definition: ModelAPI_Events.cpp:208
virtual MODELAPI_EXPORT ~ModelAPI_ImportParametersMessage()
The virtual destructor.
Definition: ModelAPI_Events.cpp:199
MODELAPI_EXPORT std::string filename() const
Returns a filename stored in the message.
Definition: ModelAPI_Events.cpp:203
MODELAPI_EXPORT ModelAPI_ImportParametersMessage(const Events_ID theID, const void *theSender=0)
Creates an empty message.
Definition: ModelAPI_Events.cpp:192
static MODELAPI_EXPORT Events_ID & eventId()
Static. Returns EventID of the message.
Definition: ModelAPI_Events.h:374
static MODELAPI_EXPORT std::shared_ptr< ModelAPI_ImportParametersMessage > send(std::string theParameter, const void *theSender)
Useful method that creates and sends the event.
Definition: ModelAPI_Events.h:384
Message that feature was deleted (used for Object Browser update)
Definition: ModelAPI_Events.h:160
virtual const std::list< std::pair< std::shared_ptr< ModelAPI_Document >, std::string > > & groups() const =0
Returns the groups where the objects were deleted.
virtual void Join(const std::shared_ptr< Events_MessageGroup > &theJoined)=0
Appends to this message the given one.
virtual const Events_ID messageId()=0
Returns the identifier of the kind of a message.
virtual std::shared_ptr< Events_MessageGroup > newEmpty()=0
Creates the new empty message of this kind.
Message sent when feature or attribute has been moved.
Definition: ModelAPI_Events.h:603
const std::shared_ptr< GeomAPI_Pnt2d > & originalPosition() const
Return original mouse position.
Definition: ModelAPI_Events.h:637
ObjectPtr movedObject() const
Return moved object.
Definition: ModelAPI_Events.h:623
MODELAPI_EXPORT void setMovedAttribute(const AttributePtr &theMovedAttribute, const int thePointIndex=-1)
Set attribute which is being moved (if the message already contains object it will be cleared)
Definition: ModelAPI_Events.cpp:404
const std::shared_ptr< GeomAPI_Pnt2d > & currentPosition() const
Return current mouse position.
Definition: ModelAPI_Events.h:645
AttributePtr movedAttribute() const
Return moved attribute.
Definition: ModelAPI_Events.h:626
MODELAPI_EXPORT void setMovedObject(const ObjectPtr &theMovedObject)
Set object which is being moved (if the message already contains attribute it will be cleared)
Definition: ModelAPI_Events.cpp:398
int movedPointIndex() const
Return index of the moved point.
Definition: ModelAPI_Events.h:629
MODELAPI_EXPORT void setCurrentPosition(double theX, double theY)
Set current mouse position.
Definition: ModelAPI_Events.cpp:431
MODELAPI_EXPORT void setOriginalPosition(double theX, double theY)
Set original mouse position.
Definition: ModelAPI_Events.cpp:412
Message that the object is renamed.
Definition: ModelAPI_Events.h:507
MODELAPI_EXPORT void setObject(ObjectPtr theObject)
Sets an object.
Definition: ModelAPI_Events.cpp:319
MODELAPI_EXPORT void setNewName(const std::wstring &theNewName)
Sets a new name.
Definition: ModelAPI_Events.cpp:339
MODELAPI_EXPORT std::wstring newName() const
Returns a new name.
Definition: ModelAPI_Events.cpp:334
static MODELAPI_EXPORT void send(ObjectPtr theObject, const std::wstring &theOldName, const std::wstring &theNewName, const void *theSender)
Useful method that creates and sends the AttributeEvalMessage event.
Definition: ModelAPI_Events.cpp:301
MODELAPI_EXPORT std::wstring oldName() const
Returns an old name.
Definition: ModelAPI_Events.cpp:324
virtual MODELAPI_EXPORT ~ModelAPI_ObjectRenamedMessage()
The virtual destructor.
Definition: ModelAPI_Events.cpp:298
MODELAPI_EXPORT ModelAPI_ObjectRenamedMessage(const Events_ID theID, const void *theSender=0)
Creates an empty message.
Definition: ModelAPI_Events.cpp:293
MODELAPI_EXPORT void setOldName(const std::wstring &theOldName)
Sets an old name.
Definition: ModelAPI_Events.cpp:329
static MODELAPI_EXPORT Events_ID & eventId()
Static. Returns EventID of the message.
Definition: ModelAPI_Events.h:514
MODELAPI_EXPORT ObjectPtr object() const
Returns an object.
Definition: ModelAPI_Events.cpp:314
Message that feature was changed (used for Object Browser update): moved, updated and deleted.
Definition: ModelAPI_Events.h:140
virtual const std::set< ObjectPtr > & objects() const =0
Returns the feature that has been updated.
virtual void Join(const std::shared_ptr< Events_MessageGroup > &theJoined)=0
Allows to join the given message with the current one.
virtual std::shared_ptr< Events_MessageGroup > newEmpty()=0
Creates a new empty group (to store it in the loop before flush)
Message that order changed (used for Object Browser update)
Definition: ModelAPI_Events.h:184
virtual std::shared_ptr< ModelAPI_Feature > reordered()=0
Returns the document that has been updated.
virtual const Events_ID messageId()=0
Returns the identifier of the kind of a message.
Message that parameter feature expression should be evaluated: value and error producing.
Definition: ModelAPI_Events.h:314
static MODELAPI_EXPORT std::shared_ptr< ModelAPI_ParameterEvalMessage > send(FeaturePtr theParameter, const void *theSender)
Useful method that creates and sends the event.
Definition: ModelAPI_Events.h:334
MODELAPI_EXPORT const double & result() const
Returns the expression result.
Definition: ModelAPI_Events.cpp:181
virtual MODELAPI_EXPORT ~ModelAPI_ParameterEvalMessage()
The virtual destructor.
Definition: ModelAPI_Events.cpp:147
MODELAPI_EXPORT bool isProcessed()
Returns true if the expression is processed.
Definition: ModelAPI_Events.cpp:170
MODELAPI_EXPORT void setParameter(FeaturePtr theParam)
Sets a parameter to the message.
Definition: ModelAPI_Events.cpp:155
MODELAPI_EXPORT const std::list< std::shared_ptr< ModelAPI_ResultParameter > > & params() const
Returns the results of processing: list of parameters found in the expression.
Definition: ModelAPI_Events.cpp:176
MODELAPI_EXPORT FeaturePtr parameter() const
Returns a parameter stored in the message.
Definition: ModelAPI_Events.cpp:150
MODELAPI_EXPORT const std::string & error() const
Returns the interpreter error (empty if no error)
Definition: ModelAPI_Events.cpp:186
MODELAPI_EXPORT ModelAPI_ParameterEvalMessage(const Events_ID theID, const void *theSender=0)
Creates an empty message.
Definition: ModelAPI_Events.cpp:142
MODELAPI_EXPORT void setResults(const std::list< std::shared_ptr< ModelAPI_ResultParameter > > &theParamsList, const double theResult, const std::string &theError)
Sets the results of processing.
Definition: ModelAPI_Events.cpp:160
static MODELAPI_EXPORT Events_ID & eventId()
Static. Returns EventID of the message.
Definition: ModelAPI_Events.h:324
Message that the parameter should be replaced with its value.
Definition: ModelAPI_Events.h:548
virtual MODELAPI_EXPORT ~ModelAPI_ReplaceParameterMessage()
The virtual destructor.
Definition: ModelAPI_Events.cpp:349
static MODELAPI_EXPORT void send(ObjectPtr theObject, const void *theSender)
Useful method that creates and sends the AttributeEvalMessage event.
Definition: ModelAPI_Events.cpp:352
MODELAPI_EXPORT ObjectPtr object() const
Returns an object.
Definition: ModelAPI_Events.cpp:361
static MODELAPI_EXPORT Events_ID & eventId()
Static. Returns EventID of the message.
Definition: ModelAPI_Events.h:553
MODELAPI_EXPORT ModelAPI_ReplaceParameterMessage(const Events_ID theID, const void *theSender=0)
Creates an empty message.
Definition: ModelAPI_Events.cpp:344
MODELAPI_EXPORT void setObject(ObjectPtr theObject)
Sets an object.
Definition: ModelAPI_Events.cpp:366
The construction element result of a feature.
Definition: ModelAPI_ResultParameter.h:34
Message that sends the failed vertices of 1D-fillet to highlight them in 3D viewer.
Definition: ModelAPI_Events.h:651
virtual MODELAPI_EXPORT ~ModelAPI_ShapesFailedMessage()
Default destructor.
Definition: ModelAPI_Events.cpp:461
MODELAPI_EXPORT ModelAPI_ShapesFailedMessage(const Events_ID theID, const void *theSender=0)
Creates an message.
Definition: ModelAPI_Events.cpp:456
MODELAPI_EXPORT void setShapes(const std::list< std::shared_ptr< GeomAPI_Shape > > &theVertices)
Sets list of failed vertices.
Definition: ModelAPI_Events.cpp:464
MODELAPI_EXPORT const std::list< std::shared_ptr< GeomAPI_Shape > > & shapes() const
Returns list of failed vertices.
Definition: ModelAPI_Events.cpp:469
static MODELAPI_EXPORT Events_ID eventId()
Static. Returns EventID of the message.
Definition: ModelAPI_Events.h:658
Message that sends the sketch solver and sketcher GUI processes to show in the property panel.
Definition: ModelAPI_Events.h:578
MODELAPI_EXPORT const std::set< ObjectPtr > & objects() const
Returns list of conflicting constraints.
Definition: ModelAPI_Events.cpp:387
void dof(const int theDOF)
Sets degrees of freedom.
Definition: ModelAPI_Events.h:591
MODELAPI_EXPORT ModelAPI_SolverFailedMessage(const Events_ID theID, const void *theSender=0)
Creates an message.
Definition: ModelAPI_Events.cpp:373
MODELAPI_EXPORT void setObjects(const std::set< ObjectPtr > &theObjects)
Sets list of conflicting constraints.
Definition: ModelAPI_Events.cpp:382
const int & dof() const
Returns degrees of freedom.
Definition: ModelAPI_Events.h:593
virtual MODELAPI_EXPORT ~ModelAPI_SolverFailedMessage()
Default destructor.
Definition: ModelAPI_Events.cpp:379