1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
|
/*
* Copyright (C) 2008,2009,2010 Thorsten Liebig (Thorsten.Liebig@gmx.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _QCSXCAD_H_
#define _QCSXCAD_H_
#include <QMainWindow>
#include <QHash>
#include <QString>
#include "QCSXCAD_Global.h"
#include "ContinuousStructure.h"
class QVTKStructure;
class QCSPrimEditor;
class QCSPropEditor;
class QCSTreeWidget;
class QCSGridEditor;
class QParameterGui;
class QParameterSet;
class TiXmlNode;
class QCSXCAD_EXPORT QCSXCAD : public QMainWindow, public ContinuousStructure
{
Q_OBJECT
friend class export_X3D;
friend class export_pov;
public:
QCSXCAD(QWidget *parent=NULL);
virtual ~QCSXCAD();
enum ViewMode
{
VIEW_2D, VIEW_3D
};
// void SetFile(QString filename);
// void SetPath(QString path) {relPath=path;};
// QString GetFilename();
//StaticComplexGeometry* GetDiscGeometry() {return SCGeometry;};
QString GetGeometry();
virtual bool isGeometryValid();
virtual bool Write2XML(TiXmlNode* rootNode, bool parameterised=true);
virtual bool Write2XML(const char* file, bool parameterised=true);
virtual bool Write2XML(QString file, bool parameterised=true);
virtual bool ReadFile(QString filename);
bool ReadNode(TiXmlNode* root);
int GetCurrentProperty();
ParameterSet* GetParaSet();
static QString GetInfoString();
static QIcon GetLibIcon();
const QHash<QString,QString> &Get_BC() const { return m_BC; }
signals:
void modified(bool val);
public slots:
bool CheckGeometry();
void ImportGeometry();
void ExportGeometry();
void ExportGeometry_Povray();
void ExportGeometry_X3D(QString filename=QString());
//! Export geometry into a given directory and type
void ExportGeometry(QString dirname, int type);
void ExportGeometry_PolyDataVTK(QString dirname=QString());
void ExportGeometry_STL(QString dirname=QString());
void ExportGeometry_PLY(QString dirname=QString());
void ExportView2Image();
void EnableDiscModelRendering(bool val=true);
void Render();
virtual void clear();
void New();
void HideAll();
void ShowAll();
//! Enable/Disable 3D parallel projection for the 3D vtk viewer
void SetParallelProjection(bool val);
void BestView();
void setViewDir(int dir);
void setXY();
void setYZ();
void setZX();
void SetSimMode(int mode);
void GUIUpdate();
static void aboutQCSXCAD(QWidget* parent=0);
protected slots:
void Edit();
void Copy();
void ShowHide();
void Delete();
void NewBox();
void NewMultiBox();
void NewSphere();
void NewCylinder();
void NewPolygon();
void NewUserDefined();
void NewMaterial();
void NewMetal();
void NewExcitation();
void NewChargeBox();
void NewResBox();
void NewDumpBox();
void setModified();
void DetectEdges(int nu);
void View2D();
void View3D();
protected:
//read supported files, return the root to a CSX
TiXmlNode* ReadOpenEMS(TiXmlNode* openEMS);
void NewPrimitive(CSPrimitives* newPrim);
void NewProperty(CSProperties* newProp);
TiXmlNode* FindRootNode(TiXmlNode* node);
void SetVisibility2All(bool value);
bool m_RenderDiscModels;
QCSTreeWidget *CSTree;
QCSGridEditor* GridEditor;
QParameterSet* QParaSet;
QVTKStructure* StructureVTK;
QAction* viewPlane[3];
void BuildToolBar();
bool bModified;
ViewMode ViewLevel;
QAction* m_PPview;
int m_ViewDir;
int m_SimMode;
virtual void keyPressEvent(QKeyEvent * event);
QHash<QString,QString> m_BC; //!< boundary conditions
};
#endif //_QCSXCAD_H_
|