diff options
Diffstat (limited to 'lib/tqwtplot3d/include')
28 files changed, 2610 insertions, 0 deletions
diff --git a/lib/tqwtplot3d/include/qwt3d_autoptr.h b/lib/tqwtplot3d/include/qwt3d_autoptr.h new file mode 100644 index 0000000..15d46e5 --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_autoptr.h @@ -0,0 +1,75 @@ +#ifndef qwt3d_autoptr_h__2004_05_14_18_57_begin_guarded_code
+#define qwt3d_autoptr_h__2004_05_14_18_57_begin_guarded_code
+
+namespace Qwt3D
+{
+
+//! Simple Auto pointer providing deep copies for raw pointer
+/*!
+ Requirements: \n
+ virtual T* T::clone() const;\n
+ T::destroy() const;
+ virtual ~T() private/protected\n\n
+ clone() is necessary for the pointer to preserve polymorphic behaviour.
+ The pointer requires also heap based objects with regard to the template
+ argument in order to be able to get ownership and control over destruction.
+ */
+template <typename T>
+class qwt3d_ptr
+{
+public:
+ //! Standard ctor
+ explicit qwt3d_ptr(T* ptr = 0)
+ :rawptr_(ptr)
+ {
+ }
+ //! Dtor (calls T::destroy)
+ ~qwt3d_ptr()
+ {
+ destroyRawPtr();
+ }
+
+ //! Copy ctor (calls (virtual) clone())
+ qwt3d_ptr(qwt3d_ptr const& val)
+ {
+ rawptr_ = val.rawptr_->clone();
+ }
+
+ //! Assignment in the same spirit as copy ctor
+ qwt3d_ptr<T>& operator=(qwt3d_ptr const& val)
+ {
+ if (this == &val)
+ return *this;
+
+ destroyRawPtr();
+ rawptr_ = val.rawptr_->clone();
+
+ return *this;
+ }
+
+ //! It's a pointerlike object, isn't it ?
+ T* operator->() const
+ {
+ return rawptr_;
+ }
+
+ //! Dereferencing
+ T& operator*() const
+ {
+ return *rawptr_;
+ }
+
+
+private:
+ T* rawptr_;
+ void destroyRawPtr()
+ {
+ if (rawptr_)
+ rawptr_->destroy();
+ rawptr_ = 0;
+ }
+};
+
+} // ns
+
+#endif /* include guarded */
diff --git a/lib/tqwtplot3d/include/qwt3d_autoscaler.h b/lib/tqwtplot3d/include/qwt3d_autoscaler.h new file mode 100644 index 0000000..31c7497 --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_autoscaler.h @@ -0,0 +1,51 @@ +#ifndef __qwt3d_autoscaler_2003_08_18_12_05__
+#define __qwt3d_autoscaler_2003_08_18_12_05__
+
+#include <vector>
+#include "qwt3d_global.h"
+#include "qwt3d_autoptr.h"
+
+namespace Qwt3D
+{
+
+//! ABC for autoscaler
+class QWT3D_EXPORT AutoScaler
+{
+friend class qwt3d_ptr<AutoScaler>;
+protected:
+ //! Returns a new heap based object of the derived class.
+ virtual AutoScaler* clone() const = 0;
+ //! To implement from subclasses
+ virtual int execute(double& a, double& b, double start, double stop, int ivals) = 0;
+ virtual ~AutoScaler(){}
+
+private:
+ void destroy() const {delete this;} //!< Used by qwt3d_ptr
+};
+
+//! Automatic beautifying of linear scales
+class QWT3D_EXPORT LinearAutoScaler : public AutoScaler
+{
+friend class LinearScale;
+protected:
+ LinearAutoScaler();
+ explicit LinearAutoScaler(std::vector<double>& mantisses);
+ //! Returns a new heap based object utilized from qwt3d_ptr
+ AutoScaler* clone() const {return new LinearAutoScaler(*this);}
+ int execute(double& a, double& b, double start, double stop, int ivals);
+
+private:
+
+ double start_, stop_;
+ int intervals_;
+
+ void init(double start, double stop, int ivals);
+ double anchorvalue(double start, double mantisse, int exponent);
+ int segments(int& l_intervals, int& r_intervals, double start, double stop, double anchor, double mantissa, int exponent);
+ std::vector<double> mantissi_;
+};
+
+} // ns
+
+
+#endif
diff --git a/lib/tqwtplot3d/include/qwt3d_axis.h b/lib/tqwtplot3d/include/qwt3d_axis.h new file mode 100644 index 0000000..08c2928 --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_axis.h @@ -0,0 +1,131 @@ +#ifndef __AXIS_H__
+#define __AXIS_H__
+
+#include "qwt3d_autoptr.h"
+#include "qwt3d_label.h"
+#include "qwt3d_scale.h"
+#include "qwt3d_autoscaler.h"
+
+namespace Qwt3D
+{
+
+//! Autoscalable axis with caption.
+/*!
+ Axes are highly customizable especially in terms
+ of labeling and scaling.
+*/
+class QWT3D_EXPORT Axis : public Drawable
+{
+
+public:
+
+ Axis(); //!< Constructs standard axis
+ Axis(Qwt3D::Triple beg, Qwt3D::Triple end); //!< Constructs a new axis with specified limits
+ virtual ~Axis(); // dtor
+
+ virtual void draw(); //!< Draws axis
+
+ void setPosition(const Qwt3D::Triple& beg, const Qwt3D::Triple& end); //!< Positionate axis
+ void position(Qwt3D::Triple& beg, Qwt3D::Triple& end) const {beg = beg_; end = end_;} //!< Returns axis' position
+ Qwt3D::Triple begin() const { return beg_; } //!< Returns axis' beginning position
+ Qwt3D::Triple end() const { return end_; } //!< Returns axis' ending position
+ double length() const { return (end_-beg_).length(); } //!< Returns axis' length
+
+ void setTicLength(double majorl, double minorl); //!< Sets tics lengths in world coordinates
+ //! Returns tics lengths
+ void ticLength(double& majorl, double& minorl) const {majorl = lmaj_; minorl = lmin_;}
+ void setTicOrientation(double tx, double ty, double tz); //!< Sets tic orientation
+ void setTicOrientation(const Qwt3D::Triple& val); //!< Same function as above
+ Qwt3D::Triple ticOrientation() const { return orientation_;} //!< Returns tic orientation
+ void setSymmetricTics( bool b) { symtics_ = b;} //!< Sets two-sided tics (default is false)
+
+ //! Sets font for axis label
+ void setLabelFont(QString const& family, int pointSize, int weight = QFont::Normal, bool italic = false);
+ void setLabelFont(QFont const& font); //!< Sets font for axis label
+ QFont const& labelFont() const {return labelfont_;} //!< Returns current label font
+
+ void setLabelString(QString const& name); //!< Sets label content
+ void setLabelPosition(const Qwt3D::Triple& pos, Qwt3D::ANCHOR);
+ void setLabelColor(Qwt3D::RGBA col);
+ void setLabel(bool d) {drawLabel_ = d;} //!< Turns label drawing on or off
+ void adjustLabel(int val) {labelgap_ = val;} //!< Shifts label in device coordinates dependent on anchor;
+
+ void setScaling(bool d) {drawTics_ = d;} //!< Turns scale drawing on or off
+ bool scaling() const {return drawTics_;} //!< Returns, if scale drawing is on or off
+ void setScale(Qwt3D::SCALETYPE);
+ void setScale(Scale* item);
+ void setNumbers(bool d) {drawNumbers_ = d;} //!< Turns number drawing on or off
+ bool numbers() const {return drawNumbers_;} //!< Returns, if number drawing is on or off
+ void setNumberColor(Qwt3D::RGBA col); //!< Sets the color for axes numbers
+ Qwt3D::RGBA numberColor() const {return numbercolor_;} //!< Returns the color for axes numbers
+ //! Sets font for numbering
+ void setNumberFont(QString const& family, int pointSize, int weight = QFont::Normal, bool italic = false);
+ void setNumberFont(QFont const&); //!< Overloaded member, works like the above function
+ QFont const& numberFont() const {return numberfont_;} //!< Returns current numbering font
+ void setNumberAnchor(Qwt3D::ANCHOR a) { scaleNumberAnchor_ = a;} //!< Sets anchor position for numbers
+ void adjustNumbers(int val) {numbergap_ = val;} //!< Shifts axis numbers in device coordinates dependent on anchor;
+
+ void setAutoScale(bool val = true) {autoscale_ = val;} //!< Turns Autoscaling on or off
+ bool autoScale() const { return autoscale_;} //!< actual Autoscaling mode
+
+ void setMajors(int val); //!< Requests major intervals (maybe changed, if autoscaling is present)
+ void setMinors(int val); //!< Requests minor intervals
+ int majors() const { return majorintervals_; } //!< Returns number of major intervals
+ int minors() const { return minorintervals_; } //!< Returns number of minor intervals
+ Qwt3D::TripleField const& majorPositions() const {return majorpos_;} //!< Returns positions for actual major tics (also if invisible)
+ Qwt3D::TripleField const& minorPositions() const {return minorpos_;} //!< Returns positions for actual minor tics (also if invisible)
+
+ //! Sets line width for axis components
+ void setLineWidth(double val, double majfac = 0.9, double minfac = 0.5);
+ double lineWidth() const { return lineWidth_;} //!< Returns line width for axis body
+ double majLineWidth() const { return majLineWidth_;} //!< Returns Line width for major tics
+ double minLineWidth() const { return minLineWidth_;} //!< Returns Line width for minor tics
+
+ void setLimits(double start, double stop) {start_=start; stop_=stop;} //!< Sets interval
+ void limits(double& start, double& stop) const {start = start_; stop = stop_;} //!< Returns axis interval
+ void recalculateTics(); //!< Enforces recalculation of ticmark positions
+
+
+private:
+
+ void init();
+ void drawBase();
+ void drawTics();
+ void drawTicLabel(Qwt3D::Triple Pos, int mtic);
+ Qwt3D::Triple drawTic(Qwt3D::Triple nadir, double length);
+ void drawLabel();
+ bool prepTicCalculation(Triple& startpoint);
+
+ Qwt3D::Triple biggestNumberString();
+
+
+ Qwt3D::ANCHOR scaleNumberAnchor_;
+ Qwt3D::Label label_;
+ std::vector<Qwt3D::Label> markerLabel_;
+
+ Qwt3D::Triple beg_, end_;
+ Qwt3D::TripleField majorpos_, minorpos_; //! vectors, holding major resp. minor tic positions;
+
+ Qwt3D::Triple ncube_beg_, ncube_end_; //!< enclosing parallelepiped for axis numbering
+
+ double start_, stop_, autostart_, autostop_;
+ double lmaj_, lmin_;
+ Qwt3D::Triple orientation_;
+
+ int majorintervals_, minorintervals_;
+
+ double lineWidth_, majLineWidth_, minLineWidth_;
+ bool symtics_;
+ bool drawNumbers_, drawTics_, drawLabel_;
+ bool autoscale_;
+ QFont numberfont_, labelfont_;
+ Qwt3D::RGBA numbercolor_;
+
+ int numbergap_, labelgap_;
+
+ Qwt3D::qwt3d_ptr<Qwt3D::Scale> scale_;
+};
+
+} // ns
+
+#endif
diff --git a/lib/tqwtplot3d/include/qwt3d_color.h b/lib/tqwtplot3d/include/qwt3d_color.h new file mode 100644 index 0000000..23daf3f --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_color.h @@ -0,0 +1,63 @@ +#ifndef __COLORGENERATOR_H__
+#define __COLORGENERATOR_H__
+
+#include <qstring.h>
+#include "qwt3d_global.h"
+#include "qwt3d_types.h"
+
+namespace Qwt3D
+{
+
+//! Abstract base class for color functors
+/*!
+Use your own color model by providing an implementation of operator()(double x, double y, double z).
+Colors destructor has been declared \c protected, in order to use only heap based objects. Plot3D
+will handle the objects destruction.
+See StandardColor for an example
+*/
+class QWT3D_EXPORT Color
+{
+public:
+ virtual Qwt3D::RGBA operator()(double x, double y, double z) const = 0; //!< Implement your color model here
+ virtual Qwt3D::RGBA operator()(Qwt3D::Triple const& t) const {return this->operator()(t.x,t.y,t.z);}
+ //! Should create a color vector usable by ColorLegend. The default implementation returns his argument
+ virtual Qwt3D::ColorVector& createVector(Qwt3D::ColorVector& vec) { return vec; }
+
+ void destroy() const { delete this;}
+
+protected:
+ virtual ~Color(){} //!< Allow heap based objects only
+};
+
+
+
+class Plot3D;
+//! Standard color model for Plot3D - implements the data driven operator()(double x, double y, double z)
+/*!
+The class has a ColorVector representing z values, which will be used by operator()(double x, double y, double z)
+*/
+class QWT3D_EXPORT StandardColor : public Color
+{
+public:
+ //! Initializes with data and set up a ColorVector with a size of 100 z values (default);
+ explicit StandardColor(Qwt3D::Plot3D* data, unsigned size = 100);
+ Qwt3D::RGBA operator()(double x, double y, double z) const; //!< Receives z-dependend color from ColorVector
+ void setColorVector(Qwt3D::ColorVector const& cv);
+ void reset(unsigned size=100); //!< Resets the standard colors;
+ void setAlpha(double a); //!< Sets unitary alpha value for all colors
+ /**
+ \brief Creates color vector
+
+ Creates a color vector used by ColorLegend. This is essentially a copy from the internal used vector.
+ \return The vector created
+ */
+ Qwt3D::ColorVector& createVector(Qwt3D::ColorVector& vec) {vec = colors_; return vec;}
+
+protected:
+ Qwt3D::ColorVector colors_;
+ Qwt3D::Plot3D* data_;
+};
+
+} // ns
+
+#endif
diff --git a/lib/tqwtplot3d/include/qwt3d_colorlegend.h b/lib/tqwtplot3d/include/qwt3d_colorlegend.h new file mode 100644 index 0000000..186840c --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_colorlegend.h @@ -0,0 +1,77 @@ +#ifndef __PLANE_H__
+#define __PLANE_H__
+
+#include "qwt3d_global.h"
+#include "qwt3d_drawable.h"
+#include "qwt3d_axis.h"
+#include "qwt3d_color.h"
+
+namespace Qwt3D
+{
+
+//! A flat color legend
+/**
+ The class visualizes a ColorVector together with a scale (axis) and a caption. ColorLegends are vertical
+ or horizontal
+*/
+class QWT3D_EXPORT ColorLegend : public Drawable
+{
+
+public:
+
+ //! Possible anchor points for caption and axis
+ enum SCALEPOSITION
+ {
+ Top, //!< scale on top
+ Bottom, //!< scale on bottom
+ Left, //!< scale left
+ Right //!< scale right
+ };
+
+ //! Orientation of the legend
+ enum ORIENTATION
+ {
+ BottomTop, //!< Positionate the legend vertically, the lowest color index is on the bottom
+ LeftRight //!< Positionate the legend horizontally, the lowest color index is on left side
+ };
+
+ ColorLegend(); //!< Standard constructor
+
+ void draw(); //!< Draws the object. You should not use this explicitely - the function is called by updateGL().
+
+ void setRelPosition(Qwt3D::Tuple relMin, Qwt3D::Tuple relMax); //!< Sets the relative position of the legend inside widget
+ void setOrientation(ORIENTATION, SCALEPOSITION); //!< Sets legend orientation and scale position
+ void setLimits(double start, double stop); //!< Sets the limit of the scale.
+ void setMajors(int); //!< Sets scale major tics.
+ void setMinors(int); //!< Sets scale minor tics.
+ void drawScale(bool val) { showaxis_ = val; } //!< Sets whether a scale will be drawn.
+ void drawNumbers(bool val) { axis_.setNumbers(val); } //!< Sets whether the scale will have scale numbers.
+ void setAutoScale(bool val); //!< Sets, whether the axis is autoscaled or not.
+ void setScale(Qwt3D::Scale *scale); //!< Sets another scale
+ void setScale(Qwt3D::SCALETYPE); //!< Sets one of the predefined scale types
+
+ void setTitleString(QString const& s); //!< Sets the legends caption string.
+
+ //! Sets the legends caption font.
+ void setTitleFont(QString const& family, int pointSize, int weight = QFont::Normal, bool italic = false);
+
+ Qwt3D::ColorVector colors; //!< The color vector
+
+private:
+
+ Qwt3D::Label caption_;
+ Qwt3D::ParallelEpiped geometry() const { return pe_;}
+ void setGeometryInternal();
+
+ Qwt3D::ParallelEpiped pe_;
+ Qwt3D::Tuple relMin_, relMax_;
+ Qwt3D::Axis axis_;
+ SCALEPOSITION axisposition_;
+ ORIENTATION orientation_;
+
+ bool showaxis_;
+};
+
+} // ns
+
+#endif
diff --git a/lib/tqwtplot3d/include/qwt3d_coordsys.h b/lib/tqwtplot3d/include/qwt3d_coordsys.h new file mode 100644 index 0000000..8d536c1 --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_coordsys.h @@ -0,0 +1,100 @@ +#ifndef __COORDSYS_H__
+#define __COORDSYS_H__
+
+#include "qwt3d_axis.h"
+#include "qwt3d_colorlegend.h"
+
+namespace Qwt3D
+{
+
+//! A coordinate system with different styles (BOX, FRAME)
+class QWT3D_EXPORT CoordinateSystem : public Drawable
+{
+
+public:
+ explicit CoordinateSystem(Qwt3D::Triple blb = Qwt3D::Triple(0,0,0), Qwt3D::Triple ftr = Qwt3D::Triple(0,0,0), Qwt3D::COORDSTYLE = Qwt3D::BOX);
+ ~CoordinateSystem();
+
+ void init(Qwt3D::Triple beg = Qwt3D::Triple(0,0,0), Qwt3D::Triple end = Qwt3D::Triple(0,0,0));
+ //! Set style for the coordinate system (NOCOORD, FRAME or BOX)
+ void setStyle(Qwt3D::COORDSTYLE s, Qwt3D::AXIS frame_1 = Qwt3D::X1,
+ Qwt3D::AXIS frame_2 = Qwt3D::Y1,
+ Qwt3D::AXIS frame_3 = Qwt3D::Z1);
+ Qwt3D::COORDSTYLE style() const { return style_;} //!< Return style oft the coordinate system
+ void setPosition(Qwt3D::Triple first, Qwt3D::Triple second); //!< first == front_left_bottom, second == back_right_top
+
+ void setAxesColor(Qwt3D::RGBA val); //!< Set common color for all axes
+ //! Set common font for all axis numberings
+ void setNumberFont(QString const& family, int pointSize, int weight = QFont::Normal, bool italic = false);
+ //! Set common font for all axis numberings
+ void setNumberFont(QFont const& font);
+ //! Set common color for all axis numberings
+ void setNumberColor(Qwt3D::RGBA val);
+ void setStandardScale(); //!< Sets an linear axis with real number items
+
+ void adjustNumbers(int val); //!< Fine tunes distance between axis numbering and axis body
+ void adjustLabels(int val); //!< Fine tunes distance between axis label and axis body
+
+ //! Sets color for the grid lines
+ void setGridLinesColor(Qwt3D::RGBA val) {gridlinecolor_ = val;}
+
+ //! Set common font for all axis labels
+ void setLabelFont(QString const& family, int pointSize, int weight = QFont::Normal, bool italic = false);
+ //! Set common font for all axis labels
+ void setLabelFont(QFont const& font);
+ //! Set common color for all axis labels
+ void setLabelColor(Qwt3D::RGBA val);
+
+ //! Set line width for tic marks and axes
+ void setLineWidth(double val, double majfac = 0.9, double minfac = 0.5);
+ //! Set length for tic marks
+ void setTicLength(double major, double minor);
+
+ //! Switch autoscaling of axes
+ void setAutoScale(bool val = true);
+
+ Qwt3D::Triple first() const { return first_;}
+ Qwt3D::Triple second() const { return second_;}
+
+ void setAutoDecoration(bool val = true) {autodecoration_ = val;}
+ bool autoDecoration() const { return autodecoration_;}
+
+ void setLineSmooth(bool val = true) {smooth_ = val;} //!< draw smooth axes
+ bool lineSmooth() const {return smooth_;} //!< smooth axes ?
+
+ void draw();
+
+ //! Defines whether a grid between the major and/or minor tics should be drawn
+ void setGridLines(bool majors, bool minors, int sides = Qwt3D::NOSIDEGRID);
+ int grids() const {return sides_;} //!< Returns grids switched on
+
+ //! The vector of all12 axes - use them to set axis properties individually.
+ std::vector<Axis> axes;
+
+
+private:
+ void destroy();
+
+ Qwt3D::Triple first_, second_;
+ Qwt3D::COORDSTYLE style_;
+
+ Qwt3D::RGBA gridlinecolor_;
+
+ bool smooth_;
+
+ void chooseAxes();
+ void autoDecorateExposedAxis(Axis& ax, bool left);
+ void drawMajorGridLines(); //!< Draws a grid between the major tics on the site
+ void drawMinorGridLines(); //!< Draws a grid between the minor tics on the site
+ void drawMajorGridLines(Qwt3D::Axis&, Qwt3D::Axis&); //! Helper
+ void drawMinorGridLines(Qwt3D::Axis&, Qwt3D::Axis&); //! Helper
+ void recalculateAxesTics();
+
+ bool autodecoration_;
+ bool majorgridlines_, minorgridlines_;
+ int sides_;
+};
+
+} // ns
+
+#endif
diff --git a/lib/tqwtplot3d/include/qwt3d_drawable.h b/lib/tqwtplot3d/include/qwt3d_drawable.h new file mode 100644 index 0000000..4324d6c --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_drawable.h @@ -0,0 +1,66 @@ +#ifndef __DRAWABLE_H__
+#define __DRAWABLE_H__
+
+
+#include <list>
+#include "qwt3d_global.h"
+#include "qwt3d_types.h"
+#include "qwt3d_io_gl2ps.h"
+
+namespace Qwt3D
+{
+
+//! ABC for Drawables
+class QWT3D_EXPORT Drawable
+{
+
+public:
+
+ virtual ~Drawable() = 0;
+
+ virtual void draw();
+
+ virtual void saveGLState();
+ virtual void restoreGLState();
+
+ void attach(Drawable*);
+ void detach(Drawable*);
+ void detachAll();
+
+ virtual void setColor(double r, double g, double b, double a = 1);
+ virtual void setColor(Qwt3D::RGBA rgba);
+ Qwt3D::Triple relativePosition(Qwt3D::Triple rel);
+
+protected:
+
+ Qwt3D::RGBA color;
+ void Enable(GLenum what, GLboolean val);
+ Qwt3D::Triple ViewPort2World(Qwt3D::Triple win, bool* err = 0);
+ Qwt3D::Triple World2ViewPort(Qwt3D::Triple obj, bool* err = 0);
+
+ GLdouble modelMatrix[16];
+ GLdouble projMatrix[16];
+ GLint viewport[4];
+
+
+private:
+
+ GLboolean ls;
+ GLboolean pols;
+ GLint polmode[2];
+ GLfloat lw;
+ GLint blsrc, bldst;
+ GLdouble col[4];
+ GLint pattern, factor;
+ GLboolean sallowed;
+ GLboolean tex2d;
+ GLint matrixmode;
+ GLfloat poloffs[2];
+ GLboolean poloffsfill;
+
+ std::list<Drawable*> dlist;
+};
+
+} // ns
+
+#endif
diff --git a/lib/tqwtplot3d/include/qwt3d_enrichment.h b/lib/tqwtplot3d/include/qwt3d_enrichment.h new file mode 100644 index 0000000..e4d427a --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_enrichment.h @@ -0,0 +1,62 @@ +#ifndef qwt3d_enrichment_h__2004_02_23_19_24_begin_guarded_code
+#define qwt3d_enrichment_h__2004_02_23_19_24_begin_guarded_code
+
+#include "qwt3d_global.h"
+#include "qwt3d_types.h"
+
+namespace Qwt3D
+{
+
+class Plot3D;
+
+
+//! Abstract base class for data dependent visible user objects
+/**
+Enrichments provide a framework for user defined OPenGL objects. The base class has a pure virtuell
+function clone(). 2 additional functions are per default empty and could also get a new implementation
+in derived classes. They can be used for initialization issues or actions not depending on the related
+primitive.
+*/
+class QWT3D_EXPORT Enrichment
+{
+public:
+ enum TYPE{
+ VERTEXENRICHMENT,
+ EDGEENRICHMENT,
+ FACEENRICHMENT,
+ VOXELENRICHMENT
+ }; //!< Type of the Enrichment - only VERTEXENRICHMENT's are defined at this moment.
+
+ Enrichment() : plot(0) {}
+ virtual ~Enrichment(){}
+ virtual Enrichment* clone() const = 0; //!< The derived class should give back a new Derived(something) here
+ virtual void drawBegin(){}; //!< Empty per default. Can be overwritten.
+ virtual void drawEnd(){}; //!< Empty per default. Can be overwritten.
+ virtual void assign(Plot3D const& pl) {plot = &pl;} //!< Assign to existent plot;
+ virtual TYPE type() const = 0; //!< Overwrite
+
+protected:
+ const Plot3D* plot;
+};
+
+//! Abstract base class for vertex dependent visible user objects
+/**
+VertexEnrichments introduce a specialized draw routine for vertex dependent data.
+draw() is called, when the Plot realizes its internal OpenGL data representation
+for every Vertex associated to his argument.
+*/
+class QWT3D_EXPORT VertexEnrichment : public Enrichment
+{
+public:
+
+ VertexEnrichment() : Qwt3D::Enrichment() {}
+ virtual Enrichment* clone() const = 0; //!< The derived class should give back a new Derived(something) here
+ virtual void draw(Qwt3D::Triple const&) = 0; //!< Overwrite this
+ virtual TYPE type() const {return Qwt3D::Enrichment::VERTEXENRICHMENT;} //!< This gives VERTEXENRICHMENT
+};
+
+// todo EdgeEnrichment, FaceEnrichment, VoxelEnrichment etc.
+
+} // ns
+
+#endif
diff --git a/lib/tqwtplot3d/include/qwt3d_enrichment_std.h b/lib/tqwtplot3d/include/qwt3d_enrichment_std.h new file mode 100644 index 0000000..a17bf58 --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_enrichment_std.h @@ -0,0 +1,116 @@ +#ifndef qwt3d_enrichment_std_h__2004_02_23_19_25_begin_guarded_code
+#define qwt3d_enrichment_std_h__2004_02_23_19_25_begin_guarded_code
+
+#include "qwt3d_enrichment.h"
+
+namespace Qwt3D
+{
+
+class Plot3D;
+
+//! The Cross Hair Style
+class QWT3D_EXPORT CrossHair : public VertexEnrichment
+{
+public:
+ CrossHair();
+ CrossHair(double rad, double linewidth, bool smooth, bool boxed);
+
+ Qwt3D::Enrichment* clone() const {return new CrossHair(*this);}
+
+ void configure(double rad, double linewidth, bool smooth, bool boxed);
+ void drawBegin();
+ void drawEnd();
+ void draw(Qwt3D::Triple const&);
+
+private:
+ bool boxed_, smooth_;
+ double linewidth_, radius_;
+ GLboolean oldstate_;
+};
+
+//! The Point Style
+class QWT3D_EXPORT Dot : public VertexEnrichment
+{
+public:
+ Dot();
+ Dot(double pointsize, bool smooth);
+
+ Qwt3D::Enrichment* clone() const {return new Dot(*this);}
+
+ void configure(double pointsize, bool smooth);
+ void drawBegin();
+ void drawEnd();
+ void draw(Qwt3D::Triple const&);
+
+private:
+ bool smooth_;
+ double pointsize_;
+ GLboolean oldstate_;
+};
+
+//! The Cone Style
+class QWT3D_EXPORT Cone : public VertexEnrichment
+{
+public:
+ Cone();
+ Cone(double rad, unsigned quality);
+ ~Cone();
+
+ Qwt3D::Enrichment* clone() const {return new Cone(*this);}
+
+ void configure(double rad, unsigned quality);
+ void draw(Qwt3D::Triple const&);
+
+private:
+ GLUquadricObj *hat;
+ GLUquadricObj *disk;
+ unsigned quality_;
+ double radius_;
+ GLboolean oldstate_;
+};
+
+//! 3D vector field.
+/**
+ The class encapsulates a vector field including his OpenGL representation as arrow field.
+ The arrows can be configured in different aspects (color, shape, painting quality).
+
+*/
+class QWT3D_EXPORT Arrow : public VertexEnrichment
+{
+public:
+
+ Arrow();
+ ~Arrow();
+
+ Qwt3D::Enrichment* clone() const {return new Arrow(*this);}
+
+ void configure(int segs, double relconelength, double relconerad, double relstemrad);
+ void setQuality(int val) {segments_ = val;} //!< Set the number of faces for the arrow
+ void draw(Qwt3D::Triple const&);
+
+ void setTop(Qwt3D::Triple t){top_ = t;}
+ void setColor(Qwt3D::RGBA rgba) {rgba_ = rgba;}
+
+private:
+
+ GLUquadricObj *hat;
+ GLUquadricObj *disk;
+ GLUquadricObj *base;
+ GLUquadricObj *bottom;
+ GLboolean oldstate_;
+
+ double calcRotation(Qwt3D::Triple& axis, Qwt3D::FreeVector const& vec);
+
+ int segments_;
+ double rel_cone_length;
+
+ double rel_cone_radius;
+ double rel_stem_radius;
+
+ Qwt3D::Triple top_;
+ Qwt3D::RGBA rgba_;
+};
+
+} // ns
+
+#endif
diff --git a/lib/tqwtplot3d/include/qwt3d_function.h b/lib/tqwtplot3d/include/qwt3d_function.h new file mode 100644 index 0000000..4351920 --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_function.h @@ -0,0 +1,41 @@ +#ifndef qwt3d_function_h__2004_03_05_13_51_begin_guarded_code
+#define qwt3d_function_h__2004_03_05_13_51_begin_guarded_code
+
+#include "qwt3d_gridmapping.h"
+
+namespace Qwt3D
+{
+
+class SurfacePlot;
+
+//! Abstract base class for mathematical functions
+/**
+ A Function encapsulates a mathematical function with rectangular domain. The user has to adapt the pure virtual operator()
+ to get a working object. Also, the client code should call setDomain, setMesh and create for reasonable operating conditions.
+*/
+class QWT3D_EXPORT Function : public GridMapping
+{
+
+public:
+
+ Function(); //!< Constructs Function object w/o assigned SurfacePlot.
+ explicit Function(Qwt3D::SurfacePlot& plotWidget); //!< Constructs Function object and assigns a SurfacePlot
+ explicit Function(Qwt3D::SurfacePlot* plotWidget); //!< Constructs Function object and assigns a SurfacePlot
+ virtual double operator()(double x, double y) = 0; //!< Overwrite this.
+
+ void setMinZ(double val); //!< Sets minimal z value.
+ void setMaxZ(double val); //!< Sets maximal z value.
+
+ //! Assigns a new SurfacePlot and creates a data representation for it.
+ virtual bool create(Qwt3D::SurfacePlot& plotWidget);
+ //! Creates data representation for the actual assigned SurfacePlot.
+ virtual bool create();
+ //! Assigns the object to another widget. To see the changes, you have to call this function before create().
+ void assign(Qwt3D::SurfacePlot& plotWidget);
+ //! Assigns the object to another widget. To see the changes, you have to call this function before create().
+ void assign(Qwt3D::SurfacePlot* plotWidget);
+};
+
+} // ns
+
+#endif /* include guarded */
diff --git a/lib/tqwtplot3d/include/qwt3d_global.h b/lib/tqwtplot3d/include/qwt3d_global.h new file mode 100644 index 0000000..d759107 --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_global.h @@ -0,0 +1,58 @@ +#ifndef QWT3D_GLOBAL_H
+#define QWT3D_GLOBAL_H
+
+#include <qglobal.h>
+#if QT_VERSION < 0x040000
+#include <qmodules.h>
+#endif
+
+#define QWT3D_MAJOR_VERSION 0
+#define QWT3D_MINOR_VERSION 2
+#define QWT3D_PATCH_VERSION 6
+
+//
+// Create Qwt3d DLL if QWT3D_DLL is defined (Windows only)
+//
+
+#if defined(Q_WS_WIN)
+ #if defined(_MSC_VER) /* MSVC Compiler */
+ #pragma warning(disable: 4251) // dll interface required for stl templates
+ //pragma warning(disable: 4244) // 'conversion' conversion from 'type1' to 'type2', possible loss of data
+ #pragma warning(disable: 4786) // truncating debug info after 255 characters
+ #pragma warning(disable: 4660) // template-class specialization 'identifier' is already instantiated
+ #if (_MSC_VER >= 1400) /* VS8 - not sure about VC7 */
+ #pragma warning(disable: 4996) /* MS security enhancements */
+ #endif
+ #endif
+
+ #if defined(QWT3D_NODLL)
+ #undef QWT3D_MAKEDLL
+ #undef QWT3D_DLL
+ #undef QWT3D_TEMPLATEDLL
+ #endif
+
+ #ifdef QWT3D_DLL
+ #if defined(QWT3D_MAKEDLL) /* create a Qwt3d DLL library */
+ #undef QWT3D_DLL
+ #define QWT3D_EXPORT __declspec(dllexport)
+ #define QWT3D_TEMPLATEDLL
+ #endif
+ #endif
+
+ #if defined(QWT3D_DLL) /* use a Qwt3d DLL library */
+ #define QWT3D_EXPORT __declspec(dllimport)
+ #define QWT3D_TEMPLATEDLL
+ #endif
+
+#else // ! Q_WS_WIN
+ #undef QWT3D_MAKEDLL /* ignore these for other platforms */
+ #undef QWT3D_DLL
+ #undef QWT3D_TEMPLATEDLL
+#endif
+
+#ifndef QWT3D_EXPORT
+ #define QWT3D_EXPORT
+#endif
+
+
+#endif
diff --git a/lib/tqwtplot3d/include/qwt3d_graphplot.h b/lib/tqwtplot3d/include/qwt3d_graphplot.h new file mode 100644 index 0000000..a1ded9f --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_graphplot.h @@ -0,0 +1,24 @@ +#ifndef qwt3d_graphplot_h__2004_03_06_01_57_begin_guarded_code
+#define qwt3d_graphplot_h__2004_03_06_01_57_begin_guarded_code
+
+#include "qwt3d_plot.h"
+
+namespace Qwt3D
+{
+
+//! TODO
+class QWT3D_EXPORT GraphPlot : public Plot3D
+{
+// Q_OBJECT
+
+public:
+ GraphPlot( QWidget* parent = 0, const char* name = 0 );
+
+protected:
+ virtual void createData() = 0;
+};
+
+} // ns
+
+
+#endif
diff --git a/lib/tqwtplot3d/include/qwt3d_gridmapping.h b/lib/tqwtplot3d/include/qwt3d_gridmapping.h new file mode 100644 index 0000000..c7893e5 --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_gridmapping.h @@ -0,0 +1,34 @@ +#ifndef qwt3d_gridmapping_h__2004_03_06_12_31_begin_guarded_code
+#define qwt3d_gridmapping_h__2004_03_06_12_31_begin_guarded_code
+
+#include "qwt3d_mapping.h"
+
+namespace Qwt3D
+{
+
+class SurfacePlot;
+
+
+//! Abstract base class for mappings acting on rectangular grids
+/**
+
+*/
+class QWT3D_EXPORT GridMapping : public Mapping
+{
+public:
+ GridMapping(); //!< Constructs GridMapping object w/o assigned SurfacePlot.
+
+ void setMesh(unsigned int columns, unsigned int rows); //!< Sets number of rows and columns.
+ void setDomain(double minu, double maxu, double minv, double maxv); //!< Sets u-v domain boundaries.
+ void restrictRange(Qwt3D::ParallelEpiped const&); //!< Restrict the mappings range to the parallelepiped
+
+protected:
+ Qwt3D::ParallelEpiped range_p;
+ Qwt3D::SurfacePlot* plotwidget_p;
+ unsigned int umesh_p, vmesh_p;
+ double minu_p, maxu_p, minv_p, maxv_p;
+};
+
+} // ns
+
+#endif /* include guarded */
diff --git a/lib/tqwtplot3d/include/qwt3d_helper.h b/lib/tqwtplot3d/include/qwt3d_helper.h new file mode 100644 index 0000000..0c1bfd7 --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_helper.h @@ -0,0 +1,36 @@ +#ifndef __HELPER_H__
+#define __HELPER_H__
+
+#include <math.h>
+#include <float.h>
+#include <vector>
+#include <algorithm>
+
+namespace
+{
+ inline double Min_(double a, double b)
+ {
+ return (a<b) ? a : b;
+ }
+}
+
+namespace Qwt3D
+{
+
+inline bool isPracticallyZero(double a, double b = 0)
+{
+ if (!b)
+ return (fabs (a) <= DBL_MIN);
+
+ return (fabs (a - b) <= Min_(fabs(a), fabs(b))*DBL_EPSILON);
+}
+
+inline int round(double d)
+{
+ return (d>0) ? int(d+0.5) : int(d-0.5);
+}
+
+
+} //ns
+
+#endif
diff --git a/lib/tqwtplot3d/include/qwt3d_io.h b/lib/tqwtplot3d/include/qwt3d_io.h new file mode 100644 index 0000000..aa2cd1f --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_io.h @@ -0,0 +1,141 @@ +#ifndef __qwt3d_io_2003_07_04_23_27__
+#define __qwt3d_io_2003_07_04_23_27__
+
+#include <vector>
+#include <algorithm>
+
+#include <qstring.h>
+#include <qstringlist.h>
+#include "qwt3d_global.h"
+
+namespace Qwt3D
+{
+
+class Plot3D;
+/**
+IO provides a generic interface for standard and user written I/O handlers.
+It also provides functionality for the registering of such handlers in the
+framework.\n
+The interface mimics roughly Qt's QImageIO functions for defining
+image input/output functions.
+*/
+class QWT3D_EXPORT IO
+{
+
+public:
+ /*!
+ The function type that can be processed by the define... members.
+ An extension is the IO::Functor.
+ */
+ typedef bool (*Function)(Plot3D*, QString const& fname);
+
+
+ /*!
+ This class gives more flexibility in implementing
+ userdefined IO handlers than the simple IO::Function type.
+ */
+ class Functor
+ {
+ public:
+ virtual ~Functor() {}
+ /*! Must clone the content of *this for an object of a derived class with
+ \c new and return the pointer. Like operator() the predefined Functors
+ hide this function from the user, still allowing IO access
+ (friend declaration)
+ */
+ virtual Functor* clone() const = 0;
+ /*! The workhorse of the user-defined implementation. Eventually, the
+ framework will call this operator.
+ */
+ virtual bool operator()(Plot3D* plot, QString const& fname) = 0;
+ };
+
+ static bool defineInputHandler( QString const& format, Function func);
+ static bool defineOutputHandler( QString const& format, Function func);
+ static bool defineInputHandler( QString const& format, Functor const& func);
+ static bool defineOutputHandler( QString const& format, Functor const& func);
+ static bool save(Plot3D*, QString const& fname, QString const& format);
+ static bool load(Plot3D*, QString const& fname, QString const& format);
+ static QStringList inputFormatList();
+ static QStringList outputFormatList();
+ static Functor* outputHandler(QString const& format);
+ static Functor* inputHandler(QString const& format);
+
+private:
+ IO(){}
+
+ //! Lightweight Functor encapsulating an IO::Function
+ class Wrapper : public Functor
+ {
+ public:
+ //! Performs actual input
+ Functor* clone() const { return new Wrapper(*this); }
+ //! Creates a Wrapper object from a function pointer
+ explicit Wrapper(Function h) : hdl(h) {}
+ //! Returns a pointer to the wrapped function
+ bool operator()(Plot3D* plot, QString const& fname)
+ {
+ return (hdl) ? (*hdl)(plot, fname) : false;
+ }
+ private:
+ Function hdl;
+ };
+
+ struct Entry
+ {
+ Entry();
+ ~Entry();
+
+ Entry(Entry const& e);
+ void operator=(Entry const& e);
+
+ Entry(QString const& s, Functor const& f);
+ Entry(QString const& s, Function f);
+
+ QString fmt;
+ Functor* iofunc;
+ };
+
+ struct FormatCompare
+ {
+ explicit FormatCompare(Entry const& e);
+ bool operator() (Entry const& e);
+
+ Entry e_;
+ };
+
+ struct FormatCompare2
+ {
+ explicit FormatCompare2(QString s);
+ bool operator() (Entry const& e);
+
+ QString s_;
+ };
+
+ typedef std::vector<Entry> Container;
+ typedef Container::iterator IT;
+
+ static bool add_unique(Container& l, Entry const& e);
+ static IT find(Container& l, QString const& fmt);
+ static Container& rlist();
+ static Container& wlist();
+ static void setupHandler();
+};
+
+//! Provides Qt's Pixmap output facilities
+class QWT3D_EXPORT PixmapWriter : public IO::Functor
+{
+friend class IO;
+public:
+ PixmapWriter() : quality_(-1) {}
+ void setQuality(int val);
+private:
+ IO::Functor* clone() const {return new PixmapWriter(*this);}
+ bool operator()(Plot3D* plot, QString const& fname);
+ QString fmt_;
+ int quality_;
+};
+
+} //ns
+
+#endif
diff --git a/lib/tqwtplot3d/include/qwt3d_io_gl2ps.h b/lib/tqwtplot3d/include/qwt3d_io_gl2ps.h new file mode 100644 index 0000000..2bbeb43 --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_io_gl2ps.h @@ -0,0 +1,91 @@ +#ifndef qwt3d_io_gl2ps_h__2004_05_07_01_16_begin_guarded_code
+#define qwt3d_io_gl2ps_h__2004_05_07_01_16_begin_guarded_code
+
+#include <time.h>
+
+#if QT_VERSION < 0x040000
+#include <qgl.h>
+#else
+#include <QtOpenGL/qgl.h>
+#endif
+
+#include "qwt3d_types.h"
+#include "qwt3d_io.h"
+
+namespace Qwt3D
+{
+
+//! Provides EPS, PS, PDF and TeX output
+/*!
+
+ */
+class QWT3D_EXPORT VectorWriter : public IO::Functor
+{
+friend class IO;
+
+public:
+ //! The possible output formats for the text parts of the scene
+ enum TEXTMODE
+ {
+ PIXEL, //!< All text will be converted to pixmaps
+ NATIVE, //!< Text output in the native output format
+ TEX //!< Text output in additional LaTeX file as an overlay
+ };
+ //! The possible behaviour for landscape settings
+ enum LANDSCAPEMODE
+ {
+ ON, //!< Landscape mode on
+ OFF, //!< Landscape mode off
+ AUTO //!< The output orientation depends on the plot widgets aspect ratio (default)
+ };
+
+ //! The possible sorting types which are translated in gl2ps types
+ enum SORTMODE
+ {
+ NOSORT, //!< No sorting at all
+ SIMPLESORT, //!< A more simple (yet quicker) algorithm (default)
+ BSPSORT //!< BSP SORT (best and slow!)
+ };
+
+ VectorWriter();
+
+ void setLandscape(LANDSCAPEMODE val) {landscape_ = val;} //!< Sets landscape mode.
+ LANDSCAPEMODE landscape() const {return landscape_;} //!< Returns the current landscape mode
+
+ void setTextMode(TEXTMODE val, QString fname = "");
+ TEXTMODE textMode() const {return textmode_;} //!< Return current text output mode.
+
+
+ //! Sets one of the SORTMODE sorting modes.
+ void setSortMode(SORTMODE val) {sortmode_ = val;}
+ SORTMODE sortMode() const {return sortmode_;} //!< Returns gl2ps sorting type.
+ //! Turns compressed output on or off (no effect if zlib support is not available)
+ void setCompressed(bool val);
+ //! Returns compression mode (always false if zlib support has not been set)
+ bool compressed() const {return compressed_;}
+
+ bool setFormat(QString const& format);
+
+private:
+ IO::Functor* clone() const;
+ bool operator()(Plot3D* plot, QString const& fname);
+
+ GLint gl2ps_format_;
+ bool formaterror_;
+ bool compressed_;
+ SORTMODE sortmode_;
+ LANDSCAPEMODE landscape_;
+ TEXTMODE textmode_;
+ QString texfname_;
+};
+
+GLint setDeviceLineWidth(GLfloat val);
+GLint setDevicePointSize(GLfloat val);
+GLint drawDevicePixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
+GLint drawDeviceText(const char* str, const char* fontname, int fontsize, Qwt3D::Triple pos, Qwt3D::RGBA rgba, Qwt3D::ANCHOR align, double gap);
+void setDevicePolygonOffset(GLfloat factor, GLfloat units);
+
+
+} // ns
+
+#endif /* include guarded */
diff --git a/lib/tqwtplot3d/include/qwt3d_io_reader.h b/lib/tqwtplot3d/include/qwt3d_io_reader.h new file mode 100644 index 0000000..772946c --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_io_reader.h @@ -0,0 +1,35 @@ +#ifndef qwt3d_reader_h__2004_03_07_14_03_begin_guarded_code
+#define qwt3d_reader_h__2004_03_07_14_03_begin_guarded_code
+
+#include "qwt3d_io.h"
+
+namespace Qwt3D
+{
+
+/*!
+Functor for reading of native files containing grid data.
+As a standart input functor associated with "mes" and "MES"
+file extensions.
+*/
+class QWT3D_EXPORT NativeReader : public IO::Functor
+{
+friend class IO;
+
+public:
+ NativeReader();
+
+private:
+ //! Provides new NativeReader object.
+ IO::Functor* clone() const{return new NativeReader(*this);}
+ //! Performs actual input
+ bool operator()(Plot3D* plot, QString const& fname);
+ static const char* magicstring;
+ double minz_, maxz_;
+ bool collectInfo(FILE*& file, QString const& fname, unsigned& xmesh, unsigned& ymesh,
+ double& minx, double& maxx, double& miny, double& maxy);
+};
+
+
+} // ns
+
+#endif
diff --git a/lib/tqwtplot3d/include/qwt3d_label.h b/lib/tqwtplot3d/include/qwt3d_label.h new file mode 100644 index 0000000..debff42 --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_label.h @@ -0,0 +1,80 @@ +#ifndef __LABELPIXMAP_H__
+#define __LABELPIXMAP_H__
+
+#include <qpixmap.h>
+#include <qimage.h>
+#include <qfont.h>
+#include <qpainter.h>
+#include <qfontmetrics.h>
+
+#include "qwt3d_drawable.h"
+
+namespace Qwt3D
+{
+
+//! A Qt string or an output device dependent string
+class QWT3D_EXPORT Label : public Drawable
+{
+
+public:
+
+ Label();
+ //! Construct label and initialize with font
+ Label(const QString & family, int pointSize, int weight = QFont::Normal, bool italic = false);
+
+ //! Sets the labels font
+ void setFont(QString const& family, int pointSize, int weight = QFont::Normal, bool italic = false);
+
+ void adjust(int gap); //!< Fine tunes label;
+ double gap() const {return gap_;} //!< Returns the gap caused by adjust();
+ void setPosition(Qwt3D::Triple pos, ANCHOR a = BottomLeft); //!< Sets the labels position
+ void setRelPosition(Tuple rpos, ANCHOR a); //!< Sets the labels position relative to screen
+ Qwt3D::Triple first() const { return beg_;} //!< Receives bottom left label position
+ Qwt3D::Triple second() const { return end_;} //!< Receives top right label position
+ ANCHOR anchor() const { return anchor_; } //!< Defines an anchor point for the labels surrounding rectangle
+ virtual void setColor(double r, double g, double b, double a = 1);
+ virtual void setColor(Qwt3D::RGBA rgba);
+
+ /*!
+ \brief Sets the labels string
+ For unicode labeling (<tt> QChar(0x3c0) </tt> etc.) please look at <a href="http://www.unicode.org/charts/">www.unicode.org</a>.
+ */
+ void setString(QString const& s);
+ void draw(); //!< Actual drawing
+
+ /**
+ \brief Decides about use of PDF standard fonts for PDF output
+ If true, Label can use one of the PDF standard fonts (unprecise positioning for now),
+ otherwise it dumps pixmaps in the PDF stream (poor quality)
+ */
+ static void useDeviceFonts(bool val);
+
+
+private:
+
+ Qwt3D::Triple beg_, end_, pos_;
+ QPixmap pm_;
+ QImage buf_, tex_;
+ QFont font_;
+ QString text_;
+
+ ANCHOR anchor_;
+
+ void init();
+ void init(const QString & family, int pointSize, int weight = QFont::Normal, bool italic = false);
+ void update(); //!< Enforces an update of the internal pixmap
+ void convert2screen();
+ double width() const;
+ double height() const;
+
+ int gap_;
+
+ bool flagforupdate_;
+
+ static bool devicefonts_;
+
+};
+
+} // ns
+
+#endif
diff --git a/lib/tqwtplot3d/include/qwt3d_mapping.h b/lib/tqwtplot3d/include/qwt3d_mapping.h new file mode 100644 index 0000000..be10b87 --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_mapping.h @@ -0,0 +1,27 @@ +#ifndef qwt3d_mapping_h__2004_03_05_13_51_begin_guarded_code
+#define qwt3d_mapping_h__2004_03_05_13_51_begin_guarded_code
+
+#include <qstring.h>
+#include "qwt3d_global.h"
+#include "qwt3d_types.h"
+
+namespace Qwt3D
+{
+
+//! Abstract base class for general mappings
+/**
+
+*/
+class QWT3D_EXPORT Mapping
+{
+
+public:
+
+ virtual ~Mapping(){} //!< Destructor.
+ virtual QString name() const { return QString(""); } //!< Descriptive String.
+};
+
+
+} // ns
+
+#endif /* include guarded */
diff --git a/lib/tqwtplot3d/include/qwt3d_multiplot.h b/lib/tqwtplot3d/include/qwt3d_multiplot.h new file mode 100644 index 0000000..1678b70 --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_multiplot.h @@ -0,0 +1,24 @@ +#ifndef qwt3d_multiplot_h__2004_03_06_02_05_begin_guarded_code
+#define qwt3d_multiplot_h__2004_03_06_02_05_begin_guarded_code
+
+#include "qwt3d_plot.h"
+
+namespace Qwt3D
+{
+
+//! TODO
+class QWT3D_EXPORT MultiPlot : public Plot3D
+{
+// Q_OBJECT
+
+public:
+ MultiPlot( QWidget* parent = 0, const char* name = 0 ){}
+
+protected:
+ virtual void createData() = 0;
+};
+
+} // ns
+
+
+#endif
diff --git a/lib/tqwtplot3d/include/qwt3d_openglhelper.h b/lib/tqwtplot3d/include/qwt3d_openglhelper.h new file mode 100644 index 0000000..e5499c2 --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_openglhelper.h @@ -0,0 +1,130 @@ +#ifndef __openglhelper_2003_06_06_15_49__
+#define __openglhelper_2003_06_06_15_49__
+
+#include "qglobal.h"
+#if QT_VERSION < 0x040000
+#include <qgl.h>
+#else
+#include <QtOpenGL/qgl.h>
+#endif
+
+namespace Qwt3D
+{
+
+#ifndef QWT3D_NOT_FOR_DOXYGEN
+
+class GLStateBewarer
+{
+public:
+
+ GLStateBewarer(GLenum what, bool on, bool persist=false)
+ {
+ state_ = what;
+ stateval_ = glIsEnabled(what);
+ if (on)
+ turnOn(persist);
+ else
+ turnOff(persist);
+ }
+
+ ~GLStateBewarer()
+ {
+ if (stateval_)
+ glEnable(state_);
+ else
+ glDisable(state_);
+ }
+
+ void turnOn(bool persist = false)
+ {
+ glEnable(state_);
+ if (persist)
+ stateval_ = true;
+ }
+
+ void turnOff(bool persist = false)
+ {
+ glDisable(state_);
+ if (persist)
+ stateval_ = false;
+ }
+
+
+private:
+
+ GLenum state_;
+ bool stateval_;
+
+};
+
+inline const GLubyte* gl_error()
+{
+ GLenum errcode;
+ const GLubyte* err = 0;
+
+ if ((errcode = glGetError()) != GL_NO_ERROR)
+ {
+ err = gluErrorString(errcode);
+ }
+ return err;
+}
+
+inline void SaveGlDeleteLists(GLuint& lstidx, GLsizei range)
+{
+ if (glIsList(lstidx))
+ glDeleteLists(lstidx, range);
+ lstidx = 0;
+}
+
+//! get OpenGL transformation matrices
+/**
+ Don't rely on (use) this in display lists !
+ \param modelMatrix should be a GLdouble[16]
+ \param projMatrix should be a GLdouble[16]
+ \param viewport should be a GLint[4]
+*/
+inline void getMatrices(GLdouble* modelMatrix, GLdouble* projMatrix, GLint* viewport)
+{
+ glGetIntegerv(GL_VIEWPORT, viewport);
+ glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix);
+ glGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
+}
+
+//! simplified glut routine (glUnProject): windows coordinates_p --> object coordinates_p
+/**
+ Don't rely on (use) this in display lists !
+*/
+inline bool ViewPort2World(double& objx, double& objy, double& objz, double winx, double winy, double winz)
+{
+ GLdouble modelMatrix[16];
+ GLdouble projMatrix[16];
+ GLint viewport[4];
+
+ getMatrices(modelMatrix, projMatrix, viewport);
+ int res = gluUnProject(winx, winy, winz, modelMatrix, projMatrix, viewport, &objx, &objy, &objz);
+
+ return (res == GL_FALSE) ? false : true;
+}
+
+//! simplified glut routine (glProject): object coordinates_p --> windows coordinates_p
+/**
+ Don't rely on (use) this in display lists !
+*/
+inline bool World2ViewPort(double& winx, double& winy, double& winz, double objx, double objy, double objz )
+{
+ GLdouble modelMatrix[16];
+ GLdouble projMatrix[16];
+ GLint viewport[4];
+
+ getMatrices(modelMatrix, projMatrix, viewport);
+ int res = gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, &winx, &winy, &winz);
+
+ return (res == GL_FALSE) ? false : true;
+}
+
+
+#endif // QWT3D_NOT_FOR_DOXYGEN
+
+} // ns
+
+#endif
diff --git a/lib/tqwtplot3d/include/qwt3d_parametricsurface.h b/lib/tqwtplot3d/include/qwt3d_parametricsurface.h new file mode 100644 index 0000000..9bcdb9f --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_parametricsurface.h @@ -0,0 +1,44 @@ +#ifndef qwt3d_parametricsurface_h__2004_03_05_23_43_begin_guarded_code
+#define qwt3d_parametricsurface_h__2004_03_05_23_43_begin_guarded_code
+
+#include "qwt3d_gridmapping.h"
+
+namespace Qwt3D
+{
+
+class SurfacePlot;
+
+
+//! Abstract base class for parametric surfaces
+/**
+
+*/
+class QWT3D_EXPORT ParametricSurface : public GridMapping
+{
+
+public:
+ ParametricSurface(); //!< Constructs ParametricSurface object w/o assigned SurfacePlot.
+ //! Constructs ParametricSurface object and assigns a SurfacePlot
+ explicit ParametricSurface(Qwt3D::SurfacePlot& plotWidget);
+ //! Constructs ParametricSurface object and assigns a SurfacePlot
+ explicit ParametricSurface(Qwt3D::SurfacePlot* plotWidget);
+ //! Overwrite this
+ virtual Qwt3D::Triple operator()(double u, double v) = 0;
+ //! Assigns a new SurfacePlot and creates a data representation for it.
+ virtual bool create(Qwt3D::SurfacePlot& plotWidget);
+ //! Creates data representation for the actual assigned SurfacePlot.
+ virtual bool create();
+ //! Assigns the object to another widget. To see the changes, you have to call this function before create().
+ void assign(Qwt3D::SurfacePlot& plotWidget);
+ //! Assigns the object to another widget. To see the changes, you have to call this function before create().
+ void assign(Qwt3D::SurfacePlot* plotWidget);
+ //! Provide information about periodicity of the 'u' resp. 'v' domains.
+ void setPeriodic(bool u, bool v);
+
+private:
+ bool uperiodic_, vperiodic_;
+};
+
+} // ns
+
+#endif /* include guarded */
diff --git a/lib/tqwtplot3d/include/qwt3d_plot.h b/lib/tqwtplot3d/include/qwt3d_plot.h new file mode 100644 index 0000000..668b29c --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_plot.h @@ -0,0 +1,315 @@ +#ifndef __plot3d_2003_06_09_12_14__
+#define __plot3d_2003_06_09_12_14__
+
+#include "qwt3d_coordsys.h"
+#include "qwt3d_enrichment_std.h"
+
+namespace Qwt3D
+{
+
+//! Base class for all plotting widgets
+/*!
+ Plot3D handles all the common features for plotting widgets - coordinate system, transformations, mouse/keyboard
+ handling, labeling etc.. It contains some pure virtual functions and is, in so far, an abstract base class.
+ The class provides interfaces for data handling and implements basic data controlled color allocation.
+*/
+class QWT3D_EXPORT Plot3D : public QGLWidget
+{
+ Q_OBJECT
+
+public:
+
+#if QT_VERSION < 0x040000
+ Plot3D( QWidget* parent = 0, const char* name = 0 );
+#else
+ Plot3D ( QWidget * parent = 0, const QGLWidget * shareWidget = 0 );
+#endif
+ virtual ~Plot3D();
+
+ QPixmap renderPixmap (int w=0, int h=0, bool useContext=false);
+ void updateData(); //!< Recalculate data
+ void createCoordinateSystem(Qwt3D::Triple beg, Qwt3D::Triple end);
+ Qwt3D::CoordinateSystem* coordinates() { return &coordinates_p; } //!< Returns pointer to CoordinateSystem object
+ Qwt3D::ColorLegend* legend() { return &legend_;} //!< Returns pointer to ColorLegend object
+
+ double xRotation() const { return xRot_;} //!< Returns rotation around X axis [-360..360] (some angles are equivalent)
+ double yRotation() const { return yRot_;} //!< Returns rotation around Y axis [-360..360] (some angles are equivalent)
+ double zRotation() const { return zRot_;} //!< Returns rotation around Z axis [-360..360] (some angles are equivalent)
+
+ double xShift() const { return xShift_;} //!< Returns shift along X axis (object coordinates)
+ double yShift() const { return yShift_;} //!< Returns shift along Y axis (object coordinates)
+ double zShift() const { return zShift_;} //!< Returns shift along Z axis (object coordinates)
+
+ double xViewportShift() const { return xVPShift_;} //!< Returns relative shift [-1..1] along X axis (view coordinates)
+ double yViewportShift() const { return yVPShift_;} //!< Returns relative shift [-1..1] along Y axis (view coordinates)
+
+ double xScale() const { return xScale_;} //!< Returns scaling for X values [0..inf]
+ double yScale() const { return yScale_;} //!< Returns scaling for Y values [0..inf]
+ double zScale() const { return zScale_;} //!< Returns scaling for Z values [0..inf]
+
+ double zoom() const { return zoom_;} //!< Returns zoom (0..inf)
+
+ bool ortho() const { return ortho_; } //!< Returns orthogonal (true) or perspective (false) projection
+ void setPlotStyle( Qwt3D::PLOTSTYLE val);
+ Qwt3D::Enrichment* setPlotStyle( Qwt3D::Enrichment const& val);
+ Qwt3D::PLOTSTYLE plotStyle() const { return plotstyle_; }//!< Returns plotting style
+ //! Returns current Enrichment object used for plotting styles (if set, zero else)
+ Qwt3D::Enrichment* userStyle() const { return userplotstyle_p; }
+ void setShading( Qwt3D::SHADINGSTYLE val );
+ Qwt3D::SHADINGSTYLE shading() const { return shading_; }//!< Returns shading style
+ void setIsolines(int isolines);
+ int isolines() const { return isolines_;} //!< Returns number of isolines
+
+ void setSmoothMesh(bool val) {smoothdatamesh_p = val;} //!< Enables/disables smooth data mesh lines. Default is false
+ bool smoothDataMesh() const {return smoothdatamesh_p;} //!< True if mesh antialiasing is on
+ void setBackgroundColor(Qwt3D::RGBA rgba); //!< Sets widgets background color
+ Qwt3D::RGBA backgroundRGBAColor() const {return bgcolor_;} //!< Returns the widgets background color
+ void setMeshColor(Qwt3D::RGBA rgba); //!< Sets color for data mesh
+ Qwt3D::RGBA meshColor() const {return meshcolor_;} //!< Returns color for data mesh
+ void setMeshLineWidth(double lw); //!< Sets line width for data mesh
+ double meshLineWidth() const {return meshLineWidth_;} //!< Returns line width for data mesh
+ void setDataColor(Color* col); //!< Sets new data color object
+ const Color* dataColor() const {return datacolor_p;} //!< Returns data color object
+
+ virtual Qwt3D::Enrichment* addEnrichment(Qwt3D::Enrichment const&); //!< Add an Enrichment
+ virtual bool degrade(Qwt3D::Enrichment*); //!< Remove an Enrichment
+
+ Qwt3D::ParallelEpiped hull() const { return hull_;} //!< Returns rectangular hull
+
+ void showColorLegend(bool);
+
+ void setCoordinateStyle(Qwt3D::COORDSTYLE st); //!< Sets style of coordinate system.
+ void setPolygonOffset(double d);
+ double polygonOffset() const {return polygonOffset_;} //!< Returns relative value for polygon offset [0..1]
+
+ void setTitlePosition(double rely, double relx = 0.5, Qwt3D::ANCHOR = Qwt3D::TopCenter);
+ void setTitleFont(const QString& family, int pointSize, int weight = QFont::Normal, bool italic = false);
+ void setTitleColor(Qwt3D::RGBA col) {title_.setColor(col);} //!< Set caption color
+ void setTitle(const QString& title) {title_.setString(title);} //!< Set caption text (one row only)
+
+
+ void assignMouse(MouseState xrot, MouseState yrot, MouseState zrot,
+ MouseState xscale, MouseState yscale, MouseState zscale,
+ MouseState zoom, MouseState xshift, MouseState yshift);
+
+ bool mouseEnabled() const; //!< Returns true, if the widget accept mouse input from the user
+ void assignKeyboard(
+ KeyboardState xrot_n, KeyboardState xrot_p
+ ,KeyboardState yrot_n, KeyboardState yrot_p
+ ,KeyboardState zrot_n, KeyboardState zrot_p
+ ,KeyboardState xscale_n, KeyboardState xscale_p
+ ,KeyboardState yscale_n, KeyboardState yscale_p
+ ,KeyboardState zscale_n, KeyboardState zscale_p
+ ,KeyboardState zoom_n, KeyboardState zoom_p
+ ,KeyboardState xshift_n, KeyboardState xshift_p
+ ,KeyboardState yshift_n, KeyboardState yshift_p
+ );
+
+ bool keyboardEnabled() const; //!< Returns true, if the widget accept keyboard input from the user
+ //! Sets speed for keyboard driven transformations
+ void setKeySpeed(double rot, double scale, double shift);
+ //! Gets speed for keyboard driven transformations
+ void keySpeed(double& rot, double& scale, double& shift) const;
+
+ bool lightingEnabled() const; //!< Returns true, if Lighting is enabled, false else
+ //! Turn light on
+ void illuminate(unsigned light = 0);
+ //! Turn light off
+ void blowout(unsigned light = 0);
+
+ void setMaterialComponent(GLenum property, double r, double g, double b, double a = 1.0);
+ void setMaterialComponent(GLenum property, double intensity);
+ void setShininess(double exponent);
+ void setLightComponent(GLenum property, double r, double g, double b, double a = 1.0, unsigned light=0);
+ void setLightComponent(GLenum property, double intensity, unsigned light=0);
+
+ //! Returns Light 'idx' rotation around X axis [-360..360] (some angles are equivalent)
+ double xLightRotation(unsigned idx = 0) const { return (idx<8) ? lights_[idx].rot.x : 0;}
+ //! Returns Light 'idx' rotation around Y axis [-360..360] (some angles are equivalent)
+ double yLightRotation(unsigned idx = 0) const { return (idx<8) ? lights_[idx].rot.y : 0;}
+ //! Returns Light 'idx' rotation around Z axis [-360..360] (some angles are equivalent)
+ double zLightRotation(unsigned idx = 0) const { return (idx<8) ? lights_[idx].rot.z : 0;}
+
+ //! Returns shift of Light 'idx 'along X axis (object coordinates)
+ double xLightShift(unsigned idx = 0) const {return (idx<8) ? lights_[idx].shift.x : 0;}
+ //! Returns shift of Light 'idx 'along Y axis (object coordinates)
+ double yLightShift(unsigned idx = 0) const {return (idx<8) ? lights_[idx].shift.y : 0;}
+ //! Returns shift of Light 'idx 'along Z axis (object coordinates)
+ double zLightShift(unsigned idx = 0) const {return (idx<8) ? lights_[idx].shift.z : 0;}
+ //! Returns true if valid data available, false else
+ bool hasData() const { return (actualData_p) ? !actualData_p->empty() : false;}
+
+
+signals:
+
+ //! Emitted, if the rotation is changed
+ void rotationChanged( double xAngle, double yAngle, double zAngle );
+ //! Emitted, if the shift is changed
+ void shiftChanged( double xShift, double yShift, double zShift );
+ //! Emitted, if the viewport shift is changed
+ void vieportShiftChanged( double xShift, double yShift );
+ //! Emitted, if the scaling is changed
+ void scaleChanged( double xScale, double yScale, double zScale );
+ //! Emitted, if the zoom is changed
+ void zoomChanged(double);
+ //! Emitted, if the projection mode is changed
+ void projectionChanged(bool);
+
+public slots:
+
+ void setRotation( double xVal, double yVal, double zVal );
+ void setShift( double xVal, double yVal, double zVal );
+ void setViewportShift( double xVal, double yVal );
+ void setScale( double xVal, double yVal, double zVal );
+ void setZoom( double );
+
+ void setOrtho(bool);
+
+ void enableMouse(bool val=true); //!< Enable mouse input
+ void disableMouse(bool val =true); //!< Disable mouse input
+ void enableKeyboard(bool val=true); //!< Enable keyboard input
+ void disableKeyboard(bool val =true); //!< Disable keyboard input
+
+ void enableLighting(bool val = true); //!< Turn Lighting on or off
+ void disableLighting(bool val = true); //!< Turn Lighting on or off
+
+ void setLightRotation( double xVal, double yVal, double zVal, unsigned int idx = 0 );
+ void setLightShift( double xVal, double yVal, double zVal, unsigned int idx = 0 );
+
+ virtual bool savePixmap(QString const& fileName, QString const& format); //!< Saves content to pixmap format
+ //! Saves content to vector format
+ virtual bool saveVector(QString const& fileName, QString const& format, VectorWriter::TEXTMODE text, VectorWriter::SORTMODE sortmode);
+ virtual bool save(QString const& fileName, QString const& format); //!< Saves content
+
+protected:
+ typedef std::list<Qwt3D::Enrichment*> EnrichmentList;
+ typedef EnrichmentList::iterator ELIT;
+
+ void initializeGL();
+ void paintGL();
+ void resizeGL( int w, int h );
+
+ void mousePressEvent( QMouseEvent *e );
+ void mouseReleaseEvent( QMouseEvent *e );
+ void mouseMoveEvent( QMouseEvent *e );
+ void wheelEvent( QWheelEvent *e );
+
+ void keyPressEvent( QKeyEvent *e );
+
+ Qwt3D::CoordinateSystem coordinates_p;
+ Qwt3D::Color* datacolor_p;
+ Qwt3D::Enrichment* userplotstyle_p;
+ EnrichmentList elist_p;
+
+ virtual void calculateHull() = 0;
+ virtual void createData() = 0;
+ virtual void createEnrichment(Qwt3D::Enrichment&){}
+ virtual void createEnrichments();
+
+ void createCoordinateSystem();
+ void setHull(Qwt3D::ParallelEpiped p) {hull_ = p;}
+
+ bool initializedGL() const {return initializedGL_;}
+
+ enum OBJECTS
+ {
+ DataObject,
+ LegendObject,
+ NormalObject,
+ DisplayListSize // only to have a vector length ...
+ };
+ std::vector<GLuint> displaylists_p;
+ Qwt3D::Data* actualData_p;
+
+
+private:
+ struct Light
+ {
+ Light() : unlit(true){}
+ bool unlit;
+ Qwt3D::Triple rot;
+ Qwt3D::Triple shift;
+ };
+ std::vector<Light> lights_;
+
+ GLdouble xRot_, yRot_, zRot_, xShift_, yShift_, zShift_, zoom_
+ , xScale_, yScale_, zScale_, xVPShift_, yVPShift_;
+
+ Qwt3D::RGBA meshcolor_;
+ double meshLineWidth_;
+ Qwt3D::RGBA bgcolor_;
+ Qwt3D::PLOTSTYLE plotstyle_;
+ Qwt3D::SHADINGSTYLE shading_;
+ Qwt3D::FLOORSTYLE floorstyle_;
+ bool ortho_;
+ double polygonOffset_;
+ int isolines_;
+ bool displaylegend_;
+ bool smoothdatamesh_p;
+
+ Qwt3D::ParallelEpiped hull_;
+
+ Qwt3D::ColorLegend legend_;
+
+ Label title_;
+ Qwt3D::Tuple titlerel_;
+ Qwt3D::ANCHOR titleanchor_;
+
+
+ // mouse
+
+ QPoint lastMouseMovePosition_;
+ bool mpressed_;
+
+ MouseState xrot_mstate_,
+ yrot_mstate_,
+ zrot_mstate_,
+ xscale_mstate_,
+ yscale_mstate_,
+ zscale_mstate_,
+ zoom_mstate_,
+ xshift_mstate_,
+ yshift_mstate_;
+
+ bool mouse_input_enabled_;
+
+ void setRotationMouse(MouseState bstate, double accel, QPoint diff);
+ void setScaleMouse(MouseState bstate, double accel, QPoint diff);
+ void setShiftMouse(MouseState bstate, double accel, QPoint diff);
+
+ // keyboard
+
+ bool kpressed_;
+
+ KeyboardState xrot_kstate_[2],
+ yrot_kstate_[2],
+ zrot_kstate_[2],
+ xscale_kstate_[2],
+ yscale_kstate_[2],
+ zscale_kstate_[2],
+ zoom_kstate_[2],
+ xshift_kstate_[2],
+ yshift_kstate_[2];
+
+ bool kbd_input_enabled_;
+ double kbd_rot_speed_, kbd_scale_speed_, kbd_shift_speed_;
+
+ void setRotationKeyboard(KeyboardState kseq, double speed);
+ void setScaleKeyboard(KeyboardState kseq, double speed);
+ void setShiftKeyboard(KeyboardState kseq, double speed);
+
+
+
+ bool lighting_enabled_;
+ void applyLight(unsigned idx);
+ void applyLights();
+
+ bool initializedGL_;
+ bool renderpixmaprequest_;
+};
+
+
+} // ns
+
+
+#endif
diff --git a/lib/tqwtplot3d/include/qwt3d_portability.h b/lib/tqwtplot3d/include/qwt3d_portability.h new file mode 100644 index 0000000..e6a6d9d --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_portability.h @@ -0,0 +1,91 @@ +#ifndef qwt3d_portability_h__2005_07_02_11_55_begin_guarded_code
+#define qwt3d_portability_h__2005_07_02_11_55_begin_guarded_code
+
+//! Portability classes providing transparent Qt3/4 support
+
+#include <qnamespace.h>
+#include "qwt3d_global.h"
+
+#if QT_VERSION < 0x040000
+
+namespace Qwt3D
+{
+ #define QWT3DLOCAL8BIT(qstring) \
+ ((const char*)(qstring.local8Bit()))
+
+ typedef int MouseState;
+ typedef int KeyboardState;
+ const Qt::TextFlags SingleLine = Qt::SingleLine;
+} // ns
+
+
+#else // Qt4
+
+#include <QMouseEvent>
+
+namespace Qwt3D
+{
+
+ #define QWT3DLOCAL8BIT(qstring) \
+ ((const char*)(qstring.toLocal8Bit()))
+
+ const Qt::TextFlag SingleLine = Qt::TextSingleLine;
+
+ //! This class creates a (mouse-button,modifier) pair (ordinary typedef for int if Qt3 is used)
+ class MouseState
+ {
+ public:
+ MouseState(Qt::MouseButtons mb = Qt::NoButton, Qt::KeyboardModifiers km = Qt::NoModifier)
+ : mb_(mb), km_(km)
+ {
+ }
+
+ MouseState(Qt::MouseButton mb, Qt::KeyboardModifiers km = Qt::NoModifier)
+ : mb_(mb), km_(km)
+ {
+ }
+
+ bool operator==(const MouseState& ms)
+ {
+ return mb_ == ms.mb_ && km_ == ms.km_;
+ }
+
+ bool operator!=(const MouseState& ms)
+ {
+ return !operator==(ms);
+ }
+
+ private:
+ Qt::MouseButtons mb_;
+ Qt::KeyboardModifiers km_;
+ };
+
+ //! This class creates a (key-button,modifier) pair (ordinary typedef for int if Qt3 is used)
+ class KeyboardState
+ {
+ public:
+ KeyboardState(int key = Qt::Key_unknown, Qt::KeyboardModifiers km = Qt::NoModifier)
+ : key_(key), km_(km)
+ {
+ }
+
+ bool operator==(const KeyboardState& ms)
+ {
+ return key_ == ms.key_ && km_ == ms.km_;
+ }
+
+ bool operator!=(const KeyboardState& ms)
+ {
+ return !operator==(ms);
+ }
+
+ private:
+ int key_;
+ Qt::KeyboardModifiers km_;
+ };
+} // ns
+
+#endif
+
+
+#endif
diff --git a/lib/tqwtplot3d/include/qwt3d_scale.h b/lib/tqwtplot3d/include/qwt3d_scale.h new file mode 100644 index 0000000..d6619ec --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_scale.h @@ -0,0 +1,87 @@ +#ifndef qwt3d_scale_h__2004_06_02_22_02_begin_guarded_code
+#define qwt3d_scale_h__2004_06_02_22_02_begin_guarded_code
+
+#include <qstring.h>
+#include "qwt3d_types.h"
+#include "qwt3d_autoscaler.h"
+#include "qwt3d_autoptr.h"
+
+namespace Qwt3D
+{
+
+/*!
+The class encapsulates non-visual scales.
+She is utilized by Axis and also collaborates closely with AutoScaler.
+A Scale allows control over all aspects of tic generation including
+arbitrary transformations of tic values into corresponding strings.
+The strings contain what eventually will be shown as tic labels.\n
+Standard linear and logarithmic scales have been integrated yet into the Axis
+interface. User-defined axes can be derived from Scale, LinearScale et al.
+*/
+class QWT3D_EXPORT Scale
+{
+ friend class Axis;
+ friend class qwt3d_ptr<Scale>;
+
+ protected:
+ Scale();
+ virtual ~Scale(){}
+ virtual QString ticLabel(unsigned int idx) const;
+
+ virtual void setLimits(double start, double stop);
+ virtual void setMajors(int val) {majorintervals_p=val;} //!< Sets number of major intervals
+ virtual void setMinors(int val) {minorintervals_p=val;} //!< Sets number of minor intervals per major interval
+ virtual void setMajorLimits(double start, double stop);
+
+ int majors() const {return majorintervals_p;} //!< Returns major intervals
+ int minors() const {return minorintervals_p;} //!< Returns minor intervals
+
+ //! Derived classes should return a new heap based object here.
+ virtual Scale* clone() const = 0;
+ //! This function should setup the 2 vectors for major and minor positions;
+ virtual void calculate() = 0;
+ virtual int autoscale(double& a, double& b, double start, double stop, int ivals);
+
+ std::vector<double> majors_p, minors_p;
+ double start_p, stop_p;
+ int majorintervals_p, minorintervals_p;
+ double mstart_p, mstop_p;
+
+ private:
+ void destroy() const {delete this;} //!< Used by qwt3d_ptr
+};
+
+//! The standard (1:1) mapping class for axis numbering
+class QWT3D_EXPORT LinearScale : public Scale
+{
+ friend class Axis;
+ friend class qwt3d_ptr<Scale>;
+protected:
+ int autoscale(double& a, double& b, double start, double stop, int ivals);
+ //! Returns a new heap based object utilized from qwt3d_ptr
+ Scale* clone() const {return new LinearScale(*this);}
+ void calculate();
+ LinearAutoScaler autoscaler_p;
+};
+
+//! log10 scale
+class QWT3D_EXPORT LogScale : public Scale
+{
+ friend class Axis;
+ friend class qwt3d_ptr<Scale>;
+protected:
+ QString ticLabel(unsigned int idx) const;
+ void setMinors(int val);
+ //! Standard ctor
+ LogScale();
+ //! Returns a new heap based object utilized from qwt3d_ptr
+ Scale* clone() const {return new LogScale;}
+ void calculate();
+private:
+ void setupCounter(double& k, int& step);
+};
+
+} // namespace Qwt3D
+
+
+#endif /* include guarded */
diff --git a/lib/tqwtplot3d/include/qwt3d_surfaceplot.h b/lib/tqwtplot3d/include/qwt3d_surfaceplot.h new file mode 100644 index 0000000..f84f2df --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_surfaceplot.h @@ -0,0 +1,132 @@ +#ifndef qwt3d_SurfacePlot_h__2004_03_05_11_36_begin_guarded_code
+#define qwt3d_SurfacePlot_h__2004_03_05_11_36_begin_guarded_code
+
+#include "qwt3d_plot.h"
+
+namespace Qwt3D
+{
+//! A class representing Surfaces
+/**
+ A SurfacePlot ...
+
+*/
+class QWT3D_EXPORT SurfacePlot : public Plot3D
+{
+ Q_OBJECT
+
+public:
+#if QT_VERSION < 0x040000
+ SurfacePlot( QWidget* parent = 0, const char* name = 0 );
+#else
+ SurfacePlot( QWidget * parent = 0, const QGLWidget * shareWidget = 0 );
+#endif
+ ~SurfacePlot();
+ void updateNormals(); //!< Recalculates surface normals;
+ int resolution() const {return resolution_p;} //!< Returns data resolution (1 means all data)
+ std::pair<int,int> facets() const; //!< Returns the number of mesh cells for the ORIGINAL data
+ bool loadFromData(Qwt3D::Triple** data, unsigned int columns, unsigned int rows
+ , bool uperiodic = false, bool vperiodic = false);
+ bool loadFromData(double** data, unsigned int columns, unsigned int rows
+ ,double minx, double maxx, double miny, double maxy);
+ bool loadFromData(Qwt3D::TripleField const& data, Qwt3D::CellField const& poly);
+
+
+ //! Equivalent to loadFromData();
+ /**
+ \deprecated Use loadFromData instead
+ */
+ bool createDataRepresentation(Qwt3D::Triple** data, unsigned int columns, unsigned int rows
+ , bool uperiodic = false, bool vperiodic = false)
+ {
+ return loadFromData(data, columns, rows, uperiodic, vperiodic);
+ }
+ //! Equivalent to loadFromData();
+ /**
+ \deprecated Use loadFromData instead
+ */
+ bool createDataRepresentation(double** data, unsigned int columns, unsigned int rows
+ ,double minx, double maxx, double miny, double maxy)
+ {
+ return loadFromData(data, columns, rows, minx, maxx, miny, maxy);
+ }
+ //! Equivalent to loadFromData();
+ /**
+ \deprecated Use loadFromData instead
+ */
+ bool createDataRepresentation(Qwt3D::TripleField const& data, Qwt3D::CellField const& poly)
+ {
+ return loadFromData(data, poly);
+ }
+
+
+ Qwt3D::FLOORSTYLE floorStyle() const { return floorstyle_;} //!< Return floor style
+ void setFloorStyle( Qwt3D::FLOORSTYLE val ) {floorstyle_ = val;} //!< Sets floor style
+ void showNormals(bool); //!< Draw normals to every vertex
+ bool normals() const { return datanormals_p;} //!< Returns \c true, if normal drawing is on
+
+ void setNormalLength(double val); //!< Sets length of normals in percent per hull diagonale
+ double normalLength() const { return normalLength_p; }//!< Returns relative length of normals
+ void setNormalQuality(int val); //!< Increases plotting quality of normal arrows
+ int normalQuality() const { return normalQuality_p; }//!< Returns plotting quality of normal arrows
+
+
+signals:
+ void resolutionChanged(int);
+
+public slots:
+ void setResolution( int );
+
+protected:
+ bool datanormals_p;
+ double normalLength_p;
+ int normalQuality_p;
+
+ virtual void calculateHull();
+ virtual void createData();
+ virtual void createEnrichment(Qwt3D::Enrichment& p);
+ virtual void createFloorData();
+ void createNormals();
+ void createPoints();
+
+ int resolution_p;
+
+ void readIn(Qwt3D::GridData& gdata, Triple** data, unsigned int columns, unsigned int rows);
+ void readIn(Qwt3D::GridData& gdata, double** data, unsigned int columns, unsigned int rows,
+ double minx, double maxx, double miny, double maxy);
+ void calcNormals(GridData& gdata);
+ void sewPeriodic(GridData& gdata);
+
+ //void calcLowResolution();
+private:
+
+ void Data2Floor();
+ void Isolines2Floor();
+
+ Qwt3D::FLOORSTYLE floorstyle_;
+
+ // grid plot
+
+ Qwt3D::GridData* actualDataG_;
+ virtual void createDataG();
+ virtual void createFloorDataG();
+ void createNormalsG();
+ void Data2FloorG();
+ void Isolines2FloorG();
+ void setColorFromVertexG(int ix, int iy, bool skip = false);
+
+
+ // mesh plot
+
+ Qwt3D::CellData* actualDataC_;
+ virtual void createDataC();
+ virtual void createFloorDataC();
+ void createNormalsC();
+ void Data2FloorC();
+ void Isolines2FloorC();
+ void setColorFromVertexC(int node, bool skip = false);
+};
+
+} // ns
+
+
+#endif
diff --git a/lib/tqwtplot3d/include/qwt3d_types.h b/lib/tqwtplot3d/include/qwt3d_types.h new file mode 100644 index 0000000..63f27d1 --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_types.h @@ -0,0 +1,455 @@ +#if defined(_MSC_VER) /* MSVC Compiler */
+#pragma warning ( disable : 4786 )
+#endif
+
+#ifndef __DATATYPES_H__
+#define __DATATYPES_H__
+
+#ifdef _DEBUG
+ #include <fstream>
+#endif
+
+#include <string>
+
+#include "qwt3d_global.h"
+
+#if defined(Q_WS_WIN)
+ #include <windows.h>
+#endif
+
+#ifndef WHEEL_DELTA
+ #define WHEEL_DELTA 120
+#endif
+
+#include "qwt3d_portability.h"
+#include "qwt3d_helper.h"
+#include "qwt3d_openglhelper.h"
+
+//! Common namespace for all QwtPlot3D classes
+namespace Qwt3D
+{
+
+const double PI = 3.14159265358979323846264338328;
+
+//! Plotting style
+enum PLOTSTYLE
+{
+ NOPLOT , //!< No visible data
+ WIREFRAME , //!< Wireframe style
+ HIDDENLINE , //!< Hidden Line style
+ FILLED , //!< Color filled polygons w/o edges
+ FILLEDMESH , //!< Color filled polygons w/ separately colored edges
+ POINTS , //!< User defined style (used by Enrichments)
+ USER //!< User defined style (used by Enrichments)
+};
+
+//! Shading style
+enum SHADINGSTYLE
+{
+ FLAT, //!< Flat shading (OpenGL)
+ GOURAUD //!< Gouraud Shading (OpenGL)
+};
+
+//! Style of Coordinate system
+enum COORDSTYLE
+{
+ NOCOORD, //!< Coordinate system is not visible
+ BOX, //!< Boxed
+ FRAME //!< Frame - 3 visible axes
+};
+
+//! Different types of axis scales
+enum SCALETYPE
+{
+ LINEARSCALE,//!< Linear scaling
+ LOG10SCALE, //!< Logarithmic scaling (base 10)
+ USERSCALE //!< User-defined (for extensions)
+};
+
+//! Plotting style for floor data (projections)
+enum FLOORSTYLE
+{
+ NOFLOOR, //!< Empty floor
+ FLOORISO, //!< Isoline projections visible
+ FLOORDATA //!< Projected polygons visible
+};
+
+//! Mesh type
+enum DATATYPE
+{
+ GRID, //!< Rectangular grid
+ POLYGON //!< Convex polygon
+};
+
+//! The 12 axes
+/**
+\image html axes.png
+*/
+enum AXIS
+{
+ X1 = 0, //!< 1st x-axis
+ X2 = 3, //!< 2nd x-axis
+ X3 = 4, //!< 3th x-axis
+ X4 = 5, //!< 4th x-axis
+ Y1 = 1, //!< 1st y-axis
+ Y2 = 8, //!< 2nd y-axis
+ Y3 = 7, //!< 3th y-axis
+ Y4 = 6, //!< 4th y-axis
+ Z1 = 2, //!< 1st z-axis
+ Z2 = 9, //!< 2nd z-axis
+ Z3 = 11, //!< 3th z-axis
+ Z4 = 10 //!< 4th z-axis
+};
+
+//! The 6 sides
+enum SIDE
+{
+ NOSIDEGRID = 0,
+ LEFT = 1 << 0,
+ RIGHT = 1 << 1,
+ CEIL = 1 << 2,
+ FLOOR = 1 << 3,
+ FRONT = 1 << 4,
+ BACK = 1 << 5
+};
+
+//! Possible anchor points for drawing operations
+enum ANCHOR
+{
+ BottomLeft,
+ BottomRight,
+ BottomCenter,
+ TopLeft,
+ TopRight,
+ TopCenter,
+ CenterLeft,
+ CenterRight,
+ Center
+};
+
+
+//! Tuple <tt>[x,y]</tt>
+struct QWT3D_EXPORT Tuple
+{
+ Tuple() : x(0), y(0) {} //!< Calls Tuple(0,0)
+ Tuple(double X, double Y) : x(X), y(Y) {} //!< Initialize Tuple with x and y
+ //! Tuple coordinates
+ double x,y;
+};
+
+//! Triple <tt>[x,y,z]</tt>
+/**
+Consider Triples also as vectors in R^3
+*/
+struct QWT3D_EXPORT Triple
+{
+ //! Initialize Triple with x,y and z
+ explicit Triple(double xv = 0,double yv = 0,double zv = 0)
+ : x(xv), y(yv), z(zv)
+ {
+ }
+
+#ifndef QWT3D_NOT_FOR_DOXYGEN
+#ifdef Q_OS_IRIX
+ Triple(const Triple& val)
+ {
+ if (&val == this)
+ return;
+ x = val.x;
+ y = val.y;
+ z = val.z;
+ }
+ const Triple& operator=(const Triple& val)
+ {
+ if (&val == this)
+ return *this;
+ x = val.x;
+ y = val.y;
+ z = val.z;
+ return *this;
+ }
+#endif
+#endif // QWT3D_NOT_FOR_DOXYGEN
+
+ //! Triple coordinates
+ double x,y,z;
+
+ Triple& operator+=(Triple t)
+ {
+ x += t.x;
+ y += t.y;
+ z += t.z;
+
+ return *this;
+ }
+
+ Triple& operator-=(Triple t)
+ {
+ x -= t.x;
+ y -= t.y;
+ z -= t.z;
+
+ return *this;
+ }
+ Triple& operator*=(double d)
+ {
+ x *= d;
+ y *= d;
+ z *= d;
+
+ return *this;
+ }
+ Triple& operator/=(double d)
+ {
+ x /= d;
+ y /= d;
+ z /= d;
+
+ return *this;
+ }
+ Triple& operator*=(Triple t) // scale
+ {
+ x *= t.x;
+ y *= t.y;
+ z *= t.z;
+
+ return *this;
+ }
+
+ bool operator!=(Triple t) const
+ {
+ return !isPracticallyZero(x,t.x) || !isPracticallyZero(y,t.y) || !isPracticallyZero(z,t.z);
+ }
+
+ bool operator==(Triple t) const
+ {
+ return !operator!=(t);
+ }
+
+ double length() const
+ {
+ double l2 = x*x + y*y + z*z;
+ return (isPracticallyZero(l2)) ? 0 :sqrt(l2);
+ }
+
+ void normalize()
+ {
+ double l = length();
+ if (l)
+ *this /= l;
+ }
+};
+
+inline const Triple operator+(const Triple& t, const Triple& t2)
+{
+ return Triple(t) += t2;
+}
+inline const Triple operator-(const Triple& t, const Triple& t2)
+{
+ return Triple(t) -= t2;
+}
+inline const Triple operator*(double d, const Triple& t)
+{
+ return Triple(t) *= d;
+}
+inline const Triple operator*(const Triple& t, double d)
+{
+ return Triple(t) *= d;
+}
+inline const Triple operator/(double d, const Triple& t)
+{
+ return Triple(t) /= d;
+}
+inline const Triple operator/(const Triple& t, double d)
+{
+ return Triple(t) /= d;
+}
+inline const Triple operator*(const Triple& t, const Triple& t2)
+{
+ return Triple(t) *= t2;
+}
+
+//! Parallelepiped spanned by 2 Triples
+/**
+Please use \em normalized Parallelepipeds:\n\n
+minVertex.x <= maxVertex.x\n
+minVertex.y <= maxVertex.y\n
+minVertex.z <= maxVertex.z\n
+*/
+struct QWT3D_EXPORT ParallelEpiped
+{
+ //! Construct non-initialized Parallelepiped
+ ParallelEpiped()
+ {
+ }
+
+ //! Construct initialized Parallelepiped
+ /**
+ minv -> minVertex\n
+ maxv -> maxVertex\n
+ */
+ ParallelEpiped(Triple minv, Triple maxv)
+ : minVertex(minv), maxVertex(maxv)
+ {
+ }
+
+ Triple minVertex;
+ Triple maxVertex;
+};
+
+//! Free vector
+/**
+ FreeVectors represent objects like normal vectors and other vector fields inside R^3
+*/
+struct QWT3D_EXPORT FreeVector
+{
+ FreeVector()
+ {
+ }
+
+ //! Construct initialized vector
+ /**
+ b -> base\n
+ e -> top\n
+ */
+ FreeVector(Triple b, Triple t)
+ : base(b), top(t)
+ {
+ }
+
+ Triple base;
+ Triple top;
+};
+
+//! A free vector field in R^3
+typedef std::vector<FreeVector> FreeVectorField;
+
+//! A point field in R^3
+typedef std::vector<Triple> TripleField;
+//! Holds indices in a TripleField interpreted as counterclockwise node numbering for a convex polygon
+typedef std::vector<unsigned> Cell;
+//! Vector of convex polygons. You need a TripleField as base for the node data
+typedef std::vector<Cell> CellField;
+//! Returns the sum over the sizes of the single cells
+unsigned tesselationSize(Qwt3D::CellField const& t);
+
+//! Red-Green-Blue-Alpha value
+struct QWT3D_EXPORT RGBA
+{
+ RGBA()
+ : r(0), g(0), b(0), a(1)
+ {}
+ RGBA(double rr, double gg, double bb, double aa = 1)
+ : r(rr), g(gg), b(bb), a(aa)
+ {}
+ double r,g,b,a;
+};
+
+//! A Color field
+typedef std::vector<RGBA> ColorVector;
+
+#ifndef QWT3D_NOT_FOR_DOXYGEN
+
+QWT3D_EXPORT QColor GL2Qt(GLdouble r, GLdouble g, GLdouble b); //!< RGB -> QColor
+QWT3D_EXPORT Qwt3D::RGBA Qt2GL(QColor col); //!< QColor -> RGBA
+
+typedef double *Vertex;
+typedef std::vector<Vertex> DataRow;
+typedef std::vector<DataRow> DataMatrix;
+
+
+class Data
+{
+public:
+ Qwt3D::DATATYPE datatype;
+ Data() {datatype= Qwt3D::POLYGON;}
+ virtual ~Data() {}
+ virtual void clear() = 0; //!< destroy content
+ virtual bool empty() const = 0; //!< no data
+ void setHull(Qwt3D::ParallelEpiped const& h) {hull_p = h;}
+ Qwt3D::ParallelEpiped const& hull() const {return hull_p;}
+
+protected:
+ Qwt3D::ParallelEpiped hull_p;
+};
+
+
+//! Implements a matrix of z-Values with limit access functions
+class GridData : public Data
+{
+public:
+ GridData();
+ GridData(unsigned int columns, unsigned int rows);//!< see setSize()
+ ~GridData() { clear();}
+
+ int columns() const;
+ int rows() const;
+
+ void clear(); //!< destroy content
+ bool empty() const { return vertices.empty();}
+ void setSize(unsigned int columns, unsigned int rows); //!< destroys content and set new size, elements are uninitialized
+
+ DataMatrix vertices; //!< mesh vertices
+ DataMatrix normals; //!< mesh normals
+ void setPeriodic(bool u, bool v) {uperiodic_ = u; vperiodic_ = v;}
+ bool uperiodic() const {return uperiodic_;}
+ bool vperiodic() const {return vperiodic_;}
+
+private:
+ bool uperiodic_, vperiodic_;
+};
+
+
+//! Implements a graph-like cell structure with limit access functions
+class CellData : public Data
+{
+public:
+ CellData() {datatype=Qwt3D::POLYGON;}
+ ~CellData() { clear();}
+
+ void clear(); //!< destroy content
+ bool empty() const { return cells.empty();}
+
+ Triple const& operator()(unsigned cellnumber, unsigned vertexnumber);
+
+ CellField cells; //!< polygon/cell mesh
+ TripleField nodes;
+ TripleField normals; //!< mesh normals
+};
+
+inline Triple normalizedcross(Triple const& u, Triple const& v)
+{
+ Triple n;
+
+ /* compute the cross product (u x v for right-handed [ccw]) */
+ n.x = u.y * v.z - u.z * v.y;
+ n.y = u.z * v.x - u.x * v.z;
+ n.z = u.x * v.y - u.y * v.x;
+
+ /* normalize */
+ double l = n.length();
+ if (l)
+ {
+ n /= l;
+ }
+ else
+ {
+ n = Triple(0,0,0);
+ }
+
+ return n;
+}
+
+inline double dotProduct(Triple const& u, Triple const& v)
+{
+ return u.x*v.x + u.y*v.y + u.z*v.z;
+}
+
+void convexhull2d( std::vector<unsigned>& idx, const std::vector<Qwt3D::Tuple>& src );
+
+
+#endif // QWT3D_NOT_FOR_DOXYGEN
+
+} // ns
+
+#endif
diff --git a/lib/tqwtplot3d/include/qwt3d_volumeplot.h b/lib/tqwtplot3d/include/qwt3d_volumeplot.h new file mode 100644 index 0000000..da2dcbe --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_volumeplot.h @@ -0,0 +1,24 @@ +#ifndef qwt3d_volumeplot_h__2004_03_06_01_52_begin_guarded_code
+#define qwt3d_volumeplot_h__2004_03_06_01_52_begin_guarded_code
+
+#include "qwt3d_plot.h"
+
+namespace Qwt3D
+{
+
+//! TODO
+class QWT3D_EXPORT VolumePlot : public Plot3D
+{
+// Q_OBJECT
+
+public:
+ VolumePlot( QWidget* parent = 0, const char* name = 0 ){}
+
+protected:
+ virtual void createData() = 0;
+};
+
+} // ns
+
+
+#endif
|