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