Salome HOME
fa500e5de5bfede57dc724de4a8673c8d82d3e55
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Services.h
1 // Name   : ModelHighAPI_Services.h
2 // Purpose:
3 //
4 // History:
5 // 17/06/16 - Sergey POKHODENKO - Creation of the file
6
7 #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_SERVICES_H_
8 #define SRC_MODELHIGHAPI_MODELHIGHAPI_SERVICES_H_
9
10 //--------------------------------------------------------------------------------------
11 #include "ModelHighAPI.h"
12
13 #include <memory>
14 #include <string>
15 //--------------------------------------------------------------------------------------
16 class GeomAPI_Ax3;
17 class GeomAPI_Dir;
18 class GeomAPI_Pnt;
19 class ModelAPI_Document;
20 //--------------------------------------------------------------------------------------
21 /// Return the main document (the Partset) created or open from the Modeler.
22 MODELHIGHAPI_EXPORT
23 std::shared_ptr<ModelAPI_Document> moduleDocument();
24
25 /** Return the active document.
26  *
27  *  This document can be either the main application document (i.e. the Partset) or one of documents
28  *  referred to by the main document (a Part).
29  */
30 MODELHIGHAPI_EXPORT
31 std::shared_ptr<ModelAPI_Document> activeDocument();
32
33 /** Return one of the three planes defined by the global coordinate system.
34  *
35  *  These planes are respectively referred to by name "XOY" (Z=0), "XOZ" (Y=0) or "YOZ" (X=0).
36  */
37 MODELHIGHAPI_EXPORT
38 std::shared_ptr<GeomAPI_Ax3> defaultPlane(const std::string & theName);
39
40 /// Return name of coordinate plane ("XOY", "XOZ" or "YOZ") or empty string for other planes.
41 MODELHIGHAPI_EXPORT
42 std::string defaultPlane(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
43                          const std::shared_ptr<GeomAPI_Dir>& theNormal,
44                          const std::shared_ptr<GeomAPI_Dir>& theDirX);
45
46 /** Start a data structure transaction.
47  *
48  *  Make a control point for being able to discard or undo
49  *  all operations done during this transaction.
50  */
51 MODELHIGHAPI_EXPORT
52 void begin();
53
54 /** Commit the data structure transaction.
55  *
56  *  Make all operations done since the last control point undo-able.
57  */
58 MODELHIGHAPI_EXPORT
59 void end();
60
61 /** Commit the data structure transaction and start the new one.
62  *
63  *  Make all operations done since the last control point undo-able
64  *  and continue with the new transaction.
65  */
66 MODELHIGHAPI_EXPORT
67 void apply();
68
69 /// Roll-back the data structure to the previous control point.
70 MODELHIGHAPI_EXPORT
71 void undo();
72
73 /// Restore the data structure rolled-back by the last undo.
74 MODELHIGHAPI_EXPORT
75 void redo();
76
77 /// Reset the data structure to initial state.
78 MODELHIGHAPI_EXPORT
79 void reset();
80
81 //--------------------------------------------------------------------------------------
82 //--------------------------------------------------------------------------------------
83 #endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_SERVICES_H_ */