dime  0.9.1
Portable DXF file library
Loading...
Searching...
No Matches
State.h
1/**************************************************************************\
2 * Copyright (c) Kongsberg Oil & Gas Technologies AS
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 *
12 * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * Neither the name of the copyright holder nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31\**************************************************************************/
32
33#ifndef DIME_STATE_H
34#define DIME_STATE_H
35
36#include <dime/util/Linear.h>
37
38class dimeInsert;
39
40class DIME_DLL_API dimeState
41{
42public:
43 dimeState(const bool traversePolylineVertices,
44 const bool explodeInserts);
45 dimeState(const dimeState &st);
46
47 const dimeMatrix &getMatrix() const;
48 const dimeMatrix &getInvMatrix() const;
49 void getMatrix(dimeMatrix &m) const;
50 void setMatrix(const dimeMatrix &matrix);
51
52 enum {
53 TRAVERSE_POLYLINE_VERTICES = 0x1,
54 EXPLODE_INSERTS = 0x2,
55 // private flags
56 PUBLIC_MASK = 0x7fff,
57 PRIVATE_MASK = 0x8000,
58 INVMATRIX_DIRTY = 0x8000
59 };
60
61 void setFlags(const unsigned int flags);
62 unsigned int getFlags() const;
63
64 const dimeInsert *getCurrentInsert() const;
65
66private:
67 friend class dimeInsert;
68 dimeMatrix matrix;
69 dimeMatrix invmatrix; // to speed up things...
70 unsigned int flags;
71 const dimeInsert *currentInsert;
72}; // class dimeState
73
74inline const dimeMatrix &
75dimeState::getMatrix() const {
76 return this->matrix;
77}
78
79inline void
80dimeState::setFlags(const unsigned int flags)
81{
82 this->flags = (this->flags & PRIVATE_MASK) | flags;
83}
84
85inline unsigned int
86dimeState::getFlags() const
87{
88 return (this->flags & PUBLIC_MASK);
89}
90
91inline const dimeInsert *
92dimeState::getCurrentInsert() const
93{
94 return this->currentInsert;
95}
96
97#endif // ! DIME_STATE_H
98
The dimeInsert class handles an INSERT entity.
Definition Insert.h:43
The dimeMatrix class is for containing and operating on a four-by-four matrix.
Definition Linear.h:159
The dimeState class manages various state variables while the model is traversed.
Definition State.h:41