]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelAPI/ModelAPI_Events.h
Salome HOME
Meet coding style (fix lines longer than 100)
[modules/shaper.git] / src / ModelAPI / ModelAPI_Events.h
1 // Copyright (C) 2014-2020  CEA/DEN, EDF R&D
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;
37 class ModelAPI_ResultParameter;
38 class GeomAPI_Pnt2d;
39
40 #if defined __GNUC__ || defined __clang__
41 #define MAYBE_UNUSED __attribute__((unused))
42 #else
43 #define MAYBE_UNUSED
44 #endif
45
46 /// Event ID that feature is created (comes with ModelAPI_ObjectUpdatedMessage)
47 MAYBE_UNUSED static const char * EVENT_OBJECT_CREATED = "ObjectCreated";
48 /// Event ID that data of feature is updated (comes with Model_ObjectUpdatedMessage)
49 MAYBE_UNUSED static const char * EVENT_OBJECT_UPDATED = "ObjectUpdated";
50 /// Event ID that data of feature is deleted (comes with Model_ObjectDeletedMessage)
51 MAYBE_UNUSED static const char * EVENT_OBJECT_DELETED = "ObjectDeleted";
52 /// Event ID that name of feature is changed (comes with Model_ObjectRenamedMessage)
53 MAYBE_UNUSED static const char * EVENT_OBJECT_RENAMED = "ObjectRenamed";
54 /// Event ID that data of feature is updated (comes with ModelAPI_ObjectUpdatedMessage)
55 MAYBE_UNUSED static const char * EVENT_OBJECT_MOVED = "ObjectsMoved";
56 /// Event ID that visualization must be redisplayed (comes with ModelAPI_ObjectUpdatedMessage)
57 MAYBE_UNUSED static const char * EVENT_OBJECT_TO_REDISPLAY = "ObjectsToRedisplay";
58 /// Event ID that plugin is loaded (comes with ModelAPI_ObjectUpdatedMessage)
59 MAYBE_UNUSED static const char * EVENT_PLUGIN_LOADED = "PluginLoaded";
60 /// The active document becomes another one
61 MAYBE_UNUSED static const char * EVENT_DOCUMENT_CHANGED = "CurrentDocumentChanged";
62
63 /// Event ID that order of objects in group is changed,
64 /// so, tree must be fully recreated (movement of feature)
65 MAYBE_UNUSED static const char * EVENT_ORDER_UPDATED = "OrderUpdated";
66 /// Event ID that the sketch is prepared and all grouped messages for the solver may be flushed
67 MAYBE_UNUSED static const char * EVENT_UPDATE_SELECTION = "UpdateSelection";
68
69 /// Request for the enabled/disabled actions behavior for some specific features
70 MAYBE_UNUSED static const char * EVENT_FEATURE_STATE_REQUEST = "FeatureStateRequest";
71 /// Reply for the enabled/disabled actions behavior for some specific features
72 MAYBE_UNUSED static const char * EVENT_FEATURE_STATE_RESPONSE = "FeatureStateResponse";
73
74 /// To block the viewer updates
75 MAYBE_UNUSED static const char * EVENT_UPDATE_VIEWER_BLOCKED = "UpdateViewerBlocked";
76 /// To unblock the viewer updates
77 MAYBE_UNUSED static const char * EVENT_UPDATE_VIEWER_UNBLOCKED = "UpdateViewerUnblocked";
78
79 /// To inform that there is an empty presentation in the viewer
80 MAYBE_UNUSED static const char * EVENT_EMPTY_AIS_PRESENTATION = "EmptyAISPresentation";
81 /// To inform that there is an empty operation for presentation in the viewer
82 MAYBE_UNUSED static const char * EVENT_EMPTY_OPERATION_PRESENTATION = "EmptyOperationPresentation";
83 /// To block preview
84 MAYBE_UNUSED static const char * EVENT_PREVIEW_BLOCKED = "PreviewBlocked";
85 /// To preview the current feature in the viewer (to compute the result)
86 MAYBE_UNUSED static const char * EVENT_PREVIEW_REQUESTED = "PreviewRequested";
87 /// To block automatic recomputation of any feature (by the GUI button press)
88 MAYBE_UNUSED static const char * EVENT_AUTOMATIC_RECOMPUTATION_DISABLE
89                                                          = "DisableAutomaticRecomputation";
90 /// To unblock block automatic recomputation (default state: the GUI button unpressed)
91 MAYBE_UNUSED static const char * EVENT_AUTOMATIC_RECOMPUTATION_ENABLE
92                                                          = "EnableAutomaticRecomputation";
93
94 /// Event ID that solver has conflicting constraints (comes with ModelAPI_SolverFailedMessage)
95 MAYBE_UNUSED static const char * EVENT_SOLVER_FAILED = "SolverFailed";
96 /// Event ID that the problem in solver disappeared
97 MAYBE_UNUSED static const char * EVENT_SOLVER_REPAIRED = "SolverRepaired";
98
99 /// Event Id that sketch has DoF = 0
100 MAYBE_UNUSED static const char * EVENT_SKETCH_FULLY_CONSTRAINED = "SketchFullyConstrainted";
101 /// Event Id that sketch has DoF > 0
102 MAYBE_UNUSED static const char * EVENT_SKETCH_UNDER_CONSTRAINED = "SketchUnderConstrainted";
103 /// Event Id that sketch has DoF < 0
104 MAYBE_UNUSED static const char * EVENT_SKETCH_OVER_CONSTRAINED  = "SketchOverConstrainted";
105
106 /// Event ID that informs that some object has changed the stability
107 MAYBE_UNUSED static const char * EVENT_STABILITY_CHANGED = "StabilityChanged";
108
109 /// Event ID that the sketch is prepared and all grouped messages for the solver may be flushed
110 MAYBE_UNUSED static const char * EVENT_SKETCH_PREPARED = "SketchPrepared";
111
112 /// Event ID that provides a request for list of non-fixed objects necessary for DoF = 0
113 MAYBE_UNUSED static const char * EVENT_GET_DOF_OBJECTS = "GetDoFObjects";
114
115 /// Event ID that provides a request for list of non-fixed objects necessary for DoF = 0
116 MAYBE_UNUSED static const char * EVENT_DOF_OBJECTS = "DoFObjects";
117
118 /// Event ID that requests updates visual attributes for presentations
119 MAYBE_UNUSED static const char * EVENT_VISUAL_ATTRIBUTES = "UpdateVisualAttributes";
120
121
122 /// Message that feature was changed (used for Object Browser update): moved, updated and deleted
123 class MODELAPI_EXPORT ModelAPI_ObjectUpdatedMessage : public Events_MessageGroup
124 {
125  protected:
126   /// Creates an empty message
127   ModelAPI_ObjectUpdatedMessage(const Events_ID theID, const void* theSender = 0);
128   /// The virtual destructor
129   virtual ~ModelAPI_ObjectUpdatedMessage();
130
131  public:
132   /// Returns the feature that has been updated
133   virtual const std::set<ObjectPtr>& objects() const = 0;
134
135   //! Creates a new empty group (to store it in the loop before flush)
136   virtual std::shared_ptr<Events_MessageGroup> newEmpty() = 0;
137
138   //! Allows to join the given message with the current one
139   virtual void Join(const std::shared_ptr<Events_MessageGroup>& theJoined) = 0;
140 };
141
142 /// Message that feature was deleted (used for Object Browser update)
143 class MODELAPI_EXPORT ModelAPI_ObjectDeletedMessage : public Events_MessageGroup
144 {
145 protected:
146   /// Creates an empty message
147   ModelAPI_ObjectDeletedMessage(const Events_ID theID, const void* theSender = 0);
148   /// The virtual destructor
149   virtual ~ModelAPI_ObjectDeletedMessage();
150
151 public:
152   /// Returns the groups where the objects were deleted
153   virtual const std::list<std::pair<std::shared_ptr<ModelAPI_Document>, std::string> >&
154     groups() const = 0;
155
156   /// Creates the new empty message of this kind
157   virtual std::shared_ptr<Events_MessageGroup> newEmpty() = 0;
158
159   /// Returns the identifier of the kind of a message
160   virtual const Events_ID messageId() = 0;
161
162   /// Appends to this message the given one.
163   virtual void Join(const std::shared_ptr<Events_MessageGroup>& theJoined) = 0;
164 };
165
166 /// Message that order changed (used for Object Browser update)
167 class MODELAPI_EXPORT ModelAPI_OrderUpdatedMessage : public Events_Message
168 {
169 protected:
170   /// Creates a message:
171   ModelAPI_OrderUpdatedMessage(const Events_ID theID, const void* theSender = 0);
172   /// The virtual destructor
173   virtual ~ModelAPI_OrderUpdatedMessage();
174
175 public:
176   /// Returns the document that has been updated
177   virtual std::shared_ptr<ModelAPI_Feature> reordered() = 0;
178
179   /// Returns the identifier of the kind of a message
180   virtual const Events_ID messageId() = 0;
181 };
182
183 /// Allows to create ModelAPI messages
184 class MODELAPI_EXPORT ModelAPI_EventCreator
185 {
186 public:
187   virtual ~ModelAPI_EventCreator() {}
188
189   /// creates created, updated or moved messages and sends to the loop
190   virtual void sendUpdated(const ObjectPtr& theObject, const Events_ID& theEvent,
191                            const bool isGroupped = true) const = 0;
192   /// creates created, updated or moved messages with the objects collection and sends to the loop
193   virtual void sendUpdated(const std::list<ObjectPtr>& theObjects, const Events_ID& theEvent,
194     const bool isGroupped = true) const = 0;
195   /// creates deleted message and sends to the loop
196   virtual void sendDeleted(const std::shared_ptr<ModelAPI_Document>& theDoc,
197                            const std::string& theGroup) const = 0;
198   /// creates reordered message and sends to the loop
199   virtual void sendReordered(const std::shared_ptr<ModelAPI_Feature>& theReordered) const = 0;
200
201   /// returns the creator instance
202   static const ModelAPI_EventCreator* get();
203
204   /// sets the creator instance
205   static void set(const ModelAPI_EventCreator* theCreator);
206 };
207
208 /// Contains the state information about the feature: is it enabled or disabled.
209 class ModelAPI_FeatureStateMessage : public Events_Message
210 {
211 public:
212   /// Creates an empty message
213   MODELAPI_EXPORT ModelAPI_FeatureStateMessage(const Events_ID theID, const void* theSender = 0);
214   /// The virtual destructor
215   MODELAPI_EXPORT virtual ~ModelAPI_FeatureStateMessage();
216
217   /// Returns the feature this message is related to
218   MODELAPI_EXPORT std::shared_ptr<ModelAPI_Feature> feature() const;
219   /// Stores the feature this message is related to
220   MODELAPI_EXPORT void setFeature(std::shared_ptr<ModelAPI_Feature>& theFeature);
221   // For response
222   /// Returns true if feature has specific state
223   MODELAPI_EXPORT bool hasState(const std::string& theFeatureId) const;
224   /// Returns true if feature is enabled
225   MODELAPI_EXPORT bool state(const  std::string& theFeatureId, bool theDefault = false) const;
226   /// Stores the feature state
227   MODELAPI_EXPORT void setState(const std::string& theFeatureId, bool theValue);
228   /// Returns all feature IDs with states
229   MODELAPI_EXPORT std::list<std::string> features() const;
230
231  private:
232   /// For Request
233   std::shared_ptr<ModelAPI_Feature> myCurrentFeature;
234   /// For response
235   std::map<std::string, bool> myFeatureState;
236 };
237
238 /// Message that document (Part, PartSet) was created
239 class ModelAPI_DocumentCreatedMessage : public Events_Message
240 {
241   DocumentPtr myDocument;
242
243  public:
244   /// Creates an empty message
245   MODELAPI_EXPORT ModelAPI_DocumentCreatedMessage(const Events_ID theID, const void* theSender = 0);
246   /// The virtual destructor
247   MODELAPI_EXPORT virtual ~ModelAPI_DocumentCreatedMessage();
248   /// Static. Returns EventID of the message.
249   MODELAPI_EXPORT static Events_ID eventId()
250   {
251     static const char * MY_DOCUMENT_CREATED_EVENT_ID("DocumentCreated");
252     return Events_Loop::eventByName(MY_DOCUMENT_CREATED_EVENT_ID);
253   }
254
255   /// Returns a document stored in the message
256   MODELAPI_EXPORT DocumentPtr document() const;
257   /// Sets a document to the message
258   MODELAPI_EXPORT void setDocument(DocumentPtr theDocument);
259 };
260
261 /// Message that attribute text should be evaluated in the attribute value
262 class ModelAPI_AttributeEvalMessage : public Events_Message
263 {
264   AttributePtr myAttribute;
265
266  public:
267   /// Static. Returns EventID of the message.
268   MODELAPI_EXPORT static Events_ID& eventId()
269   {
270     static const char * MY_ATTRIBUTE_EVALUATION_EVENT_ID("AttributeEvaluationRequest");
271     static Events_ID anId = Events_Loop::eventByName(MY_ATTRIBUTE_EVALUATION_EVENT_ID);
272     return anId;
273   }
274
275   /// Useful method that creates and sends the AttributeEvalMessage event
276   MODELAPI_EXPORT static void send(AttributePtr theAttribute, const void* theSender)
277   {
278     std::shared_ptr<ModelAPI_AttributeEvalMessage> aMessage =
279       std::shared_ptr<ModelAPI_AttributeEvalMessage>(
280       new ModelAPI_AttributeEvalMessage(eventId(), theSender));
281     aMessage->setAttribute(theAttribute);
282     Events_Loop::loop()->send(aMessage);
283   }
284
285   /// Creates an empty message
286   MODELAPI_EXPORT ModelAPI_AttributeEvalMessage(const Events_ID theID, const void* theSender = 0);
287   /// The virtual destructor
288   MODELAPI_EXPORT virtual ~ModelAPI_AttributeEvalMessage();
289
290   /// Returns a document stored in the message
291   MODELAPI_EXPORT AttributePtr attribute() const;
292   /// Sets an attribute to the message
293   MODELAPI_EXPORT void setAttribute(AttributePtr theAttribute);
294 };
295
296 /// Message that parameter feature expression should be evaluated: value and error producing
297 class ModelAPI_ParameterEvalMessage : public Events_Message
298 {
299   FeaturePtr myParam; ///< parameters that should be evaluated
300   bool myIsProcessed; ///< true if results were set
301   /// result of processing, list of parameters in expression found
302   std::list<std::shared_ptr<ModelAPI_ResultParameter> > myParamsList;
303   double myResult; ///< result of processing, the computed value of the expression
304   std::string myError; ///< error of processing, empty if there is no error
305
306  public:
307   /// Static. Returns EventID of the message.
308   MODELAPI_EXPORT static Events_ID& eventId()
309   {
310     static const char * MY_PARAMETER_EVALUATION_EVENT_ID("ParameterEvaluationRequest");
311     static Events_ID anId = Events_Loop::eventByName(MY_PARAMETER_EVALUATION_EVENT_ID);
312     return anId;
313   }
314
315   /// Useful method that creates and sends the event.
316   /// Returns the message, processed, with the resulting fields filled.
317   MODELAPI_EXPORT static std::shared_ptr<ModelAPI_ParameterEvalMessage>
318     send(FeaturePtr theParameter, const void* theSender)
319   {
320     std::shared_ptr<ModelAPI_ParameterEvalMessage> aMessage =
321       std::shared_ptr<ModelAPI_ParameterEvalMessage>(
322       new ModelAPI_ParameterEvalMessage(eventId(), theSender));
323     aMessage->setParameter(theParameter);
324     Events_Loop::loop()->send(aMessage);
325     return aMessage;
326   }
327
328   /// Creates an empty message
329   MODELAPI_EXPORT ModelAPI_ParameterEvalMessage(const Events_ID theID, const void* theSender = 0);
330   /// The virtual destructor
331   MODELAPI_EXPORT virtual ~ModelAPI_ParameterEvalMessage();
332
333   /// Returns a parameter stored in the message
334   MODELAPI_EXPORT FeaturePtr parameter() const;
335   /// Sets a parameter to the message
336   MODELAPI_EXPORT void setParameter(FeaturePtr theParam);
337   /// Sets the results of processing
338   MODELAPI_EXPORT void setResults(
339     const std::list<std::shared_ptr<ModelAPI_ResultParameter> >& theParamsList,
340     const double theResult, const std::string& theError);
341   /// Returns true if the expression is processed
342   MODELAPI_EXPORT bool isProcessed();
343   /// Returns the results of processing: list of parameters found in the expression
344   MODELAPI_EXPORT const std::list<std::shared_ptr<ModelAPI_ResultParameter> >& params() const;
345   /// Returns the expression result
346   MODELAPI_EXPORT const double& result() const;
347   /// Returns the interpreter error (empty if no error)
348   MODELAPI_EXPORT const std::string& error() const;
349 };
350
351
352 /// Message to ask compute the positions of parameters in the expression
353 class ModelAPI_ComputePositionsMessage : public Events_Message
354 {
355   std::string myExpression; ///< the expression string
356   std::string myParamName; ///< name of the parameter to be searched
357   std::list<std::pair<int, int> > myPositions; ///< computation result: start-end position indices
358
359 public:
360   /// Static. Returns EventID of the message.
361   MODELAPI_EXPORT static Events_ID& eventId()
362   {
363     static const char * MY_COMPUTE_POSITIOND_EVENT_ID("ComputePositionsRequest");
364     static Events_ID anId = Events_Loop::eventByName(MY_COMPUTE_POSITIOND_EVENT_ID);
365     return anId;
366   }
367
368   /// Useful method that creates and sends the AttributeEvalMessage event
369   /// Returns the message, processed, with the resulting fields filled
370   MODELAPI_EXPORT static std::shared_ptr<ModelAPI_ComputePositionsMessage>
371     send(const std::string& theExpression, const std::string& theParameter, const void* theSender)
372   {
373     std::shared_ptr<ModelAPI_ComputePositionsMessage> aMessage =
374       std::shared_ptr<ModelAPI_ComputePositionsMessage>(
375       new ModelAPI_ComputePositionsMessage(eventId(), theSender));
376     aMessage->set(theExpression, theParameter);
377     Events_Loop::loop()->send(aMessage);
378     return aMessage;
379   }
380
381   /// Creates an empty message
382   MODELAPI_EXPORT ModelAPI_ComputePositionsMessage(
383     const Events_ID theID, const void* theSender = 0);
384   /// The virtual destructor
385   MODELAPI_EXPORT virtual ~ModelAPI_ComputePositionsMessage();
386
387   /// Returns an expression stored in the message
388   MODELAPI_EXPORT const std::string& expression() const;
389   /// Returns a parameter name stored in the message
390   MODELAPI_EXPORT const std::string& parameter() const;
391   /// Sets an expression and parameter needed for computation
392   MODELAPI_EXPORT void set(const std::string& theExpression, const std::string& theParameter);
393   /// Sets the results of processing
394   MODELAPI_EXPORT void setPositions(const std::list<std::pair<int, int> >& thePositions);
395   /// Returns the results of processing: position start and end indices
396   MODELAPI_EXPORT const std::list<std::pair<int, int> >& positions() const;
397 };
398
399 /// Message that the object is renamed
400 class ModelAPI_ObjectRenamedMessage : public Events_Message
401 {
402   ObjectPtr myObject;
403   std::string myOldName;
404   std::string myNewName;
405
406  public:
407   /// Static. Returns EventID of the message.
408   MODELAPI_EXPORT static Events_ID& eventId()
409   {
410     static const char * MY_OBJECT_RENAMED_EVENT_ID("ObjectRenamed");
411     static Events_ID anId = Events_Loop::eventByName(MY_OBJECT_RENAMED_EVENT_ID);
412     return anId;
413   }
414
415   /// Useful method that creates and sends the AttributeEvalMessage event
416   MODELAPI_EXPORT static void send(ObjectPtr theObject,
417                                    const std::string& theOldName,
418                                    const std::string& theNewName,
419                                    const void* theSender);
420
421   /// Creates an empty message
422   MODELAPI_EXPORT ModelAPI_ObjectRenamedMessage(const Events_ID theID, const void* theSender = 0);
423   /// The virtual destructor
424   MODELAPI_EXPORT virtual ~ModelAPI_ObjectRenamedMessage();
425
426   /// Returns an object
427   MODELAPI_EXPORT ObjectPtr object() const;
428   /// Sets an object
429   MODELAPI_EXPORT void setObject(ObjectPtr theObject);
430   /// Returns an old name
431   MODELAPI_EXPORT std::string oldName() const;
432   /// Sets an old name
433   MODELAPI_EXPORT void setOldName(const std::string& theOldName);
434   /// Returns a new name
435   MODELAPI_EXPORT std::string newName() const;
436   /// Sets a new name
437   MODELAPI_EXPORT void setNewName(const std::string& theNewName);
438 };
439
440 /// Message that the parameter should be replaced with its value
441 class ModelAPI_ReplaceParameterMessage : public Events_Message
442 {
443   ObjectPtr myObject;
444
445  public:
446   /// Static. Returns EventID of the message.
447   MODELAPI_EXPORT static Events_ID& eventId()
448   {
449     static const char * MY_EVENT_ID("ReplaceParameter");
450     static Events_ID anId = Events_Loop::eventByName(MY_EVENT_ID);
451     return anId;
452   }
453
454   /// Useful method that creates and sends the AttributeEvalMessage event
455   MODELAPI_EXPORT static void send(ObjectPtr theObject,
456                                    const void* theSender);
457
458   /// Creates an empty message
459   MODELAPI_EXPORT
460     ModelAPI_ReplaceParameterMessage(const Events_ID theID, const void* theSender = 0);
461   /// The virtual destructor
462   MODELAPI_EXPORT virtual ~ModelAPI_ReplaceParameterMessage();
463
464   /// Returns an object
465   MODELAPI_EXPORT ObjectPtr object() const;
466   /// Sets an object
467   MODELAPI_EXPORT void setObject(ObjectPtr theObject);
468 };
469
470 /// Message that sends the sketch solver and sketcher GUI processes to show in the property panel
471 class ModelAPI_SolverFailedMessage : public Events_Message
472 {
473 public:
474   /// Creates an message
475   MODELAPI_EXPORT ModelAPI_SolverFailedMessage(const Events_ID theID, const void* theSender = 0);
476   /// Default destructor
477   MODELAPI_EXPORT virtual ~ModelAPI_SolverFailedMessage();
478
479   /// Sets list of conflicting constraints
480   MODELAPI_EXPORT void setObjects(const std::set<ObjectPtr>& theObjects);
481   /// Returns list of conflicting constraints
482   MODELAPI_EXPORT const std::set<ObjectPtr>& objects() const;
483
484   /// Sets degrees of freedom
485   void dof(const int theDOF) { myDOF = theDOF; }
486   /// Returns degrees of freedom
487   const int& dof() const { return myDOF; }
488
489 private:
490   std::set<ObjectPtr> myObjects;
491   int myDOF;
492 };
493
494 /// Message sent when feature or attribute has been moved.
495 /// Stores the moving object/attribute, original and new positions of mouse.
496 class ModelAPI_ObjectMovedMessage : public Events_Message
497 {
498   ObjectPtr myMovedObject;
499   AttributePtr myMovedAttribute;
500   int myMovedPointIndex;
501
502   std::shared_ptr<GeomAPI_Pnt2d> myOriginalPosition;
503   std::shared_ptr<GeomAPI_Pnt2d> myCurrentPosition;
504
505 public:
506   MODELAPI_EXPORT ModelAPI_ObjectMovedMessage(const void* theSender = 0);
507
508   /// Set object which is being moved (if the message already contains attribute it will be cleared)
509   MODELAPI_EXPORT void setMovedObject(const ObjectPtr& theMovedObject);
510   /// Set attribute which is being moved (if the message already contains object it will be cleared)
511   /// \param[in] theMovedAttribute moved attribute
512   /// \param[in] thePointIndex     index of the point if the moved attribute is an array of points
513   MODELAPI_EXPORT void setMovedAttribute(const AttributePtr& theMovedAttribute,
514                                          const int thePointIndex = -1);
515
516   /// Return moved object
517   ObjectPtr movedObject() const
518   { return myMovedObject; }
519   /// Return moved attribute
520   AttributePtr movedAttribute() const
521   { return myMovedAttribute; }
522   /// Return index of the moved point
523   int movedPointIndex() const
524   { return myMovedPointIndex; }
525
526   /// Set original mouse position
527   MODELAPI_EXPORT void setOriginalPosition(double theX, double theY);
528   /// Set original mouse position
529   MODELAPI_EXPORT void setOriginalPosition(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
530   /// Return original mouse position
531   const std::shared_ptr<GeomAPI_Pnt2d>& originalPosition() const
532   { return myOriginalPosition; }
533
534   /// Set current mouse position
535   MODELAPI_EXPORT void setCurrentPosition(double theX, double theY);
536   /// Set current mouse position
537   MODELAPI_EXPORT void setCurrentPosition(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
538   /// Return current mouse position
539   const std::shared_ptr<GeomAPI_Pnt2d>& currentPosition() const
540   { return myCurrentPosition; }
541 };
542
543 #endif