OpenFOAM logo
Open Source CFD Toolkit

Xstream.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2005 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Xstream
00027 
00028 Description
00029     Xstream provides code to implement a simple plotting xwindow
00030     by declaring it to be an object.
00031 
00032 SourceFiles
00033     Xstream.C
00034     XstreamIO.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef Xstream_H
00039 #define Xstream_H
00040 
00041 
00042 #include <X11/Xlib.h>
00043 #include <X11/Xutil.h>
00044 
00045 #include "GEvent.H"
00046 #include "shapes2D.H"
00047 #include "Gstream.H"
00048 #include "lineStyle.H"
00049 #include "List.H"
00050 #include "word.H"
00051 #include "colour.H"
00052 
00053 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00054 
00055 namespace Foam
00056 {
00057 
00058 /*---------------------------------------------------------------------------*\
00059                            Class Xstream Declaration
00060 \*---------------------------------------------------------------------------*/
00061 
00062 class Xstream
00063 :
00064     public virtual Gstream
00065 {
00066 
00067     // Private data
00068 
00069         Display *mydisplay;
00070         Window mywindow;
00071         GC mygc;
00072         XEvent myevent;
00073         XSizeHints myhint;
00074         XGCValues myxgcv;
00075 
00076         int myscreen;
00077         Screen *myscreenp;
00078 
00079     // Private Member Functions
00080 
00081         //- Disallow default bitwise copy construct and assignment
00082         Xstream(const Xstream&);
00083         void operator=(const Xstream&);
00084 
00085 
00086         // x() and y() : return the raw Xstream coordinates associated
00087         // with particular points
00088 
00089         int x(const point2D&);
00090         int y(const point2D&);
00091 
00092         // and the X and Y values of the point associated with a particular
00093         // coord
00094 
00095         double x(const coord2D&);
00096         double y(const coord2D&);
00097 
00098         //- open a window
00099         void openSesame(const colour&, const colour&);
00100 
00101 
00102 public:
00103 
00104     // Constructors
00105 
00106         //- Construct from components
00107         Xstream
00108         (
00109             const word& winName,
00110             const colour&,
00111             const colour&,
00112             double,
00113             double,
00114             double = 0.5,
00115             double = 0.5,
00116             int widthX = 800,
00117             int widthY = 800
00118         );
00119 
00120 
00121     // Destructor
00122 
00123         virtual ~Xstream();
00124 
00125 
00126     // Member Functions
00127 
00128         // Event Handlers
00129 
00130             //- Wait for any keypress then return true
00131             int waitForEvent();
00132             int waitForEvent(GEvent &);
00133 
00134         // Change Context
00135 
00136             virtual void setColour(const colour&);
00137             virtual void setLineStyle(const lineStyle&);
00138             virtual void clear();
00139 
00140         // Draw
00141 
00142             virtual void draw(const line2D&);
00143             virtual void draw(const rectangle2D&);
00144             virtual void draw(const polygon2D&);
00145             virtual void draw(const string2D&);
00146             virtual void draw(const structuredScalars2D&);
00147 };
00148 
00149 
00150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00151 
00152 } // End namespace Foam
00153 
00154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00155 
00156 // include inline implementaions
00157 
00158 #include "XstreamI.H"
00159 
00160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00161 
00162 #endif
00163 
00164 // ************************************************************************* //
For further information go to www.openfoam.org