State.h
1 /**************************************************************************\
2  *
3  * FILE: State.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_STATE_H
31 #define DIME_STATE_H
32 
33 #include <dime/util/Linear.h>
34 
35 class dimeInsert;
36 
37 class DIME_DLL_API dimeState
38 {
39 public:
40  dimeState(const bool traversePolylineVertices,
41  const bool explodeInserts);
42  dimeState(const dimeState &st);
43 
44  const dimeMatrix &getMatrix() const;
45  const dimeMatrix &getInvMatrix() const;
46  void getMatrix(dimeMatrix &m) const;
47  void setMatrix(const dimeMatrix &matrix);
48 
49  enum {
50  TRAVERSE_POLYLINE_VERTICES = 0x1,
51  EXPLODE_INSERTS = 0x2,
52  // private flags
53  PUBLIC_MASK = 0x7fff,
54  PRIVATE_MASK = 0x8000,
55  INVMATRIX_DIRTY = 0x8000
56  };
57 
58  void setFlags(const unsigned int flags);
59  unsigned int getFlags() const;
60 
61  const dimeInsert *getCurrentInsert() const;
62 
63 private:
64  friend class dimeInsert;
65  dimeMatrix matrix;
66  dimeMatrix invmatrix; // to speed up things...
67  unsigned int flags;
68  const dimeInsert *currentInsert;
69 }; // class dimeState
70 
71 inline const dimeMatrix &
72 dimeState::getMatrix() const {
73  return this->matrix;
74 }
75 
76 inline void
77 dimeState::setFlags(const unsigned int flags)
78 {
79  this->flags = (this->flags & PRIVATE_MASK) | flags;
80 }
81 
82 inline unsigned int
83 dimeState::getFlags() const
84 {
85  return (this->flags & PUBLIC_MASK);
86 }
87 
88 inline const dimeInsert *
89 dimeState::getCurrentInsert() const
90 {
91  return this->currentInsert;
92 }
93 
94 #endif // ! DIME_STATE_H
95 

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