/*! * Reads the scene saved on the file with given \a filename and return a pointer to the scene. * * Returns null on any error. */ TSceneKit* Document::GetSceneKitFromFile( const QString& fileName ) { SoInput sceneInput; if ( !sceneInput.openFile( fileName.toLatin1().constData() ) ) { QString message = QString( "Cannot open file %1." ).arg( fileName ); emit Warning( message ); return 0; } if( !sceneInput.isValidFile() ) { QString message = QString( "Error reading file %1.\n" ).arg( fileName ); emit Warning( message ); return 0; } SoSeparator* graphSeparator = SoDB::readAll( &sceneInput ); sceneInput.closeFile(); if ( !graphSeparator ) { QString message = QString( "Error reading file %1.\n" ).arg( fileName ); emit Warning( message ); return 0; } return static_cast< TSceneKit* >( graphSeparator->getChild(0) ); return 0; }
bool QCtkXipSGWidget::loadIvFile(const QString& ivFileName) { if(!QFile::exists(ivFileName)) { QString pwd = QDir::currentPath(); return false; } std::string ivFileNameStr(ivFileName.toStdString()); const char *ivStr = (const char*) ivFileNameStr.c_str(); SoInput in; in.openFile(ivStr); // file SoSeparator *topNode = SoDB::readAll(&in); if (topNode) { if(mRoot) { mRoot->removeAllChildren(); mRoot->addChild(topNode); return true; } } return false; }
void SoVtkImageVariance3D::inputChanged(SoField * f) { // Get the KernelSize value if ( f == &KernelSize ) { SbVariant *vKernelSize = (SbVariant *)KernelSize.getValues(0); SoInput input; int nb_fields = KernelSize.getNum(); int val0; int val1; int val2; for (int i=0; i < nb_fields; i++) { input.setBuffer((void *)vKernelSize[i].getField().getString(),256); input.read(val0); input.read(val1); input.read(val2); mObject->SetKernelSize( (int) val0, (int) val1, (int) val2 ); } } // Get the NumberOfThreads value if ( f == &NumberOfThreads ) SO_VTK_SET_FIELD_VALUE( mObject, NumberOfThreads); mObject->Update(); }
/*! \brief Add a new object in the scene graph \param iv_filename : name of.iv file to load \param fMo : position of the object wrt the reference frame */ void vpSimulator::load(const char * iv_filename,const vpHomogeneousMatrix &fMo) { SoInput in; SoSeparator * newObject; if (! in.openFile (iv_filename)) { vpERROR_TRACE ("Erreur lors de la lecture du fichier %s.", iv_filename); } newObject = SoDB::readAll (&in); if (NULL == newObject) { vpERROR_TRACE ("Problem reading data for file <%s>.", iv_filename); } try { this->addObject (newObject, fMo) ; } catch(...) { vpERROR_TRACE("Error adding object from file <%s> ",iv_filename) ; throw ; } }
//!loading the virtual scene void vpSimulator::load(const char *file_name) { SoInput input; if (!input.openFile(file_name)) { vpERROR_TRACE("Erreur cannot open file %s",file_name); } SoSeparator *newscene=SoDB::readAll(&input); newscene->ref() ; if (newscene==NULL) { vpERROR_TRACE("Error while reading %s",file_name); } SoScale *taille = new SoScale; taille->scaleFactor.setValue (zoomFactor, zoomFactor, zoomFactor); // newscene->addChild(taille); // std::cout << "this->scene->getNumChildren() = " << this->scene->getNumChildren() << std::endl; this->scene->addChild(taille); this->scene->addChild(newscene); newscene->unref() ; }
void DragDropHandlerP::dropEvent(QDropEvent * event) { const QMimeData * mimedata = event->mimeData(); SoSeparator * root; SoInput in; QByteArray bytes; if (mimedata->hasUrls()) { QUrl url = mimedata->urls().takeFirst(); if (url.scheme().isEmpty() || url.scheme().toLower() == QString("file") ) { // attempt to open file if (!in.openFile(url.toLocalFile().toLatin1().constData())) return; } } else if (mimedata->hasText()) { /* FIXME 2007-11-09 preng: dropping text buffer does not work on Windows Vista. */ bytes = mimedata->text().toUtf8(); in.setBuffer((void *) bytes.constData(), bytes.size()); if (!in.isValidBuffer()) return; } // attempt to import it root = SoDB::readAll(&in); if (root == NULL) return; // set new scenegraph this->quarterwidget->setSceneGraph(root); this->quarterwidget->viewport()->update(); }
SoSeparator *ReadScene(const char *Dir, const char *filename) { FILE *filePtr = NULL; SoSeparator *root; SoInput in; in.addDirectoryLast(Dir); if (!in.openFile(filename)) { cerr << "Error opening file " << filename << " from Directory " << Dir << endl; exit(1); } root = SoDB::readAll(&in); if (root == NULL) cerr << "Error reading file " << filename << " from Directory " << Dir << endl; else { #ifdef DEBUG cerr << "Scene (" << filename << ") read!\n"; #endif root->ref(); } in.closeFile(); return root; }
void SoVtkOutlineFilter::inputChanged(SoField * f) { // Get the InputArrayToProcess value if ( f == &InputArrayToProcess ) { SbVariant vInputArrayToProcess = (SbVariant)InputArrayToProcess.getValue(); SoInput input; int val0; int val1; int val2; int val3; SbString val4; input.setBuffer((void *)vInputArrayToProcess.getField().getString(),256); input.read(val0); input.read(val1); input.read(val2); input.read(val3); input.read(val4); mObject->SetInputArrayToProcess( (int) val0, (int) val1, (int) val2, (int) val3, val4.getString() ); } //mObject->Update(); }
TSeparatorKit* ComponentHeliostatField::OpenHeliostatComponent( QString fileName ) { if ( fileName.isEmpty() ) return 0; SoInput componentInput; if ( !componentInput.openFile( fileName.toLatin1().constData() ) ) { QMessageBox::warning( 0, QString( "Scene Graph Structure" ), QString( "Cannot open file %1:\n." ).arg( fileName ) ); return 0; } SoSeparator* componentSeparator = SoDB::readAll( &componentInput ); componentInput.closeFile(); if ( !componentSeparator ) { QMessageBox::warning( 0, QString( "Scene Graph Structure" ), QString( "Error reading file %1:\n%2." ) .arg( fileName ) ); return 0; } TSeparatorKit* componentRoot = static_cast< TSeparatorKit* >( componentSeparator->getChild(0) ); componentRoot->ref(); return componentRoot; }
void SoVtkGenericProbeFilter::inputChanged(SoField * f) { // Get the Source value if ( f == &Source ) SO_VTK_SET_FIELD_DATA( mObject, Source, vtkGenericDataSet); // Get the NumberOfInputConnections value if ( f == &NumberOfInputConnections ) { SbVariant *vNumberOfInputConnections = (SbVariant *)NumberOfInputConnections.getValues(0); SoInput input; int nb_fields = NumberOfInputConnections.getNum(); int val0; int val1; for (int i=0; i < nb_fields; i++) { input.setBuffer((void *)vNumberOfInputConnections[i].getField().getString(),256); input.read(val0); input.read(val1); //mObject->SetNumberOfInputConnections( (int) val0, (int) val1 ); } } mObject->Update(); }
SoSeparator * SceneFileObj::readSceneFile(void) { SoInput input; SoSeparator *s; FILE *f = NULL; if (_sceneFileName[0] == '<') { char *p = _sceneFileName+1; while (*p) { if (! isdigit(*p)) break; p++; } if (*p == '\0') { int fd = atoi(_sceneFileName+1); if ((f = fdopen(fd, "r")) == NULL) { return (NULL); } input.setFilePointer(f); } } if (f == NULL) { if (!input.openFile(_sceneFileName)) return NULL; } s = SoDB::readAll(&input); input.closeFile(); return s; }
SoSeparator* loadModel(const char* fileName) { SoSeparator *root = new SoSeparator; SoInput myScene; //try to open the file if (!myScene.openFile(fileName)) { printf("Could not open %s\n",fileName) ; return NULL; } //check if the file is valid if (!myScene.isValidFile()) { printf("%s is not a valid Inventor file\n",fileName) ; return NULL; } //try to read the file root = SoDB::readAll(&myScene) ; if (root == NULL) { printf("Problem reading %s\n",fileName) ; myScene.closeFile() ; return NULL; } //close the file myScene.closeFile() ; return root ; }
void LightManip(SoSeparator * root) { SoInput in; in.setBuffer((void *)scenegraph, std::strlen(scenegraph)); SoSeparator * _root = SoDB::readAll( &in ); if ( _root == NULL ) return; // Shouldn't happen. root->addChild(_root); root->ref(); const char * pointlightnames[3] = { "RedLight", "GreenLight", "BlueLight" }; SoSearchAction sa; for (int i = 0; i < 3; i++) { sa.setName( pointlightnames[i] ); sa.setInterest( SoSearchAction::FIRST ); sa.setSearchingAll( false ); sa.apply( root ); SoPath * path = sa.getPath(); if ( path == NULL) return; // Shouldn't happen. SoPointLightManip * manip = new SoPointLightManip; manip->replaceNode( path ); } }
void SoVtkFieldData::inputChanged(SoField * f) { // Get the Component value if ( f == &Component ) { SbVariant *vComponent = (SbVariant *)Component.getValues(0); SoInput input; int nb_fields = Component.getNum(); vtkIdType val0; int val1; double val2; for (int i=0; i < nb_fields; i++) { input.setBuffer((void *)vComponent[i].getField().getString(),256); input.read(val0); input.read(val1); input.read(val2); mObject->SetComponent( (const vtkIdType) val0, (const int) val1, (const double) val2 ); } } }
void SoVtkFieldData::reset() { mObject->UnRegister(0); mObject->Delete(); mObject = 0; mObject = vtkFieldData::New(); mObject->Register(0); mObject->SetGlobalWarningDisplay(0); // Get the input type(s) // Get the Component value if (addCalled == 1) { SbVariant *vComponent = (SbVariant *)Component.getValues(0); SoInput input; int nb_fields = Component.getNum(); vtkIdType val0; int val1; double val2; for (int i=0; i < nb_fields; i++) { input.setBuffer((void *)vComponent[i].getField().getString(),256); input.read(val0); input.read(val1); input.read(val2); mObject->SetComponent( (const vtkIdType) val0, (const int) val1, (const double) val2 ); } } }
// Read file and convert to OSG osgDB::ReaderWriter::ReadResult ReaderWriterIV::readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const { // Accept extension std::string ext = osgDB::getLowerCaseFileExtension(file); if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED; // Find file std::string fileName = osgDB::findDataFile( file, options ); if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; // Notify OSG_NOTICE << "osgDB::ReaderWriterIV::readNode() Reading file " << fileName.data() << std::endl; OSG_INFO << "osgDB::ReaderWriterIV::readNode() Inventor version: " << SoDB::getVersion() << std::endl; // Open the file SoInput input; if (!input.openFile(fileName.data())) { OSG_WARN << "osgDB::ReaderWriterIV::readIVFile() " << "Cannot open file " << fileName << std::endl; return ReadResult::ERROR_IN_READING_FILE; } // Perform reading from SoInput return readNodeFromSoInput(input, fileName, options); }
void SoVtkConeSource::inputChanged(SoField * f) { // Get the Radius value if ( f == &Radius ) SO_VTK_SET_FIELD_VALUE( mObject, Radius); // Get the Height value if ( f == &Height ) SO_VTK_SET_FIELD_VALUE( mObject, Height); // Get the Capping value if ( f == &Capping ) SO_VTK_SET_FIELD_VALUE( mObject, Capping); // Get the Direction value if ( f == &Direction ) SO_VTK_SET_FIELD_VEC3F( mObject, Direction); // Get the Center value if ( f == &Center ) SO_VTK_SET_FIELD_VEC3F( mObject, Center); // Get the Resolution value if ( f == &Resolution ) SO_VTK_SET_FIELD_VALUE( mObject, Resolution); // Get the Angle value if ( f == &Angle ) SO_VTK_SET_FIELD_VALUE( mObject, Angle); // Get the InputArrayToProcess value if ( f == &InputArrayToProcess ) { SbVariant vInputArrayToProcess = (SbVariant)InputArrayToProcess.getValue(); SoInput input; int val0; int val1; int val2; int val3; SbString val4; input.setBuffer((void *)vInputArrayToProcess.getField().getString(),256); input.read(val0); input.read(val1); input.read(val2); input.read(val3); input.read(val4); mObject->SetInputArrayToProcess( (int) val0, (int) val1, (int) val2, (int) val3, val4.getString() ); } //mObject->Update(); }
void SoVtkImageWrapPad::reset() { mObject->UnRegister(0); mObject->Delete(); mObject = 0; mObject = vtkImageWrapPad::New(); mObject->Register(0); mObject->SetGlobalWarningDisplay(0); // Get the input type(s) SoVtkAlgorithmOutput *inputPortPtr = InputConnection.getValue(); if (inputPortPtr) mObject->SetInputConnection(inputPortPtr->getPointer()); // Get the OutputNumberOfScalarComponents value SO_VTK_SET_FIELD_VALUE( mObject, OutputNumberOfScalarComponents); // Get the NumberOfThreads value SO_VTK_SET_FIELD_VALUE( mObject, NumberOfThreads); // Get the OutputWholeExtent value if (addCalled == 1) { SbVariant *vOutputWholeExtent = (SbVariant *)OutputWholeExtent.getValues(0); SoInput input; int nb_fields = OutputWholeExtent.getNum(); int val0; int val1; int val2; int val3; int val4; int val5; for (int i=0; i < nb_fields; i++) { input.setBuffer((void *)vOutputWholeExtent[i].getField().getString(),256); input.read(val0); input.read(val1); input.read(val2); input.read(val3); input.read(val4); input.read(val5); mObject->SetOutputWholeExtent( (int) val0, (int) val1, (int) val2, (int) val3, (int) val4, (int) val5 ); } } mObject->Update(); }
/// return the camera definition of the active view static PyObject * povViewCamera(PyObject *self, PyObject *args) { // no arguments if (!PyArg_ParseTuple(args, "")) return NULL; PY_TRY { std::string out; const char* ppReturn=0; Gui::Application::Instance->sendMsgToActiveView("GetCamera",&ppReturn); SoNode* rootNode; SoInput in; in.setBuffer((void*)ppReturn,std::strlen(ppReturn)); SoDB::read(&in,rootNode); if (!rootNode || !rootNode->getTypeId().isDerivedFrom(SoCamera::getClassTypeId())) throw Base::Exception("CmdRaytracingWriteCamera::activated(): Could not read " "camera information from ASCII stream....\n"); // root-node returned from SoDB::readAll() has initial zero // ref-count, so reference it before we start using it to // avoid premature destruction. SoCamera * Cam = static_cast<SoCamera*>(rootNode); Cam->ref(); SbRotation camrot = Cam->orientation.getValue(); SbVec3f upvec(0, 1, 0); // init to default up vector camrot.multVec(upvec, upvec); SbVec3f lookat(0, 0, -1); // init to default view direction vector camrot.multVec(lookat, lookat); SbVec3f pos = Cam->position.getValue(); float Dist = Cam->focalDistance.getValue(); // making gp out of the Coin stuff gp_Vec gpPos(pos.getValue()[0],pos.getValue()[1],pos.getValue()[2]); gp_Vec gpDir(lookat.getValue()[0],lookat.getValue()[1],lookat.getValue()[2]); lookat *= Dist; lookat += pos; gp_Vec gpLookAt(lookat.getValue()[0],lookat.getValue()[1],lookat.getValue()[2]); gp_Vec gpUp(upvec.getValue()[0],upvec.getValue()[1],upvec.getValue()[2]); // getting image format ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Raytracing"); int width = hGrp->GetInt("OutputWidth", 800); int height = hGrp->GetInt("OutputHeight", 600); // call the write method of PovTools.... out = PovTools::getCamera(CamDef(gpPos,gpDir,gpLookAt,gpUp),width,height); return Py::new_reference_to(Py::String(out)); } PY_CATCH; }
void SoVtkImageEllipsoidSource::inputChanged(SoField * f) { // Get the Radius value if ( f == &Radius ) SO_VTK_SET_FIELD_VEC3F( mObject, Radius); // Get the OutputScalarType value if ( f == &OutputScalarType ) SO_VTK_SET_FIELD_VALUE( mObject, OutputScalarType); // Get the OutValue value if ( f == &OutValue ) SO_VTK_SET_FIELD_VALUE( mObject, OutValue); // Get the InValue value if ( f == &InValue ) SO_VTK_SET_FIELD_VALUE( mObject, InValue); // Get the Center value if ( f == &Center ) SO_VTK_SET_FIELD_VEC3F( mObject, Center); // Get the WholeExtent value if ( f == &WholeExtent ) { SbVariant *vWholeExtent = (SbVariant *)WholeExtent.getValues(0); SoInput input; int nb_fields = WholeExtent.getNum(); int val0; int val1; int val2; int val3; int val4; int val5; for (int i=0; i < nb_fields; i++) { input.setBuffer((void *)vWholeExtent[i].getField().getString(),256); input.read(val0); input.read(val1); input.read(val2); input.read(val3); input.read(val4); input.read(val5); mObject->SetWholeExtent( (int) val0, (int) val1, (int) val2, (int) val3, (int) val4, (int) val5 ); } } mObject->Update(); }
void SoVtkGeometryFilter::inputChanged(SoField * f) { // Get the CellClipping value if ( f == &CellClipping ) SO_VTK_SET_FIELD_VALUE( mObject, CellClipping); // Get the Locator value if ( f == &Locator ) SO_VTK_SET_FIELD_DATA( mObject, Locator, vtkPointLocator); // Get the PointClipping value if ( f == &PointClipping ) SO_VTK_SET_FIELD_VALUE( mObject, PointClipping); // Get the ExtentClipping value if ( f == &ExtentClipping ) SO_VTK_SET_FIELD_VALUE( mObject, ExtentClipping); // Get the Merging value if ( f == &Merging ) SO_VTK_SET_FIELD_VALUE( mObject, Merging); // Get the Extent value if ( f == &Extent ) { SbVariant *vExtent = (SbVariant *)Extent.getValues(0); SoInput input; int nb_fields = Extent.getNum(); double val0; double val1; double val2; double val3; double val4; double val5; for (int i=0; i < nb_fields; i++) { input.setBuffer((void *)vExtent[i].getField().getString(),256); input.read(val0); input.read(val1); input.read(val2); input.read(val3); input.read(val4); input.read(val5); mObject->SetExtent( (double) val0, (double) val1, (double) val2, (double) val3, (double) val4, (double) val5 ); } } mObject->Update(); }
int main(int argc, char *argv[]) { SoDB::init(); QApplication app(argc, argv); qAddPostRoutine(cleanup); // Moved here because of https://developer.oculusvr.com/forums/viewtopic.php?f=17&t=7915&p=108503#p108503 // Init libovr. if (!ovr_Initialize()) { qDebug() << "Could not initialize Oculus SDK."; exit(1); } CoinRiftWidget window; window.show(); // An example scene. static const char * inlineSceneGraph[] = { "#Inventor V2.1 ascii\n", "\n", "Separator {\n", " Rotation { rotation 1 0 0 0.3 }\n", " Cone { }\n", " BaseColor { rgb 1 0 0 }\n", " Scale { scaleFactor .7 .7 .7 }\n", " Cube { }\n", "\n", " DrawStyle { style LINES }\n", " ShapeHints { vertexOrdering COUNTERCLOCKWISE }\n", " Coordinate3 {\n", " point [\n", " -2 -2 1.1, -2 -1 1.1, -2 1 1.1, -2 2 1.1,\n", " -1 -2 1.1, -1 -1 1.1, -1 1 1.1, -1 2 1.1\n", " 1 -2 1.1, 1 -1 1.1, 1 1 1.1, 1 2 1.1\n", " 2 -2 1.1, 2 -1 1.1, 2 1 1.1, 2 2 1.1\n", " ]\n", " }\n", "\n", " Complexity { value 0.7 }\n", " NurbsSurface {\n", " numUControlPoints 4\n", " numVControlPoints 4\n", " uKnotVector [ 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0 ]\n", " vKnotVector [ 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0 ]\n", " }\n", "}\n", NULL }; SoInput in; in.setStringArray(inlineSceneGraph); window.setSceneGraph(SoDB::readAll(&in)); return app.exec(); }
SoNode *ReadString(char* string) { SoNode *node; SoInput in; in.setBuffer(string, strlen(string)); node = SoDB::readAll(&in); node->ref(); return node; }
osgDB::ReaderWriter::ReadResult ReaderWriterIV::readNode(std::istream& fin, const osgDB::ReaderWriter::Options* options) const { // Notify OSG_NOTICE << "osgDB::ReaderWriterIV::readNode() " "Reading from stream." << std::endl; OSG_INFO << "osgDB::ReaderWriterIV::readNode() " "Inventor version: " << SoDB::getVersion() << std::endl; // Open the file SoInput input; // Assign istream to SoInput // note: It seems there is no straightforward way to do that. // SoInput accepts only FILE by setFilePointer or memory buffer // by setBuffer. The FILE is dangerous on Windows, since it forces // the plugin and Inventor DLL to use the same runtime library // (otherwise there are app crashes). // The memory buffer seems much better option here, even although // there will not be a real streaming. However, the model data // are usually much smaller than textures, so we should not worry // about it and think how to stream textures instead. // Get the data to the buffer size_t bufSize = 126*1024; // let's make it something below 128KB char *buf = (char*)malloc(bufSize); size_t dataSize = 0; while (!fin.eof() && fin.good()) { fin.read(buf+dataSize, bufSize-dataSize); dataSize += fin.gcount(); if (bufSize == dataSize) { bufSize *= 2; char* new_buf = (char*)realloc(buf, bufSize); if (!new_buf) { free(buf); return osgDB::ReaderWriter::ReadResult::INSUFFICIENT_MEMORY_TO_LOAD; } buf = new_buf; } } input.setBuffer(buf, dataSize); OSG_INFO << "osgDB::ReaderWriterIV::readNode() " "Stream size: " << dataSize << std::endl; // Perform reading from SoInput osgDB::ReaderWriter::ReadResult r; std::string fileName(""); r = readNodeFromSoInput(input, fileName, options); // clean up and return free(buf); return r; }
void SoVtkEnSightGoldReader::reset() { mObject->UnRegister(0); mObject->Delete(); mObject = 0; mObject = vtkEnSightGoldReader::New(); mObject->Register(0); mObject->SetGlobalWarningDisplay(0); // Get the input type(s) SoVtkAlgorithmOutput *inputPortPtr = InputConnection.getValue(); if (inputPortPtr) mObject->SetInputConnection(inputPortPtr->getPointer()); // Get the ByteOrder value SO_VTK_SET_FIELD_VALUE( mObject, ByteOrder); // Get the TimeValue value SO_VTK_SET_FIELD_VALUE( mObject, TimeValue); // Get the FilePath value SO_VTK_SET_FIELD_MFSTRING( mObject, FilePath); // Get the NumberOfInputConnections value if (addCalled == 1) { SbVariant *vNumberOfInputConnections = (SbVariant *)NumberOfInputConnections.getValues(0); SoInput input; int nb_fields = NumberOfInputConnections.getNum(); int val0; int val1; for (int i=0; i < nb_fields; i++) { input.setBuffer((void *)vNumberOfInputConnections[i].getField().getString(),256); input.read(val0); input.read(val1); //mObject->SetNumberOfInputConnections( (int) val0, (int) val1 ); } } // Get the CaseFileName value SO_VTK_SET_FIELD_MFSTRING( mObject, CaseFileName); // Get the ReadAllVariables value SO_VTK_SET_FIELD_VALUE( mObject, ReadAllVariables); mObject->Update(); }
void SoVtkImageAccumulate::inputChanged(SoField * f) { // Get the ReverseStencil value if ( f == &ReverseStencil ) SO_VTK_SET_FIELD_VALUE( mObject, ReverseStencil); // Get the ComponentExtent value if ( f == &ComponentExtent ) { SbVariant *vComponentExtent = (SbVariant *)ComponentExtent.getValues(0); SoInput input; int nb_fields = ComponentExtent.getNum(); int val0; int val1; int val2; int val3; int val4; int val5; for (int i=0; i < nb_fields; i++) { input.setBuffer((void *)vComponentExtent[i].getField().getString(),256); input.read(val0); input.read(val1); input.read(val2); input.read(val3); input.read(val4); input.read(val5); mObject->SetComponentExtent( (int) val0, (int) val1, (int) val2, (int) val3, (int) val4, (int) val5 ); } } // Get the Stencil value if ( f == &Stencil ) SO_VTK_SET_FIELD_DATA( mObject, Stencil, vtkImageStencilData); // Get the ComponentSpacing value if ( f == &ComponentSpacing ) SO_VTK_SET_FIELD_VEC3F( mObject, ComponentSpacing); // Get the ComponentOrigin value if ( f == &ComponentOrigin ) SO_VTK_SET_FIELD_VEC3F( mObject, ComponentOrigin); mObject->Update(); }
void SoVtkImageBlend::reset() { mObject->UnRegister(0); mObject->Delete(); mObject = 0; mObject = vtkImageBlend::New(); mObject->Register(0); mObject->SetGlobalWarningDisplay(0); // Get the input type(s) SoVtkAlgorithmOutput *inputPortPtr = InputConnection.getValue(); if (inputPortPtr) mObject->SetInputConnection(inputPortPtr->getPointer()); // Get the Stencil value SO_VTK_SET_FIELD_DATA( mObject, Stencil, vtkImageStencilData); // Get the CompoundThreshold value SO_VTK_SET_FIELD_VALUE( mObject, CompoundThreshold); // Get the NumberOfThreads value SO_VTK_SET_FIELD_VALUE( mObject, NumberOfThreads); // Get the Opacity value if (addCalled == 1) { SbVariant *vOpacity = (SbVariant *)Opacity.getValues(0); SoInput input; int nb_fields = Opacity.getNum(); int val0; double val1; for (int i=0; i < nb_fields; i++) { input.setBuffer((void *)vOpacity[i].getField().getString(),256); input.read(val0); input.read(val1); mObject->SetOpacity( (int) val0, (double) val1 ); } } // Get the BlendMode value SO_VTK_SET_FIELD_VALUE( mObject, BlendMode); mObject->Update(); }
void SoVtkExtractGrid::inputChanged(SoField * f) { // Get the VOI value if ( f == &VOI ) { if ( VOI.getNum() >= 6) { SO_VTK_SET_FIELD_MFINT32( mObject, VOI); } else { SoDebugError::post( __FILE__, "This field must have 6 values." ); } } // Get the SampleRate value if ( f == &SampleRate ) SO_VTK_SET_FIELD_VEC3F( mObject, SampleRate); // Get the InputArrayToProcess value if ( f == &InputArrayToProcess ) { SbVariant vInputArrayToProcess = (SbVariant)InputArrayToProcess.getValue(); SoInput input; int val0; int val1; int val2; int val3; SbString val4; input.setBuffer((void *)vInputArrayToProcess.getField().getString(),256); input.read(val0); input.read(val1); input.read(val2); input.read(val3); input.read(val4); mObject->SetInputArrayToProcess( (int) val0, (int) val1, (int) val2, (int) val3, val4.getString() ); } // Get the IncludeBoundary value if ( f == &IncludeBoundary ) SO_VTK_SET_FIELD_VALUE( mObject, IncludeBoundary); //mObject->Update(); }
void SoVtkImageDataGeometryFilter::inputChanged(SoField * f) { // Get the OutputTriangles value if ( f == &OutputTriangles ) SO_VTK_SET_FIELD_VALUE( mObject, OutputTriangles); // Get the Extent value if ( f == &Extent ) { SbVariant *vExtent = (SbVariant *)Extent.getValues(0); SoInput input; int nb_fields = Extent.getNum(); int val0; int val1; int val2; int val3; int val4; int val5; for (int i=0; i < nb_fields; i++) { input.setBuffer((void *)vExtent[i].getField().getString(),256); input.read(val0); input.read(val1); input.read(val2); input.read(val3); input.read(val4); input.read(val5); mObject->SetExtent( (int) val0, (int) val1, (int) val2, (int) val3, (int) val4, (int) val5 ); } } // Get the ThresholdCells value if ( f == &ThresholdCells ) SO_VTK_SET_FIELD_VALUE( mObject, ThresholdCells); // Get the ThresholdValue value if ( f == &ThresholdValue ) SO_VTK_SET_FIELD_VALUE( mObject, ThresholdValue); mObject->Update(); }
void SoVtkImageGaussianSource::inputChanged(SoField * f) { // Get the Maximum value if ( f == &Maximum ) SO_VTK_SET_FIELD_VALUE( mObject, Maximum); // Get the StandardDeviation value if ( f == &StandardDeviation ) SO_VTK_SET_FIELD_VALUE( mObject, StandardDeviation); // Get the Center value if ( f == &Center ) SO_VTK_SET_FIELD_VEC3F( mObject, Center); // Get the WholeExtent value if ( f == &WholeExtent ) { SbVariant *vWholeExtent = (SbVariant *)WholeExtent.getValues(0); SoInput input; int nb_fields = WholeExtent.getNum(); int val0; int val1; int val2; int val3; int val4; int val5; for (int i=0; i < nb_fields; i++) { input.setBuffer((void *)vWholeExtent[i].getField().getString(),256); input.read(val0); input.read(val1); input.read(val2); input.read(val3); input.read(val4); input.read(val5); mObject->SetWholeExtent( (int) val0, (int) val1, (int) val2, (int) val3, (int) val4, (int) val5 ); } } mObject->Update(); }