osg qt ifc
ui_ifcproject_20190702.h
#pragma once
/********************************************************************************
** Form generated from reading UI file 'ifcproject_201907.ui'
**
** Created by: Qt User Interface Compiler version 5.12.2
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/ #ifndef UI_IFCPROJECT_201907_H
#define UI_IFCPROJECT_201907_H #include <QFile>
#include <QtCore/QVariant>
#include <QtWidgets/QApplication>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QStatusBar>
#include <QtWidgets/QToolBar>
#include <QtWidgets/QWidget>
#include <QtWidgets/QHBoxLayout> #include <QTableView>
#include <QDockWidget>
#include <QSplitter> QT_BEGIN_NAMESPACE class Ui_IFCProject_201907Class
{
public:
QMenuBar *menuBar;
QToolBar *mainToolBar;
QWidget *centralWidget;
QStatusBar *statusBar;
QSplitter *qsplitter1;
QHBoxLayout *horizontalLayout; QDockWidget *centerDockWidget; void setupUi(QMainWindow *IFCProject_201907Class)
{
if (IFCProject_201907Class->objectName().isEmpty())
IFCProject_201907Class->setObjectName(QString::fromUtf8("IFCProject_201907Class")); //QFile stylefile("F:\\IFCProject\\IFCProject_201907\\IFCProject_201907\\Resources\\styles.qss");
QFile stylefile("./Resources/styles.qss"); stylefile.open(QFile::ReadOnly);
QString styleSheet = QLatin1String(stylefile.readAll());
IFCProject_201907Class->setStyleSheet(styleSheet); IFCProject_201907Class->resize(, );
menuBar = new QMenuBar(IFCProject_201907Class);
menuBar->setObjectName(QString::fromUtf8("menuBar"));
IFCProject_201907Class->setMenuBar(menuBar); mainToolBar = new QToolBar(IFCProject_201907Class);
mainToolBar->setObjectName(QString::fromUtf8("mainToolBar"));
IFCProject_201907Class->addToolBar(mainToolBar); centralWidget = new QWidget(IFCProject_201907Class);
centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
IFCProject_201907Class->setCentralWidget(centralWidget);
//IFCProject_201907Class->addDockWidget(); horizontalLayout = new QHBoxLayout(centralWidget);
horizontalLayout->setSpacing();
horizontalLayout->setContentsMargins(, , , );
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); qsplitter1 = new QSplitter(centralWidget); QDockWidget *dock = new QDockWidget(qsplitter1);
dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
//addDockWidget(Qt::RightDockWidgetArea, dock);
//dock->setTitleBarWidget(IFCProject_201907Class);
//IFCProject_201907Class->addDockWidget(Qt::LeftDockWidgetArea, dock);
qsplitter1->addWidget(dock);
//qsplitter1->setOrientation(Qt::Vertical);
qsplitter1->setOrientation(Qt::Horizontal); centerDockWidget = new QDockWidget(qsplitter1);
//IFCProject_201907Class->addDockWidget(Qt::LeftDockWidgetArea, centerDockWidget); QTableView *tableView1 = new QTableView(dock);
tableView1->setMinimumHeight();
dock->setWidget(tableView1); qsplitter1->addWidget(centerDockWidget); QDockWidget *dockRight = new QDockWidget(qsplitter1);
dockRight->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
//addDockWidget(Qt::RightDockWidgetArea, dock);
//IFCProject_201907Class->addDockWidget(Qt::RightDockWidgetArea, dockRight);
qsplitter1->addWidget(dockRight); horizontalLayout->addWidget(qsplitter1); statusBar = new QStatusBar(IFCProject_201907Class);
statusBar->setObjectName(QString::fromUtf8("statusBar"));
IFCProject_201907Class->setStatusBar(statusBar); retranslateUi(IFCProject_201907Class); QMetaObject::connectSlotsByName(IFCProject_201907Class);
} // setupUi void retranslateUi(QMainWindow *IFCProject_201907Class)
{
IFCProject_201907Class->setWindowTitle(QApplication::translate("IFCProject_201907Class", "IFCProject_201907", nullptr));
} // retranslateUi }; namespace Ui {
class IFCProject_201907Class : public Ui_IFCProject_201907Class {};
} // namespace Ui QT_END_NAMESPACE #endif // UI_IFCPROJECT_201907_H
ifcproject_201907.cpp
#include "ifcproject_201907.h" IFCProject_201907::IFCProject_201907(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
loadIfcModel();
} IFCProject_201907::~IFCProject_201907()
{ } void IFCProject_201907::loadIfcModel()
{
std::wstring m_file_path = L"D://yd0014.ifc";
IfcVCTool* ifcVCTool1 = new IfcVCTool();
osg::ref_ptr<osg::Switch> model_switch = ifcVCTool1->getModelNode();
SceneGraphUtils::clearAllChildNodes(model_switch);
ifcVCTool1->clearSelection(); // reset the IFC model
shared_ptr<GeometryConverter> geometry_converter = ifcVCTool1->getGeometryConverter();
geometry_converter->clearMessagesCallback();
geometry_converter->resetModel();
std::stringstream err; try
{
// load file to IFC model
ifcVCTool1->getModelReader()->loadModelFromFile(m_file_path, geometry_converter->getBuildingModel()); // convert IFC geometric representations into Carve geometry
geometry_converter->convertGeometry(); // convert Carve geometry to OSG
shared_ptr<ConverterOSG> converter_osg(new ConverterOSG(geometry_converter->getGeomSettings()));
converter_osg->setMessageTarget(geometry_converter.get());
converter_osg->convertToOSG(geometry_converter->getShapeInputData(), model_switch); // in case there are IFC entities that are not in the spatial structure
const std::map<int, shared_ptr<BuildingObject> >& objects_outside_spatial_structure = geometry_converter->getObjectsOutsideSpatialStructure();
if (objects_outside_spatial_structure.size() > )
{
osg::ref_ptr<osg::Switch> sw_objects_outside_spatial_structure = new osg::Switch();
sw_objects_outside_spatial_structure->setName("IfcProduct objects outside spatial structure"); converter_osg->addNodes(objects_outside_spatial_structure, sw_objects_outside_spatial_structure);
if (sw_objects_outside_spatial_structure->getNumChildren() > )
{
model_switch->addChild(sw_objects_outside_spatial_structure);
}
}
}
catch (OutOfMemoryException& e)
{
throw e;
}
catch (BuildingException& e)
{
err << e.what();
}
catch (std::exception& e)
{
err << e.what();
}
catch (...)
{
err << "loadModelFromFile, createGeometryOSG failed" << std::endl;
} try
{
if (model_switch)
{
bool optimize = true;
if (optimize)
{
osgUtil::Optimizer opt;
opt.optimize(model_switch);
} // if model bounding sphere is far from origin, move to origin
const osg::BoundingSphere& bsphere = model_switch->getBound();
if (bsphere.center().length() > )
{
if (bsphere.center().length() / bsphere.radius() > )
{
std::unordered_set<osg::Geode*> set_applied;
SceneGraphUtils::translateGroup(model_switch, -bsphere.center(), set_applied);
}
}
}
}
catch (std::exception& e)
{
err << e.what();
} geometry_converter->clearInputCache(); if (err.tellp() > )
{
throw BuildingException(err.str().c_str());
} ViewerWidget* viewer_widget = new ViewerWidget(ifcVCTool1);
viewer_widget->setRootNode(ifcVCTool1->getRootNode()); this->ui.centerDockWidget->setWidget(viewer_widget); //IfcTreeWidget* ifc_tree_widget = new IfcTreeWidget(ifcVCTool1);
//dock->setWidget(ifc_tree_widget); }
main.cpp
#include "ifcproject_201907.h"
#include <QtWidgets/QApplication> int main(int argc, char *argv[])
{
QApplication a(argc, argv);
IFCProject_201907 w;
//w.show();
w.showMaximized();
return a.exec();
}
osg qt ifc的更多相关文章
- osg 渲染ifc数据-测试
直接使用osg渲染ifc数据,提高渲染速度. #include "teslamanage.h" #include <QtWidgets/QApplication> #i ...
- osg qt fbx ifc bim osg ive 3ds max rvt
项目环境变量配置 include E:\Qt\Qt5.12.2\5.12.2\msvc2017_64\include E:\OpenSourceGraph\OpenSceneGraph_install ...
- osg,qt编译的一些问题
osg编译例子的时候,打开文件就出问题,可能是一些不兼容的问题 qt编译的是时候要添加qt和vs2010的整合工具,这样才能把 vs2010里面的QTDIR变量和环境变量QTDIR关联起来 同是右击文 ...
- [原][osg][QT]osg与QT界面结合的简单例子二
//main.cpp #include "VREObliqueEditorQTWindow.h" #include <QtWidgets/QApplication> # ...
- [转][osg][QT]osg与QT界面结合的简单例子
//QT += core gui opengl //LIBS += -losgViewer -losgDB -losgUtil -losg -lOpenThreads -losgGA -losgQt ...
- OSG Qt Widget加载三维模型
graphicswindowqt.h #ifndef GRAPHICSWINDOWQT_H #define GRAPHICSWINDOWQT_H #include <QGLWidget> ...
- osg qt kdchart 开发施工过程模拟软件
void TeslaManage::initGanttModel() { ganttModel = , , this); ganttModel->setHeaderData(, Qt::Hori ...
- osg qt 三维模型加载
osg::ref_ptr<osg::Node> OSG_Qt_::operateMatrix() { osg::ref_ptr<osg::Group> group = new ...
- 关于OSG+QT+VS版本的问题
CMake3.10.0 Qt5.11.0安装包只有VS2017_64版本,没有VS2017的32位版本,有VS2015的32位版本 Qt5.11.0+osg3.4在CMake的时候,会出现 CMake ...
随机推荐
- Linux文件系统概览
三 Linux文件系统概览 3.1 Linux文件系统简介 在Linux操作系统中,所有被操作系统管理的资源,例如网络接口卡.磁盘驱动器.打印机.输入输出设备.普通文件或是目录都被看作是一个文件. 也 ...
- 【转】angular使用代理解决跨域
原文:https://www.cnblogs.com/sghy/p/9111293.html ----------------------------------------------------- ...
- 0014SpringBoot结合thymeleaf实现登录功能
该登录功能需要实现的需求如下: 1.输入用户名密码,如果验证通过,进入首页,并显示登录的用户名 2.如果验证不通过,则重新进入登录页面,并显示“用户名密码错误” 3.如果未经登录,不能直接访问首页等静 ...
- 解决在jenkins中无法打开robot framework report.html log.html的问题
问题描述: Opening Robot Framework report failed Verify that you have JavaScript enabled in your browser. ...
- 在 windows 上安装 git 2.15
下载 by win 下载地址:https://git-scm.com/download/win 如下图.选择对应的版本下载: 安装 by win 1.双击下载好的git安装包.弹出提示框.如下图: 2 ...
- Mybatis面向接口式编程
Mybatis面向接口编程 1.xml文件书写格式 <?xml version="1.0" encoding="UTF-8" ?> <!DOC ...
- MySQL 表之间的关系
表之间的关系 # 定义一张部门员工表 emp id name gander dep_name dep_desc 1 ming male 教学部 教书 2 lilei male 教学部 教书 3 ham ...
- codeforces#571Div2 D---Vus the Cossack and Numbers【贪心】
题目:http://codeforces.com/contest/1186/problem/D 题意:给定一个大小为$n$的浮点序列,这$n$个数的和为0. 现在对这个序列中的每个数,进行向上取整或向 ...
- CF891C Envy【最小生成树】
题目链接 我们知道,根据Kruskal的贪心,对于最小生成树,每一种权值的边数是一样的,而且如果将\(\leq x\)的边做最小生成树,合法方案的联通性是一样的.所以我们可以对于所有边分开考虑. 对于 ...
- 解决Ubuntu重启后,core_pattern失效问题——手动关闭apport
云主机重启后,core_pattern,即/proc/sys/kernel/core_pattern和/etc/sysctl*配置失效,被系统自动修改. 配置后,重启后core_pattern被重写 ...