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