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