00001 /* $Id: image2D.hh,v 1.2 2003/07/22 05:08:45 tetron Exp $ */ 00002 00003 00004 /* This file was generated by otd2cpp.pl, a script for VOS by Reed Hedges <reed@zerohour.net> 00005 and Peter Amstutz <tetron@interreality.org> 00006 00007 Search for TODO for stuff that needs editing. You will want to especially fill in constructors, 00008 destructors, message handlers, non-property subobjects... 00009 00010 I can make no guarantee that this code will work, or even that it even is safe to run. 00011 Use it at your own risk. 00012 */ 00013 00014 /** @file image2D.hh Defines MetaObject class for Image2D type (revision 0). 00015 00016 */ 00017 00018 #ifndef _IMAGE2D_HH_ 00019 #define _IMAGE2D_HH_ 00020 00021 #include <vos/corelibs/vos/vos.hh> 00022 #include <vos/metaobjects/property/property.hh> 00023 00024 /** MetaObject implementing Image2D Object Type. 00025 00026 Base object type for 2D image objects: provides position, orientation 00027 and size properties. These three properties define a transformation for this 00028 2D image relative to its parent image. An image should be displayed 00029 superimposed on top of its parent image, and its child image objects should be 00030 displayed superimposed on top of it. 00031 00032 */ 00033 class Image2D : public virtual MetaObject 00034 { 00035 protected: 00036 PropertyAccessControl* accessControl; 00037 00038 public: 00039 00040 /** Constructor */ 00041 Image2D(MetaObject* superobject); 00042 00043 /** Destructor */ 00044 virtual ~Image2D(); 00045 00046 /** Return type string ("image2D") */ 00047 virtual const string getType(); 00048 00049 /** Register Extenders */ 00050 static void registerExtenders(); 00051 00052 /** Set default access control policy for subobjects */ 00053 virtual void setPropertyAccessControl(PropertyAccessControl* ac) { 00054 accessControl = ac; 00055 } 00056 00057 /** Get default access control policy for subobjects */ 00058 virtual PropertyAccessControl* getPropertyAccessControl() { 00059 return accessControl; 00060 } 00061 00062 /** @name Access Subobjects */ 00063 //@{ 00064 00065 /** Get the value of position property. 00066 This is the position or translation of this object relative to the origin of its 00067 parent image object. 00068 */ 00069 virtual void getPosition(double& x, double& y); 00070 00071 00072 /** Set position property. 00073 */ 00074 virtual void setPosition(double x, double y, PropertyAccessControl* ac = NULL); 00075 00076 /** Get the value of orientation property. 00077 This is the orientation or rotation of this object relative to the orientation 00078 of its parent image object (clockwise). 00079 */ 00080 virtual double getOrientation(); 00081 00082 /** Set orientation property. 00083 */ 00084 virtual void setOrientation(double o, PropertyAccessControl* ac = NULL); 00085 00086 /** Get the values of scaling property. 00087 This is the size of this object, and a scaling transformation to 00088 apply to all children of this object. 00089 All objects under the same 2D object 00090 or space with the same scaling value should be rendered at the same 00091 size (regardless of the size of the shape/bitmap itself). 00092 */ 00093 virtual void getScaling(double& x, double& y); 00094 00095 /** Set caling property. */ 00096 virtual void setScaling(double x, double y, PropertyAccessControl* ac = NULL); 00097 00098 /** Get the value of image property. 00099 This is the image data. The datatype indicates the data format. 00100 Suggested datatypes to support are: PNG, JPEG, BMP, TIFF, PCX, 00101 PNM, and XPM. 00102 */ 00103 // @{ 00104 virtual string getImage(); 00105 virtual void getImage(string& s); 00106 // @} 00107 00108 /** Get the datatype of image2D:image property. */ 00109 virtual string getImageDatatype(); 00110 00111 /** Set image property. 00112 @param value The new value 00113 @param datatype The new datatype: if omitted, then the existing datatype will be preserved. */ 00114 virtual void setImage(const string& value, const string& datatype = "?", PropertyAccessControl* ac = NULL); 00115 00116 /** Set contents of image property with dat aread from file. 00117 @param filename Filename 00118 @param datatype The datatype 00119 */ 00120 virtual void setImageFromFile(const string& filename, const string& datatype = "?", PropertyAccessControl* ac = NULL); 00121 00122 /** Get size of image data (in bytes) */ 00123 virtual int getImageLength(); 00124 00125 //@} 00126 00127 00128 00129 }; 00130 00131 00132 00133 /** Local version of Image2D. */ 00134 class LocalImage2D : public virtual Image2D 00135 { 00136 public: 00137 00138 /** Constructor */ 00139 LocalImage2D(MetaObject* superobject); 00140 00141 /** Destructor */ 00142 ~LocalImage2D(); 00143 00144 /** Initialize subproperties etc. */ 00145 virtual void initialize(); 00146 00147 /** Intialize subproperties and set default access control policy */ 00148 void initialize(PropertyAccessControl* ac); 00149 00150 /** Static generator, for factory. */ 00151 static MetaObject* new_LocalImage2D(MetaObject* superobject, const string& type); 00152 00153 /** Called when this object gets a message */ 00154 virtual void sendMessage(Message* m); 00155 00156 00157 }; 00158 00159 00160 /** Remote version of Image2D. */ 00161 class RemoteImage2D : public virtual Image2D 00162 { 00163 public: 00164 00165 /** Constructor */ 00166 RemoteImage2D(MetaObject* superobject); 00167 00168 /** Destructor */ 00169 virtual ~RemoteImage2D(); 00170 00171 /** Static generator, for factory. */ 00172 static MetaObject* new_RemoteImage2D(MetaObject* superobject, const string& type); 00173 00174 /** Called when this object gets an update message from its Local master across the network. */ 00175 void sendUpdateMessage(Message *m); 00176 00177 00178 }; 00179 00180 00181 #endif // #ifdef _IMAGE2D_HH_ 00182