void SoConditionalTrigger::evaluate() { /*boolIn.getValues(0); floatIn.getValues(0); intIn.getValues(0); timeIn.getValues(0); stringIn.getValues(0);*/ SO_ENGINE_OUTPUT(boolOut, SoSFBool, setValue(tempBool)); //SoDebugError::postInfo("SoConditionalTrigger::evaluate()", // "%s: boolOut: %i", // this->getName().getString(),tempBool); if (trigger.isEnabled()) { //printf("About to output ... %d\n", tmp); SO_ENGINE_OUTPUT(tokenOut, SoSFString, setValue(token.getValue())); SO_ENGINE_OUTPUT(trigger, SoSFTrigger, setValue()); if (forwardInput.getValue()) { SO_ENGINE_OUTPUT(intValueOut, SoSFInt32, setValue(intIn[0])); } //SoDebugError::postInfo("SoConditionalTrigger::evaluate()", // "%s: Token: %s, trigger fired!", // this->getName().getString(),token.getValue().getString()); } trigger.enable(FALSE); tokenOut.enable(FALSE); }
void SoNodeToName::evaluate() { // make room as necessary SO_ENGINE_OUTPUT(output, SoMFString, setNum(input.getNum())); int next = 0; for( int i = 0; i < input.getNum(); i++ ) { SoNode * node = input[i]; if( node == NULL || node->getName() == "" ) { if( compact.getValue() == FALSE ) { SO_ENGINE_OUTPUT(output, SoMFString, set1Value(next, "")); next++; } } else { SO_ENGINE_OUTPUT(output, SoMFString, set1Value(next, node->getName().getString())); next++; } } // truncate as necessary SO_ENGINE_OUTPUT(output, SoMFString, setNum(next)); }
void SoVRMLCoordinateInterpolator::evaluate(void) { if (!this->value_changed.isEnabled()) return; float interp; int i, idx = this->getKeyValueIndex(interp, this->keyValue.getNum()); if (idx < 0) return; PRIVATE(this)->tmplist.truncate(0); const int numkeys = this->key.getNum(); const int numcoords = this->keyValue.getNum() / numkeys; const SbVec3f * c0 = this->keyValue.getValues(idx*numcoords); const SbVec3f * c1 = c0; if (interp > 0.0f) c1 = this->keyValue.getValues((idx+1)*numcoords); for (i = 0; i < numcoords; i++) { PRIVATE(this)->tmplist.append(c0[i] + (c1[i]-c0[i]) * interp); } const SbVec3f * coords = PRIVATE(this)->tmplist.getArrayPtr(); SO_ENGINE_OUTPUT(value_changed, SoMFVec3f, setNum(numcoords)); SO_ENGINE_OUTPUT(value_changed, SoMFVec3f, setValues(0, numcoords, coords)); }
void SoXipOverlayExtractContour::evaluate() { SoMFVec3f pointTmp; SoMFInt32 coordIndexTmp; for( int i = 0; i < overlays.getNum(); ++ i ) { SoXipShapeList* shapeList = (SoXipShapeList *) overlays[i]; if( !shapeList ) { SoDebugError::post( __FILE__, "Warning. Should not have NULL pointer in list of overlays" ); continue ; } int numShapes = shapeList->getNumChildren(); for( int j = 0; j < numShapes; ++ j ) { SoXipManipulableShape* shape = (SoXipManipulableShape *) shapeList->getChild(j); if( !shape ) { SoDebugError::post( __FILE__, "Warning. Should not have NULL pointer in list of overlays" ); continue ; } appendContour( shape, pointTmp, coordIndexTmp ); } } SO_ENGINE_OUTPUT( point, SoMFVec3f, copyFrom( pointTmp ) ); SO_ENGINE_OUTPUT( coordIndex, SoMFInt32, copyFrom( coordIndexTmp ) ); }
void SoMap2ImagePt::updateOutput() { if (refInput.getNum() <= 0 ||coordinates.getNum() <= 0) return; SoMFInt32 _points; SbString _sopInstanceUID; for (int i = 0; i < coordinates.getNum(); i++){ SbVec3f point = coordinates[i]; int pt[2]; SbString uid; if (getMappingPoint(pt, uid, point) && point != SbVec3f(0, 0, 0)){ _points.set1Value(_points.getNum(), pt[0]); _points.set1Value(_points.getNum(), pt[1]); _sopInstanceUID = uid; } } // if (_points.getNum() > 0) { SO_ENGINE_OUTPUT( points, SoMFInt32, setValues(0, _points.getNum(), _points.getValues(0)) ); SO_ENGINE_OUTPUT( sopInstanceUID, SoSFString, setValue(_sopInstanceUID) ); } }
void SoXipDicomExtractSlice::evaluate() { if (mOutput) { mOutput->unref(); mOutput = 0; } int nSlices = 0; if (image.getValue()) { nSlices = image.getValue()->getNumSlices(); if ((sliceIndex.getValue() < nSlices) && (sliceIndex.getValue() >= 0)) { // convert dicom data to xip image SbXipImage *img = new SbXipImage(); if (!img) { SoMemoryError::post("SbXipImage"); } else if (image.getValue()->getPixelData(*img, sliceIndex.getValue())) { // create instance of SoXipDataImage mOutput = new SoXipDataImage(); mOutput->ref(); mOutput->set(img); } } } SO_ENGINE_OUTPUT(numSlices, SoSFShort, setValue(nSlices)); SO_ENGINE_OUTPUT(output, SoXipSFDataImage, setValue(mOutput)); }
void TTracker::SetEngineOutputRotation(SbRotation rotation) { SO_ENGINE_OUTPUT( outputTranslation, SoSFVec3f, setValue( SbVec3f( 0.0, 0.0, 0.0 ) ) ); SO_ENGINE_OUTPUT( outputRotation, SoSFRotation, setValue( rotation ) ); SO_ENGINE_OUTPUT( outputScaleFactor, SoSFVec3f, setValue( SbVec3f( 1.0, 1.0, 1.0 ) ) ); SO_ENGINE_OUTPUT( outputScaleOrientation, SoSFRotation, setValue( SbRotation() ) ); SO_ENGINE_OUTPUT( outputCenter, SoSFVec3f, setValue( SbVec3f( 0.0, 0.0, 0.0 ) ) ); }
void TTracker::SetEngineOutputIdentity() { SO_ENGINE_OUTPUT( outputTranslation, SoSFVec3f, setValue( 0.0, 0.0, 0.0 ) ); SO_ENGINE_OUTPUT( outputRotation, SoSFRotation, setValue( 0.0, 0.0, 1.0, 0.0 ) ); SO_ENGINE_OUTPUT( outputScaleFactor, SoSFVec3f, setValue( 1.0, 1.0, 1.0 ) ); SO_ENGINE_OUTPUT( outputScaleOrientation, SoSFRotation, setValue( 0.0, 0.0, 1.0, 0.0 ) ); SO_ENGINE_OUTPUT( outputCenter, SoSFVec3f, setValue( 0.0, 0.0, 0.0 ) ); }
// Doc in parent void SoVRMLTimeSensor::evaluate(void) { SO_ENGINE_OUTPUT(time, SoSFTime, setValue(PRIVATE(this)->currtime)); SO_ENGINE_OUTPUT(isActive, SoSFBool, setValue(PRIVATE(this)->running)); SO_ENGINE_OUTPUT(cycleTime, SoSFTime, setValue(PRIVATE(this)->cyclestart)); SO_ENGINE_OUTPUT(fraction_changed, SoSFFloat, setValue(PRIVATE(this)->fraction)); }
void TTracker::SetEngineOutput(SoTransform* newTransform) { SO_ENGINE_OUTPUT( outputTranslation, SoSFVec3f, setValue( newTransform->translation.getValue() ) ); SO_ENGINE_OUTPUT( outputRotation, SoSFRotation, setValue( newTransform->rotation.getValue() ) ); SO_ENGINE_OUTPUT( outputScaleFactor, SoSFVec3f, setValue( newTransform->scaleFactor.getValue() ) ); SO_ENGINE_OUTPUT( outputScaleOrientation, SoSFRotation, setValue( newTransform->scaleOrientation.getValue() ) ); SO_ENGINE_OUTPUT( outputCenter, SoSFVec3f, setValue( newTransform->center.getValue() ) ); }
void SoVtkGridTransform::evaluate() { try { // Get the input type(s) // Deletion of the objects if they exist if ( mDisplacementGrid ) { mDisplacementGrid->unref(); mDisplacementGrid = 0; } if ( mInverse ) { mInverse->unref(); mInverse = 0; } if ( mOutput ) { mOutput->unref(); mOutput = 0; } if ( addCalled ) { reset(); addCalled = 0; } mObject->GetDisplacementGrid(); mDisplacementGrid = new SoVtkObject(); mDisplacementGrid->ref(); mDisplacementGrid->setPointer( mObject->GetDisplacementGrid() ); mObject->GetInverse(); mInverse = new SoVtkObject(); mInverse->ref(); mInverse->setPointer( mObject->GetInverse() ); mOutput = new SoVtkObject(); mOutput->ref(); mOutput->setPointer( mObject ); } catch(...) { SoDebugError::post( __FILE__, "Unknown Exception" ); return; } SO_ENGINE_OUTPUT( oDisplacementGrid, SoSFVtkObject, setValue( mDisplacementGrid ) ); SO_ENGINE_OUTPUT( oInverse, SoSFVtkObject, setValue( mInverse ) ); SO_ENGINE_OUTPUT( Output, SoSFVtkObject, setValue( mOutput ) ); }
void SoVtkImageDataGeometryFilter::evaluate() { try { // Get the input type(s) SoVtkAlgorithmOutput *inputPortPtr = InputConnection.getValue(); if (inputPortPtr) mObject->SetInputConnection(inputPortPtr->getPointer()); // Deletion of the objects if they exist if ( mOutput ) { mOutput->unref(); mOutput = 0; } if ( mOutputPort ) { mOutputPort->unref(); mOutputPort = 0; } if ( addCalled ) { reset(); addCalled = 0; } mObject->GetOutput()->Register(0); mOutput = new SoVtkObject(); mOutput->ref(); mOutput->setPointer( mObject->GetOutput() ); if ( mObject->GetNumberOfOutputPorts() > 0 ) { mObject->GetOutputPort()->Register(0); mOutputPort = new SoVtkAlgorithmOutput(); mOutputPort->ref(); mOutputPort->setPointer( mObject->GetOutputPort() ); } } catch(...) { SoDebugError::post( __FILE__, "Unknown Exception" ); return; } SO_ENGINE_OUTPUT( Output, SoSFVtkObject, setValue( mOutput ) ); SO_ENGINE_OUTPUT( OutputPort, SoSFVtkAlgorithmOutput, setValue( mOutputPort ) ); }
void SoItkConvertItkImageToXipImage::evaluate() { if( mXipImage ) { mXipImage->unref(); mXipImage = 0; SO_ENGINE_OUTPUT( output, SoXipSFDataImage, setValue(0) ); } SoItkDataImage* xipItkImage = input.getValue(); if (!xipItkImage) return; if (xipItkImage->getType() != SoItkDataImage::UNSIGNED_SHORT && xipItkImage->getType() != SoItkDataImage::FLOAT && xipItkImage->getType() != SoItkDataImage::UNSIGNED_CHAR && xipItkImage->getType() != SoItkDataImage::SHORT) { SoDebugError::post( __FILE__, "Itk image only supports UNSIGNED_SHORT, UNSIGNED_CHAR, SHORT or FLOAT" ); return ; } try { switch (xipItkImage->getNumDimension()) { case 1: mXipImage = createXipImage<1>(xipItkImage); break; case 2: mXipImage = createXipImage<2>(xipItkImage); break; case 3: mXipImage = createXipImage<3>(xipItkImage); break; } } catch( itk::ExceptionObject& e ) { SoDebugError::post( e.GetFile(), "line %d: %s", e.GetLine(), e.GetDescription() ); return ; } catch(...) { SoDebugError::post( __FILE__, "Unknown exception" ); return ; } SO_ENGINE_OUTPUT( output, SoXipSFDataImage, setValue( mXipImage ) ); }
void SoVtkConeSource::evaluate() { try { // Deletion of the objects if they exist if ( mOutput ) { mOutput->unref(); mOutput = 0; } if ( mOutputPort ) { mOutputPort->unref(); mOutputPort = 0; } // Get the input type(s) SoVtkObject *inputPtr = Input.getValue(); if (inputPtr && inputPtr->getPointer()->IsA("vtkDataObject")) mObject->SetInput(vtkDataObject::SafeDownCast(inputPtr->getPointer())); SoVtkAlgorithmOutput *inputPortPtr = InputConnection.getValue(); if (inputPortPtr) mObject->SetInputConnection(inputPortPtr->getPointer()); mObject->GetOutput()->Register(0); mOutput = new SoVtkObject(); mOutput->ref(); mOutput->setPointer( mObject->GetOutput() ); if ( mObject->GetNumberOfOutputPorts() > 0 ) { mObject->GetOutputPort()->Register(0); mOutputPort = new SoVtkAlgorithmOutput(); mOutputPort->ref(); mOutputPort->setPointer( mObject->GetOutputPort() ); } } catch(...) { SoDebugError::post( __FILE__, "Unknown Exception" ); return; } SO_ENGINE_OUTPUT( Output, SoSFVtkObject, setValue( mOutput ) ); SO_ENGINE_OUTPUT( OutputPort, SoSFVtkAlgorithmOutput, setValue( mOutputPort ) ); }
// Documented in superclass. void SoOneShot::evaluate(void) { SbTime elapsed = this->timeIn.getValue() - this->starttime; SbTime durationval = this->duration.getValue(); SbTime timeoutval; float rampval = -999.0f; // Explicit init to kill bogus egcs-2.91.66 warning. if (this->running) { if (elapsed < durationval) { timeoutval = elapsed; rampval = float(elapsed.getValue()) / float(durationval.getValue()); } else { this->running = FALSE; if (this->flags.getValue() & SoOneShot::HOLD_FINAL) { this->holdduration = durationval; this->holdramp = 1.0f; } } } // Don't use "else" here, as the value of this->running might change // in the if-block above. if (!this->running) { if (this->flags.getValue() & SoOneShot::HOLD_FINAL) { timeoutval = this->holdduration; rampval = this->holdramp; } else { timeoutval = 0.0; rampval = 0.0f; } } // Values should be distributed on evaluate() even though outputs // are not initially enabled. // // enable-settings will be restored again on the next // inputChanged(). this->timeOut.enable(TRUE); this->ramp.enable(TRUE); this->isActive.enable(TRUE); SO_ENGINE_OUTPUT(isActive, SoSFBool, setValue(this->running)); SO_ENGINE_OUTPUT(timeOut, SoSFTime, setValue(timeoutval)); SO_ENGINE_OUTPUT(ramp, SoSFFloat, setValue(rampval)); }
/* *! Used to get the bitsUsed from the server */ void SoXipRemoteVolume::getBitsUsed() { if(!mStream) return; //send the request for modelMatrix mReqSender.initSender(mStream, GET_VOLUME_BITSUSED); mReqSender.send(); // expect the response from the server. mReqReceiver.initReceiver(mStream); mReqReceiver.receive(); // if there is some error or the sorting operation did not result in a valid volume. if( (mReqReceiver.getFirstElementId() != GET_VOLUME_BITSUSED)) { SoError::post("RemoteVolume: Server getBitsused request error!\n"); return; } int Bits; if(!mReqReceiver.getUniqueIntElement(GETVOLUMEBITSUSEDRESPONSE, Bits)) { SoError::post("RemoteVolume: Server getBitsused request error!\n"); return; } mReqReceiver.rNtohl(&Bits); SO_ENGINE_OUTPUT(bitsUsedOutput, SoSFInt32, setValue(Bits)); }
void SoItkRigid2DTransform::evaluate() { if( mOutput ) { mOutput->unref(); mOutput = 0; SO_ENGINE_OUTPUT( Output, SoItkSFDataTransform, setValue( 0 ) ); } try { typedef itk::Rigid2DTransform< double > TransformType; TransformType::Pointer transform = TransformType::New(); if( Parameters.getNum() ) { SO_ITK_SET_FIELD_ARRAY( transform, Parameters, double ); } else { if( UseMatrix.getValue() ) { SO_ITK_SET_FIELD_MATRIX( transform, Matrix, double, 2, 2 ); SO_ITK_SET_FIELD_VECTOR( transform, Offset, double, 2 ); } else { SO_ITK_SET_FIELD_POINT( transform, Center, double, 2 ); SO_ITK_SET_FIELD_VECTOR( transform, Translation, double, 2 ); } transform->SetAngle( Angle.getValue() ); }
void SoXipLoadDicom::evaluate() { unloadAll(); SoMFString nameLocal; for (int i = 0; i < name.getNum(); i++) { #ifdef WIN32 //assuming everything is done using the bad backslashes... so we convert all forward slashes to those nameLocal.set1Value(i, XipReplaceChar(name[i].getString(), '/', '\\')); #else //UNIX //assuming the other way around since we need forward slashes now... nameLocal.set1Value(i, XipReplaceChar(name[i].getString(), '\\', '/')); #endif //WIN32 } // "interpret" may replace folders with files in the folder or DICOMDIR with images SoMFString interpreted; SoXipDataDicom::interpret(nameLocal, interpreted); for (int i = 0; i < interpreted.getNum(); i++) { SoXipDataDicom* dicomData = new SoXipDataDicom; if (dicomData) { if (dicomData->open(interpreted[i].getString())) { mLoadedData.set1Value(mLoadedData.getNum(), dicomData); } } } SO_ENGINE_OUTPUT( dicom, SoXipMFDataDicom, copyFrom(mLoadedData) ); }
void CubicSplineEngine::inputChanged(SoField * which) { if (which == &this->timeIn) { this->currtime = this->timeIn.getValue().getValue(); if (this->first) { this->starttime = this->currtime; this->first = FALSE; } this->currtime -= this->starttime; if (this->currtime > this->currduration) { this->syncOut.enable(TRUE); SO_ENGINE_OUTPUT(syncOut, SoSFTrigger, setValue()); this->syncOut.enable(FALSE); if (this->loop.getValue()) { double num = this->currtime / this->currduration; this->starttime += this->currduration * floor(num); this->currtime = this->currtime - this->starttime; } else { this->currtime = this->currduration; this->evaluate(); // force output before disabling this->timeIn.enableNotify(FALSE); this->on = FALSE; this->pointOut.enable(FALSE); this->tangentOut.enable(FALSE); this->orientationOut.enable(FALSE); } } } else if (which == &this->on) { this->activate(this->on.getValue()); } }
void SoVtkPlane::evaluate() { try { // Deletion of the objects if they exist if ( mOutput ) { mOutput->unref(); mOutput = 0; } // Get the input type(s) mOutput = new SoVtkObject(); mOutput->ref(); mOutput->setPointer( mObject ); } catch(...) { SoDebugError::post( __FILE__, "Unknown Exception" ); return; } SO_ENGINE_OUTPUT( Output, SoSFVtkObject, setValue( mOutput ) ); }
void SoVtkGenericInterpolatedVelocityField::evaluate() { try { // Get the input type(s) // Deletion of the objects if they exist if ( mLastCell ) { mLastCell->unref(); mLastCell = 0; } if ( mOutput ) { mOutput->unref(); mOutput = 0; } if ( addCalled ) { reset(); addCalled = 0; } mObject->GetLastCell(); mLastCell = new SoVtkObject(); mLastCell->ref(); mLastCell->setPointer( mObject->GetLastCell() ); mOutput = new SoVtkObject(); mOutput->ref(); mOutput->setPointer( mObject ); } catch(...) { SoDebugError::post( __FILE__, "Unknown Exception" ); return; } SO_ENGINE_OUTPUT( oLastCell, SoSFVtkObject, setValue( mLastCell ) ); SO_ENGINE_OUTPUT( Output, SoSFVtkObject, setValue( mOutput ) ); }
void InvComposePlane::evaluate() { // Compute the product of the input fields SbPlane p = SbPlane(normal.getValue(), point.getValue()); // "Send" the value to the output. In effect, we are setting // the value in all fields to which this output is connected. SO_ENGINE_OUTPUT(plane, SoSFPlane, setValue(p)); }
void CubicSplineEngine::evaluate(void) { SbMatrix m; float t = (float) (this->currtime / this->currduration); if (!this->linear) { t = (1.0f - float(cos(double(t)*M_PI))) * 0.5f; } if (this->pointOut.isEnabled()) { SbVec3f v = this->currspline.getPoint(t); SbVec3d res = this->offset.getValue(); res[0] += v[0]; res[1] += v[1]; res[2] += v[2]; if (this->verifycb) this->verifycb(res); SO_ENGINE_OUTPUT(pointOut, SoSFVec3d, setValue(res)); } if (this->tangentOut.isEnabled()) { SbVec3f v = this->currspline.getTangent(t); SO_ENGINE_OUTPUT(tangentOut, SoSFVec3f, setValue(v)); } if (this->orientationOut.isEnabled()) { int i = 0, n = this->orientationTime.getNum()-1; while (this->orientationTime[i+1] < t && i < n) i++; SbRotation rot0 = this->orientation[SbMin(i, this->orientation.getNum()-1)]; SbRotation rot1 = this->orientation[SbMin(i+1, this->orientation.getNum()-1)]; float delta = this->orientationTime[i+1] - this->orientationTime[i]; float diff = t - this->orientationTime[i]; #if 0 // testing non-linear spline-exec float rt = (1.0f - float(cos(double(diff/delta)*M_PI))) * 0.5f; #else float rt = diff/delta; #endif SbRotation rot = SbRotation::slerp(rot0, rot1, rt); SO_ENGINE_OUTPUT(orientationOut, SoSFRotation, setValue(rot)); } this->cblist.invokeCallbacks(this); }
void SoBoolOperation::evaluate() // //////////////////////////////////////////////////////////////////////// { int na = a.getNum(); int nb = b.getNum(); int noperation = operation.getNum(); int nout = max(na,nb,noperation); SO_ENGINE_OUTPUT(output, SoMFBool, setNum(nout)); SO_ENGINE_OUTPUT(inverse, SoMFBool, setNum(nout)); for (int i=0; i<nout; i++) { SbBool va = a[clamp(i,na)]; SbBool vb = b[clamp(i,nb)]; SbBool result; switch (operation[clamp(i,noperation)]) { case CLEAR: result = FALSE; break; case SET: result = TRUE; break; case A: result = va; break; case NOT_A: result = !va; break; case B: result = vb; break; case NOT_B: result = !vb; break; case A_OR_B: result = va || vb; break; case NOT_A_OR_B: result = (!va) || vb; break; case A_OR_NOT_B: result = va || (!vb); break; case NOT_A_OR_NOT_B: result = (!va) || (!vb); break; case A_AND_B: result = va && vb; break; case NOT_A_AND_B: result = (!va) && (vb); break; case A_AND_NOT_B: result = va && (!vb); break; case NOT_A_AND_NOT_B: result = (!va) && (!vb); break; case A_EQUALS_B: result = (va == vb); break; case A_NOT_EQUALS_B: result = (va != vb); break; } SO_ENGINE_OUTPUT(output, SoMFBool, set1Value(i, result)); SO_ENGINE_OUTPUT(inverse, SoMFBool, set1Value(i, !result)); } }
void SoCounter::evaluate() // //////////////////////////////////////////////////////////////////////// { #ifdef DEVELOP if (debug.getValue()) { printf("Counter::evaluate output=%d\n", stages[curStage].val); } #endif SO_ENGINE_OUTPUT(output, SoSFShort, setValue(stages[curStage].val)); }
void SoXipImageOverlayClear::evaluate() { // Do not evaluate at loading if( m_ReadInstance ) { m_ReadInstance = FALSE; status.enable( FALSE ); return ; } try { for( int k = 0; k < image.getNum(); ++ k ) { SoXipDataImage* refData = 0; SoXipDataImage* imageData = image[k]; if( !imageData ) return ; while( (refData = (SoXipDataImage *) imageData->getRefByType( SoXipDataImage::getClassTypeId() )) ) imageData = refData; imageData->setProperty( "overlays", "" ); } SO_ENGINE_OUTPUT( status, SoSFString, setValue( "OK" ) ); } catch( ... ) { SO_ENGINE_OUTPUT( status, SoSFString, setValue( "" ) ); SoDebugError::post( __FILE__, "Error during adding"); } status.enable( FALSE ); }
void SoGuiRadioGroup::evaluate(void) { if ( this->index == -1 ) return; // avoid update SoSFBool * fields[] = { &(this->in0), &(this->in1), &(this->in2), &(this->in3), &(this->in4), &(this->in5), &(this->in6), &(this->in7), NULL }; SoEngineOutput * outputs[] = { &(this->out0), &(this->out1), &(this->out2), &(this->out3), &(this->out4), &(this->out5), &(this->out6), &(this->out7), NULL }; int i; for ( i = 0; i < 8; i++ ) { if ( i == this->index ) { SO_ENGINE_OUTPUT((*outputs[i]), SoSFBool, setValue(TRUE)); } else { SO_ENGINE_OUTPUT((*outputs[i]), SoSFBool, setValue(FALSE)); } } }
void SoVtkFloatArray::evaluate() { try { // Get the input type(s) // Deletion of the objects if they exist if ( mLookupTable ) { mLookupTable->unref(); mLookupTable = 0; } if ( addCalled ) { reset(); addCalled = 0; } mObject->GetLookupTable(); mLookupTable = new SoVtkObject(); mLookupTable->ref(); mLookupTable->setPointer( mObject->GetLookupTable() ); mOutput = new SoVtkObject(); mOutput->ref(); mOutput->setPointer( mObject ); } catch(...) { SoDebugError::post( __FILE__, "Unknown Exception" ); return; } SO_ENGINE_OUTPUT( oLookupTable, SoSFVtkObject, setValue( mLookupTable ) ); SO_ENGINE_OUTPUT( Output, SoSFVtkObject, setValue( mOutput ) ); }
// Documented in superclass. void SoComposeMatrix::evaluate() { int numTranslation = this->translation.getNum(); int numRotation = this->rotation.getNum(); int numScaleFactor = this->scaleFactor.getNum(); int numScaleOrientation = this->scaleOrientation.getNum(); int numCenter = this->center.getNum(); int numOut = numTranslation > numRotation? numTranslation:numRotation; int numOut2 = numScaleFactor>numScaleOrientation?numScaleFactor:numScaleOrientation; numOut2 = numOut2>numCenter?numOut2:numCenter; numOut = numOut>numOut2?numOut:numOut2; SO_ENGINE_OUTPUT(matrix,SoMFMatrix,setNum(numOut)); int i; for (i=0;i<numOut;i++) { const SbVec3f translationVal= i<numTranslation?this->translation[i]:this->translation[numTranslation-1]; const SbVec3f scaleFactorVal= i<numScaleFactor?this->scaleFactor[i]:this->scaleFactor[numScaleFactor-1]; const SbVec3f centerVal=i<numCenter?this->center[i]:this->center[numCenter-1]; const SbRotation rotationVal= i<numRotation?this->rotation[i]:this->rotation[numRotation-1]; const SbRotation scaleOrientationVal= i<numScaleOrientation? this->scaleOrientation[i]:this->scaleOrientation[numScaleOrientation-1]; SbMatrix mat; mat.setTransform(translationVal,rotationVal,scaleFactorVal, scaleOrientationVal,centerVal); SO_ENGINE_OUTPUT(matrix,SoMFMatrix,set1Value(i,mat)); } }
// This is the evaluation routine. void SoXipConvertMFDicomToSFDicom::evaluate() { SoXipDataDicom * out = 0; int numSlices = input.getNum(); int sliceId = index.getValue(); if (sliceId >= 0 && sliceId < numSlices) { out = (SoXipDataDicom*) *(input.getValues(sliceId)); } // set output to NULL SO_ENGINE_OUTPUT(output, SoXipSFDataDicom, setValue(out)); }