Salome HOME
Update copyrights
[modules/shaper.git] / src / InitializationPlugin / InitializationPlugin_Plugin.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 INITIALIZATIONPLUGIN_PLUGIN_H_
21 #define INITIALIZATIONPLUGIN_PLUGIN_H_
22
23 #include <InitializationPlugin.h>
24 #include <ModelAPI_Feature.h>
25
26 #include <Events_Loop.h>
27
28 class InitializationPlugin_EvalListener;
29
30 /**\class InitializationPlugin_Plugin
31  * \ingroup Plugins
32  * This class is represents a plugin.
33  * It's aim is to fulfill the newly created documents with the "origin"
34  * construction point (0,0,0) and base planes (x0y, z0y, x0z)
35  */
36 class InitializationPlugin_Plugin : public Events_Listener
37 {
38  public:
39   /// Creates plug-in and registers it in the Event Loop
40   INITIALIZATIONPLUGIN_EXPORT InitializationPlugin_Plugin();
41   /// Destructs the plugin
42   INITIALIZATIONPLUGIN_EXPORT virtual ~InitializationPlugin_Plugin() {}
43   /// Process the ModelAPI_DocumentCreatedMessage to fulfill a document
44   /// from the message with origin and planes
45   INITIALIZATIONPLUGIN_EXPORT virtual void processEvent(
46     const std::shared_ptr<Events_Message>& theMessage);
47
48  protected:
49   /// Creates a plane by given parameters A, B, C
50   /// \param theDoc - document to contain a "plane" feature
51   /// \param theX - determines if X is 0 or not
52   /// \param theY - determines if Y is 0 or not
53   /// \param theZ - determines if Z is 0 or not
54   FeaturePtr createPlane(DocumentPtr theDoc, double theX, double theY, double theZ);
55   /// Creates the origin point in (0,0,0)
56   /// \param theDoc - document to contain a "point" feature
57   /// \param theName - name of the point
58   /// \param theX - X coordinate
59   /// \param theY - Y coordinate
60   /// \param theZ - Z coordinate
61   FeaturePtr createPoint(DocumentPtr theDoc, const std::string& theName,
62                          double theX, double theY, double theZ);
63
64   /// Creates an axis which is started from origin point
65   /// \param theDoc - document to contain an "axis" feature
66   /// \param theOrigin - origin point feature
67   /// \param theX - X of direction point
68   /// \param theY - Y of direction point
69   /// \param theZ - Z of direction point
70   FeaturePtr createAxis(DocumentPtr theDoc, FeaturePtr theOrigin,
71                         double theX, double theY, double theZ);
72
73  private:
74   std::shared_ptr<InitializationPlugin_EvalListener> myEvalListener;
75 };
76
77 #endif
78