VR-Forces 4.0.4 Class Documentation
include/gdb/polyImm.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 ** Copyright (c) 1999 MaK Technologies, Inc.
00003 ** All rights reserved.
00004 *********************************************************************/
00005 /*********************************************************************
00006 ** $RCSfile: polyImm.h,v $ $Revision: 1.12 $ $State: Exp $
00007 *********************************************************************/
00008 
00009 #ifndef polyImm_H_
00010 #define polyImm_H_
00011 
00012 #include "gdb/gdbDefines.h"
00013 #include "gdb/basePoly.h"
00014 #include <vlutil/vlConfig.h>
00015 #include <vector>
00016 #include <assert.h>
00017 #include "geometry/surface.h"
00018 
00019 
00020 
00021 //forward declarations
00022 class DtPoint;
00023 
00024 // class DtPolygonImmediate:
00025 //
00026 // DtPolygonImmediate are
00027 
00028 class DT_DLL_gdb DtPolygonImmediate : public DtBasePolygon
00029 {
00030 public:
00031 
00032    // default constructor
00033    DtPolygonImmediate();
00034 
00035    // additional constructor
00036    DtPolygonImmediate(unsigned int numVertices);
00037 
00038    // set the number of polygon vertices; initializes the vertex
00039    // list array to the specified size
00040    virtual void setNumberOfVertices(unsigned int n);   
00041 
00042    // destructor
00043    virtual ~DtPolygonImmediate();
00044 
00045    // copy constructor
00046    DtPolygonImmediate(const DtPolygonImmediate& orig);
00047 
00048    // assignment operator
00049    DtPolygonImmediate& operator=(const DtPolygonImmediate& orig);
00050 
00051    // @return the type of DtGdbNode 
00052    virtual DtGdbNode::DtGdbNodeType type() const;
00053 
00054    // determine if the polygon has all vertices specified.
00055    virtual bool isFull() const; 
00056 
00057    // add a vertex to the polygon
00058    virtual int addVertex(const DtPoint& v);
00059 
00060    // get the i-th vertex of the polygon
00061    virtual bool getVertex(DtPoint& retVal, unsigned int i) const;
00062    const DtPoint& getVertex(unsigned int i) const;
00063 
00064    // get the surface associated with the polygon
00065    virtual  bool getSurface(DtSurface& surfPtr) const;
00066    const DtSurface& getSurface() const;
00067 
00068    // set the surface associated with the polygon
00069    virtual bool setSurface(const DtSurface& newSurface);
00070 
00071    // debugging aid function
00072    virtual void dump(int indentLevel) const;
00073 
00074    virtual int sizeInBytes() const;
00075 
00076 protected:
00077 
00078    DtSurface             mySurface;
00079    std::vector<DtVertex> myVertices;
00080 };
00081 
00082 inline const DtSurface& DtPolygonImmediate::getSurface() const
00083 {
00084    return mySurface;
00085 }
00086 
00087 inline DtGdbNode::DtGdbNodeType DtPolygonImmediate::type() const
00088 {
00089    return DtGdbNode::POLYGON_IMMEDIATE;
00090 }
00091 
00092 inline bool DtPolygonImmediate::isFull() const
00093 {
00094    return(myVertices.size() >= numberOfVertices());
00095 }
00096 
00097 inline int DtPolygonImmediate::addVertex(const DtPoint& v)
00098 {
00099    assert(myVertices.size() < numberOfVertices());
00100    myVertices.push_back(v);
00101    return myVertices.size();
00102 }
00103 
00104 // get the i-th vertex of the polygon
00105 inline bool DtPolygonImmediate::getVertex(DtPoint& retPoint, unsigned int i) const
00106 {
00107    bool returnValue = false;
00108    if (i < myVertices.size())
00109    {
00110       retPoint = myVertices[i];
00111       returnValue = true;
00112    }
00113 
00114    return returnValue;
00115 }
00116 
00117 inline const DtPoint& DtPolygonImmediate::getVertex(unsigned int i) const
00118 {
00119    return myVertices[i];
00120 }
00121 
00122 // set the surface associated with the polygon
00123 inline bool DtPolygonImmediate::setSurface(const DtSurface& newSurface)
00124 {
00125    mySurface = newSurface;
00126    return true;
00127 }
00128 
00129 #endif

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)