OpenLexocad  27.0
DocObjectFactory.h
Go to the documentation of this file.
1 #pragma once
2 #include <Base/Enums.h>
3 #include <Core/CoreDocument.h>
4 #include <LxIfc4/IFC4_impl/LxIfc4EntityEnums.h>
5 #include <OpenLxApp/Element.h>
6 #include <OpenLxApp/Geometry.h>
7 #include <OpenLxApp/Group.h>
11 #include <OpenLxApp/ProfileDef.h>
12 #include <OpenLxApp/SubElement.h>
13 
14 namespace App
15 {
16 class Document;
17 class Geometry;
18 class ObjectDefinition;
19 class MaterialSelect;
20 } // namespace App
21 
22 namespace Part
23 {
24 class ProfileDef;
25 }
26 
27 namespace OpenLxApp
28 {
29 class Document;
30 
38 {
39 public:
40  friend class Document;
41 
42  DocObjectFactory(std::shared_ptr<Document> aDoc);
43  DocObjectFactory(App::Document* aDoc);
45 
46  static std::vector<std::shared_ptr<Product>> aProducts(const std::vector<App::Product*> aProduct);
47  static std::shared_ptr<Product> aProduct(App::Product* aProduct);
48 
49  static std::vector<std::shared_ptr<Element>> aElements(const std::vector<App::Element*> aElem);
50  static std::shared_ptr<Element> aElement(App::Element* aElem);
51 
52  std::shared_ptr<Element> aTmpElement();
53  static std::shared_ptr<Geometry> aGeometry(App::Geometry* aGeom);
54  static std::shared_ptr<ProfileDef> aProfile(Part::ProfileDef* aProfileDef);
55  static std::shared_ptr<DocObject> aDocObject(Core::DocObject* aObj);
56  static std::shared_ptr<ObjectDefinition> aObjectDefinition(App::ObjectDefinition* aObj);
57  static std::shared_ptr<Object> aObject(App::Object* aObj);
58  static std::shared_ptr<Root> aRoot(App::Root* aObj);
59  static std::shared_ptr<MaterialSelect> aMaterialSelect(App::MaterialSelect* aMatSel);
60 
61  template <typename OpenLxClass>
62  std::shared_ptr<OpenLxClass> aObject()
63  {
64  return OpenLxClass::createIn(_doc);
65  }
66 
67  template <typename OpenLxClass>
68  static std::shared_ptr<OpenLxClass> aObject(std::shared_ptr<Document> aDoc)
69  {
70  return OpenLxClass::createIn(aDoc);
71  }
72 
73  static LxIfc4::LxIfc4EntityEnum getEntityTypeFromTypeName(const std::string& aType);
74 
75 
76 private:
77  DocObjectFactory() {}
78  static std::shared_ptr<Product> _createProduct(LxIfc4::LxIfc4EntityEnum aType, App::Product* aProduct, std::shared_ptr<Document> aDoc);
79 
80  std::shared_ptr<Document> _doc;
81  Core::CoreDocument* _coredoc = nullptr;
82 };
83 
84 
85 
86 } // namespace OpenLxApp
Definition: CoreDocument.h:197
Document holding all persistent DocObjects.
Definition: Document.h:62
DocObjectFactory to create DocObjects.
Definition: DocObjectFactory.h:37
#define OPENLXAPP_EXPORT
Definition: OpenLxApp_defines.h:12
Definition: ActiveScript.h:9
static std::shared_ptr< OpenLxClass > aObject(std::shared_ptr< Document > aDoc)
Definition: DocObjectFactory.h:68
std::shared_ptr< OpenLxClass > aObject()
Definition: DocObjectFactory.h:62
Definition: DocObject.h:28