Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages | Examples

ArDrawingData.h

00001 /*
00002 MobileRobots Advanced Robotics Interface for Applications (ARIA)
00003 Copyright (C) 2004, 2005 ActivMedia Robotics LLC
00004 Copyright (C) 2006, 2007 MobileRobots Inc.
00005 
00006      This program is free software; you can redistribute it and/or modify
00007      it under the terms of the GNU General Public License as published by
00008      the Free Software Foundation; either version 2 of the License, or
00009      (at your option) any later version.
00010 
00011      This program is distributed in the hope that it will be useful,
00012      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014      GNU General Public License for more details.
00015 
00016      You should have received a copy of the GNU General Public License
00017      along with this program; if not, write to the Free Software
00018      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 If you wish to redistribute ARIA under different terms, contact 
00021 MobileRobots for information about a commercial version of ARIA at 
00022 robots@mobilerobots.com or 
00023 MobileRobots Inc, 19 Columbia Drive, Amherst, NH 03031; 800-639-9481
00024 */
00025 
00026 #ifndef ARDRAWINGDATA_H
00027 #define ARDRAWINGDATA_H
00028 
00029 #include "ariaTypedefs.h"
00030 #include "ariaUtil.h"
00031 
00033 class ArColor
00034 {
00035 public:
00037   ArColor(unsigned char red, unsigned char green, unsigned char blue)
00038     { myRed = red; myGreen = green; myBlue = blue; }
00040   ArColor() { myRed = 255, myGreen = 255, myBlue = 255; }
00041 
00043   ArColor(ArTypes::Byte4 rgbValue)
00044   {
00045     myRed   = (rgbValue & 0xFF0000) >> 16;
00046     myGreen = (rgbValue & 0x00FF00) >> 8;
00047     myBlue  = (rgbValue & 0x0000FF);
00048   }
00049 
00051   virtual ~ArColor() {}
00053   unsigned char getRed(void) { return myRed; }
00055   unsigned char getGreen(void) { return myGreen; }
00057   unsigned char getBlue(void) { return myBlue; }
00059   ArTypes::Byte4 colorToByte4(void) 
00060     { return ((myRed << 16) | (myGreen << 8) | myBlue); }
00061 protected:
00062   unsigned char myRed;
00063   unsigned char myGreen;
00064   unsigned char myBlue;
00065 
00066 };
00067 
00068 
00107 class ArDrawingData
00108 {
00109 public:
00110 
00111   enum {
00112     DEFAULT_REFRESH_TIME = 200 
00113   };
00114 
00115 
00117 
00127   AREXPORT ArDrawingData(const char *shape, 
00128                               ArColor primaryColor, 
00129                               int size,
00130                               int layer, 
00131                               unsigned int defaultRefreshTime = DEFAULT_REFRESH_TIME, 
00132                         const char *visibility = "DefaultOn") :
00133     myShape(shape),
00134     myPrimaryColor(primaryColor),
00135     mySize(size),
00136     myLayer(layer),
00137     myDefaultRefreshTime(defaultRefreshTime),
00138     mySecondaryColor(ArColor(0,0,0)),
00139     myVisibility(visibility)
00140   { 
00141   }
00142 
00144 
00155   AREXPORT ArDrawingData(const char *shape, 
00156              ArColor primaryColor, 
00157              int size,
00158              int layer, 
00159              unsigned int defaultRefreshTime, 
00160              ArColor secondaryColor,
00161        const char *visibility = "DefaultOn")
00162     { 
00163       myShape = shape; 
00164       myPrimaryColor = primaryColor; 
00165       mySize = size; 
00166       myLayer = layer; 
00167       myDefaultRefreshTime = defaultRefreshTime;
00168       mySecondaryColor = secondaryColor; 
00169       myVisibility = visibility;
00170     }
00172   AREXPORT virtual ~ArDrawingData() {}
00174   const char * getShape(void) { return myShape.c_str(); }
00176   ArColor getPrimaryColor(void) { return myPrimaryColor; }
00178   int getSize(void) { return mySize; }
00180   int getLayer(void) { return myLayer; }
00182   unsigned int getDefaultRefreshTime(void) { return myDefaultRefreshTime; }
00184   ArColor getSecondaryColor(void) { return mySecondaryColor; }
00186   const char *getVisibility(void) { return myVisibility.c_str(); }
00187 
00189   void setShape(const char *shape) { myShape = shape; }
00191   void setPrimaryColor(ArColor color) { myPrimaryColor = color; }
00193   void setSize(int size) { mySize = size; }
00195   void setLayer(int layer) { myLayer = layer; }
00197   void setDefaultRefreshTime(unsigned int refreshTime)
00198     { myDefaultRefreshTime = refreshTime; }
00200   void setSecondaryColor(ArColor color) { mySecondaryColor = color; }
00202   void setVisibility(const char *visibility) { myVisibility = visibility; }
00203 protected:
00204   std::string myShape;
00205    ArColor myPrimaryColor;
00206   int mySize;
00207   int myLayer;
00208   unsigned int myDefaultRefreshTime;
00209   ArColor mySecondaryColor;
00210   std::string myVisibility;
00211 };
00212 
00213 #endif

Generated on Tue Feb 20 10:51:39 2007 for Aria by  doxygen 1.4.0