| 1 |
/*************************************************************************** |
| 2 |
* Copyright (c) 2010 Werner Mayer <wmayer[at]users.sourceforge.net> * |
| 3 |
* * |
| 4 |
* This file is part of the FreeCAD CAx development system. * |
| 5 |
* * |
| 6 |
* This library is free software; you can redistribute it and/or * |
| 7 |
* modify it under the terms of the GNU Library General Public * |
| 8 |
* License as published by the Free Software Foundation; either * |
| 9 |
* version 2 of the License, or (at your option) any later version. * |
| 10 |
* * |
| 11 |
* This library is distributed in the hope that it will be useful, * |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 14 |
* GNU Library General Public License for more details. * |
| 15 |
* * |
| 16 |
* You should have received a copy of the GNU Library General Public * |
| 17 |
* License along with this library; see the file COPYING.LIB. If not, * |
| 18 |
* write to the Free Software Foundation, Inc., 59 Temple Place, * |
| 19 |
* Suite 330, Boston, MA 02111-1307, USA * |
| 20 |
* * |
| 21 |
***************************************************************************/ |
| 22 |
|
| 23 |
#ifndef GUI_SOSHAPESCALE_H |
| 24 |
#define GUI_SOSHAPESCALE_H |
| 25 |
|
| 26 |
#include <Inventor/fields/SoSFColor.h> |
| 27 |
#include <Inventor/fields/SoSFFloat.h> |
| 28 |
#include <Inventor/fields/SoSFString.h> |
| 29 |
#include <Inventor/fields/SoSFVec3f.h> |
| 30 |
#include <Inventor/nodekits/SoBaseKit.h> |
| 31 |
#include <Inventor/nodes/SoShape.h> |
| 32 |
#include <FCGlobal.h> |
| 33 |
|
| 34 |
|
| 35 |
class SbViewport; |
| 36 |
class SoState; |
| 37 |
class SbColor; |
| 38 |
class SbVec2s; |
| 39 |
|
| 40 |
namespace Gui |
| 41 |
{ |
| 42 |
class GuiExport SoShapeScale: public SoBaseKit |
| 43 |
{ |
| 44 |
using inherited = SoBaseKit; |
| 45 |
|
| 46 |
SO_KIT_HEADER(SoShapeScale); |
| 47 |
|
| 48 |
SO_KIT_CATALOG_ENTRY_HEADER(topSeparator); |
| 49 |
SO_KIT_CATALOG_ENTRY_HEADER(scale); |
| 50 |
SO_KIT_CATALOG_ENTRY_HEADER(shape); |
| 51 |
|
| 52 |
public: |
| 53 |
SoShapeScale(); |
| 54 |
static void initClass(); |
| 55 |
|
| 56 |
SoSFFloat active; |
| 57 |
SoSFFloat scaleFactor; |
| 58 |
|
| 59 |
protected: |
| 60 |
void GLRender(SoGLRenderAction* action) override; |
| 61 |
~SoShapeScale() override; |
| 62 |
}; |
| 63 |
|
| 64 |
class GuiExport SoAxisCrossKit: public SoBaseKit |
| 65 |
{ |
| 66 |
using inherited = SoBaseKit; |
| 67 |
|
| 68 |
SO_KIT_HEADER(SoAxisCrossKit); |
| 69 |
|
| 70 |
SO_KIT_CATALOG_ENTRY_HEADER(xAxis); |
| 71 |
SO_KIT_CATALOG_ENTRY_HEADER(xHead); |
| 72 |
SO_KIT_CATALOG_ENTRY_HEADER(yAxis); |
| 73 |
SO_KIT_CATALOG_ENTRY_HEADER(yHead); |
| 74 |
SO_KIT_CATALOG_ENTRY_HEADER(zAxis); |
| 75 |
SO_KIT_CATALOG_ENTRY_HEADER(zHead); |
| 76 |
|
| 77 |
public: |
| 78 |
SoAxisCrossKit(); |
| 79 |
|
| 80 |
// Overrides default method. All the parts are shapeKits, |
| 81 |
// so this node will not affect the state. |
| 82 |
SbBool affectsState() const override; |
| 83 |
void addWriteReference(SoOutput* out, SbBool isfromfield = false) override; |
| 84 |
void getBoundingBox(SoGetBoundingBoxAction* action) override; |
| 85 |
|
| 86 |
static void initClass(); |
| 87 |
|
| 88 |
private: |
| 89 |
// Constructor calls to build and set up parts. |
| 90 |
void createAxes(); |
| 91 |
~SoAxisCrossKit() override; |
| 92 |
}; |
| 93 |
|
| 94 |
class GuiExport SoRegPoint: public SoShape |
| 95 |
{ |
| 96 |
using inherited = SoShape; |
| 97 |
|
| 98 |
SO_NODE_HEADER(SoRegPoint); |
| 99 |
|
| 100 |
public: |
| 101 |
static void initClass(); |
| 102 |
SoRegPoint(); |
| 103 |
|
| 104 |
void notify(SoNotList* node) override; |
| 105 |
|
| 106 |
SoSFVec3f base; |
| 107 |
SoSFVec3f normal; |
| 108 |
SoSFFloat length; |
| 109 |
SoSFColor color; |
| 110 |
SoSFString text; |
| 111 |
|
| 112 |
protected: |
| 113 |
~SoRegPoint() override; |
| 114 |
void GLRender(SoGLRenderAction* action) override; |
| 115 |
void computeBBox(SoAction* action, SbBox3f& box, SbVec3f& center) override; |
| 116 |
void generatePrimitives(SoAction* action) override; |
| 117 |
|
| 118 |
private: |
| 119 |
SoSeparator* root; |
| 120 |
}; |
| 121 |
|
| 122 |
} // namespace Gui |
| 123 |
|
| 124 |
#endif // GUI_SOSHAPESCALE_H |