当前位置: 首页>>代码示例>>C++>>正文


C++ SoInput::setBuffer方法代码示例

本文整理汇总了C++中SoInput::setBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ SoInput::setBuffer方法的具体用法?C++ SoInput::setBuffer怎么用?C++ SoInput::setBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SoInput的用法示例。


在下文中一共展示了SoInput::setBuffer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: inputChanged

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
            );
        }
    }

}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:27,代码来源:SoVtkFieldData.cpp

示例2: inputChanged

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();
	
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:30,代码来源:SoVtkOutlineFilter.cpp

示例3: if

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();
}
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:30,代码来源:DragDropHandler.cpp

示例4:

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();
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:32,代码来源:SoVtkImageVariance3D.cpp

示例5: inputChanged

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();
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:26,代码来源:SoVtkGenericProbeFilter.cpp

示例6: LightManip

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 );
  }


} 
开发者ID:SparkyCola,项目名称:FreeCAD,代码行数:27,代码来源:View3DInventorExamples.cpp

示例7: reset

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
            );
        }
    }

}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:34,代码来源:SoVtkFieldData.cpp

示例8: inputChanged

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();
	
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:58,代码来源:SoVtkConeSource.cpp

示例9: reset

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();
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:57,代码来源:SoVtkImageWrapPad.cpp

示例10: strlen

SoNode *ReadString(char* string) {
   SoNode *node;
   SoInput in;
   in.setBuffer(string, strlen(string));
   node = SoDB::readAll(&in);
   node->ref();

   return node;
}
开发者ID:tarunrs,项目名称:homework-fall-2011,代码行数:9,代码来源:OSUInventor.C

示例11: Exception

/// 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;
}
开发者ID:Barleyman,项目名称:FreeCAD_sf_master,代码行数:58,代码来源:AppRaytracingGuiPy.cpp

示例12: inputChanged

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();
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:57,代码来源:SoVtkImageEllipsoidSource.cpp

示例13: inputChanged

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();
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:57,代码来源:SoVtkGeometryFilter.cpp

示例14: fileName

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;
}
开发者ID:LaurensVoerman,项目名称:OpenSceneGraph,代码行数:55,代码来源:ReaderWriterIV.cpp

示例15: reset

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();
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:54,代码来源:SoVtkEnSightGoldReader.cpp


注:本文中的SoInput::setBuffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。