1 | /****************************************************************************** |
---|
2 | * SAGE - Scalable Adaptive Graphics Environment |
---|
3 | * |
---|
4 | * Module: sageDrawObject.h |
---|
5 | * Author : Byungil Jeong |
---|
6 | * |
---|
7 | * Description: the super class of simple drawing objects |
---|
8 | * |
---|
9 | * Copyright (C) 2007 Electronic Visualization Laboratory, |
---|
10 | * University of Illinois at Chicago |
---|
11 | * |
---|
12 | * All rights reserved. |
---|
13 | * |
---|
14 | * Redistribution and use in source and binary forms, with or without |
---|
15 | * modification, are permitted provided that the following conditions are met: |
---|
16 | * |
---|
17 | * * Redistributions of source code must retain the above copyright |
---|
18 | * notice, this list of conditions and the following disclaimer. |
---|
19 | * * Redistributions in binary form must reproduce the above |
---|
20 | * copyright notice, this list of conditions and the following disclaimer |
---|
21 | * in the documentation and/or other materials provided with the distribution. |
---|
22 | * * Neither the name of the University of Illinois at Chicago nor |
---|
23 | * the names of its contributors may be used to endorse or promote |
---|
24 | * products derived from this software without specific prior written permission. |
---|
25 | * |
---|
26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
27 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
28 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
29 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
---|
30 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
---|
31 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
32 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
---|
33 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
---|
34 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
---|
35 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
---|
36 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
37 | * |
---|
38 | * Direct questions, comments etc about SAGE to sage_users@listserv.uic.edu or |
---|
39 | * http://www.evl.uic.edu/cavern/forum/ |
---|
40 | * |
---|
41 | *********************************************************************************/ |
---|
42 | |
---|
43 | #ifndef SAGE_DRAW_OBJECT_H |
---|
44 | #define SAGE_DRAW_OBJECT_H |
---|
45 | |
---|
46 | #include "sageBase.h" |
---|
47 | |
---|
48 | #if defined(__APPLE__) |
---|
49 | #include <OpenGL/gl.h> // Header File For The OpenGL Library |
---|
50 | #include <OpenGL/glu.h> // Header File For The GLu Library |
---|
51 | #include <OpenGL/OpenGL.h> |
---|
52 | |
---|
53 | #else |
---|
54 | #include <GL/gl.h> // Header File For The OpenGL Library |
---|
55 | #include <GL/glu.h> // Header File For The GLu Library |
---|
56 | #endif |
---|
57 | |
---|
58 | class sageDrawObject : public sageRect { |
---|
59 | protected: |
---|
60 | char objName[SAGE_NAME_LEN]; |
---|
61 | int objectID; |
---|
62 | bool global; |
---|
63 | sageRect tileRect; |
---|
64 | |
---|
65 | int setGlobalView(); |
---|
66 | int setLocalView(); |
---|
67 | |
---|
68 | public: |
---|
69 | int displayID; |
---|
70 | bool visible; |
---|
71 | sageDrawObject() : objectID(0), displayID(0), global(true), visible(true) {} |
---|
72 | void setName(char *name); |
---|
73 | char *getName() { return objName; } |
---|
74 | int getID() { return objectID; } |
---|
75 | void init(int id, char *name, sageRect &layout, bool g, int dispId); |
---|
76 | void updatePosition(int nx, int ny) { x = nx; y = ny; } |
---|
77 | int setViewport(sageRect &rect); |
---|
78 | void showObject(bool doShow); |
---|
79 | |
---|
80 | virtual int init(char *name) = 0; |
---|
81 | virtual int draw() = 0; |
---|
82 | virtual int destroy() = 0; |
---|
83 | virtual int parseMessage(char *msg) = 0; |
---|
84 | }; |
---|
85 | |
---|
86 | #endif |
---|