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 ...
随机推荐
- Winform工程反编译后的工作
Winform工程,反编译后,虽然能用,但不太好用. 因为form并没有像原生的那样. 所以,需要几个步聚: 1. 用ResGen工具,把二进制资源文件还原为xml格式: ResGen fromXX. ...
- P2661 信息传递[最小环+边带权并查集]
题目来源:洛谷 题目描述 有 n 个同学(编号为 1 到 n )正在玩一个信息传递的游戏.在游戏里每人都有一个固定的信息传递对象,其中,编号为 i 的同学的信息传递对象是编号为 Ti 的同学. 游戏 ...
- .NET Core WebAPI IIS 部署问题
虽然建了 .NET Core 的项目,基本的一些功能也实现了,运行什么的也没有问题,但是一直没有直接发布. 今天就进行了发布测试,结果问题还是来了,只是你不去做自然就不会出现. 一.基本发布 1.先是 ...
- subline html5的快捷键
选择类 Ctrl+D 选中光标所占的文本,继续操作则会选中下一个相同的文本. Alt+F3 选中文本按下快捷键,即可一次性选择全部的相同文本进行同时编辑.举个栗子:快速选中并更改所有相同的变量名.函数 ...
- Selenium常用API的使用java语言之8-模拟鼠标操作
通过前面例子了解到,可以使用click()来模拟鼠标的单击操作,现在的Web产品中提供了更丰富的鼠标交互方式, 例如鼠标右击.双击.悬停.甚至是鼠标拖动等功能.在WebDriver中,将这些关于鼠标操 ...
- js关闭当前页面不弹出提示
window.top.opener=null; window.top.open('','_top');//top当前最顶层窗口.self表示当前打开的窗口 window.top.close(); 作用 ...
- junit报错
java.lang.RuntimeException: iwap 环境还没有初始化,请先调用IWapContext.init(). at com.nantian.ofpiwap.IWapContext ...
- git 切换远程已有分支
本地分支a,且没有分支b,想要切换到远程以后分支b 1. git remote update origin --prune 更新本地分支列表与远程一致 2. git branch 查看本地所有分支,是 ...
- Xmind8安装
现在新版安装极其简单.是deb安装包Xmind8安装小书匠 kindle 参照官网安装方法,在此记录下来,方便自己查找. 流程: 55ccaad0655d256ac5fb9fea8aa8569d.pn ...
- 基于JSON的接口测试框架
更多学习资料请加QQ群: 822601020获取 实现效果 需求场景: 公司微服务接口使用数字签名的方式, 使用Postman调试接口每次都需要修改源码将验签临时关闭, 但是关闭后,其他微服务不能正常 ...