Vertex.h
1 /**************************************************************************\
2  *
3  * FILE: Vertex.h
4  *
5  * This source file is part of DIME.
6  * Copyright (C) 1998-1999 by Systems In Motion. All rights reserved.
7  *
8  * This library is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License, version 2, as
10  * published by the Free Software Foundation.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License (the accompanying file named COPYING) for more
16  * details.
17  *
18  **************************************************************************
19  *
20  * If you need DIME for a non-GPL project, contact Systems In Motion
21  * to acquire a Professional Edition License:
22  *
23  * Systems In Motion http://www.sim.no/
24  * Prof. Brochs gate 6 sales@sim.no
25  * N-7030 Trondheim Voice: +47 22114160
26  * NORWAY Fax: +47 67172912
27  *
28 \**************************************************************************/
29 
30 #ifndef DIME_VERTEX_H
31 #define DIME_VERTEX_H
32 
33 #include <dime/Basic.h>
34 #include <dime/entities/Entity.h>
35 #include <dime/util/Linear.h>
36 
37 class dimePolyline;
38 
39 class DIME_DLL_API dimeVertex : public dimeEntity
40 {
41  friend class dimePolyline;
42  friend class dimeEntity;
43 
44 public:
45  dimeVertex();
46 
47  enum Flags {
48  CURVE_FITTING_VERTEX = 0x01,
49  HAS_CURVE_FIT_TANGENT = 0x02,
50  SPLINE_VERTEX = 0x08,
51  FRAME_CONTROL_POINT = 0x10,
52  POLYLINE_3D_VERTEX = 0x20,
53  POLYGON_MESH_VERTEX = 0x40,
54  POLYFACE_MESH_VERTEX = 0x80
55  };
56 
57  virtual dimeEntity *copy(dimeModel * const model) const;
58  virtual bool getRecord(const int groupcode,
59  dimeParam &param,
60  const int index = 0) const;
61  virtual const char *getEntityName() const;
62 
63  int16 getFlags() const;
64  void setFlags(const int16 flags);
65 
66  void setCoords(const dimeVec3f &v);
67  const dimeVec3f &getCoords() const;
68 
69  int numIndices() const;
70  int getIndex(const int idx) const;
71  void setIndex(const int idx, const int val);
72 
73  virtual bool write(dimeOutput * const out);
74  virtual int typeId() const;
75  virtual int countRecords() const;
76 
77 protected:
78  virtual bool handleRecord(const int groupcode,
79  const dimeParam &param,
80  dimeMemHandler * const memhandler);
81 
82 private:
83  int16 flags;
84 #ifdef DIME_FIXBIG
85  int32 indices[4];
86 #else
87  int16 indices[4];
88 #endif
89  dimeVec3f coords;
90  dimePolyline *polyline; // link back to polyline...
91 
92 }; // class dimeVertex
93 
94 inline void
95 dimeVertex::setCoords(const dimeVec3f &v)
96 {
97  this->coords = v;
98 }
99 
100 inline const dimeVec3f &
101 dimeVertex::getCoords() const
102 {
103  return this->coords;
104 }
105 
106 inline void
107 dimeVertex::setIndex(const int idx, const int val)
108 {
109  assert(idx >= 0 && idx < 4);
110  this->indices[idx] = val;
111 }
112 
113 inline int16
114 dimeVertex::getFlags() const
115 {
116  return this->flags;
117 }
118 
119 inline void
120 dimeVertex::setFlags(const int16 flags)
121 {
122  this->flags = flags;
123 }
124 
125 #endif // ! DIME_VERTEX_H
126 

Copyright © 1998-1999, Systems In Motion <sales@sim.no>. All rights reserved.
System documentation was generated using doxygen.