Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
Layer.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_LAYER_H
34 #define DIME_LAYER_H
35 
36 #include <dime/Basic.h>
37 
38 class DIME_DLL_API dimeLayer
39 {
40 public:
41 
42  enum Flags {
43  FROZEN = 0x1,
44  FROZEN_NEW_VIEWPORTS = 0x2,
45  LOCKED = 0x4
46  };
47 
48  const char *getLayerName() const;
49  int getLayerNum() const;
50 
51  int16 getColorNumber() const;
52  void setColorNumber(const int16 num);
53 
54  int16 getFlags() const;
55  void setFlags(const int16 &flags);
56 
57  bool isDefaultLayer() const;
58 
59  static const dimeLayer *getDefaultLayer();
60 
61  static void colorToRGB(const int colornum,
62  dxfdouble &r, dxfdouble &g, dxfdouble &b);
63 
64 private:
65  friend class dimeModel;
66 
67  dimeLayer();
68  dimeLayer(const char * const name, const int num,
69  const int16 colnum, const int16 flags);
70  const char *layerName;
71  int layerNum;
72  int16 colorNum;
73  int16 flags;
74 
75  static void cleanup_default_layer(void);
76  static dimeLayer * defaultLayer;
77 
78 }; // class dimeLayer
79 
80 inline const char *
82 {
83  return layerName;
84 }
85 
86 inline int
88 {
89  return layerNum;
90 }
91 
92 inline int16
94 {
95  return colorNum;
96 }
97 
98 inline void
99 dimeLayer::setColorNumber(const int16 num)
100 {
101  this->colorNum = num;
102 }
103 
104 inline int16
106 {
107  return this->flags;
108 }
109 
110 inline void
111 dimeLayer::setFlags(const int16 &flags)
112 {
113  this->flags = flags;
114 }
115 
116 inline bool
118 {
119  return this == dimeLayer::getDefaultLayer();
120 }
121 
122 #endif // ! DIME_LAYER_H
123 
const char * getLayerName() const
Definition: Layer.h:81
int16 getColorNumber() const
Definition: Layer.h:93
static const dimeLayer * getDefaultLayer()
Definition: Layer.cpp:404
int16 getFlags() const
Definition: Layer.h:105
The dimeModel class organizes a model.
Definition: Model.h:54
void setColorNumber(const int16 num)
Definition: Layer.h:99
void setFlags(const int16 &flags)
Definition: Layer.h:111
bool isDefaultLayer() const
Definition: Layer.h:117
int getLayerNum() const
Definition: Layer.h:87
The dimeLayer class handles layers.
Definition: Layer.h:38