00001
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00033
00034 #ifndef GROOVX_GFX_GXDRAWSTYLE_CC_UTC20050626084025_DEFINED
00035 #define GROOVX_GFX_GXDRAWSTYLE_CC_UTC20050626084025_DEFINED
00036
00037 #include "gfx/gxdrawstyle.h"
00038
00039 #include "gfx/canvas.h"
00040
00041 #include "io/reader.h"
00042 #include "io/writer.h"
00043
00044 namespace
00045 {
00046 const io::version_id GXDRAWSTYLE_SVID = 1;
00047 }
00048
00049 GxDrawStyle::GxDrawStyle() :
00050 FieldContainer(&sigNodeChanged),
00051 polygonFill(false),
00052 pointSize(1.0),
00053 lineWidth(1.0),
00054 linePattern(0xFFFF)
00055 {
00056 setFieldMap(GxDrawStyle::classFields());
00057 }
00058
00059 GxDrawStyle::~GxDrawStyle() throw() {}
00060
00061 io::version_id GxDrawStyle::class_version_id() const
00062 {
00063 return GXDRAWSTYLE_SVID;
00064 }
00065
00066 void GxDrawStyle::read_from(io::reader& reader)
00067 {
00068 reader.ensure_version_id("GxDrawStyle", 1,
00069 "Try groovx0.8a7", SRC_POS);
00070
00071 readFieldsFrom(reader, classFields());
00072 }
00073
00074 void GxDrawStyle::write_to(io::writer& writer) const
00075 {
00076 writer.ensure_output_version_id("GxDrawStyle", GXDRAWSTYLE_SVID, 1,
00077 "Try groovx0.8a7", SRC_POS);
00078
00079 writeFieldsTo(writer, classFields(), GXDRAWSTYLE_SVID);
00080 }
00081
00082 const FieldMap& GxDrawStyle::classFields()
00083 {
00084 static const Field FIELD_ARRAY[] =
00085 {
00086 Field("polygonFill", &GxDrawStyle::polygonFill, false, false, true, true,
00087 Field::NEW_GROUP),
00088 Field("pointSize", &GxDrawStyle::pointSize, 1.0, 0.1, 10.0, 0.1),
00089 Field("lineWidth", &GxDrawStyle::lineWidth, 1.0, 0.1, 10.0, 0.1),
00090 Field("linePattern", &GxDrawStyle::linePattern, 0xFFFF, 0, 0xFFFF, 1)
00091 };
00092
00093 static FieldMap GXDRAWSTYLE_FIELDS(FIELD_ARRAY);
00094
00095 return GXDRAWSTYLE_FIELDS;
00096 }
00097
00098 void GxDrawStyle::getBoundingCube(Gfx::Bbox&) const
00099 {
00100 ;
00101 }
00102
00103 void GxDrawStyle::draw(Gfx::Canvas& canvas) const
00104 {
00105 canvas.setPolygonFill(polygonFill);
00106 canvas.setPointSize(pointSize);
00107 canvas.setLineWidth(lineWidth);
00108 canvas.setLineStipple(static_cast<unsigned short>(linePattern));
00109 }
00110
00111 static const char __attribute__((used)) vcid_groovx_gfx_gxdrawstyle_cc_utc20050626084025[] = "$Id: gxdrawstyle.cc 10065 2007-04-12 05:54:56Z rjpeters $ $HeadURL: file:
00112 #endif // !GROOVX_GFX_GXDRAWSTYLE_CC_UTC20050626084025_DEFINED