WXP C++ Library Version 6.74.6
Loading...
Searching...
No Matches
Graph.h
1#ifndef _WINC_GRAPH
2#define _WINC_GRAPH
3
4#include <WXP/Device.h>
5#include <WXP/GFont.h>
6#include <WXP/GTran.h>
7#include <WXP/GraphAttr.h>
8#include <WXP/Image.h>
9#include <WXP/Listener.h>
10#include <WXP/Point.h>
11#include <WXP/Points.h>
12#include <WXP/Rect.h>
13#include <WXP/RGB.h>
14#include <WXP/String.h>
15#include <WXP/Symbol.h>
16
17namespace WXP {
18 class Graph : public Listener, public GraphAttr {
19 bool opened;
20 Device *window;
21 static const int max_tran = 4;
22 GTran tran[max_tran];
23 int ctran;
24 int font_type;
25 char font_name[40]; // The WXP font name
26 char font_spec[120]; // The device specific font specification
27 GFont font;
28 char symb_file[80];
29 Symbol symbol;
30 Points pts;
31
32 int device;
33 bool managed;
34 bool fixed;
35
36 int line_color; /* Line color */
37 float line_width; /* Line width */
38 int line_style; /* Line style */
39
40 int fill_color; /* Fill color */
41 int fill_style; /* Fill style */
42 /*
43 Text attributes
44 */
45 int hfont; // Use hardware font
46 int text_color; /* Text color */
47 float text_weight; /* Text weight */
48 float text_height; /* Text height */
49 float text_expan; /* Text expansion factor */
50 float text_char_space; /* Space factor between characters */
51 float text_char_width; /* Width of each character */
52 int text_halign; /* Horizontal text alignment */
53 int text_valign; /* Vertical text alignment */
54 float text_upx, text_upy; /* Text up vector */
55 int text_box_color;
56 bool text_box;
57 int drop_color;
58 int drop_shadow;
59 int drop_width;
60 int mark_type; /* Marker type */
61 float mark_size; /* Marker size */
62 float mark_weight; /* Marker weight */
63 int mark_color; /* Marker color */
64
65 int drawTextLine( float ox, float oy, const char *string );
66 int initClass();
67 public:
68
69 Graph();
70 Graph( const char *device, const char *param );
71 ~Graph();
72 int init();
73 int setDevice( const char *device, const char *params );
74 int getDevice( String &str );
75 int open();
76 int open( const char *dev, const char *params );
77 bool isOpen();
78 int close();
79 int update();
80 int manage();
81 int unmanage();
83 inline bool isManaged(){ return managed; };
84 void callback( const char *ev_str, const char *ev_data, const void *data );
85 int doCallback( const char *ev_str, const char *ev_data );
86 int addCallback( const char *ev, Listener *list, const void *data );
87 int setFixed( bool val );
88 int setSize( float width, float height );
89 int setOffset( float rx, float ry );
90 int setInverse( bool val );
91 bool getInverse();
92 int setBackground( const char *str );
93 int setIcon( bool val );
94 int setTitle( const char *str );
95 int setTran( int num );
96 int setViewportAspect( Rect &limit, float aspect, int halign, int valign );
97 int setViewportAspect( Rect &limit, float aspect );
98 int setViewport( int num, Rect &rect );
99 int setViewport( Rect &rect );
100 int getViewport( Rect &rect );
102 int getDeviceViewport( Rect &rect );
104 int getMaxViewport( Rect &rect );
106 int setWindow( int num, Rect &rect );
107 int setWindow( Rect &rect );
108 int getWindow( Rect &rect );
109 Rect getWindow();
110 int getTran();
111 int activateTran();
112 int activateTran( int val );
113 int tranPlotView( float x1, float y1, float &x2, float &y2 );
114 int tranPlotWindow( float x1, float y1, float &x2, float &y2 );
115 int tranPlotWindow( Point &pt1, Point &pt2 );
116 int tranWindow( int tran1, float x1, float y1, int tran2, float &x2, float &y2 );
117 int tranWindow( int tran1, Point &pt1, int tran2, Point &pt2 );
118 int clear();
119 int clearRect( Rect &rect );
120 int allocColor( float red, float grn, float blu );
121 int allocColor( RGB &rgb );
122 int drawLine( float x1, float y1, float x2, float y2 );
123 int drawLine( Point &p1, Point &p2 );
124 int drawLine( Points &data );
125 int drawRect( float x1, float y1, float x2, float y2 );
126 int drawRect( Rect &rect );
127 int drawCircle( float x1, float y1, float rad );
128 int drawCircle( Point &pt, float rad );
129 int setLineColor( int index );
130 int setLineWidth( float width );
131 int setLineStyle( int style );
132 int drawFill( Rect &rect );
133 int drawFill( Points &data );
134 int drawFillarea( Points &data );
135 int setFillColor( int index );
136 int setFillStyle( int index );
137 int drawMarkLine( float x, float y, float size );
138 int drawMark( float x, float y );
139 int drawMark( Point pt );
140 int setMarkColor( int index );
141 int setMarkSize( float size );
142 int setMarkType( int type );
143 int setMarkWeight( float weight );
144 int drawText( float ox, float oy, const char *string );
145 int drawText( Point pt, const char *string );
146 int drawFormText( float x, float y, const char *format, ... );
147 int drawFormText( Point pt, const char *format, ... );
148 int setTextColor( int color );
149 int setFontSpec();
150 int setFont( const char *str );
151 int setTextBoxColor( int index );
152 int setDropColor( int index );
153 int setDropShadow( int val );
154 int getDropShadow();
155 int setDropWidth( int val );
156 int setTextExpansion( float expansion );
157 int setTextWeight( float weight );
158 int setTextHeight( float height );
159 int setTextDirection( float x, float y );
160 int setTextAlign( int hor, int vert );
161 int setTextCharWidth( float space );
162 int setTextSpacing( float space );
163 int setSymbol( const char *file );
164 int drawSymbol( float ox, float oy, const char *string, float size );
165 int drawSymbol( Point pt, const char *string, float size );
166 int setImageAlign( int h, int v );
167 int drawImage( Image &image, float x, float y );
168 int drawImage( Image &image, int color, float x, float y );
169 int getImage( Image &image );
170 int setCursor( int type );
171 bool isLooping();
172 int getFrame();
173 int setFrame( int ind );
174 int newFrame();
175 int deleteFrame(int ind);
176 int getNumFrames();
177 int bell();
178 int message( const char *str, ... );
179 int printTran();
180
181 static const int DEVICE_NONE = 0;
182 static const int DEVICE_WINDOW = 1;
183 static const int DEVICE_POSTSCRIPT = 2;
184 static const int DEVICE_HPGL = 3;
185 static const int DEVICE_METAFILE = 4;
186 };
187}
188#endif
This virtual class defines methods for output to generic device.
Definition: Device.h:19
This class stores WXP font information.
Definition: GFont.h:7
This class creates device independent coordinate systems.
Definition: GTran.h:10
This class plots to a device independent graphics interface.
Definition: Graph.h:18
int setViewportAspect(Rect &limit, float aspect, int halign, int valign)
Definition: Graph.cc:382
int getFrame()
Definition: Graph.cc:1827
int setTran(int num)
Definition: Graph.cc:368
int activateTran()
Definition: Graph.cc:593
int getDropShadow()
Definition: Graph.cc:1359
bool isOpen()
Definition: Graph.cc:199
int setDropShadow(int val)
Definition: Graph.cc:1350
int doCallback(const char *ev_str, const char *ev_data)
Definition: Graph.cc:280
int addCallback(const char *ev, Listener *list, const void *data)
Definition: Graph.cc:268
int setMarkSize(float size)
Definition: Graph.cc:1669
int setTextDirection(float x, float y)
Definition: Graph.cc:1411
int allocColor(float red, float grn, float blu)
Definition: Graph.cc:706
int getTran()
Definition: Graph.cc:585
int setWindow(int num, Rect &rect)
Definition: Graph.cc:547
int setIcon(bool val)
Definition: Graph.cc:349
int open()
Definition: Graph.cc:158
int setLineStyle(int style)
Definition: Graph.cc:872
int tranPlotWindow(float x1, float y1, float &x2, float &y2)
Definition: Graph.cc:632
int drawLine(float x1, float y1, float x2, float y2)
Definition: Graph.cc:728
int setMarkType(int type)
Definition: Graph.cc:1679
int setLineColor(int index)
Definition: Graph.cc:848
Rect getWindow()
Definition: Graph.cc:575
int drawMarkLine(float x, float y, float size)
Definition: Graph.cc:1462
int bell()
Definition: Graph.cc:1875
int manage()
Definition: Graph.cc:226
int setTextColor(int color)
Definition: Graph.cc:1232
int setDropWidth(int val)
Definition: Graph.cc:1368
int setFillColor(int index)
Definition: Graph.cc:942
int setDropColor(int index)
Definition: Graph.cc:1340
int drawSymbol(float ox, float oy, const char *string, float size)
Definition: Graph.cc:1718
int setImageAlign(int h, int v)
Definition: Graph.cc:1767
Rect getDeviceViewport()
Definition: Graph.cc:519
int tranPlotView(float x1, float y1, float &x2, float &y2)
Definition: Graph.cc:618
int clear()
Definition: Graph.cc:680
int setSymbol(const char *file)
Definition: Graph.cc:1701
int drawFill(Rect &rect)
Definition: Graph.cc:912
int printTran()
Definition: Graph.cc:1909
int message(const char *str,...)
Definition: Graph.cc:1894
int drawCircle(float x1, float y1, float rad)
Definition: Graph.cc:780
int init()
Definition: Graph.cc:50
int setOffset(float rx, float ry)
Definition: Graph.cc:311
int getDevice(String &str)
Definition: Graph.cc:149
int setMarkColor(int index)
Definition: Graph.cc:1657
int setTextWeight(float weight)
Definition: Graph.cc:1387
int close()
Definition: Graph.cc:206
int setTextCharWidth(float space)
Definition: Graph.cc:1451
int setTextBoxColor(int index)
Definition: Graph.cc:1330
int setTextAlign(int hor, int vert)
Definition: Graph.cc:1431
Rect getViewport()
Definition: Graph.cc:501
~Graph()
Definition: Graph.cc:107
int setDevice(const char *device, const char *params)
Definition: Graph.cc:116
int setInverse(bool val)
Definition: Graph.cc:322
int drawFillarea(Points &data)
Definition: Graph.cc:934
int getImage(Image &image)
Definition: Graph.cc:1808
int drawRect(float x1, float y1, float x2, float y2)
Definition: Graph.cc:754
int setCursor(int type)
Definition: Graph.cc:1884
int drawMark(float x, float y)
Definition: Graph.cc:1624
void callback(const char *ev_str, const char *ev_data, const void *data)
Definition: Graph.cc:250
int drawImage(Image &image, float x, float y)
Definition: Graph.cc:1795
int drawFormText(float x, float y, const char *format,...)
Definition: Graph.cc:1201
bool isLooping()
Definition: Graph.cc:1818
int update()
Definition: Graph.cc:217
int setFontSpec()
Definition: Graph.cc:1243
int setTextSpacing(float space)
Definition: Graph.cc:1441
bool isManaged()
Definition: Graph.h:83
int setFixed(bool val)
Definition: Graph.cc:289
int unmanage()
Definition: Graph.cc:237
int tranWindow(int tran1, float x1, float y1, int tran2, float &x2, float &y2)
Definition: Graph.cc:656
int setSize(float width, float height)
Definition: Graph.cc:300
int newFrame()
Definition: Graph.cc:1846
int getNumFrames()
Definition: Graph.cc:1867
Rect getMaxViewport()
Definition: Graph.cc:538
int clearRect(Rect &rect)
Definition: Graph.cc:689
int setLineWidth(float width)
Definition: Graph.cc:860
int setTextExpansion(float expansion)
Definition: Graph.cc:1377
int drawText(float ox, float oy, const char *string)
Definition: Graph.cc:1087
int setFont(const char *str)
Definition: Graph.cc:1273
int setTitle(const char *str)
Definition: Graph.cc:359
int setMarkWeight(float weight)
Definition: Graph.cc:1689
int deleteFrame(int ind)
Definition: Graph.cc:1858
Graph()
Definition: Graph.cc:90
int setFillStyle(int index)
Definition: Graph.cc:954
bool getInverse()
Definition: Graph.cc:332
int setFrame(int ind)
Definition: Graph.cc:1836
int setViewport(int num, Rect &rect)
Definition: Graph.cc:473
int setTextHeight(float height)
Definition: Graph.cc:1399
int setBackground(const char *str)
Definition: Graph.cc:341
This class defines an image.
Definition: Image.h:19
This virtual class defines the callback method for use with plotting.
Definition: Listener.h:11
This class creates an array a 2D points (x, y)
Definition: Points.h:8
This is a variable length string class.
Definition: String.h:5
This class reads in symbol font data.
Definition: Symbol.h:7
All WXP classes fall under the WXP namespace.
Definition: Angle.h:4
This defines some basic graphics attributes.
Definition: GraphAttr.h:11
This struct sets a 3D point (x, y, z)
Definition: Point.h:5
This struct defines a set of RGB values.
Definition: RGB.h:5
This structure defines rectangle coordinates.
Definition: Rect.h:5