VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
polygonImmediate.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1999 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: polyImm.h,v $ $Revision: 1.12 $ $State: Exp $
7 *********************************************************************/
8 
9 #ifndef polygonImmediate_H_
10 #define polygonImmediate_H_
11 
12 #include "gdb/gdbDefines.h"
13 #include "gdb/basePolygon.h"
14 #include <vlutil/vlConfig.h>
15 #include <vector>
16 #include <assert.h>
17 #include "geometry/surface.h"
18 
19 
20 
21 //forward declarations
22 class DtPoint;
23 
24 // class DtPolygonImmediate:
25 //
26 // DtPolygonImmediate are
27 
29 {
30 public:
31 
32  // default constructor
34 
35  // additional constructor
36  DtPolygonImmediate(unsigned int numVertices);
37 
38  // set the number of polygon vertices; initializes the vertex
39  // list array to the specified size
40  virtual void setNumberOfVertices(unsigned int n);
41 
42  // destructor
43  virtual ~DtPolygonImmediate();
44 
45  // copy constructor
47 
48  // assignment operator
50 
51  // @return the type of DtGdbNode
52  virtual DtGdbNode::DtGdbNodeType type() const;
53 
54  // determine if the polygon has all vertices specified.
55  virtual bool isFull() const;
56 
57  // add a vertex to the polygon
58  virtual int addVertex(const DtPoint& v);
59 
60  // get the i-th vertex of the polygon
61  virtual bool getVertex(DtPoint& retVal, unsigned int i) const;
62  const DtPoint& getVertex(unsigned int i) const;
63 
64  // get the surface associated with the polygon
65  virtual bool getSurface(DtSurface& surfPtr) const;
66  const DtSurface& getSurface() const;
67 
68  // set the surface associated with the polygon
69  virtual bool setSurface(const DtSurface& newSurface);
70 
71  // debugging aid function
72  virtual void dump(int indentLevel) const;
73 
74  virtual int sizeInBytes() const;
75 
76 protected:
77 
79  std::vector<DtVertex> myVertices;
80 };
81 
83 {
84  return mySurface;
85 }
86 
88 {
90 }
91 
92 inline bool DtPolygonImmediate::isFull() const
93 {
94  return(myVertices.size() >= numberOfVertices());
95 }
96 
98 {
99  assert(myVertices.size() < numberOfVertices());
100  myVertices.push_back(v);
101  return myVertices.size();
102 }
103 
104 // get the i-th vertex of the polygon
105 inline bool DtPolygonImmediate::getVertex(DtPoint& retPoint, unsigned int i) const
106 {
107  bool returnValue = false;
108  if (i < myVertices.size())
109  {
110  retPoint = myVertices[i];
111  returnValue = true;
112  }
113 
114  return returnValue;
115 }
116 
117 inline const DtPoint& DtPolygonImmediate::getVertex(unsigned int i) const
118 {
119  return myVertices[i];
120 }
121 
122 // set the surface associated with the polygon
123 inline bool DtPolygonImmediate::setSurface(const DtSurface& newSurface)
124 {
125  mySurface = newSurface;
126  return true;
127 }
128 
129 #endif
std::vector< DtVertex > myVertices
Definition: polygonImmediate.h:79
virtual bool getVertex(DtPoint &retVal, unsigned int i) const
Definition: polygonImmediate.h:105
Definition: polygonImmediate.h:28
DtBasePolygon & operator=(const DtBasePolygon &orig)
DtGdbNodeType
Definition: gdbNode.h:48
virtual bool setSurface(const DtSurface &newSurface)=0
Definition: surface.h:181
#define DT_DLL_gdb
Definition: gdbDefines.h:25
Definition: basePolygon.h:29
virtual int sizeInBytes() const =0
virtual void setNumberOfVertices(unsigned int n)
Definition: basePolygon.h:206
Definition: gdbNode.h:54
virtual DtGdbNode::DtGdbNodeType type() const
Definition: polygonImmediate.h:87
virtual const DtSurface & getSurface() const =0
virtual bool isFull() const =0
virtual unsigned int numberOfVertices() const
Definition: basePolygon.h:201
const DtSurface & getSurface() const
Definition: polygonImmediate.h:82
DtSurface mySurface
Definition: polygonImmediate.h:78
virtual int addVertex(const DtPoint &v)
Definition: polygonImmediate.h:97
virtual bool setSurface(const DtSurface &newSurface)
Definition: polygonImmediate.h:123
virtual bool isFull() const
Definition: polygonImmediate.h:92
virtual void dump(int indentLevel) const =0
virtual bool getVertex(DtPoint &retVal, unsigned int i) const =0
virtual DtGdbNodeType type(void) const =0
Definition: point.h:34

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)