本文整理汇总了C++中SoType::isDerivedFrom方法的典型用法代码示例。如果您正苦于以下问题:C++ SoType::isDerivedFrom方法的具体用法?C++ SoType::isDerivedFrom怎么用?C++ SoType::isDerivedFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoType
的用法示例。
在下文中一共展示了SoType::isDerivedFrom方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
SoEnabledElementsList::enable(SoType elementType, int stackIndex)
//
////////////////////////////////////////////////////////////////////////
{
SoType prev = elements[stackIndex];
// If not enabled before or if enabled before but we are now
// enabling a more-specific subclass, add the element.
if (prev.isBad() ||
(elementType != prev && elementType.isDerivedFrom(prev))) {
elements.set(stackIndex, elementType);
// Increment global counter to indicate that lists have changed
counter++;
}
#ifdef DEBUG
// If we aren't enabling a more general super-class (and therefore
// don't need to do anything), error:
else if (! prev.isDerivedFrom(elementType)) {
const char *eltName = elementType.getName().getString();
SoDebugError::post("SoAction::enableElement",
"Cannot enable element %s because element %s "
"is already enabled",
eltName, prev.getName().getString());
}
#endif
}
示例2: if
// Documented in superclass.
void
SoWinExaminerViewer::setCamera(SoCamera * newCamera)
{
// This method overridden from parent class to toggle the camera
// type selection button pixmap and string of the zoom/dolly
// thumbwheel.
inherited::setCamera(newCamera);
if (! newCamera)
return;
SoType camtype = newCamera->getTypeId();
SbBool orthogonal =
camtype.isDerivedFrom(SoOrthographicCamera::getClassTypeId());
const char * oldLabel = this->getRightWheelString();
if (oldLabel) {
if (orthogonal) {
if (strcmp("Dolly",oldLabel) == 0)
this->setRightWheelString("Zoom");
}
else if (strcmp("Zoom",oldLabel) == 0)
this->setRightWheelString("Dolly");
}
SoWinBitmapButton * wbtn = PRIVATE(this)->camerabutton;
// If viewer was made without decorations, button will not have been
// made yet.
if (wbtn) { wbtn->setBitmap(orthogonal ? 1 : 0); }
}
示例3: getCompatibilityMode
/*!
Set the node compatibility mask for node type \a nodetype. The mask
specifies for which file formats the node is supported.
\COIN_FUNCTION_EXTENSION
\sa getCompatibilityMode()
\since Coin 2.0
*/
void
SoNode::setCompatibilityTypes(const SoType & nodetype, const uint32_t bitmask)
{
assert(compatibility_dict);
assert(nodetype.isDerivedFrom(SoNode::getClassTypeId()));
compatibility_dict->put(nodetype.getKey(), bitmask);
}
示例4: if
void
SoUnknownNode::createFromIsA(SoMFString *isA)
//
////////////////////////////////////////////////////////////////////////
{
for (int i = 0; i < isA->getNum(); i++) {
SoType t = SoType::fromName((*isA)[i]);
if (t.canCreateInstance() &&
t.isDerivedFrom(SoNode::getClassTypeId())) {
SoNode *alternateRep = (SoNode *)t.createInstance();
alternateRep->ref();
#ifdef DEBUG
if (alternateRep == NULL) {
SoDebugError::post("SoUnknownNode::createFromIsA",
"SoType.createInstance returned "
"NULL (type %s)",
t.getName().getString());
return;
}
#endif
// Copy over all fields that are shared:
int num = instanceFieldData->getNumFields();
for (int j=0; j<num; j++) {
const SbName &fieldName = instanceFieldData->getFieldName(j);
SoField *f = instanceFieldData->getField(this, j);
// Don't copy over fields with default values:
if (f->isDefault()) continue;
SoField *nf = alternateRep->getField(fieldName);
if (nf != NULL && nf->getTypeId() == f->getTypeId()) {
nf->copyFrom(*f);
if (f->isConnectedFromField()) {
SoField *cf;
f->getConnectedField(cf);
nf->connectFrom(cf);
} else if (f->isConnectedFromEngine()) {
SoEngineOutput *eo;
f->getConnectedEngine(eo);
nf->connectFrom(eo);
}
}
}
// And if alternateRep is a group, copy over hidden
// children:
if (alternateRep->isOfType(SoGroup::getClassTypeId())) {
SoGroup *g = (SoGroup *)alternateRep;
for (int kid = 0; kid < hiddenChildren.getLength();
kid++) {
g->addChild(hiddenChildren[kid]);
}
}
addChild(alternateRep);
return;
}
}
}
示例5: if
int
main(void)
{
SoDB::init();
SoNodeKit::init();
SoInteraction::init();
SoTypeList tl;
const unsigned int n = SoType::getAllDerivedFrom(SoNode::getClassTypeId(), tl);
for (unsigned int i=0; i < n; i++) {
(void)fprintf(stdout, "%s", tl[i].getName().getString());
SoFieldContainer * fc = (SoFieldContainer *)
(tl[i].canCreateInstance() ? tl[i].createInstance() : NULL);
if (fc == NULL) {
(void)fprintf(stdout, " (abstract)\n");
continue;
}
(void)fprintf(stdout, "\n");
SoFieldList fl;
const unsigned int nrf = fc->getAllFields(fl);
for (unsigned int j=0; j < nrf; j++) {
SoField * f = fl[j];
SoType ftype = f->getTypeId();
SbName fname;
f->getContainer()->getFieldName(f, fname);
(void)fprintf(stdout, " %s (%s)\n",
fname.getString(),
ftype.getName().getString());
if (ftype.isDerivedFrom(SoSFEnum::getClassTypeId())) {
list_enums((SoSFEnum *)f);
}
else if (ftype.isDerivedFrom(SoMFEnum::getClassTypeId())) {
list_enums((SoMFEnum *)f);
}
}
}
return 0;
}
示例6: assert
/*!
Get the node compatibility mask for node type \a nodetype. The
return value will be a bit mask of SoNode::NodeType flags,
containing one or several flags.
\COIN_FUNCTION_EXTENSION
\since Coin 2.0
*/
uint32_t
SoNode::getCompatibilityTypes(const SoType & nodetype)
{
assert(compatibility_dict);
assert(nodetype.isDerivedFrom(SoNode::getClassTypeId()));
uint32_t tmp;
if (compatibility_dict->get(nodetype.getKey(), tmp)) { return tmp; }
return SoNode::EXTENSION;
}
示例7:
SoCallbackAction::Response
SoIntersectionDetectionAction::PImpl::dragger(SoCallbackAction * action, const SoNode *)
{
if ( !this->draggersenabled ) // dragger setting overrides setting for manipulators
return SoCallbackAction::PRUNE;
#ifdef HAVE_MANIPULATORS
if ( !this->manipsenabled ) {
const SoPath * path = action->getCurPath();
SoNode * tail = path->getTail();
SoType type = tail->getTypeId();
if ( type.isDerivedFrom(SoTransformManip::getClassTypeId()) ||
type.isDerivedFrom(SoClipPlaneManip::getClassTypeId()) ||
type.isDerivedFrom(SoDirectionalLightManip::getClassTypeId()) ||
type.isDerivedFrom(SoPointLightManip::getClassTypeId()) ||
type.isDerivedFrom(SoSpotLightManip::getClassTypeId()) )
return SoCallbackAction::PRUNE;
}
#endif // HAVE_MANIPULATORS
return SoCallbackAction::CONTINUE;
}
示例8: getSoRenderManager
void SIM::Coin3D::Quarter::SoQTQuarterAdaptor::setCameraType(SoType type)
{
if(!getSoRenderManager()->getCamera()->isOfType(SoPerspectiveCamera::getClassTypeId()) &&
!getSoRenderManager()->getCamera()->isOfType(SoOrthographicCamera::getClassTypeId())) {
Base::Console().Warning("Quarter::setCameraType",
"Only SoPerspectiveCamera and SoOrthographicCamera is supported.");
return;
}
SoType perspectivetype = SoPerspectiveCamera::getClassTypeId();
SbBool oldisperspective = getSoRenderManager()->getCamera()->getTypeId().isDerivedFrom(perspectivetype);
SbBool newisperspective = type.isDerivedFrom(perspectivetype);
if((oldisperspective && newisperspective) ||
(!oldisperspective && !newisperspective)) // Same old, same old..
return;
SoCamera* currentcam = getSoRenderManager()->getCamera();
SoCamera* newcamera = (SoCamera*)type.createInstance();
// Transfer and convert values from one camera type to the other.
if(newisperspective) {
convertOrtho2Perspective((SoOrthographicCamera*)currentcam,
(SoPerspectiveCamera*)newcamera);
}
else {
convertPerspective2Ortho((SoPerspectiveCamera*)currentcam,
(SoOrthographicCamera*)newcamera);
}
getSoRenderManager()->setCamera(newcamera);
getSoEventManager()->setCamera(newcamera);
//if the superscene has a camera we need to replace it too
SoSeparator* superscene = (SoSeparator*) getSoRenderManager()->getSceneGraph();
SoSearchAction sa;
sa.setInterest(SoSearchAction::FIRST);
sa.setType(SoCamera::getClassTypeId());
sa.apply(superscene);
if(sa.getPath()) {
SoNode* node = sa.getPath()->getTail();
SoGroup* parent = (SoGroup*) sa.getPath()->getNodeFromTail(1);
if(node && node->isOfType(SoCamera::getClassTypeId())) {
parent->replaceChild(node, newcamera);
}
}
};
示例9:
void
SoActionMethodList::addMethod(SoType nodeType, SoActionMethod method)
//
////////////////////////////////////////////////////////////////////////
{
#ifdef DEBUG
// Make sure nodeType is a kind of node!
if (! nodeType.isDerivedFrom(SoNode::getClassTypeId()))
SoDebugError::post("SoAction::addMethod", "%s is not a node type",
nodeType.getName().getString());
#endif /* DEBUG */
numValidTypes = 0;
(*this)[SoNode::getActionMethodIndex(nodeType)] = method;
}
示例10: printf
/*!
This method appends all the class types derived from \a type to \a list,
and returns the number of types added to the list. Internal types are not
included in the list, nor are they counted.
\a type itself is also added to the list, as a type is seen as a derivation
of its own type.
NB: do not write code which depends in any way on the order of the
elements returned in \a list.
Here is a small, stand-alone example which shows how this method can
be used for introspection, listing all subclasses of the SoBase
superclass:
\code
#include <stdio.h>
#include <Inventor/SoDB.h>
#include <Inventor/lists/SoTypeList.h>
static void
list_subtypes(SoType t, unsigned int indent = 0)
{
SoTypeList tl;
SoType::getAllDerivedFrom(t, tl);
for (unsigned int i=0; i < indent; i++) { printf(" "); }
printf("%s\n", t.getName().getString());
indent++;
for (int j=0; j < tl.getLength(); j++) {
if (tl[j].getParent() == t) { // only interested in direct descendents
list_subtypes(tl[j], indent);
}
}
}
int
main(void)
{
SoDB::init();
list_subtypes(SoType::fromName("SoBase"));
return 0;
}
\endcode
*/
int
SoType::getAllDerivedFrom(const SoType type, SoTypeList & list)
{
assert(type != SoType::badType() && "argument is badType()");
int counter = 0;
int n = SoType::typedatalist->getLength();
for (int i = 0; i < n; i++) {
if ((*SoType::typedatalist)[i]) {
SoType chktype = (*SoType::typedatalist)[i]->type;
if (!chktype.isInternal() && chktype.isDerivedFrom(type)) {
list.append(chktype);
counter++;
}
}
}
return counter;
}
示例11: readInstance
SbBool
SoGate::readInstance(SoInput *in, unsigned short flags)
//
////////////////////////////////////////////////////////////////////////
{
SbName typeName;
if (!in->read(typeName, TRUE) ||
typeName != "type" || !typeField.read(in, "type")) {
SoReadError::post(in, "SoGate is missing type field");
return FALSE;
}
SoType inputType = SoType::fromName(typeField.getValue());
if (! inputType.isDerivedFrom(SoMField::getClassTypeId())) {
SoReadError::post(in, "\"%s\" is not a type of MField",
typeField.getValue().getString());
return FALSE;
}
setup(inputType);
return SoEngine::readInstance(in, flags);
}
示例12: processSoEvent
SbBool GestureNavigationStyle::processSoEvent(const SoEvent * const ev)
{
// Events when in "ready-to-seek" mode are ignored, except those
// which influence the seek mode itself -- these are handled further
// up the inheritance hierarchy.
if (this->isSeekMode()) { return inherited::processSoEvent(ev); }
// Switch off viewing mode (Bug #0000911)
if (!this->isSeekMode()&& !this->isAnimating() && this->isViewing() )
this->setViewing(false); // by default disable viewing mode to render the scene
//setViewing() is never used in this style, so the previous if is very unlikely to be hit.
const SoType type(ev->getTypeId());
//define some shortcuts...
bool evIsButton = type.isDerivedFrom(SoMouseButtonEvent::getClassTypeId());
bool evIsKeyboard = type.isDerivedFrom(SoKeyboardEvent::getClassTypeId());
bool evIsLoc2 = type.isDerivedFrom(SoLocation2Event::getClassTypeId());//mouse movement
bool evIsLoc3 = type.isDerivedFrom(SoMotion3Event::getClassTypeId());//spaceball/joystick movement
bool evIsGesture = type.isDerivedFrom(SoGestureEvent::getClassTypeId());//touchscreen gesture
const SbVec2f prevnormalized = this->lastmouseposition;
const SbVec2s pos(ev->getPosition());//not valid for gestures
const SbVec2f posn = this->normalizePixelPos(pos);
//pos: local coordinates of event, in pixels
//posn: normalized local coordinates of event ((0,0) = lower left corner, (1,1) = upper right corner)
float ratio = viewer->getSoRenderManager()->getViewportRegion().getViewportAspectRatio();
if (evIsButton || evIsLoc2){
this->lastmouseposition = posn;
}
const ViewerMode curmode = this->currentmode;
//ViewerMode newmode = curmode;
//make a unified mouse+modifiers state value (combo)
enum {
BUTTON1DOWN = 1 << 0,
BUTTON2DOWN = 1 << 1,
BUTTON3DOWN = 1 << 2,
CTRLDOWN = 1 << 3,
SHIFTDOWN = 1 << 4,
ALTDOWN = 1 << 5,
MASKBUTTONS = BUTTON1DOWN | BUTTON2DOWN | BUTTON3DOWN,
MASKMODIFIERS = CTRLDOWN | SHIFTDOWN | ALTDOWN
};
unsigned int comboBefore = //before = state before this event
(this->button1down ? BUTTON1DOWN : 0) |
(this->button2down ? BUTTON2DOWN : 0) |
(this->button3down ? BUTTON3DOWN : 0) |
(this->ctrldown ? CTRLDOWN : 0) |
(this->shiftdown ? SHIFTDOWN : 0) |
(this->altdown ? ALTDOWN : 0);
//test for complex clicks
int cntMBBefore = (comboBefore & BUTTON1DOWN ? 1 : 0 ) //cntMBBefore = how many buttons were down when this event arrived?
+(comboBefore & BUTTON2DOWN ? 1 : 0 )
+(comboBefore & BUTTON3DOWN ? 1 : 0 );
if (cntMBBefore>=2) this->thisClickIsComplex = true;
if (cntMBBefore==0) {//a good chance to reset some click-related stuff
this->thisClickIsComplex = false;
this->mousedownConsumedCount = 0;//shouldn't be necessary, just a fail-safe.
}
// Mismatches in state of the modifier keys happens if the user
// presses or releases them outside the viewer window.
this->ctrldown = ev->wasCtrlDown();
this->shiftdown = ev->wasShiftDown();
this->altdown = ev->wasAltDown();
//before this block, mouse button states in NavigationStyle::buttonXdown reflected those before current event arrived.
//track mouse button states
if (evIsButton) {
const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev;
const int button = event->getButton();
const SbBool press //the button was pressed (if false -> released)
= event->getState() == SoButtonEvent::DOWN ? TRUE : FALSE;
switch (button) {
case SoMouseButtonEvent::BUTTON1:
this->button1down = press;
break;
case SoMouseButtonEvent::BUTTON2:
this->button2down = press;
break;
case SoMouseButtonEvent::BUTTON3:
this->button3down = press;
break;
//whatever else, we don't track
}
}
//after this block, the new states of the buttons are already in.
unsigned int comboAfter = //after = state after this event (current, essentially)
(this->button1down ? BUTTON1DOWN : 0) |
(this->button2down ? BUTTON2DOWN : 0) |
(this->button3down ? BUTTON3DOWN : 0) |
(this->ctrldown ? CTRLDOWN : 0) |
(this->shiftdown ? SHIFTDOWN : 0) |
(this->altdown ? ALTDOWN : 0);
//test for complex clicks (again)
int cntMBAfter = (comboAfter & BUTTON1DOWN ? 1 : 0 ) //cntMBAfter = how many buttons were down when this event arrived?
+(comboAfter & BUTTON2DOWN ? 1 : 0 )
//.........这里部分代码省略.........
示例13: processSoEvent
SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
{
#if 0
// Events when in "ready-to-seek" mode are ignored, except those
// which influence the seek mode itself -- these are handled further
// up the inheritance hierarchy.
if (this->isSeekMode()) { return inherited::processSoEvent(ev); }
#else
if (!this->isSeekMode() && this->isViewing())
this->setViewing(false); // by default disable viewing mode to render the scene
#endif
const SoType type(ev->getTypeId());
const SbViewportRegion & vp = viewer->getViewportRegion();
const SbVec2s size(vp.getViewportSizePixels());
const SbVec2f prevnormalized = this->lastmouseposition;
const SbVec2s pos(ev->getPosition());
const SbVec2f posn((float) pos[0] / (float) SoQtMax((int)(size[0] - 1), 1),
(float) pos[1] / (float) SoQtMax((int)(size[1] - 1), 1));
this->lastmouseposition = posn;
// Set to TRUE if any event processing happened. Note that it is not
// necessary to restrict ourselves to only do one "action" for an
// event, we only need this flag to see if any processing happened
// at all.
SbBool processed = FALSE;
const ViewerMode curmode = this->currentmode;
ViewerMode newmode = curmode;
// Mismatches in state of the modifier keys happens if the user
// presses or releases them outside the viewer window.
if (this->ctrldown != ev->wasCtrlDown()) {
this->ctrldown = ev->wasCtrlDown();
}
if (this->shiftdown != ev->wasShiftDown()) {
this->shiftdown = ev->wasShiftDown();
}
if (this->altdown != ev->wasAltDown()) {
this->altdown = ev->wasAltDown();
}
// give the nodes in the foreground root the chance to handle events (e.g color bar)
if (!processed && !viewer->isEditing()) {
processed = handleEventInForeground(ev);
if (processed)
return TRUE;
}
// Keyboard handling
if (type.isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
const SoKeyboardEvent * const event = (const SoKeyboardEvent *) ev;
const SbBool press = event->getState() == SoButtonEvent::DOWN ? TRUE : FALSE;
switch (event->getKey()) {
case SoKeyboardEvent::LEFT_CONTROL:
case SoKeyboardEvent::RIGHT_CONTROL:
this->ctrldown = press;
break;
case SoKeyboardEvent::LEFT_SHIFT:
case SoKeyboardEvent::RIGHT_SHIFT:
this->shiftdown = press;
break;
case SoKeyboardEvent::LEFT_ALT:
case SoKeyboardEvent::RIGHT_ALT:
this->altdown = press;
break;
case SoKeyboardEvent::H:
processed = TRUE;
viewer->saveHomePosition();
break;
case SoKeyboardEvent::S:
case SoKeyboardEvent::HOME:
case SoKeyboardEvent::LEFT_ARROW:
case SoKeyboardEvent::UP_ARROW:
case SoKeyboardEvent::RIGHT_ARROW:
case SoKeyboardEvent::DOWN_ARROW:
if (!this->isViewing())
this->setViewing(true);
break;
default:
break;
}
}
// Mouse Button / Spaceball Button handling
if (type.isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev;
const int button = event->getButton();
const SbBool press = event->getState() == SoButtonEvent::DOWN ? TRUE : FALSE;
// SoDebugError::postInfo("processSoEvent", "button = %d", button);
switch (button) {
case SoMouseButtonEvent::BUTTON1:
this->lockrecenter = TRUE;
this->button1down = press;
#if 0 // disable to avoid interferences where this key combination is used, too
if (press && ev->wasShiftDown() &&
(this->currentmode != NavigationStyle::SELECTION)) {
//.........这里部分代码省略.........
示例14: processSoEvent
SbBool TouchpadNavigationStyle::processSoEvent(const SoEvent * const ev)
{
// Events when in "ready-to-seek" mode are ignored, except those
// which influence the seek mode itself -- these are handled further
// up the inheritance hierarchy.
if (this->isSeekMode()) { return inherited::processSoEvent(ev); }
// Switch off viewing mode (Bug #0000911)
if (!this->isSeekMode() && !this->isAnimating() && this->isViewing())
this->setViewing(false); // by default disable viewing mode to render the scene
const SoType type(ev->getTypeId());
const SbViewportRegion & vp = viewer->getSoRenderManager()->getViewportRegion();
const SbVec2s size(vp.getViewportSizePixels());
const SbVec2f prevnormalized = this->lastmouseposition;
const SbVec2s pos(ev->getPosition());
const SbVec2f posn((float) pos[0] / (float) std::max((int)(size[0] - 1), 1),
(float) pos[1] / (float) std::max((int)(size[1] - 1), 1));
this->lastmouseposition = posn;
// Set to TRUE if any event processing happened. Note that it is not
// necessary to restrict ourselves to only do one "action" for an
// event, we only need this flag to see if any processing happened
// at all.
SbBool processed = FALSE;
const ViewerMode curmode = this->currentmode;
ViewerMode newmode = curmode;
// Mismatches in state of the modifier keys happens if the user
// presses or releases them outside the viewer window.
if (this->ctrldown != ev->wasCtrlDown()) {
this->ctrldown = ev->wasCtrlDown();
}
if (this->shiftdown != ev->wasShiftDown()) {
this->shiftdown = ev->wasShiftDown();
}
if (this->altdown != ev->wasAltDown()) {
this->altdown = ev->wasAltDown();
}
// give the nodes in the foreground root the chance to handle events (e.g color bar)
if (!processed && !viewer->isEditing()) {
processed = handleEventInForeground(ev);
if (processed)
return TRUE;
}
// Keyboard handling
if (type.isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
const SoKeyboardEvent * const event = (const SoKeyboardEvent *) ev;
const SbBool press = event->getState() == SoButtonEvent::DOWN ? TRUE : FALSE;
switch (event->getKey()) {
case SoKeyboardEvent::LEFT_CONTROL:
case SoKeyboardEvent::RIGHT_CONTROL:
this->ctrldown = press;
break;
case SoKeyboardEvent::LEFT_SHIFT:
case SoKeyboardEvent::RIGHT_SHIFT:
this->shiftdown = press;
break;
case SoKeyboardEvent::LEFT_ALT:
case SoKeyboardEvent::RIGHT_ALT:
this->altdown = press;
break;
case SoKeyboardEvent::H:
processed = TRUE;
viewer->saveHomePosition();
break;
case SoKeyboardEvent::S:
case SoKeyboardEvent::HOME:
case SoKeyboardEvent::LEFT_ARROW:
case SoKeyboardEvent::UP_ARROW:
case SoKeyboardEvent::RIGHT_ARROW:
case SoKeyboardEvent::DOWN_ARROW:
if (!this->isViewing())
this->setViewing(true);
break;
case SoKeyboardEvent::PAGE_UP:
doZoom(viewer->getSoRenderManager()->getCamera(), TRUE, posn);
processed = TRUE;
break;
case SoKeyboardEvent::PAGE_DOWN:
doZoom(viewer->getSoRenderManager()->getCamera(), FALSE, posn);
processed = TRUE;
break;
default:
break;
}
}
// Mouse Button / Spaceball Button handling
if (type.isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev;
const int button = event->getButton();
const SbBool press = event->getState() == SoButtonEvent::DOWN ? TRUE : FALSE;
// SoDebugError::postInfo("processSoEvent", "button = %d", button);
switch (button) {
//.........这里部分代码省略.........
示例15: DECIDE
void
SoGate::setup(SoType inputType)
//
////////////////////////////////////////////////////////////////////////
{
#ifdef DEBUG
if (input != NULL) {
SoDebugError::post("SoGate::setup",
"Already initialized!");
}
#endif
if (inputType.isDerivedFrom(SoMField::getClassTypeId())) {
input = (SoMField *)inputType.createInstance();
} else {
input = NULL;
}
if (input == NULL) {
#ifdef DEBUG
SoDebugError::post("SoGate::setup",
"Couldn't create field of type %s",
inputType.getName().getString());
#endif
conversionCase = BAD_TYPE;
} else {
input->setContainer(this);
// Pass in the static field data as the parent field data for
// the per-instance field data:
myInputData->addField(this, "input", input);
// Construct the output:
output = new SoEngineOutput;
output->setContainer(this);
myOutputData->addOutput(this, "output", output, inputType);
// This handy macro sets up conversionCase, which is used to quickly
// decide what type we're hooked up to at evaluate() time:
#define DECIDE(class) \
(inputType == SO__CONCAT(SoMF,class)::getClassTypeId()) { \
conversionCase = class; \
}
// Set up for which switch to use in evaluate() routine:
if DECIDE(BitMask)
else if DECIDE(Bool)
else if DECIDE(Color)
else if DECIDE(Enum)
else if DECIDE(Float)
else if DECIDE(Int32)
else if DECIDE(Matrix)
else if DECIDE(Name)
else if DECIDE(Node)
else if DECIDE(Path)
else if DECIDE(Plane)
else if DECIDE(Rotation)
else if DECIDE(Short)
else if DECIDE(String)
else if DECIDE(Time)
else if DECIDE(UInt32)
else if DECIDE(UShort)
else if DECIDE(Vec2f)
else if DECIDE(Vec3f)
else if DECIDE(Vec4f)
#undef DECIDE
else {
#ifdef DEBUG
SoDebugError::post("SoGate::setup",
"Can't gate field of type %s",
inputType.getName().getString());
#endif
conversionCase = BAD_TYPE;
}
}
}