OpenLexocad  28.0
DocObjectFactory.h
Go to the documentation of this file.
1 #pragma once
2 #include <LxIfc4/IFC4_impl/LxIfc4EntityEnums.h>
3 #include <OpenLxApp/Element.h>
4 #include <OpenLxApp/Geometry.h>
5 #include <OpenLxApp/Group.h>
8 #include <OpenLxApp/Process.h>
9 #include <OpenLxApp/ProfileDef.h>
10 #include <OpenLxApp/SubElement.h>
11 #include <OpenLxApp/Task.h>
12 
13 
14 namespace App
15 {
16 class Document;
17 class Geometry;
18 class Element;
19 class ObjectDefinition;
20 class MaterialSelect;
21 } // namespace App
22 
23 namespace boost
24 {
25  template <class T, class H, class P, class A> class unordered_set;
26 }
27 
28 namespace Part
29 {
30 class ProfileDef;
31 }
32 
33 namespace OpenLxApp
34 {
35 class Document;
36 
43 class LX_OPENLXAPP_EXPORT DocObjectFactory
44 {
45 public:
46  friend class Document;
47 
48  DocObjectFactory(std::shared_ptr<Document> aDoc);
49  DocObjectFactory(App::Document* aDoc);
51 
52  static std::vector<std::shared_ptr<Product>> aProducts(const std::vector<App::Product*> aProduct);
53  static std::shared_ptr<Product> aProduct(App::Product* aProduct);
54 
55  static std::vector<std::shared_ptr<Element>> aElements(const std::vector<App::Element*> aElem);
56  static std::vector<std::shared_ptr<Element>> aElements(std::unordered_set<App::Element*> aElems);
57  static std::shared_ptr<Element> aElement(App::Element* aElem);
58 
59  std::shared_ptr<Element> aTmpElement();
60  static std::shared_ptr<Geometry> aGeometry(App::Geometry* aGeom);
61  static std::shared_ptr<ProfileDef> aProfile(Part::ProfileDef* aProfileDef);
62  static std::shared_ptr<DocObject> aDocObject(Core::DocObject* aObj);
63  static std::shared_ptr<ObjectDefinition> aObjectDefinition(App::ObjectDefinition* aObj);
64  static std::shared_ptr<Object> aObject(App::Object* aObj);
65  static std::shared_ptr<Process> aProcess(App::Process* aProcess);
66  static std::shared_ptr<Root> aRoot(App::Root* aObj);
67  static std::shared_ptr<Task> aTask(App::Task* aTask);
68  static std::shared_ptr<MaterialSelect> aMaterialSelect(App::MaterialSelect* aMatSel);
69 
70  template <typename OpenLxClass>
71  std::shared_ptr<OpenLxClass> aObject()
72  {
73  return OpenLxClass::createIn(_doc);
74  }
75 
76  template <typename OpenLxClass>
77  static std::shared_ptr<OpenLxClass> aObject(std::shared_ptr<Document> aDoc)
78  {
79  return OpenLxClass::createIn(aDoc);
80  }
81 
82  static LxIfc4::LxIfc4EntityEnum getEntityTypeFromTypeName(const std::string& aType);
83 
84 
85 private:
86  DocObjectFactory() {}
87  static std::shared_ptr<Product> _createProduct(LxIfc4::LxIfc4EntityEnum aType, App::Product* aProduct, std::shared_ptr<Document> aDoc);
88 
89  std::shared_ptr<Document> _doc;
90  Core::CoreDocument* _coredoc = nullptr;
91 };
92 
93 
94 
95 } // namespace OpenLxApp
OpenLxApp
Definition: ActiveScript.h:10
OpenLxApp::DocObjectFactory::aTask
static std::shared_ptr< Task > aTask(App::Task *aTask)
Element.h
MaterialSelect.h
ProfileDef.h
Core::CoreDocument
Definition: CoreDocument.h:269
OpenLxApp::DocObjectFactory::aElements
static std::vector< std::shared_ptr< Element > > aElements(const std::vector< App::Element * > aElem)
OpenLxApp::DocObjectFactory::aRoot
static std::shared_ptr< Root > aRoot(App::Root *aObj)
OpenLxApp::DocObjectFactory::aProducts
static std::vector< std::shared_ptr< Product > > aProducts(const std::vector< App::Product * > aProduct)
OpenLxApp::DocObjectFactory::DocObjectFactory
DocObjectFactory(std::shared_ptr< Document > aDoc)
Process.h
OpenLxApp::DocObjectFactory::aProfile
static std::shared_ptr< ProfileDef > aProfile(Part::ProfileDef *aProfileDef)
Task.h
OpenLxApp::DocObjectFactory::aTmpElement
std::shared_ptr< Element > aTmpElement()
OpenLxApp::DocObjectFactory::getEntityTypeFromTypeName
static LxIfc4::LxIfc4EntityEnum getEntityTypeFromTypeName(const std::string &aType)
OpenLxApp::DocObjectFactory::aObject
static std::shared_ptr< Object > aObject(App::Object *aObj)
boost
Definition: DocObjectFactory.h:24
OpenLxApp::DocObjectFactory
DocObjectFactory to create DocObjects.
Definition: DocObjectFactory.h:44
OpenLxApp::DocObjectFactory::aDocObject
static std::shared_ptr< DocObject > aDocObject(Core::DocObject *aObj)
OpenLxApp::DocObjectFactory::aProcess
static std::shared_ptr< Process > aProcess(App::Process *aProcess)
Core::DocObject
Definition: DocObject.h:54
OpenLxApp::Document
Document holding all persistent DocObjects.
Definition: Document.h:62
OpenLxApp::DocObjectFactory::aElements
static std::vector< std::shared_ptr< Element > > aElements(std::unordered_set< App::Element * > aElems)
OpenLxApp::DocObjectFactory::aMaterialSelect
static std::shared_ptr< MaterialSelect > aMaterialSelect(App::MaterialSelect *aMatSel)
boost::unordered_set
Definition: DocObjectFactory.h:25
OpenLxApp::DocObjectFactory::aGeometry
static std::shared_ptr< Geometry > aGeometry(App::Geometry *aGeom)
OpenLxApp::DocObjectFactory::aObject
static std::shared_ptr< OpenLxClass > aObject(std::shared_ptr< Document > aDoc)
Definition: DocObjectFactory.h:77
OpenLxApp::DocObjectFactory::DocObjectFactory
DocObjectFactory(App::Document *aDoc)
OpenLxApp::DocObjectFactory::aObject
std::shared_ptr< OpenLxClass > aObject()
Definition: DocObjectFactory.h:71
OpenLxApp::DocObjectFactory::aElement
static std::shared_ptr< Element > aElement(App::Element *aElem)
Group.h
Geometry.h
OpenLxApp::DocObjectFactory::aObjectDefinition
static std::shared_ptr< ObjectDefinition > aObjectDefinition(App::ObjectDefinition *aObj)
ObjectDefinition.h
SubElement.h
OpenLxApp::DocObjectFactory::aProduct
static std::shared_ptr< Product > aProduct(App::Product *aProduct)
OpenLxApp::DocObjectFactory::~DocObjectFactory
~DocObjectFactory()