occview窗口类继承于Qwideget,用过Qt的QGraphicsview和Scene视图-场景架构的可以将occview窗口类看作是view和Scene的结合体。对3D环境中视图的平移、旋转、放缩等等全是通过occview类的鼠标事件实现的;而且生成的3D图元都是经过occview的交互式上下文来显示。下面是occview窗口类的代码。
一.h文件
#ifndef OCCVIEW_H
#define OCCVIEW_H
#include <QWidget>
#include <QWidget>
#include<QDebug>
#include<QVector>
#include<AIS_InteractiveContext.hxx>
#include<OpenGl_GraphicDriver.hxx>
#include<V3d_View.hxx>
#include<V3d_Viewer.hxx>
#include<WNT_Window.hxx>
#include<Quantity_NameOfColor.hxx>
#include<gp_Pnt2d.hxx>
#include<QpointF>
#include<TopoDS_Shape.hxx>
#include<ProjLib.hxx>
#include<ElSLib.hxx>
#include <AIS_Manipulator.hxx>
#include<TopoDS_Face.hxx>
#include<BRepBuilderAPI_MakeFace.hxx>
#include<AIS_Shape.hxx>
namespace Ui {
cla