/*****************************************************************************1* *2* Elmer, A Finite Element Software for Multiphysical Problems *3* *4* Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland *5* *6* This program is free software; you can redistribute it and/or *7* modify it under the terms of the GNU General Public License *8* as published by the Free Software Foundation; either version 2 *9* of the License, or (at your option) any later version. *10* *11* This program is distributed in the hope that it will be useful, *12* but WITHOUT ANY WARRANTY; without even the implied warranty of *13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *14* GNU General Public License for more details. *15* *16* You should have received a copy of the GNU General Public License *17* along with this program (in file fem/GPL-2); if not, write to the *18* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *19* Boston, MA 02110-1301, USA. *20* *21*****************************************************************************/2223/*****************************************************************************24* *25* ElmerGUI cadview *26* *27*****************************************************************************28* *29* Authors: Mikko Lyly, Juha Ruokolainen and Peter Råback *30* Email: [email protected] *31* Web: http://www.csc.fi/elmer *32* Address: CSC - IT Center for Science Ltd. *33* Keilaranta 14 *34* 02101 Espoo, Finland *35* *36* Original Date: 15 Mar 2008 *37* *38*****************************************************************************/3940#ifndef CADVIEW_H41#define CADVIEW_H4243#include <QHash>44#include <QMainWindow>454647#include "cadpreferences.h"4849namespace nglib {50#include "nglib.h"51}5253#include <TopoDS_Shape.hxx>54#include <Standard_Version.hxx>5556#if OCC_VERSION_HEX >= 0x06080057#include <BRepMesh_IncrementalMesh.hxx>58#endif5960#ifndef VTK_MAJOR_VERSION61#include "vtkVersionMacros.h"62#endif6364class QMenu;65class QAction;66#if VTK_MAJOR_VERSION >= 867class QVTKOpenGLNativeWidget;68#else69class QVTKWidget;70#endif71class vtkRenderer;72class vtkActor;73class vtkPolyData;74class vtkAppendPolyData;7576class pt {77public:78int n;79double x;80double y;81};8283class seg {84public:85int p0;86int p1;87int bc;88};8990class CadView : public QMainWindow {91Q_OBJECT9293public:94CadView(QWidget *parent = 0);95~CadView();9697QSize minimumSizeHint() const;98QSize sizeHint() const;99100#if VTK_MAJOR_VERSION >= 8101QVTKOpenGLNativeWidget* GetQVTKWidget();102#else103QVTKWidget* GetQVTKWidget();104#endif105106bool readFile(QString);107void generateSTL();108109void setMesh(nglib::Ng_Mesh *);110void setGeom(nglib::Ng_STL_Geometry *);111void setMp(nglib::Ng_Meshing_Parameters *);112void setDeflection(double);113double lengthOf(double *);114void differenceOf(double *, double *, double *);115int getFaceNumber(vtkActor *);116int getDim();117void generateIn2dFile();118119private slots:120void closeSlot();121void generateSTLSlot();122void cadPreferencesSlot();123void reloadSlot();124125private:126void createActions();127void createMenus();128void clearScreen();129TopoDS_Shape readBrep(QString);130TopoDS_Shape readStep(QString);131TopoDS_Shape readIges(QString);132void restrictMeshSizeLocal(nglib::Ng_Mesh *, vtkPolyData *, double, double);133134QMenu *fileMenu;135QMenu *modelMenu;136137QAction *exitAct;138QAction *reloadAct;139QAction *cadPreferencesAct;140141#if VTK_MAJOR_VERSION >= 8142QVTKOpenGLNativeWidget* qVTKWidget;143#else144QVTKWidget* qVTKWidget;145#endif146vtkRenderer* renderer;147148vtkAppendPolyData *stlSurfaceData;149vtkAppendPolyData *stlEdgeData;150151int numberOfFaces;152double modelLength;153154nglib::Ng_Mesh *mesh;155nglib::Ng_STL_Geometry *geom;156nglib::Ng_Meshing_Parameters *mp;157158CadPreferences *cadPreferences;159160QString fileName;161162QHash<vtkActor *, int> actorToFace;163164int modelDim;165166TopoDS_Shape shape;167};168169#endif // CADVIEW_H170171172