[4] | 1 | /****************************************************************************** |
---|
| 2 | * SAGE - Scalable Adaptive Graphics Environment |
---|
| 3 | * |
---|
| 4 | * Copyright (C) 2004 Electronic Visualization Laboratory, |
---|
| 5 | * University of Illinois at Chicago |
---|
| 6 | * |
---|
| 7 | * All rights reserved. |
---|
| 8 | * |
---|
| 9 | * Redistribution and use in source and binary forms, with or without |
---|
| 10 | * modification, are permitted provided that the following conditions are met: |
---|
| 11 | * |
---|
| 12 | * * Redistributions of source code must retain the above copyright |
---|
| 13 | * notice, this list of conditions and the following disclaimer. |
---|
| 14 | * * Redistributions in binary form must reproduce the above |
---|
| 15 | * copyright notice, this list of conditions and the following disclaimer |
---|
| 16 | * in the documentation and/or other materials provided with the distribution. |
---|
| 17 | * * Neither the name of the University of Illinois at Chicago nor |
---|
| 18 | * the names of its contributors may be used to endorse or promote |
---|
| 19 | * products derived from this software without specific prior written permission. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
| 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
| 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
| 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
---|
| 25 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
---|
| 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
---|
| 28 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
---|
| 29 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
---|
| 30 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
---|
| 31 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 32 | * |
---|
| 33 | * Direct questions, comments etc about SAGE to http://www.evl.uic.edu/cavern/forum/ |
---|
| 34 | * |
---|
| 35 | *****************************************************************************/ |
---|
| 36 | |
---|
| 37 | /*------------------------------------------------------------------------ |
---|
| 38 | - Author: Arun Rao |
---|
| 39 | - Library: Tile Config |
---|
| 40 | - Revision Date: 4/22/2004 |
---|
| 41 | - Module: tile_config.h |
---|
| 42 | - Purpose: Contains all class descriptions for building |
---|
| 43 | - a description of a tile display system, at run time |
---|
| 44 | ---------------------------------------------------------------------------*/ |
---|
| 45 | #ifndef SAGE_TILE_CONFIG_H |
---|
| 46 | #define SAGE_TILE_CONFIG_H |
---|
| 47 | |
---|
| 48 | #define _DEBUG 1 |
---|
| 49 | |
---|
| 50 | #include <stdio.h> |
---|
| 51 | #include <stdlib.h> |
---|
| 52 | |
---|
| 53 | //__________________________________________ |
---|
| 54 | class Physical_Tile; |
---|
| 55 | class Display_Node; |
---|
| 56 | class Virtual_Desktop_Tile; |
---|
| 57 | |
---|
| 58 | class DisplayCluster; |
---|
| 59 | class PhysicalDisplay; |
---|
| 60 | class VirtualDesktop; |
---|
| 61 | //__________________________________________ |
---|
| 62 | |
---|
| 63 | class Physical_Tile |
---|
| 64 | { |
---|
| 65 | private: |
---|
| 66 | //int horizRes; //horizontal resolution |
---|
| 67 | //int vertRes; //vertical resolution |
---|
| 68 | float screenWidth; //width of screen in inches |
---|
| 69 | float screenHeight; //height of screen in inches |
---|
| 70 | float leftMullion; //the width of the left Mullion in inches |
---|
| 71 | float rightMullion; // " " " right " " |
---|
| 72 | float topMullion; // " " " top " " |
---|
| 73 | float bottomMullion; // " " " bottom " " |
---|
| 74 | float lowerleftX; //the x position of the bottom left corner of the tile (including the mullions from left) |
---|
| 75 | //with respect to some arbritrary origin |
---|
| 76 | float lowerleftY; //the y position of the bottom left corner of the tile (including the mullions from bottom) |
---|
| 77 | //with respect to some arbritrary origin |
---|
| 78 | int id; |
---|
| 79 | Virtual_Desktop_Tile* virtDeskTile; //the virtual desktop tile that the physical tile will display |
---|
| 80 | Physical_Tile* next; |
---|
| 81 | Display_Node* source; //the display node that is the source to the physical tile |
---|
| 82 | public: |
---|
| 83 | Physical_Tile(); |
---|
| 84 | ~Physical_Tile(); |
---|
| 85 | |
---|
| 86 | float ScreenWidthDimension(); |
---|
| 87 | float ScreenHeightDimension(); |
---|
| 88 | float LeftMullionThickness(); |
---|
| 89 | float RightMullionThickness(); |
---|
| 90 | float TopMullionThickness(); |
---|
| 91 | float BottomMullionThickness(); |
---|
| 92 | float LowerLeftX(); |
---|
| 93 | float LowerLeftY(); |
---|
| 94 | int ID(); |
---|
| 95 | Physical_Tile* Next(); |
---|
| 96 | Display_Node* Source(); |
---|
| 97 | Virtual_Desktop_Tile* VirtualDesktopTile(); |
---|
| 98 | |
---|
| 99 | |
---|
| 100 | void ScreenWidthDimension(float); |
---|
| 101 | void ScreenHeightDimension(float); |
---|
| 102 | void RightMullionThickness(float); |
---|
| 103 | void LeftMullionThickness(float); |
---|
| 104 | void TopMullionThickness(float); |
---|
| 105 | void BottomMullionThickness(float); |
---|
| 106 | void LowerLeftX(float); |
---|
| 107 | void LowerLeftY(float); |
---|
| 108 | void ID(int); |
---|
| 109 | void Next(Physical_Tile*); |
---|
| 110 | void Source(Display_Node*); |
---|
| 111 | void VirtualDesktopTile(Virtual_Desktop_Tile*); |
---|
| 112 | }; |
---|
| 113 | |
---|
| 114 | class Virtual_Desktop_Tile |
---|
| 115 | { |
---|
| 116 | private: |
---|
| 117 | float lowerLeftX; //the ratio of the lower left x position to the entire virtual desktop width |
---|
| 118 | float lowerLeftY; //the ratio of the lower left y position to the entire virtual desktop height |
---|
| 119 | |
---|
| 120 | float widthRatio; //the ratio of the width of the virtual desktop tile |
---|
| 121 | //to the entire virtual desktop width |
---|
| 122 | |
---|
| 123 | float heightRatio; //the ratio of the height of the virtual desktop tile |
---|
| 124 | //to the entire virtual desktop height |
---|
| 125 | |
---|
| 126 | int id; //the id of the virtual desktop tile |
---|
| 127 | |
---|
| 128 | |
---|
| 129 | int lowerLeftPixelX; |
---|
| 130 | int lowerLeftPixelY; |
---|
| 131 | int widthInPixels; |
---|
| 132 | int heightInPixels; |
---|
| 133 | |
---|
| 134 | int nonMullionLLX; //lower left X on a zero mullion display |
---|
| 135 | int nonMullionLLY; //lower left Y on a zero mullion display |
---|
| 136 | |
---|
| 137 | Display_Node* dispNode; //the node that will display the virtual desktop tile to the associated physical tile |
---|
| 138 | Virtual_Desktop_Tile *next; |
---|
| 139 | |
---|
| 140 | |
---|
| 141 | public: |
---|
| 142 | Virtual_Desktop_Tile(); |
---|
| 143 | ~Virtual_Desktop_Tile(); |
---|
| 144 | float LowerLeftX(); |
---|
| 145 | float LowerLeftY(); |
---|
| 146 | int LowerLeftPixelX(); |
---|
| 147 | int LowerLeftPixelY(); |
---|
| 148 | int WidthInPixels(); |
---|
| 149 | int HeightInPixels(); |
---|
| 150 | int NonMullionLLX(); |
---|
| 151 | int NonMullionLLY(); |
---|
| 152 | |
---|
| 153 | float WidthRatio(); //The ratio of the width of the tile to that of the whole virtual desktop |
---|
| 154 | float HeightRatio(); //The ratio of the height of the tile to that of the whole virtual desktop |
---|
| 155 | int ID(); //The unique ID of the tile |
---|
| 156 | Display_Node* DisplayNode(); //The physical tile that this virtual desktop tile resides |
---|
| 157 | Virtual_Desktop_Tile* Next(); |
---|
| 158 | |
---|
| 159 | void LowerLeftX(float); |
---|
| 160 | void LowerLeftY(float); |
---|
| 161 | void NonMullionLLX(int); |
---|
| 162 | void NonMullionLLY(int); |
---|
| 163 | void LowerLeftPixelX(int); |
---|
| 164 | void LowerLeftPixelY(int); |
---|
| 165 | void WidthInPixels(int); |
---|
| 166 | void HeightInPixels(int); |
---|
| 167 | void WidthRatio(float); |
---|
| 168 | void HeightRatio(float); |
---|
| 169 | void ID(int); |
---|
| 170 | void DisplayNode(Display_Node*); |
---|
| 171 | void Next(Virtual_Desktop_Tile*); |
---|
| 172 | |
---|
| 173 | }; |
---|
| 174 | |
---|
| 175 | class VDTtoPTmapper |
---|
| 176 | { |
---|
| 177 | Physical_Tile* pt; |
---|
| 178 | Virtual_Desktop_Tile *vdt; |
---|
| 179 | |
---|
| 180 | public: |
---|
| 181 | VDTtoPTmapper(Physical_Tile*, Virtual_Desktop_Tile*); |
---|
| 182 | ~VDTtoPTmapper(); |
---|
| 183 | Physical_Tile* PhysicalTile(); |
---|
| 184 | Virtual_Desktop_Tile* VirtualDesktopTile(); |
---|
| 185 | |
---|
| 186 | }; |
---|
| 187 | |
---|
| 188 | class Display_Node |
---|
| 189 | { |
---|
| 190 | private: |
---|
| 191 | char* nodeName; //the name of the computer that holds pixels to display |
---|
| 192 | char* ip; //ip address of the computer the holds pixels to display |
---|
| 193 | VDTtoPTmapper** maps; //pointer to the array of VDTtoPTmapper objects |
---|
| 194 | Display_Node* next; //next display node in list |
---|
| 195 | int numberOfMaps; //The number of mappings from virtual desktop tile to physical tile |
---|
| 196 | //that this display node can make (i.e. how many outputs the display node has) |
---|
| 197 | public: |
---|
| 198 | Display_Node(); |
---|
| 199 | ~Display_Node(); |
---|
| 200 | void Name(char* ); |
---|
| 201 | void IP(char* ); |
---|
| 202 | char* Name(void); |
---|
| 203 | char* IP(void); |
---|
| 204 | int NumberOfMaps(); |
---|
| 205 | void NumberOfMaps(int); |
---|
| 206 | VDTtoPTmapper** Maps(); |
---|
| 207 | bool AddMap(VDTtoPTmapper*); |
---|
| 208 | Display_Node* Next(); |
---|
| 209 | void Next(Display_Node*); |
---|
| 210 | void RemoveMap(VDTtoPTmapper*); |
---|
| 211 | void RemoveMap(int); //delete a specific mapping given an index |
---|
| 212 | }; |
---|
| 213 | |
---|
| 214 | |
---|
| 215 | //__________________________________________ |
---|
| 216 | |
---|
| 217 | class DisplayCluster |
---|
| 218 | { |
---|
| 219 | protected: |
---|
| 220 | Display_Node* displayNodeListHead; //pointer to the display node linked list |
---|
| 221 | VirtualDesktop* vd; |
---|
| 222 | PhysicalDisplay* pd; |
---|
| 223 | |
---|
| 224 | public: |
---|
| 225 | DisplayCluster(); |
---|
| 226 | ~DisplayCluster(); |
---|
| 227 | void AddDisplayNode(Display_Node* ); |
---|
| 228 | void RemoveDisplayNode(char*); //remove a display node given the display node name |
---|
| 229 | void RemoveDisplayNodeByName(char*); |
---|
| 230 | void RemoveDisplayNodeByIP(char*); //remove a display node given the display node ip |
---|
| 231 | Display_Node* getFirstNode(); //return the first node in the display node list |
---|
| 232 | |
---|
| 233 | VirtualDesktop* VirtualDesktopAssoc(); |
---|
| 234 | void VirtualDesktopAssoc(VirtualDesktop* ); |
---|
| 235 | PhysicalDisplay* PhysicalDisplayAssoc(); |
---|
| 236 | void PhysicalDisplayAssoc(PhysicalDisplay*); |
---|
| 237 | |
---|
| 238 | bool GenerateMapping(Virtual_Desktop_Tile*, Physical_Tile*); |
---|
| 239 | bool GenerateMapping(Virtual_Desktop_Tile*, Physical_Tile*, Display_Node*); |
---|
| 240 | void RemoveMapping(Virtual_Desktop_Tile*, Physical_Tile*, Display_Node*); |
---|
| 241 | void RemoveMapsWith(Virtual_Desktop_Tile*); //Removes any mappings made witht the given virtual tile |
---|
| 242 | void RemoveMapsWith(Physical_Tile*); //Removes any mappings made with the given physical tile |
---|
| 243 | bool NodeOnCluster(Display_Node*); |
---|
| 244 | |
---|
| 245 | }; |
---|
| 246 | |
---|
| 247 | |
---|
| 248 | class PhysicalDisplay |
---|
| 249 | { |
---|
| 250 | protected: |
---|
| 251 | Physical_Tile* physicalTileListHead; //pointer to the physical tile linked list |
---|
| 252 | |
---|
| 253 | VirtualDesktop* vd; |
---|
| 254 | DisplayCluster* dc; |
---|
| 255 | float pixelsPerInch; //the pixels per inch ratio |
---|
| 256 | |
---|
| 257 | public: |
---|
| 258 | PhysicalDisplay(); |
---|
| 259 | ~PhysicalDisplay(); |
---|
| 260 | VirtualDesktop* VirtualDesktopAssoc(); |
---|
| 261 | void VirtualDesktopAssoc(VirtualDesktop* ); |
---|
| 262 | DisplayCluster* DisplayClusterAssoc(); |
---|
| 263 | void DisplayClusterAssoc(DisplayCluster* ); |
---|
| 264 | int AddPhysicalTile(Physical_Tile*); //adds a tile to the display and returns its unique id |
---|
| 265 | |
---|
| 266 | Physical_Tile* RemovePhysicalTileByID(int, bool); //remove a physical tile from this physical display |
---|
| 267 | //the second parameter is used to have the tile deleted |
---|
| 268 | //or just removed. If "true" the tile will be deleted |
---|
| 269 | //from memory, otherwise the address of the tile will |
---|
| 270 | //be returned |
---|
| 271 | |
---|
| 272 | Physical_Tile* getFirstNode(); //returns the first node in the physical tile list |
---|
| 273 | bool TileOnPhysicalDisplay(Physical_Tile*); |
---|
| 274 | float PixelsPerInch(); //get the pixels per inch that ALL the physical tiles on this display conform to |
---|
| 275 | void PixelsPerInch(float); //set the pixels per inch that ALL the physical tiles on this display conform to |
---|
| 276 | }; |
---|
| 277 | |
---|
| 278 | class VirtualDesktop |
---|
| 279 | { |
---|
| 280 | protected: |
---|
| 281 | int horizRes; //horizontal resolution of virtual desktop |
---|
| 282 | int vertRes; //vertical resolution of virtual desktop |
---|
| 283 | |
---|
| 284 | //pointer to Virtual_Desktop_Tile linked list |
---|
| 285 | Virtual_Desktop_Tile* tileListHead; |
---|
| 286 | |
---|
| 287 | PhysicalDisplay* pd; |
---|
| 288 | DisplayCluster* dc; |
---|
| 289 | |
---|
| 290 | |
---|
| 291 | public: |
---|
| 292 | VirtualDesktop(); |
---|
| 293 | ~VirtualDesktop(); |
---|
| 294 | |
---|
| 295 | PhysicalDisplay* PhysicalDisplayAssoc(); |
---|
| 296 | void PhysicalDisplayAssoc(PhysicalDisplay*); |
---|
| 297 | DisplayCluster* DisplayClusterAssoc(); |
---|
| 298 | void DisplayClusterAssoc(DisplayCluster*); |
---|
| 299 | |
---|
| 300 | int HorizRes(void){ return horizRes; } |
---|
| 301 | int VertRes(void){ return vertRes; } |
---|
| 302 | |
---|
| 303 | void AddTile(Virtual_Desktop_Tile*); |
---|
| 304 | void RemoveTile(Virtual_Desktop_Tile*); |
---|
| 305 | |
---|
| 306 | Virtual_Desktop_Tile* getFirstNode(void);
|
---|
| 307 |
|
---|
| 308 | bool Update(void); //update the virtual desktop with newly added/removed tile mappings
|
---|
| 309 |
|
---|
| 310 | }; |
---|
| 311 | |
---|
| 312 | #endif |
---|