Path: blob/devel/ElmerGUI/Application/twod/renderarea.h
3203 views
/*****************************************************************************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 RenderArea *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*****************************************************************************/39#ifndef RENDERAREA_H40#define RENDERAREA_H4142#include <QWidget>43#include <QHash>4445class CurveEditor;46class QTableWidget;4748class Spline49{50public:51int out;52int in;53int np;54int p[3];55};5657class RenderArea : public QWidget58{59Q_OBJECT6061public:62RenderArea(QWidget *parent = 0);63~RenderArea();6465void setCurveEditor(CurveEditor *curveEditor);66void modifyPoint(int idx, double x, double y);67void modifyCurve(int idx, int in, int out, int np, int p1, int p2, int p3);68void updatePoints(QTableWidget *table);69void updateCurves(QTableWidget *table);7071public slots:72void fitSlot();73void readSlot(QString fileName);74void saveSlot(QString fileName);75void drawPointsSlot(bool state);76void drawSplinesSlot(bool state);77void drawTangentsSlot(bool state);78void drawPointNumbersSlot(bool state);79void drawSplineNumbersSlot(bool state);80void drawMaterialNumbersSlot(bool state);8182signals:83void statusMessage(QString message);8485protected:86void paintEvent(QPaintEvent *event);87void mousePressEvent(QMouseEvent *event);88void mouseReleaseEvent(QMouseEvent *event);89void mouseMoveEvent(QMouseEvent *event);90void wheelEvent(QWheelEvent *event);9192private:93QHash<int, QPointF> points;94QHash<int, Spline> splines;95QVector<int> bodies;96QRectF viewport;97QRectF renderport;98int selectedPoint;99int pointRadius;100QPointF mapToViewport(QPointF point) const;101QPointF mapToRenderport(QPointF point) const;102QPointF quadNurbs(double u, QPointF P0, QPointF P1, QPointF P2) const;103QPoint lastPos;104bool drawPoints;105bool drawSplines;106bool drawTangents;107bool drawPointNumbers;108bool drawSplineNumbers;109bool drawMaterialNumbers;110CurveEditor *curveEditor;111bool reading;112};113114#endif // RENDERAREA_H115116117