SmallChange  1.0.0
A collection of extensions to Coin3D
Loading...
Searching...
No Matches
SoFEMKit.h
1#ifndef SMALLCHANGE_SOFEM_H
2#define SMALLCHANGE_SOFEM_H
3
4/**************************************************************************\
5 * Copyright (c) Kongsberg Oil & Gas Technologies AS
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * Neither the name of the copyright holder nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34\**************************************************************************/
35
36#include <Inventor/nodekits/SoSubKit.h>
37#include <Inventor/nodekits/SoBaseKit.h>
38#include <Inventor/fields/SoSFBool.h>
39#include <Inventor/SbVec3f.h>
40
41#include <SmallChange/basic.h>
42
43class SoFEMKitP;
44class SbColor;
45class SbPlane;
46class SoSensor;
47class SbVec3f;
48
49
50class SMALLCHANGE_DLL_API SoFEMKit : public SoBaseKit {
51 typedef SoBaseKit inherited;
52
53 SO_KIT_HEADER(SoFEMKit);
54
55 SO_KIT_CATALOG_ENTRY_HEADER(topSeparator);
56 SO_KIT_CATALOG_ENTRY_HEADER(shapehints);
57 SO_KIT_CATALOG_ENTRY_HEADER(mbind);
58 SO_KIT_CATALOG_ENTRY_HEADER(nbind);
59 SO_KIT_CATALOG_ENTRY_HEADER(nodes);
60 SO_KIT_CATALOG_ENTRY_HEADER(colors);
61 SO_KIT_CATALOG_ENTRY_HEADER(normals);
62 SO_KIT_CATALOG_ENTRY_HEADER(faceset);
63
64public:
65 SoFEMKit(void);
66
67 SoSFBool ccw;
68 static void initClass(void);
69
70protected:
71 virtual ~SoFEMKit();
72
73public:
74
75 virtual void getBoundingBox(SoGetBoundingBoxAction * action);
76 virtual void GLRender(SoGLRenderAction * action);
77
78 void reset(void);
79 void removeHiddenFaces(const SbBool onoff);
80
81 void addNode(const int nodeidx, const SbVec3f & xyz);
82 void add3DElement(const int elementidx, const int32_t * nodes, const int layerindex = 0);
83 void add2DElement(const int elementidx, const int32_t * nodes, const int layerindex = 0);
84
85 void setNodeColor(const int nodeidx, const SbColor & color);
86 void setElementColor(const int elementidx, const SbColor & color);
87
88 void enableAllElements(const SbBool onoroff);
89 void enableElement(const int elementidx, const SbBool onoroff);
90 void enableElements(const SbPlane & plane, const SbBool onoroff);
91 void enableLayer(const int layerindex, const SbBool onoroff);
92
93 void create3DIndices(int32_t * idxarray, const int32_t * nodes);
94 void create2DIndices(int32_t * idxarray, const int32_t * nodes);
95
96private:
97
98 void updateScene(void);
99
100 static void ccw_cb(void * data, SoSensor * sensor);
101 static void update_cb(void * data, SoSensor * sensor);
102 SoFEMKitP * pimpl;
103
104};
105
106#endif // !SMALLCHANGE_SOFEM_H
Definition misc/SbList.h:69
Definition SbPlane.h:44
The SoFEMKit class is used to visualize finite element meshes.
Definition SoFEMKit.h:50
SoSFBool ccw
Definition SoFEMKit.h:67