VR-Forces 4.0.4 Class Documentation
include/vrfGuiCore/DtEnvironmentalCreationData.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 2008 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 /******************************************************************************
00006 ** $RCSfile: DtEnvironmentalCreationData.h,v $ $Revision: 1.1 $ $State: Exp $
00007 ******************************************************************************/
00008 
00011 
00013 
00014 #pragma once
00015 
00016 #include <vrfGuiCore/vrfGuiCore.h>
00017 
00018 #include <string>
00019 
00020 static const int DtLineWidthMask = 0xF0000000;
00021 static const int DtAppearanceMask = 0x0FFFFFFF;
00022 
00023 namespace makVrf
00024 {
00025    class DT_DLL_VRFGUICORE DtEnvironmentalCreationData
00026    {
00027       #define DtLineWidthFromAppearance(theAppr) ((theAppr >> 28) & 0x0000000F)
00028       #define DtLineWidthToAppearance(theLineWidth) (theLineWidth << 28)
00029       #define DtLineStyleFromAppearance(theAppr) ((theAppr >> 8) & 0x0000000F)
00030       #define DtLineStyleToAppearance(theLineStyle) (theLineStyle << 8)
00031       #define DtFillStyleFromAppearance(theAppr) ((theAppr >> 12) & 0x0000000F)
00032       #define DtFillStyleToAppearance(theFillStyle) (theFillStyle << 12)
00033 
00034    public:
00035       DtEnvironmentalCreationData(const std::string& name = "",
00036          const std::string& label = "", int color = 0, const std::string& overlayParent = "",
00037          bool projected = false, bool closed = false, int appearance = 0,
00038          const std::string& attachedTo = "", const std::string& userData = "",
00039          unsigned int rId = 0)
00040       : myName(name)
00041       , myLabel(label)
00042       , myColor(color)
00043       , myOverlayParent(overlayParent)
00044       , myIsProjected(projected)
00045       , myIsClosedFigure(closed)
00046       , myAppearance(appearance)
00047       , myAttachedTo(attachedTo)
00048       , myUserData(userData)
00049       , myRequestId(rId)
00050       {
00051       }
00052 
00053       DtEnvironmentalCreationData(const DtEnvironmentalCreationData& orig)
00054       : myName(orig.myName)
00055       , myLabel(orig.myLabel)
00056       , myColor(orig.myColor)
00057       , myOverlayParent(orig.myOverlayParent)
00058       , myIsProjected(orig.myIsProjected)
00059       , myIsClosedFigure(orig.myIsClosedFigure)
00060       , myAppearance(orig.myAppearance)
00061       , myAttachedTo(orig.myAttachedTo)
00062       , myUserData(orig.myUserData)
00063       , myRequestId(orig.myRequestId)
00064       {
00065       }
00066 
00067       void setName(const std::string& n)
00068       {
00069          myName = n;
00070       }
00071 
00072       const std::string& name() const
00073       {
00074          return myName;
00075       }
00076 
00077       void setLabel(const std::string& l)
00078       {
00079          myLabel = l;
00080       }
00081 
00082       const std::string& label() const
00083       {
00084          return myLabel;
00085       }
00086 
00087       void setColor(int c)
00088       {
00089          myColor = c;
00090       }
00091 
00092       int color() const
00093       {
00094          return myColor;
00095       }
00096 
00097       void setOverlayParent(const std::string& s)
00098       {
00099          myOverlayParent = s;
00100       }
00101 
00102       const std::string& overlayParent() const
00103       {
00104          return myOverlayParent;
00105       }
00106 
00107       void setIsProjected(bool b)
00108       {
00109          myIsProjected = b;
00110       }
00111 
00112       bool isProjected() const
00113       {
00114          return myIsProjected;
00115       }
00116 
00117       void setIsClosedFigure(bool b)
00118       {
00119          myIsClosedFigure = b;
00120       }
00121 
00122       bool isClosedFigure() const
00123       {
00124          return myIsClosedFigure;
00125       }
00126 
00127       void setAppearance(int i)
00128       {
00129          myAppearance = lineWidth() | (i & DtAppearanceMask);
00130       }
00131 
00132       int appearance() const
00133       {
00134          return (rawAppearance() & DtAppearanceMask);
00135       }
00136 
00137       void setAttachedTo(const std::string& a)
00138       {
00139          myAttachedTo = a;
00140       }
00141 
00142       const std::string& attachedTo() const
00143       {
00144          return myAttachedTo;
00145       }
00146 
00147       void setUserData(const std::string& u)
00148       {
00149          myUserData = u;
00150       }
00151 
00152       const std::string& userData() const
00153       {
00154          return myUserData;
00155       }
00156 
00157       void setRequestId(unsigned int id)
00158       {
00159          myRequestId = 0;
00160       }
00161 
00162       int requestId() const
00163       {
00164          return myRequestId;
00165       }
00166 
00167    protected:
00168       int rawAppearance() const
00169       {
00170          return myAppearance;
00171       }
00172 
00173    public:
00174       void setLineStyle(int i)
00175       {
00176          myAppearance = (rawAppearance() & 0xFFFFF0FF) | (i << 8);
00177       }
00178 
00179       int lineStyle() const
00180       {
00181          int appearance = rawAppearance();
00182 
00183          return DtLineStyleFromAppearance(appearance);
00184       }
00185 
00186       void setFillStyle(int i)
00187       {
00188          myAppearance = (rawAppearance() & 0xFFFF0FFF) | (i << 12);
00189       }
00190 
00191       int fillStyle() const
00192       {
00193          int appearance = rawAppearance();
00194 
00195          return DtFillStyleFromAppearance(appearance);
00196       }
00197 
00198       void setLineWidth(int i)
00199       {
00200          myAppearance = appearance() | (i << 28);
00201       }
00202 
00203       int lineWidth() const
00204       {
00205          int appearance = rawAppearance();
00206 
00207          return DtLineWidthFromAppearance(appearance);
00208       }
00209 
00210    protected:
00211       std::string myName;
00212       std::string myLabel;
00213       int         myColor;
00214       std::string myOverlayParent;
00215       bool        myIsProjected;
00216       bool        myIsClosedFigure;
00217       int         myAppearance;
00218       std::string myAttachedTo;
00219       std::string myUserData;
00220       unsigned int myRequestId;
00221    };
00222 }

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)