1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
|
/**************************************************************************\
*
* This file is part of the Coin 3D visualization library.
* Copyright (C) by Kongsberg Oil & Gas Technologies.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* ("GPL") version 2 as published by the Free Software Foundation.
* See the file LICENSE.GPL at the root directory of this source
* distribution for additional information about the GNU GPL.
*
* For using Coin with software that can not be combined with the GNU
* GPL, and for taking advantage of the additional benefits of our
* support services, please contact Kongsberg Oil & Gas Technologies
* about acquiring a Coin Professional Edition License.
*
* See http://www.coin3d.org/ for more information.
*
* Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
* http://www.sim.no/ sales@sim.no coin-support@coin3d.org
*
\**************************************************************************/
/*!
\class SoDetail SoDetail.h Inventor/details/SoDetail.h
\brief The SoDetail class is the superclass for all classes storing
detailed information about particular shapes.
\ingroup details
Detail information about shapes is used in relation to picking
actions in Coin. They typically contain the relevant information
about what particular part of the shape a pick ray intersected with.
*/
// *************************************************************************
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG_H
#include <Inventor/SbName.h>
#include <Inventor/details/SoConeDetail.h>
#include <Inventor/details/SoCubeDetail.h>
#include <Inventor/details/SoCylinderDetail.h>
#include <Inventor/details/SoFaceDetail.h>
#include <Inventor/details/SoLineDetail.h>
#include <Inventor/details/SoPointDetail.h>
#include <Inventor/details/SoTextDetail.h>
#ifdef HAVE_NODEKITS
#include <Inventor/details/SoNodeKitDetail.h>
#endif // HAVE_NODEKITS
// *************************************************************************
/*!
\fn SoDetail * SoDetail::copy(void) const
Return a deep copy of ourself.
\DANGEROUS_ALLOC_RETURN
*/
// Note: the following documentation for getTypeId() will also be
// visible for subclasses, so keep it general. If you write any
// additional documentation for this method, check the other top-level
// classes with getTypeId() documentation to see if it is applicable
// to update those also (it probably is).
/*!
\fn SoType SoDetail::getTypeId(void) const
Returns the type identification of a detail derived from a class
inheriting SoDetail. This is used for run-time type checking and
"downward" casting.
Usage example:
\code
void fuhbear(SoDetail * detail)
{
if (detail->getTypeId() == SoFaceDetail::getClassTypeId()) {
// safe downward cast, know the type
SoFaceDetail * facedetail = (SoFaceDetail *)detail;
/// [then something] ///
}
return; // ignore if not a SoFaceDetail
}
\endcode
For application programmers wanting to extend the library with new
detail classes: this method needs to be overridden in \e all
subclasses. This is typically done as part of setting up the full
type system for extension classes, which is usually accomplished by
using the pre-defined macros available through
Inventor/nodes/SoSubDetail.h: SO_DETAIL_SOURCE and
SO_DETAIL_INIT_CLASS.
*/
// *************************************************************************
SoType SoDetail::classTypeId STATIC_SOTYPE_INIT;
// *************************************************************************
/*!
Default constructor.
*/
SoDetail::SoDetail(void)
{
}
/*!
Destructor.
*/
SoDetail::~SoDetail()
{
}
/*!
Returns \c TRUE if \a type is derived from (or \e is) this class.
*/
SbBool
SoDetail::isOfType(const SoType type) const
{
return this->getTypeId().isDerivedFrom(type);
}
/*!
Returns the type for this class.
*/
SoType
SoDetail::getClassTypeId(void)
{
return SoDetail::classTypeId;
}
// Note: the following documentation for initClass() will also be
// visible for subclasses, so keep it general.
/*!
Initialize relevant common data for all instances, like the type
system.
*/
void
SoDetail::initClass(void)
{
SoDetail::classTypeId =
SoType::createType(SoType::badType(), SbName("SoDetail"));
SoDetail::initClasses();
}
/*!
Call the initClass() methods of all built-in detail classes.
(The initClass() method of user extension detail classes -- if any
-- must be called explicitly by the application programmer in the
application initialization code.)
*/
void
SoDetail::initClasses(void)
{
SoConeDetail::initClass();
SoCubeDetail::initClass();
SoCylinderDetail::initClass();
SoFaceDetail::initClass();
SoLineDetail::initClass();
SoPointDetail::initClass();
SoTextDetail::initClass();
#ifdef HAVE_NODEKITS
SoNodeKitDetail::initClass();
#endif // HAVE_NODEKITS
}
|