ceshi/plugins/CA_PreProcessing/PreProcessing.h

105 lines
3.7 KiB
C++

#ifndef PREPROCESSING_H
#define PREPROCESSING_H
#include<iostream>
#include <fstream>
#include<string>
#include<sstream>
#include<vtkProperty.h>
#include <vtkPolyDataMapper.h>
#include <vtkRenderWindow.h>
#include <vtkSphereSource.h>
#include "vtkCamera.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
#include "BuildGridSettingWidget.h"
#include "CuboidSettingWidget.h"
#include "RectangleSettingWidget.h"
#include "ImportGridSettingWidget.h"
#include<vtkPoints.h>
#include<vtkPolyData.h>
#include<vtkCellData.h>
#include<vtkCellArray.h>
#include<vtkQuad.h>
#include<vtkRenderWindowInteractor.h>
#include<vtkHexahedron.h>
#include <vtkAutoInit.h>
#include<vtkUnstructuredGrid.h>
#include<vtkDataSetMapper.h>
#include <public/services/PreProcessingService.h>
#include <public/services/ProjectManagerService.h>
#include <public/services/UiFrameService.h>
#include <public/services/VisualWidgetService.h>
#include <public/struct/Mesh.h>
using namespace std;
class PreProcessing:public QObject,public PreProcessingService
{
Q_OBJECT
public:
PreProcessing();
void test();
void generateRectangle(float x,float y,float ox,float oy,int type);
void generateCubiod(float x,float y, float z, float ox,float oy,float oz,int type);
void generateGrid(float maxgrid);
void importGrid(QString fileName);
vtkSmartPointer<vtkUnstructuredGrid> getGridStructure();
vtkSmartPointer<vtkUnstructuredGrid> getGridStructureOrigin();
vtkSmartPointer<vtkUnstructuredGrid> getPointStructure();
QVector<QSet<int> > getFaceToPoint();
QVector<QVector<int> > getFaceToCell();
vtkSmartPointer<vtkActor> getPointActor();
QMap<int, int> getCellIdToGridIdMap();
vtkSmartPointer<vtkSphereSource> getSphereSource();
bool isHaveStructured();
bool is3DType();
private:
bool buildquad(ifstream &elements, vtkSmartPointer<vtkCellArray> cells);
bool buildcells(ifstream &elements, vtkSmartPointer<vtkCellArray> cells, int state, vtkSmartPointer<vtkUnstructuredGrid> Grid);
private:
ProjectManagerService *m_projectManagerService;
VisualWidgetService *m_visualWidgetService;
UiFrameService *m_uiFrameService;
void setupTreeWidget();
BuildGridSettingWidget *m_buildGridSettingWidget;
CuboidSettingWidget *m_cuboidSettingWidget;
ImportGridSettingWidget *m_importGridSettingWidget;
RectangleSettingWidget *m_rectangleSettingWidget;
vtkSmartPointer<vtkActor> m_rectangleActor;
vtkSmartPointer<vtkActor> m_cubiodActor;
QVector<QSet<int>> m_faceToPoint;
QVector<QVector<int>> m_faceToCell;
QMap<int,int> m_cellIdToGridCellId;
vtkSmartPointer<vtkUnstructuredGrid> m_gridStructure;
vtkSmartPointer<vtkUnstructuredGrid> m_gridStructure_origin;
vtkSmartPointer<vtkUnstructuredGrid> m_pointStructure;
vtkSmartPointer<vtkActor> m_pointActor;
vtkSmartPointer<vtkSphereSource> m_sphereSource;
vtkSmartPointer<vtkActor> m_cellActor;
vtkSmartPointer<vtkActor> m_cellActor2;
int m_modelType;
int m_status;
float m_x,m_y,m_z;
float m_ox,m_oy,m_oz;
QMap<vtkSmartPointer<vtkActor>,QString>m_map;
void displayVertices(vtkSmartPointer<vtkRenderer> renderer, vtkSmartPointer<vtkUnstructuredGrid> grid);
void displayEdges(vtkSmartPointer<vtkRenderer> renderer, vtkSmartPointer<vtkUnstructuredGrid> grid);
void displayFaces(vtkSmartPointer<vtkRenderer> renderer, vtkSmartPointer<vtkUnstructuredGrid> grid);
// void readNASTRANFile(const QString &filename, QVector<Node> &nodes, QVector<Tetrahedron> &tetrahedrons, QVector<Hexahedron> &hexahedrons, QVector<Quad> &quads, QVector<Triangle> &triangles,int &faceNum);
};
#endif // PREPROCESSING_H