Salome HOME
52d5cc3e93664e2460c9c506175323fe31e60e65
[modules/shaper.git] / src / InitializationPlugin / InitializationPlugin_Plugin.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 #ifndef INITIALIZATIONPLUGIN_PLUGIN_H_
4 #define INITIALIZATIONPLUGIN_PLUGIN_H_
5
6 #include <InitializationPlugin.h>
7 #include <ModelAPI_Feature.h>
8
9 #include <Events_Loop.h>
10
11 class InitializationPlugin_EvalListener;
12
13 /**\class InitializationPlugin_Plugin
14  * \ingroup Plugins
15  * This class is represents a plugin.
16  * It's aim is to fulfill the newly created documents with the "origin"
17  * construction point (0,0,0) and base planes (x0y, z0y, x0z)
18  */
19 class InitializationPlugin_Plugin : public Events_Listener
20 {
21  public:
22   /// Creates plug-in and registers it in the Event Loop
23   INITIALIZATIONPLUGIN_EXPORT InitializationPlugin_Plugin();
24   /// Destructs the plugin
25   INITIALIZATIONPLUGIN_EXPORT virtual ~InitializationPlugin_Plugin() {}
26   /// Process the ModelAPI_DocumentCreatedMessage to fulfill a document
27   /// from the message with origin and planes
28   INITIALIZATIONPLUGIN_EXPORT virtual void processEvent(
29     const std::shared_ptr<Events_Message>& theMessage);
30
31  protected:
32   /// Creates a plane by given parameters A, B, C
33   /// \param theDoc - document to contain a "plane" feature
34   /// \param theX - determines if X is 0 or not
35   /// \param theY - determines if Y is 0 or not
36   /// \param theZ - determines if Z is 0 or not
37   FeaturePtr createPlane(DocumentPtr theDoc, double theX, double theY, double theZ);
38   /// Creates the origin point in (0,0,0)
39   /// \param theDoc - document to contain a "point" feature
40   /// \param theName - name of the point
41   /// \param theX - X coordinate
42   /// \param theY - Y coordinate
43   /// \param theZ - Z coordinate
44   FeaturePtr createPoint(DocumentPtr theDoc, const std::string& theName,
45                          double theX, double theY, double theZ);
46
47   /// Creates an axis which is started from origin point
48   /// \param theDoc - document to contain an "axis" feature
49   /// \param theOrigin - origin point feature
50   /// \param theX - X of direction point
51   /// \param theY - Y of direction point
52   /// \param theZ - Z of direction point
53   FeaturePtr createAxis(DocumentPtr theDoc, FeaturePtr theOrigin,
54                         double theX, double theY, double theZ);
55
56  private:
57   std::shared_ptr<InitializationPlugin_EvalListener> myEvalListener;
58 };
59
60 #endif
61