diff --git a/UserInterface/Dialogues/Ifc4x1TreeItem.cpp b/UserInterface/Dialogues/Ifc4x1TreeItem.cpp
new file mode 100644
index 000000000..77e89a375
--- /dev/null
+++ b/UserInterface/Dialogues/Ifc4x1TreeItem.cpp
@@ -0,0 +1,141 @@
+/*
+Copyright (c) 2018 Technical University of Munich
+Chair of Computational Modeling and Simulation.
+
+TUM Open Infra Platform is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License Version 3
+as published by the Free Software Foundation.
+
+TUM Open Infra Platform is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+
+#include
+#include
+#include
+
+#include "Ifc4x1TreeItem.h"
+#include "Ifc4x1TreeModel.h"
+#include "OpenInfraPlatform/Infrastructure/Export/IfcAlignment1x1Caster.h"
+
+#include
+#include
+
+
+
+OpenInfraPlatform::UserInterface::Ifc4x1TreeItem::Ifc4x1TreeItem(std::pair> data, std::shared_ptr parentItem)
+{
+parentItem_ = parentItem;
+data_ = data;
+//auto attributes = getAttributeDescription();
+//auto entity = data_.find(parent.row() + 1)->second;
+//OpenInfraPlatform::IfcAlignment1x1::castAndCall(entity, attributes);
+//hier cast and call verwenden und den getattributedesciption struct übergeben
+}
+
+struct OpenInfraPlatform::UserInterface::Ifc4x1TreeItem::getAttributeDescription {
+
+ template typename std::enable_if::value && std::is_base_of::value, void>::type
+ operator()(T entity)
+ {
+ visit_struct::for_each(entity, [&](const char* name, const auto &value) {
+ names_.push_back(name);
+ typename_= typeid(T).name(entity);
+ value_.push_back(value);
+
+ });
+ }
+
+ //This is a dummy function which should never be called but is required by the compiler since it could theoretically be called. Throws exception.
+ template typename std::enable_if::value, void>::type
+ operator()(T& entity) const
+ {
+ std::string message = "Invalid function call. " + std::string(typeid(entity).name()) + " isn't a member of IfcAlignment1x1Entity.";
+ throw buw::Exception(message.data());
+ }
+
+ //This is a dummy function which should never be called but is required by the compiler since it could theoretically be called. Throws exception.
+ void operator()(OpenInfraPlatform::IfcAlignment1x1::IfcAlignment1x1Entity& entity) const
+ {
+ std::string message = "Invalid function call.";
+ throw buw::Exception(message.data());
+ }
+
+ std::vector names_;
+ std::vector typename_;
+ std::vector value_;
+
+};
+
+
+
+OpenInfraPlatform::UserInterface::Ifc4x1TreeItem::~Ifc4x1TreeItem()
+{
+ childItems_.clear();
+}
+
+void OpenInfraPlatform::UserInterface::Ifc4x1TreeItem::appendChild(std::shared_ptr item)
+{
+ childItems_.append(item);
+}
+
+std::shared_ptr OpenInfraPlatform::UserInterface::Ifc4x1TreeItem::child(int row)
+{
+ return childItems_.value(row);
+}
+
+int OpenInfraPlatform::UserInterface::Ifc4x1TreeItem::childCount() const
+{
+ return childItems_.count();
+}
+
+int OpenInfraPlatform::UserInterface::Ifc4x1TreeItem::columnCount() const
+{
+ return 3;
+}
+
+QVariant OpenInfraPlatform::UserInterface::Ifc4x1TreeItem::data(int column, int row) const
+{
+ auto attributes = getAttributeDescription();
+
+ switch (column)
+ {
+ case 0:
+ return attributes.names_[row];
+ break;
+ case 1:
+ return attributes.value_[row];//data_.value(column);//value of the object
+ break;
+ case 2:
+ return attributes.typename_[row];//type of the object
+ break;
+ }
+
+}
+
+std::shared_ptr OpenInfraPlatform::UserInterface::Ifc4x1TreeItem::parentItem()
+{
+ if (parentItem_)
+ return parentItem_;
+
+ return std::shared_ptr();
+}
+
+std::string OpenInfraPlatform::UserInterface::Ifc4x1TreeItem::getIfcClassName()
+{
+ return std::string(data_.second->classname());
+}
+
+
+int OpenInfraPlatform::UserInterface::Ifc4x1TreeItem::row() const
+{
+// if (parentItem_)
+// return parentItem_->childItems_.indexOf(const_cast>(this));
+
+ return 0;
+}
\ No newline at end of file
diff --git a/UserInterface/Dialogues/Ifc4x1TreeItem.h b/UserInterface/Dialogues/Ifc4x1TreeItem.h
new file mode 100644
index 000000000..7b05cc4b9
--- /dev/null
+++ b/UserInterface/Dialogues/Ifc4x1TreeItem.h
@@ -0,0 +1,61 @@
+/*
+Copyright (c) 2018 Technical University of Munich
+Chair of Computational Modeling and Simulation.
+
+TUM Open Infra Platform is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License Version 3
+as published by the Free Software Foundation.
+
+TUM Open Infra Platform is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+
+#ifndef Ifc4X1TREEITEM_H
+#define Ifc4X1TREEITEM_H
+
+#include
+#include
+#include "OpenInfraPlatform/IfcAlignment1x1/model/Object.h"
+#include "OpenInfraPlatform\IfcAlignment1x1\model\Model.h"
+
+
+namespace OpenInfraPlatform {
+ namespace UserInterface {
+
+ class Ifc4x1TreeItem
+ {
+ public:
+ explicit Ifc4x1TreeItem(std::pair > data, std::shared_ptr parentItem = nullptr);
+ ~Ifc4x1TreeItem();
+
+ void appendChild(shared_ptr child);
+
+ shared_ptr child(int row);
+ int childCount() const;
+ int columnCount() const;
+ QVariant data(int column, int row) const;
+ int row() const;
+ shared_ptr parentItem();
+ std::string getIfcClassName();
+
+ private:
+ QList> childItems_;
+ std::pair > data_;
+ shared_ptr parentItem_;
+
+ struct getAttributeDescription;
+ };
+
+ }
+}
+#endif // TREEITEM_H
+
+namespace buw
+{
+ using OpenInfraPlatform::UserInterface::Ifc4x1TreeItem;
+}
diff --git a/UserInterface/Dialogues/Ifc4x1TreeModel.cpp b/UserInterface/Dialogues/Ifc4x1TreeModel.cpp
new file mode 100644
index 000000000..44660b6a0
--- /dev/null
+++ b/UserInterface/Dialogues/Ifc4x1TreeModel.cpp
@@ -0,0 +1,144 @@
+/*
+Copyright (c) 2018 Technical University of Munich
+Chair of Computational Modeling and Simulation.
+
+TUM Open Infra Platform is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License Version 3
+as published by the Free Software Foundation.
+
+TUM Open Infra Platform is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+
+#include "Ifc4x1TreeModel.h"
+#include "OpenInfraPlatform/Infrastructure/Export/IfcAlignment1x1Caster.h"
+#include "Ifc4x1TreeItem.h"
+
+#include
+#include
+
+
+#include
+#include
+#include
+
+OpenInfraPlatform::UserInterface::Ifc4x1TreeModel::Ifc4x1TreeModel(std::map>& entities)
+ :
+ QAbstractItemModel()
+{
+ for (auto it : entities) {
+ shared_ptr item = std::make_shared(it);
+ data_.push_back(item);
+
+ }
+}
+
+OpenInfraPlatform::UserInterface::Ifc4x1TreeModel::~Ifc4x1TreeModel()
+{
+ data_.clear();
+}
+
+QModelIndex OpenInfraPlatform::UserInterface::Ifc4x1TreeModel::index(int row, int column, const QModelIndex & parent) const
+{
+ if (!hasIndex(row, column, parent))
+ return QModelIndex();
+
+ if (!parent.isValid())
+ return this->createIndex(row, column, nullptr);
+ else {
+ return this->createIndex(row, column, nullptr);
+
+ }
+
+ //from Qt documentation
+
+ shared_ptr parentItem;
+ if (!parent.isValid())
+ parentItem = nullptr;
+ //else
+ // parentItem = static_cast>(parent.internalPointer());
+
+ shared_ptr childItem = parentItem->child(row);
+ //if (childItem)
+ //return createIndex(row, column, childItem);
+ //else
+ return QModelIndex();
+}
+
+
+QModelIndex OpenInfraPlatform::UserInterface::Ifc4x1TreeModel::parent(const QModelIndex & child) const
+{
+ if(child.internalPointer() != nullptr) {
+ return this->createIndex(0, 0, nullptr);
+ }
+ else {
+ return QModelIndex();
+ }
+
+ //from Qt documentation
+ //shared_ptr childItem = static_cast>(child.internalPointer());
+ //shared_ptr parentItem = childItem->parentItem();
+
+ //if (parentItem==nullptr)
+ // return QModelIndex();
+
+// return createIndex(parentItem->row(), 0, parentItem);
+}
+
+
+//int OpenInfraPlatform::UserInterface::Ifc4x1TreeModel::rowCount(const QModelIndex & parent) const
+//{
+// if (!parent.isValid())
+// return data_.size();
+// else {
+// auto entity = data_.find(parent.row() + 1)->second;
+// auto counter = countRows {};
+// OpenInfraPlatform::IfcAlignment1x1::castToDerivedAndCall(entity, counter);
+// return counter.rows_;
+// }
+//
+// //Menge der Attribute des Objekts data_.size(index) oder data_[parent].size()?oder mit visit struct?
+// //würde das hier auch mit childCount() gehen?
+//}
+
+
+int OpenInfraPlatform::UserInterface::Ifc4x1TreeModel::columnCount(const QModelIndex & parent) const
+{
+ if (!parent.isValid())
+ return 1;
+ else
+ return 3;
+}
+
+
+//QVariant OpenInfraPlatform::UserInterface::Ifc4x1TreeModel::data(const QModelIndex & index, int role) const
+//{
+// if (!index.isValid())
+// return QVariant();
+//
+// if (role != Qt::DisplayRole)
+// return QVariant();
+//
+// if (!index.parent().isValid())
+// return QVariant(data_[index.row()]->getIfcClassName().data());
+// else {
+//
+// auto ptr = std::static_pointer_cast(buw::claimOwnership(index.internalPointer()));
+// auto name = getName();
+// OpenInfraPlatform::IfcAlignment1x1::castToDerivedAndCall(ptr, name);
+// return QVariant(name.names_[index.row()]);
+// }
+//}
+
+bool OpenInfraPlatform::UserInterface::Ifc4x1TreeModel::insertRows(int row, int count, const QModelIndex & parent)
+{
+ beginInsertRows(parent, row, row + count);
+
+ endInsertRows();
+ return true;
+}
\ No newline at end of file
diff --git a/UserInterface/Dialogues/Ifc4x1TreeModel.h b/UserInterface/Dialogues/Ifc4x1TreeModel.h
new file mode 100644
index 000000000..a04bc5e04
--- /dev/null
+++ b/UserInterface/Dialogues/Ifc4x1TreeModel.h
@@ -0,0 +1,54 @@
+/*
+Copyright (c) 2018 Technical University of Munich
+Chair of Computational Modeling and Simulation.
+
+TUM Open Infra Platform is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License Version 3
+as published by the Free Software Foundation.
+
+TUM Open Infra Platform is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+
+#pragma once
+
+#include "OpenInfraPlatform/IfcAlignment1x1/model/Object.h"
+#include
+#include
+#include
+#include
+
+
+namespace OpenInfraPlatform {
+ namespace UserInterface {
+
+ class Ifc4x1TreeItem;
+
+ class Ifc4x1TreeModel : public QAbstractItemModel {
+
+ Q_OBJECT;
+
+ public:
+ Ifc4x1TreeModel(std::map >& entities);
+ ~Ifc4x1TreeModel();
+
+ // Inherited from QAbstractItemModel
+ virtual QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const override;
+ virtual QModelIndex parent(const QModelIndex & child) const override;
+ //virtual int rowCount(const QModelIndex & parent = QModelIndex()) const override;
+ virtual int columnCount(const QModelIndex & parent = QModelIndex()) const override;
+ //virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const override;
+ virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
+
+
+ private:
+ std::vector> data_;
+ };
+
+ }
+}
diff --git a/UserInterface/Dialogues/ShowIFCtree.cpp b/UserInterface/Dialogues/ShowIFCtree.cpp
new file mode 100644
index 000000000..ef6a919e0
--- /dev/null
+++ b/UserInterface/Dialogues/ShowIFCtree.cpp
@@ -0,0 +1,99 @@
+/*
+Copyright (c) 2018 Technical University of Munich
+Chair of Computational Modeling and Simulation.
+
+TUM Open Infra Platform is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License Version 3
+as published by the Free Software Foundation.
+
+TUM Open Infra Platform is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+
+#include "ShowIFCtree.h"
+//#include "Ifc4x1TreeModel.h"
+#include "DataManagement/General/Data.h"
+#include "SimpleTreeModel.h"
+#include "SimpleTreeItem.h"
+
+OpenInfraPlatform::UserInterface::ShowIFCtree::ShowIFCtree(OpenInfraPlatform::UserInterface::View * view, QWidget * parent)
+ :ui_(new Ui::ShowIFCtree),
+ QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint),
+ view_(view)
+{
+ ui_->setupUi(this);
+ ui_->treeView->setEditTriggers(QAbstractItemView::EditTrigger::NoEditTriggers);
+ ui_->treeView->setAutoExpandDelay(-1);
+ QObject::connect(ui_->treeView, &QTreeView::expanded, this, &ShowIFCtree::on_treeView_expanded);
+}
+
+void OpenInfraPlatform::UserInterface::ShowIFCtree::on_treeView_expanded(const QModelIndex &index)
+{
+ //std::shared_ptr ptr = nullptr;
+ //if(!index.isValid())
+ // TreeItem* item = new TreeItem(ptr, nullptr);
+ //else
+ TreeItem* item = static_cast(index.internalPointer());
+
+
+ if(item->childCount() == 0)
+ item->createChildren();
+
+ for(int i = 0; i < item->childCount(); i++) {
+ auto child = item->child(i);
+ if(child->childCount() == 0)
+ child->createChildren();
+
+ for(int i = 0; i < child->childCount(); i++) {
+ auto grandchild = child->child(i);
+ if(grandchild->childCount() == 0)
+ grandchild->createChildren();
+ }
+ }
+}
+
+
+void OpenInfraPlatform::UserInterface::ShowIFCtree::show()
+{
+ auto proxyModel = OpenInfraPlatform::DataManagement::DocumentManager::getInstance().getData().getProxyModel();
+ auto entities = proxyModel->getIfc4x1Data();
+ ui_->treeView->setModel(new TreeModel(entities));
+
+ ((QDialog*)this)->show();
+}
+
+//bool OpenInfraPlatform::UserInterface::ShowIFCtree::itemsExpandable(const QModelIndex &index) const
+//{
+// TreeItem* item = static_cast(index.internalPointer());
+// if(item->childCount() > 0)
+// return true;
+// else
+// return false;
+//}
+//
+//void OpenInfraPlatform::UserInterface::ShowIFCtree::setItemsExpandable(bool enable, const QModelIndex &index)
+//{
+// if(enable == true) {
+//
+// }
+//}
+
+
+ //QApplication app(argc, argv);
+
+ //QFile file("default.txt");
+ //file.open(QIODevice::ReadOnly);
+ //TreeModel* model = new TreeModel(file.readAll());
+ //file.close();
+
+ //QTreeView view;
+ //ui_->treeView->setModel(model);
+ //view.setModel(&model);
+ //view.setWindowTitle(QObject::tr("Simple Tree Model"));
+ //view.show();
+ //return app.exec();
\ No newline at end of file
diff --git a/UserInterface/Dialogues/ShowIFCtree.h b/UserInterface/Dialogues/ShowIFCtree.h
new file mode 100644
index 000000000..985280c3a
--- /dev/null
+++ b/UserInterface/Dialogues/ShowIFCtree.h
@@ -0,0 +1,73 @@
+/*
+Copyright (c) 2018 Technical University of Munich
+Chair of Computational Modeling and Simulation.
+
+TUM Open Infra Platform is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License Version 3
+as published by the Free Software Foundation.
+
+TUM Open Infra Platform is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+
+#pragma once
+
+#include "ui_ShowIFCtree.h"
+#include "ViewPanel/View.h"
+//#include
+#include
+#include
+#include
+#include
+#include
+
+
+using namespace OpenInfraPlatform::IfcAlignment1x1;
+namespace OpenInfraPlatform
+{
+ namespace UserInterface
+ {
+ class ShowIFCtree : public QDialog
+ {
+ //Q_OBJECT;
+ //public:
+
+ //private Q_SLOTS:
+
+
+
+ public:
+ //! Default constructor.
+ ShowIFCtree(OpenInfraPlatform::UserInterface::View* view, QWidget *parent = nullptr);
+
+ //! Virtual destructor.
+ virtual ~ShowIFCtree() {};
+ void show();
+
+ private Q_SLOTS:
+ void on_treeView_expanded(const QModelIndex &index);
+ //bool itemsExpandable(const QModelIndex &index) const;
+ //void setItemsExpandable(bool enable, const QModelIndex &index);
+
+
+ private:
+ Ui::ShowIFCtree* ui_;
+
+ QTranslator* translator_;
+ OpenInfraPlatform::UserInterface::View* view_;
+ //buw::ReferenceCounted infraCameraController_;
+
+ }; // end class AddGeoreference
+ } // end namespace UserInterface
+} // end namespace OpenInfraPlatform
+
+namespace buw
+{
+ using OpenInfraPlatform::UserInterface::ShowIFCtree;
+}
+
diff --git a/UserInterface/Dialogues/SimpleTreeItem.cpp b/UserInterface/Dialogues/SimpleTreeItem.cpp
new file mode 100644
index 000000000..2c79458c3
--- /dev/null
+++ b/UserInterface/Dialogues/SimpleTreeItem.cpp
@@ -0,0 +1,124 @@
+#include
+
+#include "SimpleTreeItem.h"
+#include
+#include
+
+#include "SimpleTreeModel.h"
+
+#ifdef OIP_MODULE_EARLYBINDING_IFC2X3
+#include "reader/IFC2X3Reader.h"
+#include "EMTIFC2X3EntityTypes.h"
+#include "IFC2X3.h"
+#endif
+
+#ifdef OIP_MODULE_EARLYBINDING_IFC4
+#include "reader/IFC4Reader.h"
+#include "EMTIFC4EntityTypes.h"
+#include "IFC4.h"
+#endif
+
+#ifdef OIP_MODULE_EARLYBINDING_IFC4X1
+#include "reader/IFC4X1Reader.h"
+#include "EMTIFC4X1EntityTypes.h"
+#include "IFC4X1.h"
+#endif
+
+#ifdef OIP_MODULE_EARLYBINDING_IFC4X3_RC1
+#include "reader/IFC4X3_RC1Reader.h"
+#include "EMTIFC4X3_RC1EntityTypes.h"
+#include "IFC4X3_RC1.h"
+#endif
+
+#include
+#include
+
+//OpenInfraPlatform::UserInterface::TreeItem::TreeItem(const QList &data, TreeItem *parent)
+
+
+
+OpenInfraPlatform::UserInterface::TreeItem::TreeItem(std::shared_ptr &data, TreeItem * parent)
+ : m_managedData(data), m_parentItem(parent), parser_()
+{
+ parser_.thisPtr = this;
+}
+
+OpenInfraPlatform::UserInterface::TreeItem::~TreeItem()
+{
+ qDeleteAll(m_childItems);
+}
+
+
+void OpenInfraPlatform::UserInterface::TreeItem::appendChild(TreeItem *item)
+{
+ m_childItems.append(item);
+}
+
+OpenInfraPlatform::UserInterface::TreeItem *OpenInfraPlatform::UserInterface::TreeItem::child(int row)
+{
+ return m_childItems.value(row);
+}
+
+int OpenInfraPlatform::UserInterface::TreeItem::childCount() const
+{
+ return m_childItems.count();
+}
+
+int OpenInfraPlatform::UserInterface::TreeItem::columnCount() const
+{
+ return 3;
+}
+
+//QVariant OpenInfraPlatform::UserInterface::TreeItem::data(int column) const
+QVariant OpenInfraPlatform::UserInterface::TreeItem::data(int column) const
+{
+ return m_itemData.value(column);
+}
+
+OpenInfraPlatform::UserInterface::TreeItem *OpenInfraPlatform::UserInterface::TreeItem::parentItem()
+{
+ return m_parentItem;
+}
+
+void OpenInfraPlatform::UserInterface::TreeItem::setItemData(QList itemData)
+{
+ m_itemData = itemData;
+}
+
+void OpenInfraPlatform::UserInterface::TreeItem::createChildren()
+{
+ auto func = [&](auto item)->void {
+ visit_struct::for_each(item, [&](const char* name, auto &value) {
+ TreeItem* child;
+ //if(std::is_base_of::value) {
+ // child = new TreeItem(value, this);
+ //}
+ //else {
+ // child = new TreeItem(OpenInfraPlatform::IfcAlignment1x1::IfcAlignment1x1Object(), this);
+ //}
+ std::shared_ptr ptr = nullptr;
+ child = new TreeItem(ptr, this);
+ QList itemData;
+ itemData << QVariant(name) << QVariant("") << QVariant(typeid(value).name());
+ this->appendChild(child);
+ });
+ };
+
+ auto parse = [&](auto item) {
+ visit_struct::for_each(item, parser_);
+ };
+
+ if(m_managedData && m_managedData.get() != nullptr) {
+ if(std::dynamic_pointer_cast(m_managedData)){
+ //OpenInfraPlatform::IfcAlignment1x1::castToVisitableAndCall(std::dynamic_pointer_cast(m_managedData), parse);
+ }
+ }
+}
+
+int OpenInfraPlatform::UserInterface::TreeItem::row() const
+{
+ if(m_parentItem)
+ return m_parentItem->m_childItems.indexOf(const_cast(this));
+
+ return 0;
+}
\ No newline at end of file
diff --git a/UserInterface/Dialogues/SimpleTreeItem.h b/UserInterface/Dialogues/SimpleTreeItem.h
new file mode 100644
index 000000000..602d30027
--- /dev/null
+++ b/UserInterface/Dialogues/SimpleTreeItem.h
@@ -0,0 +1,276 @@
+#pragma once
+#ifndef TREEITEM_H
+#define TREEITEM_H
+
+
+#include
+#include
+
+#ifdef OIP_MODULE_EARLYBINDING_IFC2X3
+#include "reader/IFC2X3Reader.h"
+#include "EMTIFC2X3EntityTypes.h"
+#include "IFC2X3.h"
+#endif
+
+#ifdef OIP_MODULE_EARLYBINDING_IFC4
+#include "reader/IFC4Reader.h"
+#include "EMTIFC4EntityTypes.h"
+#include "IFC4.h"
+#endif
+
+#ifdef OIP_MODULE_EARLYBINDING_IFC4X1
+#include "reader/IFC4X1Reader.h"
+#include "EMTIFC4X1EntityTypes.h"
+#include "IFC4X1.h"
+#endif
+
+#ifdef OIP_MODULE_EARLYBINDING_IFC4X3_RC1
+#include "reader/IFC4X3_RC1Reader.h"
+#include "EMTIFC4X3_RC1EntityTypes.h"
+#include "IFC4X3_RC1.h"
+#endif
+
+#include
+
+namespace OpenInfraPlatform {
+ namespace UserInterface {
+
+ class TreeItem {
+ public:
+ TreeItem(std::shared_ptr &data, TreeItem* parent = nullptr);
+ virtual ~TreeItem();
+
+ void appendChild(TreeItem *child);
+ TreeItem *child(int row);
+ int childCount() const;
+ int columnCount() const;
+ QVariant data(int column) const;
+ int row() const;
+ TreeItem *parentItem();
+
+ void setItemData(QList itemData);
+
+ void createChildren();
+
+
+ private:
+ QList m_childItems;
+ QList m_itemData;
+ TreeItem *m_parentItem;
+
+ std::shared_ptr m_managedData = nullptr;
+
+ //Helper struct which parses the attributes of a derived entity which are IfcAlignment1x1Types and hold flat values.
+ struct parseType {
+
+ void operator()(const char* name, std::string string)
+ {
+ std::shared_ptr ptr = nullptr;
+ TreeItem* child = new TreeItem(ptr, thisPtr);
+ QList itemData;
+ itemData << QVariant(name) << QVariant(string.data()) << QVariant("std::string");
+ child->setItemData(itemData);
+ thisPtr->appendChild(child);
+ }
+
+ //Function operator() which creates a statement from a boolean value.
+ void operator()(const char* name, bool value)
+ {
+ std::shared_ptr ptr = nullptr;
+ TreeItem* child = new TreeItem(ptr, thisPtr);
+ QList itemData;
+ itemData << QVariant(name) << QVariant(value) << QVariant("bool");
+ child->setItemData(itemData);
+ thisPtr->appendChild(child);
+ }
+
+ void operator()(const char* name, std::shared_ptr value)
+ {
+ TreeItem* child = new TreeItem(std::static_pointer_cast(value), thisPtr);
+ QList itemData;
+ itemData << QVariant(name) << QVariant(value ? value->getId() : -1); //<< QVariant(value ? value->classname() : "nullptr");
+ child->setItemData(itemData);
+ thisPtr->appendChild(child);
+ }
+
+ //TODO: Get value stored in type
+ void operator()(const char* name, std::shared_ptr value)
+ {
+ TreeItem* child = new TreeItem(std::static_pointer_cast(value), thisPtr);
+ QList itemData;
+
+ //std::stringstream ss;
+ if(value)
+ //readStepData(std::string& arg)
+ //value->getStepData(ss);
+
+
+ //auto classname = value->classname(); //Gibt z.B. IfcLabel o.ä. zurück
+ //static_cast(value);
+ //auto castedValue = value.m_value; //gibt m_value zurück aus IfcLabel, also den eigentlichen Wert, der als String o.ö. gespeichert ist
+ //auto castedType = typeid(castedValue).name(); //gibt den Typ von m_value zurück, also z.B. String
+ //
+ //if (castedType == "string" || "char")
+ // QVariant value2 = QVariant(castedValue.data());
+ // return value2;
+ //if (castedType == "bool" || "int" || "float" || "double")
+ // QVariant value2 = QVariant(castedValue);
+ // return value2;
+
+ //itemData << QVariant(name) << QVariant(ss.str().data()) << QVariant(value ? value->classname() : "nullptr");
+ itemData << QVariant(name) << QVariant("m_type"); //<< QVariant(value ? value->classname() : "nullptr");
+ //itemData << QVariant(name) << QVariant("m_type") << QVariant(value ? value->classname() : "nullptr");
+
+ child->setItemData(itemData);
+ thisPtr->appendChild(child);
+ }
+
+ //template typename std::enable_if::value && !std::is_base_of::value, void>::type
+ //operator()(const char* name, std::shared_ptr value)
+ //{
+ // std::shared_ptr ptr = nullptr;
+ // TreeItem* child = new TreeItem(ptr, thisPtr);
+ // QList itemData;
+ // itemData << QVariant(name) << QVariant("m_select") << QVariant(typeid(T).name());
+ // child->setItemData(itemData);
+ // thisPtr->appendChild(child);
+ //}
+
+ //template typename std::enable_if::value && !std::is_base_of::value && !std::is_base_of::value, void>::type
+ // operator()(const char* name, std::shared_ptr value)
+ template typename std::enable_if::value && !std::is_base_of::value, void>::type
+ operator()(const char* name, std::shared_ptr value)
+ {
+ std::shared_ptr ptr = nullptr;
+ TreeItem* child = new TreeItem(ptr, thisPtr);
+ QList itemData;
+
+ //if !std::is_base_of::value, void>::type
+ //{
+ //std::stringstream ss;
+ //if(value)
+ // value->getStepData(ss);
+ //return ss;
+ //}
+
+ //itemData << QVariant(name) << QVariant(ss.str().data()) << QVariant(typeid(T).name());
+ itemData << QVariant(name) << QVariant("m_select") << QVariant(typeid(T).name());
+ child->setItemData(itemData);
+ thisPtr->appendChild(child);
+ }
+
+ //void operator()(const char* name, std::shared_ptr value)
+ //{
+ // std::shared_ptr ptr = nullptr;
+ // TreeItem* child = new TreeItem(ptr, thisPtr);
+ // QList itemData;
+ // itemData << QVariant(name) << QVariant("m_enum") << QVariant(value->classname());
+ // child->setItemData(itemData);
+ // thisPtr->appendChild(child);
+ //}
+
+ template typename std::enable_if::value || std::is_same::value || std::is_same::value, void>::type
+ operator()(const char* name, T value)
+ {
+ std::shared_ptr ptr = nullptr;
+ TreeItem* child = new TreeItem(ptr, thisPtr);
+ QList itemData;
+ itemData << QVariant(name) << QVariant(value) << QVariant(typeid(value).name());
+ child->setItemData(itemData);
+ thisPtr->appendChild(child);
+ }
+
+
+ //Function operator() which covers std::shared_ptr.
+ //template
+ //void operator()(const char* name, std::shared_ptr &ptr)
+ //{
+ //}
+
+ //Function operator() which covers std::vector.
+ template
+ void operator()(const char* name, std::vector vector)
+ {
+ std::shared_ptr ptr = nullptr;
+ TreeItem* child = new TreeItem(ptr, thisPtr);
+ QList itemData;
+ itemData << QVariant(name) << QVariant("vector") << QVariant(typeid(T).name());
+ child->setItemData(itemData);
+ thisPtr->appendChild(child);
+
+ int i = 0;
+ for(T it : vector) {
+ TreeItem* vectorChild = new TreeItem(ptr, child);
+ QList vectorData;
+ //doesn't work yet since it is of type T and that requires the parser again (rekusiver aufruf)
+ //T value = it;
+ //
+ //auto parse = [&](auto item) {
+ // visit_struct::for_each(item, parser_);
+ //};
+ //
+ //if(ptr && ptr.get() != nullptr) {
+ // if(std::dynamic_pointer_cast(ptr))
+ // OpenInfraPlatform::IfcAlignment1x1::castToVisitableAndCall(std::dynamic_pointer_cast(ptr), parse);
+ //}
+ //vectorData << QVariant(i++) << QVariant(value) << QVariant(typeid(value).name());
+ vectorData << QVariant(i++) << QVariant("") << QVariant("");
+ vectorChild->setItemData(vectorData);
+ child->appendChild(vectorChild);
+ }
+ }
+
+ //Function operator() which covers everything that is not an int, float/double, string, boolean, pointer or vector.
+ //This function also takes enums, since alot of classes derived from IfcAlignment1x1Type have a corresponding enum class, which is derived from it.
+ //template typename std::enable_if::value && !std::is_same::value, void>::type
+ // operator()(const char* name, T t)
+ //{
+ //
+ //}
+
+ TreeItem* thisPtr = nullptr;
+
+ } parser_;
+ };
+
+
+
+ //template class TreeItemT : public TreeItem {
+ //public:
+ // TreeItemT(T &data, TreeItem* parent) : TreeItem(parent), m_managedData(data)
+ // {
+ // auto func = [&](auto item)->void {
+ // visit_struct::for_each(item, [&](const char* name, auto &value) {
+ // TreeItemT* child = new TreeItemT(value, this);
+ // QList itemData;
+ // itemData << QVariant(name) << QVariant("") << QVariant(typeid(value).name());
+ // child->setItemData(itemData);
+ // this->appendChild(child);
+ // });
+ // };
+ //
+ // if(visit_struct::traits::is_visitable::value) {
+ // OpenInfraPlatform::IfcAlignment1x1::castToVisitableAndCall(std::shared_ptr(&m_managedData), func);
+ // } else {
+ //
+ // }
+ // }
+ //
+ // void createChildren()
+ // {
+ // visit_struct::for_each(m_managedData, [&](const char* name, auto &value) {
+ // TreeItemT* child = new TreeItemT(value, this);
+ // QList itemData;
+ // itemData << QVariant(name) << QVariant("") << QVariant(typeid(value).name());
+ // child->setItemData(itemData);
+ // this->appendChild(child);
+ // });
+ // }
+ //
+ //
+ // T m_managedData;
+ //};
+ }
+}
+
+#endif // TREEITEM_H
\ No newline at end of file
diff --git a/UserInterface/Dialogues/SimpleTreeItem.h.orig b/UserInterface/Dialogues/SimpleTreeItem.h.orig
new file mode 100644
index 000000000..1d574c09d
--- /dev/null
+++ b/UserInterface/Dialogues/SimpleTreeItem.h.orig
@@ -0,0 +1,269 @@
+#pragma once
+#ifndef TREEITEM_H
+#define TREEITEM_H
+
+
+#include
+#include
+#include "OpenInfraPlatform/IfcAlignment1x1/model/Object.h"
+#include "OpenInfraPlatform\IfcAlignment1x1\model\Model.h"
+
+#include
+
+namespace OpenInfraPlatform {
+ namespace UserInterface {
+
+ class TreeItem {
+ public:
+ TreeItem(std::shared_ptr &data, TreeItem* parent = nullptr);
+ virtual ~TreeItem();
+
+ void appendChild(TreeItem *child);
+ TreeItem *child(int row);
+ int childCount() const;
+ int columnCount() const;
+ QVariant data(int column) const;
+ int row() const;
+ TreeItem *parentItem();
+
+ void setItemData(QList itemData);
+
+ void createChildren();
+
+
+ private:
+ QList m_childItems;
+ QList m_itemData;
+ TreeItem *m_parentItem;
+
+ std::shared_ptr m_managedData = nullptr;
+
+ //Helper struct which parses the attributes of a derived entity which are IfcAlignment1x1Types and hold flat values.
+ struct parseType {
+
+ void operator()(const char* name, std::string string)
+ {
+ std::shared_ptr ptr = nullptr;
+ TreeItem* child = new TreeItem(ptr, thisPtr);
+ QList itemData;
+ itemData << QVariant(name) << QVariant(string.data()) << QVariant("std::string");
+ child->setItemData(itemData);
+ thisPtr->appendChild(child);
+ }
+
+ //Function operator() which creates a statement from a boolean value.
+ void operator()(const char* name, bool value)
+ {
+ std::shared_ptr ptr = nullptr;
+ TreeItem* child = new TreeItem(ptr, thisPtr);
+ QList itemData;
+ itemData << QVariant(name) << QVariant(value) << QVariant("bool");
+ child->setItemData(itemData);
+ thisPtr->appendChild(child);
+ }
+
+ void operator()(const char* name, std::shared_ptr value)
+ {
+ TreeItem* child = new TreeItem(std::static_pointer_cast(value), thisPtr);
+ QList itemData;
+ itemData << QVariant(name) << QVariant(value ? value->getId() : -1) << QVariant(value ? value->classname() : "nullptr");
+ child->setItemData(itemData);
+ thisPtr->appendChild(child);
+ }
+
+ template typename std::enable_if::value && !std::is_base_of::value && std::is_default_constructible::value, void>::type
+ operator()(const char* name, std::shared_ptr value) {
+ TreeItem* child = new TreeItem(std::static_pointer_cast(value), thisPtr);
+ QList itemData;
+ /// Fix bug related to QVariant not being able to cope with strings
+ //if (value && typeid(value->m_value).name() == "std::string") {
+ // void* data = &(value->m_value);
+ // itemData << QVariant(name) << QVariant(static_cast(data)->data()) << QVariant(value ? value->classname() : "nullptr");
+ //}
+ //else
+ // itemData << QVariant(name) << QVariant(value ? value->m_value : "empty" ) << QVariant(value ? value->classname() : "nullptr");
+
+ child->setItemData(itemData);
+ thisPtr->appendChild(child);
+ }
+
+
+ //TODO: Get value stored in type
+ void operator()(const char* name, std::shared_ptr value)
+ {
+ TreeItem* child = new TreeItem(std::static_pointer_cast(value), thisPtr);
+ QList itemData;
+
+ std::stringstream ss;
+ if(value)
+ //readStepData(std::string& arg)
+ value->getStepData(ss);
+
+
+ //auto classname = value->classname(); //Gibt z.B. IfcLabel o.ä. zurück
+ //static_cast(value);
+ //auto castedValue = value.m_value; //gibt m_value zurück aus IfcLabel, also den eigentlichen Wert, der als String o.ö. gespeichert ist
+ //auto castedType = typeid(castedValue).name(); //gibt den Typ von m_value zurück, also z.B. String
+ //
+ //if (castedType == "string" || "char")
+ // QVariant value2 = QVariant(castedValue.data());
+ // return value2;
+ //if (castedType == "bool" || "int" || "float" || "double")
+ // QVariant value2 = QVariant(castedValue);
+ // return value2;
+
+ //itemData << QVariant(name) << QVariant(ss.str().data()) << QVariant(value ? value->classname() : "nullptr");
+ itemData << QVariant(name) << QVariant("type") << QVariant(value ? value->classname() : "nullptr");
+ //itemData << QVariant(name) << QVariant("m_type") << QVariant(value ? value->classname() : "nullptr");
+
+ child->setItemData(itemData);
+ thisPtr->appendChild(child);
+ }
+
+ //template typename std::enable_if::value && !std::is_base_of::value, void>::type
+ //operator()(const char* name, std::shared_ptr value)
+ //{
+ // std::shared_ptr ptr = nullptr;
+ // TreeItem* child = new TreeItem(ptr, thisPtr);
+ // QList itemData;
+ // itemData << QVariant(name) << QVariant("m_select") << QVariant(typeid(T).name());
+ // child->setItemData(itemData);
+ // thisPtr->appendChild(child);
+ //}
+
+ template typename std::enable_if::value && !std::is_base_of::value && !std::is_base_of::value, void>::type
+ operator()(const char* name, std::shared_ptr value)
+ {
+ std::shared_ptr ptr = nullptr;
+ TreeItem* child = new TreeItem(ptr, thisPtr);
+ QList itemData;
+
+ //if !std::is_base_of::value, void>::type
+ //{
+ //std::stringstream ss;
+ //if(value)
+ // value->getStepData(ss);
+ //return ss;
+ //}
+
+ //itemData << QVariant(name) << QVariant(ss.str().data()) << QVariant(typeid(T).name());
+ itemData << QVariant(name) << QVariant("m_select") << QVariant(typeid(T).name());
+ child->setItemData(itemData);
+ thisPtr->appendChild(child);
+ }
+
+ //void operator()(const char* name, std::shared_ptr value)
+ //{
+ // std::shared_ptr ptr = nullptr;
+ // TreeItem* child = new TreeItem(ptr, thisPtr);
+ // QList itemData;
+ // itemData << QVariant(name) << QVariant("m_enum") << QVariant(value->classname());
+ // child->setItemData(itemData);
+ // thisPtr->appendChild(child);
+ //}
+
+ template typename std::enable_if::value || std::is_same::value || std::is_same::value, void>::type
+ operator()(const char* name, T value)
+ {
+ std::shared_ptr ptr = nullptr;
+ TreeItem* child = new TreeItem(ptr, thisPtr);
+ QList itemData;
+ itemData << QVariant(name) << QVariant(value) << QVariant(typeid(value).name());
+ child->setItemData(itemData);
+ thisPtr->appendChild(child);
+ }
+
+
+ //Function operator() which covers std::shared_ptr.
+ //template
+ //void operator()(const char* name, std::shared_ptr &ptr)
+ //{
+ //}
+
+ //Function operator() which covers std::vector.
+ template
+ void operator()(const char* name, std::vector vector)
+ {
+ std::shared_ptr ptr = nullptr;
+ TreeItem* child = new TreeItem(ptr, thisPtr);
+ QList itemData;
+ itemData << QVariant(name) << QVariant("vector") << QVariant(typeid(T).name());
+ child->setItemData(itemData);
+ thisPtr->appendChild(child);
+
+ int i = 0;
+ for(T it : vector) {
+ TreeItem* vectorChild = new TreeItem(ptr, child);
+ QList vectorData;
+ //doesn't work yet since it is of type T and that requires the parser again (rekusiver aufruf)
+ //T value = it;
+ //
+ //auto parse = [&](auto item) {
+ // visit_struct::for_each(item, parser_);
+ //};
+ //
+ //if(ptr && ptr.get() != nullptr) {
+ // if(std::dynamic_pointer_cast(ptr))
+ // OpenInfraPlatform::IfcAlignment1x1::castToVisitableAndCall(std::dynamic_pointer_cast(ptr), parse);
+ //}
+ //vectorData << QVariant(i++) << QVariant(value) << QVariant(typeid(value).name());
+ vectorData << QVariant(i++) << QVariant("") << QVariant("");
+ vectorChild->setItemData(vectorData);
+ child->appendChild(vectorChild);
+ }
+ }
+
+ //Function operator() which covers everything that is not an int, float/double, string, boolean, pointer or vector.
+ //This function also takes enums, since alot of classes derived from IfcAlignment1x1Type have a corresponding enum class, which is derived from it.
+ //template typename std::enable_if::value && !std::is_same::value, void>::type
+ // operator()(const char* name, T t)
+ //{
+ //
+ //}
+
+ TreeItem* thisPtr = nullptr;
+
+ } parser_;
+ };
+
+
+
+ //template class TreeItemT : public TreeItem {
+ //public:
+ // TreeItemT(T &data, TreeItem* parent) : TreeItem(parent), m_managedData(data)
+ // {
+ // auto func = [&](auto item)->void {
+ // visit_struct::for_each(item, [&](const char* name, auto &value) {
+ // TreeItemT* child = new TreeItemT(value, this);
+ // QList itemData;
+ // itemData << QVariant(name) << QVariant("") << QVariant(typeid(value).name());
+ // child->setItemData(itemData);
+ // this->appendChild(child);
+ // });
+ // };
+ //
+ // if(visit_struct::traits::is_visitable::value) {
+ // OpenInfraPlatform::IfcAlignment1x1::castToVisitableAndCall(std::shared_ptr(&m_managedData), func);
+ // } else {
+ //
+ // }
+ // }
+ //
+ // void createChildren()
+ // {
+ // visit_struct::for_each(m_managedData, [&](const char* name, auto &value) {
+ // TreeItemT* child = new TreeItemT(value, this);
+ // QList itemData;
+ // itemData << QVariant(name) << QVariant("") << QVariant(typeid(value).name());
+ // child->setItemData(itemData);
+ // this->appendChild(child);
+ // });
+ // }
+ //
+ //
+ // T m_managedData;
+ //};
+ }
+}
+
+#endif // TREEITEM_H
\ No newline at end of file
diff --git a/UserInterface/Dialogues/SimpleTreeModel.cpp b/UserInterface/Dialogues/SimpleTreeModel.cpp
new file mode 100644
index 000000000..9d8836610
--- /dev/null
+++ b/UserInterface/Dialogues/SimpleTreeModel.cpp
@@ -0,0 +1,196 @@
+#include "SimpleTreeItem.h"
+#include "SimpleTreeModel.h"
+//#include "OpenInfraPlatform/Infrastructure/Export/IfcAlignment1x1Caster.h"
+
+#ifdef OIP_MODULE_EARLYBINDING_IFC2X3
+#include "reader/IFC2X3Reader.h"
+#include "EMTIFC2X3EntityTypes.h"
+#include "IFC2X3.h"
+#endif
+
+#ifdef OIP_MODULE_EARLYBINDING_IFC4
+#include "reader/IFC4Reader.h"
+#include "EMTIFC4EntityTypes.h"
+#include "IFC4.h"
+#endif
+
+#ifdef OIP_MODULE_EARLYBINDING_IFC4X1
+#include "reader/IFC4X1Reader.h"
+#include "EMTIFC4X1EntityTypes.h"
+#include "IFC4X1.h"
+#endif
+
+#ifdef OIP_MODULE_EARLYBINDING_IFC4X3_RC1
+#include "reader/IFC4X3_RC1Reader.h"
+#include "EMTIFC4X3_RC1EntityTypes.h"
+#include "IFC4X3_RC1.h"
+#endif
+
+#include
+#include
+
+//OpenInfraPlatform::UserInterface::TreeModel::TreeModel(const QString &data, QObject *parent)
+// : QAbstractItemModel(parent)
+
+template T cast(S s)
+{
+ return dynamic_cast(s);
+}
+
+OpenInfraPlatform::UserInterface::TreeModel::TreeModel(std::map>& data, QObject *parent)
+ : QAbstractItemModel(parent)
+{
+ std::shared_ptr ptr = nullptr;
+ rootItem = new TreeItem (ptr, nullptr);
+
+ for(auto entity : data) {
+ TreeItem* child = new TreeItem(std::static_pointer_cast(entity.second), rootItem);
+ QList itemData;
+ itemData << QVariant(entity.first);// << QVariant(entity.second->classname()) << QVariant("");
+ child->setItemData(itemData);
+ child->createChildren();
+ rootItem->appendChild(child);
+ }
+
+}
+
+OpenInfraPlatform::UserInterface::TreeModel::~TreeModel()
+{
+ delete rootItem;
+}
+
+QVariant OpenInfraPlatform::UserInterface::TreeModel::data(const QModelIndex & index, int role) const
+{
+ if(!index.isValid())
+ return QVariant();
+
+ if(role != Qt::DisplayRole)
+ return QVariant();
+
+ TreeItem *item = static_cast(index.internalPointer());
+ return item->data(index.column());
+
+}
+
+Qt::ItemFlags OpenInfraPlatform::UserInterface::TreeModel::flags(const QModelIndex &index) const
+{
+ if(!index.isValid())
+ return 0;
+
+ return QAbstractItemModel::flags(index);
+}
+
+QVariant OpenInfraPlatform::UserInterface::TreeModel::headerData(int section, Qt::Orientation orientation,
+ int role) const
+{
+ if(orientation == Qt::Horizontal && role == Qt::DisplayRole)
+ return QVariant(QString::number(section));
+
+ return QVariant();
+}
+
+QModelIndex OpenInfraPlatform::UserInterface::TreeModel::index(int row, int column, const QModelIndex & parent) const
+{
+ if(!hasIndex(row, column, parent))
+ return QModelIndex();
+
+ TreeItem *parentItem;
+
+ if(!parent.isValid())
+ parentItem = rootItem;
+ else
+ parentItem = static_cast(parent.internalPointer());
+
+ TreeItem *childItem = parentItem->child(row);
+ if(childItem)
+ return createIndex(row, column, childItem);
+ else
+ return QModelIndex();
+
+}
+
+QModelIndex OpenInfraPlatform::UserInterface::TreeModel::parent(const QModelIndex & index) const
+{
+ if(!index.isValid())
+ return QModelIndex();
+
+ TreeItem *childItem = static_cast(index.internalPointer());
+ TreeItem *parentItem = childItem->parentItem();
+
+ if(parentItem == rootItem)
+ return QModelIndex();
+
+ return createIndex(parentItem->row(), 0, parentItem);
+}
+
+int OpenInfraPlatform::UserInterface::TreeModel::rowCount(const QModelIndex & parent) const
+{
+ TreeItem *parentItem;
+ if(parent.column() > 0)
+ return 0;
+
+ if(!parent.isValid())
+ parentItem = rootItem;
+ else
+ parentItem = static_cast(parent.internalPointer());
+
+ return parentItem->childCount();
+}
+
+int OpenInfraPlatform::UserInterface::TreeModel::columnCount(const QModelIndex & parent) const
+{
+ if(parent.isValid())
+ return static_cast(parent.internalPointer())->columnCount();
+ else
+ return rootItem->columnCount();
+}
+
+//void OpenInfraPlatform::UserInterface::TreeModel::setupModelData(const QStringList &lines, TreeItem *parent)
+//{
+// QList parents;
+// QList indentations;
+// parents << parent;
+// indentations << 0;
+//
+// int number = 0;
+//
+// while(number < lines.count()) {
+// int position = 0;
+// while(position < lines[number].length()) {
+// if(lines[number].at(position) != ' ')
+// break;
+// position++;
+// }
+//
+// QString lineData = lines[number].mid(position).trimmed();
+//
+// if(!lineData.isEmpty()) {
+// // Read the column data from the rest of the line.
+// QStringList columnStrings = lineData.split("\t", QString::SkipEmptyParts);
+// QList columnData;
+// for(int column = 0; column < columnStrings.count(); ++column)
+// columnData << columnStrings[column];
+//
+// if(position > indentations.last()) {
+// // The last child of the current parent is now the new parent
+// // unless the current parent has no children.
+//
+// if(parents.last()->childCount() > 0) {
+// parents << parents.last()->child(parents.last()->childCount() - 1);
+// indentations << position;
+// }
+// }
+// else {
+// while(position < indentations.last() && parents.count() > 0) {
+// parents.pop_back();
+// indentations.pop_back();
+// }
+// }
+//
+// // Append a new item to the current parent's list of children.
+// parents.last()->appendChild(new TreeItem(columnData, parents.last()));
+// }
+//
+// ++number;
+// }
+//}
\ No newline at end of file
diff --git a/UserInterface/Dialogues/SimpleTreeModel.h b/UserInterface/Dialogues/SimpleTreeModel.h
new file mode 100644
index 000000000..ed55530ca
--- /dev/null
+++ b/UserInterface/Dialogues/SimpleTreeModel.h
@@ -0,0 +1,66 @@
+#pragma once
+#ifdef OIP_MODULE_EARLYBINDING_IFC2X3
+#include "reader/IFC2X3Reader.h"
+#include "EMTIFC2X3EntityTypes.h"
+#include "IFC2X3.h"
+#endif
+
+#ifdef OIP_MODULE_EARLYBINDING_IFC4
+#include "reader/IFC4Reader.h"
+#include "EMTIFC4EntityTypes.h"
+#include "IFC4.h"
+#endif
+
+#ifdef OIP_MODULE_EARLYBINDING_IFC4X1
+#include "reader/IFC4X1Reader.h"
+#include "EMTIFC4X1EntityTypes.h"
+#include "IFC4X1.h"
+#endif
+
+#ifdef OIP_MODULE_EARLYBINDING_IFC4X3_RC1
+#include "reader/IFC4X3_RC1Reader.h"
+#include "EMTIFC4X3_RC1EntityTypes.h"
+#include "IFC4X3_RC1.h"
+#include "EXPRESS/EXPRESSReference.h"
+#endif
+
+#include
+#include
+#include
+#include
+
+
+namespace OpenInfraPlatform {
+ namespace UserInterface {
+ class TreeItem;
+
+ class TreeModel : public QAbstractItemModel {
+ Q_OBJECT;
+
+ public:
+ TreeModel(std::map>& data, QObject *parent = 0);
+ //explicit TreeModel(const QString &data, QObject *parent = 0);
+ ~TreeModel();
+
+ QVariant data(const QModelIndex &index, int role) const override;
+
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
+
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
+
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
+
+ QModelIndex parent(const QModelIndex &index) const override;
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+
+ private:
+ //void setupModelData(const QStringList &lines, TreeItem *parent);
+
+ TreeItem *rootItem;
+ //std::vector> data_;
+ };
+ }
+}