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


C++ SbString类代码示例

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


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

示例1: soupgrader_add_to_namedict

// add a name to the upgrader lookup dict.
static void
soupgrader_add_to_namedict(const SbString & name)
{
  assert(soupgrader_namedict);

  // Note: the SbString->SbName wrapping is necessary, or the const
  // char* will _not_ be valid upon the SbString going out of scope
  // (while SbName makes permanent const char* references).
  soupgrader_namedict->put(SbName(name.getString()).getString(), NULL);

  // Create lookup both with and without the "So" prefix. This is
  // necessary for the hash lookup in soupgrader_exists() to match
  // with both permutations.

  SbString tmp;
  if (name.compareSubString("So") == 0) {
    tmp = name.getSubString(2);
  }
  else {
    tmp = "So";
    tmp += name;
  }

  // Note: the SbString->SbName wrapping is necessary, see above
  // comment.
  soupgrader_namedict->put(SbName(tmp.getString()).getString(), NULL);
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:28,代码来源:SoUpgrader.cpp

示例2: saveScreenshot

void IKRRTWindow::saveScreenshot()
{
    static int counter = 0;
    SbString framefile;

    framefile.sprintf("renderFrame_%06d.png", counter);
    counter++;
    redraw();
    viewer->getSceneManager()->render();
    viewer->getSceneManager()->scheduleRedraw();
    QGLWidget* w = (QGLWidget*)viewer->getGLWidget();

    QImage i = w->grabFrameBuffer();
    bool bRes = i.save(framefile.getString(), "BMP");

    if (bRes)
    {
        cout << "wrote image " << counter << endl;
    }
    else
    {
        cout << "failed writing image " << counter << endl;
    }

}
开发者ID:gkalogiannis,项目名称:simox,代码行数:25,代码来源:IKRRTWindow.cpp

示例3: writeImage

SbBool 
writeImage( const char* file, unsigned int offset, SbXipImage& image )
{
#ifdef WIN32
    //assuming everything is done using the bad backslashes... so we convert all forward slashes to those
    const char * fileLocal = XipReplaceChar(file, '/', '\\').getString();
#else //UNIX
    //assuming the other way around since we need forward slashes now...
    const char * fileLocal = XipReplaceChar(file, '\\', '/').getString();
#endif //WIN32
    
	int r = 0;

	void* imageBufferPtr = image.refBufferPtr();
	if( imageBufferPtr )
	{
		SbString path = XipStrExpandEnv( fileLocal );
		FILE* fs = fopen( path.getString(), "wb" );
		if (!fs) 
			return FALSE;

		fseek( fs, offset, SEEK_SET );
		r = fwrite(imageBufferPtr, 1, image.bufferSize(), fs );

		fclose( fs );
	}
	image.unrefBufferPtr();

	return (r == image.bufferSize());
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:30,代码来源:SbXipImageFile.cpp

示例4: SoRegPoint

/**
 * Creates a point element as visible feedback for the user.
 */
SoNode* ManualAlignment::pickedPointsSubGraph(const SbVec3f& p, const SbVec3f& n, int id)
{
    static const float color_table [10][3] = {
        {1.0f,0.0f,0.0f}, // red
        {0.0f,1.0f,0.0f}, // green
        {0.0f,0.0f,1.0f}, // blue
        {1.0f,1.0f,0.0f}, // yellow
        {0.0f,1.0f,1.0f}, // cyan
        {0.7f,0.0f,0.0f},
        {0.0f,0.7f,0.0f},
        {0.7f,0.7f,0.0f},
        {0.7f,0.0f,0.5f},
        {1.0f,0.7f,0.0f}
    };

    int index = (id-1) % 10;

    SoRegPoint* probe = new SoRegPoint();
    probe->base.setValue(p);
    probe->normal.setValue(n);
    probe->color.setValue(color_table[index][0],color_table[index][1],color_table[index][2]);
    SbString s;
    probe->text.setValue(s.sprintf("RegPoint_%d", id));
    return probe;
}
开发者ID:kkoksvik,项目名称:FreeCAD,代码行数:28,代码来源:ManualAlignment.cpp

示例5:

void
SoXipImageOverlayManager::updateSliceMap()
{
	// Removes all the previous entries
	mSliceMap.clear();

	SoSearchAction sa;
	sa.setInterest( SoSearchAction::ALL );
	sa.setType( SoXipShapeList::getClassTypeId() );
	sa.setSearchingAll( TRUE );
	sa.apply( mShapeSwitch );

	SoPathList paths = sa.getPaths();
	for( int i = 0; i < paths.getLength(); ++ i )
	{
		SbString label = ((SoXipShapeList *) paths[i]->getTail())->label.getValue().getString();

		int sliceIndex;
		if( sscanf( label.getString(), "%d", &sliceIndex ) != 1 )
		{
			SoDebugError::post( __FILE__, "Invalid label found '%s'", label.getString() );
			continue  ;
		}
		
		mSliceMap[ sliceIndex ] = (SoXipShapeList *) paths[i]->getTail();
	}
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:27,代码来源:SoXipImageOverlayManager.cpp

示例6: clearClipboard

void
SoXipImageOverlayManager::loadOverlays()
{
	// When the patient changes
	clearClipboard();

	// Remove all the geometries from the switch
	mShapeSwitch->removeAllChildren();
	mShapeSwitch->whichChild.setValue(-1);

	mCurrentSlice = -1;

	if( mImageData )
	{
		SbString overlayStr = mImageData->getProperty( "overlays" );
		SoNodeList nodes = XipOverlayUtils::loadOverlaysFromString( overlayStr.getString(), overlayStr.getLength(), TRUE );

		for( int i = 0; i < nodes.getLength(); ++ i )
		{
			if( !nodes[i]->isOfType( SoXipShapeList::getClassTypeId() ) )
			{
				SoDebugError::post( __FILE__, "Invalid overlay node found in Dicom. Ignored." );				
				continue ;
			}
			mShapeSwitch->addChild( nodes[i] );
		}
	}

	updateSliceMap();
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:30,代码来源:SoXipImageOverlayManager.cpp

示例7: SbMax

// Documented in superclass. Overridden to pass GL state to the
// previous element.
void
SoGLMultiTextureImageElement::pop(SoState * state,
                                  const SoElement * prevTopElement)
{
  inherited::pop(state, prevTopElement);
  SoGLMultiTextureImageElement * prev = (SoGLMultiTextureImageElement*)
    prevTopElement;

  SoGLShaderProgram * prog = SoGLShaderProgramElement::get(state);
  SbString str;
  
  const int maxunits = SbMax(PRIVATE(prev)->unitdata.getLength(),
                             PRIVATE(this)->unitdata.getLength());

  for (int i = 0; i < maxunits; i++) {
    const GLUnitData & prevud = 
      (i < PRIVATE(prev)->unitdata.getLength()) ?
      PRIVATE(prev)->unitdata[i] :
      PRIVATE(prev)->defaultdata;
    
    const GLUnitData & thisud = 
      (i < PRIVATE(this)->unitdata.getLength()) ?
      PRIVATE(this)->unitdata[i] :
      PRIVATE(this)->defaultdata;

    if (thisud.glimage != prevud.glimage) this->updateGL(i);
    str.sprintf("coin_texunit%d_model", i);
    if (prog) prog->updateCoinParameter(state, SbName(str.getString()),
                                        thisud.glimage != NULL ? this->getUnitData(i).model : 0);
  }
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:33,代码来源:SoGLMultiTextureImageElement.cpp

示例8: autoLock

void
SoVRMLAudioClipP::loadUrl()
{
#ifdef HAVE_THREADS
  SbThreadAutoLock autoLock(&this->syncmutex);
#endif
  this->unloadUrl();

  for (int i=0; i<PUBLIC(this)->url.getNum(); i++) {
    const char * str = PUBLIC(this)->url[i].getString();
    if ( (str == NULL) || (strlen(str)==0) )
      continue; // ignore empty url

    SbString filename =
      SoInput::searchForFile(SbString(str), SoInput::getDirectories(),
                             SoVRMLAudioClip::getSubdirectories());

    if (filename.getLength() <= 0) {
      SoDebugError::postWarning("SoVRMLAudioClipP::loadUrl(index)",
                                "File not found: '%s'",
                                str);
      continue; // ignore invalid file
    }

    this->playlist.append(filename);
  }
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:27,代码来源:AudioClip.cpp

示例9: errorHandlerCB

void
errorHandlerCB(const SoError * error, void * data)
{
	if (pipeErrorMessagesToConsole) {
		(void)printf("%s\n", error->getDebugString().getString());
	}
	else {
		SbString debugstring = error->getDebugString();
		::MessageBox(NULL, CHAR_TO_NATIVE(debugstring.getString()), TEXT("SoError"), MB_OK | MB_ICONERROR);
	}
}
开发者ID:astanin,项目名称:mirror-studierstube,代码行数:11,代码来源:SoSimple.cpp

示例10: COIN_UNUSED_ARG

SoCallbackAction::Response
SoToVRMLActionP::unsupported_cb(void * closure, SoCallbackAction * COIN_UNUSED_ARG(action), const SoNode * node)
{
  SoInfo * info = NEW_NODE(SoInfo, node);
  SbString str;
  str.sprintf("Unsupported node: %s",
              node->getTypeId().getName().getString());
  info->string = str;
  THISP(closure)->get_current_tail()->addChild(info);
  return SoCallbackAction::CONTINUE;
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:11,代码来源:SoToVRMLAction.cpp

示例11: SbStringList

void ViewProviderVRMLObject::addResource(const SbString& url, std::list<std::string>& resources)
{
    SbString found = SoInput::searchForFile(url, SoInput::getDirectories(), SbStringList());
    Base::FileInfo fi(found.getString());
    if (fi.exists()) {
        // add the resource file if not yet listed
        if (std::find(resources.begin(), resources.end(), found.getString()) == resources.end()) {
            resources.push_back(found.getString());
        }
    }
}
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:11,代码来源:ViewProviderVRMLObject.cpp

示例12: PRIVATE

/*!
  Sets the current texture. Id \a didapply is TRUE, it is assumed
  that the texture image already is the current GL texture. Do not
  use this feature unless you know what you're doing.
*/
void
SoGLMultiTextureImageElement::set(SoState * const state, SoNode * const node,
                                  const int unit,
                                  SoGLImage * image,
                                  Model model,
                                  const SbColor & blendColor)
{
  SoGLMultiTextureImageElement * elem = (SoGLMultiTextureImageElement*)
    state->getElement(classStackIndex);

  PRIVATE(elem)->ensureCapacity(unit);
  GLUnitData & ud = PRIVATE(elem)->unitdata[unit];
  
  // FIXME: buggy. Find some solution to handle this. pederb, 2003-11-12
  // if (ud.glimage && ud.glimage->getImage()) ud.glimage->getImage()->readUnlock();

  if (image) {
    // keep SoMultiTextureImageElement "up-to-date"
    inherited::set(state, node,
                   unit,
                   SbVec3s(0,0,0),
                   0,
                   NULL,
                   multi_translateWrap(image->getWrapS()),
                   multi_translateWrap(image->getWrapT()),
                   multi_translateWrap(image->getWrapR()),
                   model,
                   blendColor);
    ud.glimage = image;
    // make sure image isn't changed while this is the active texture
    // FIXME: buggy. Find some solution to handle this. pederb, 2003-11-12
    // if (image->getImage()) image->getImage()->readLock();
  }
  else {
    ud.glimage = NULL;
    inherited::setDefault(state, node, unit);
  }
  elem->updateGL(unit);

  // FIXME: check if it's possible to support for other units as well
  if ((unit == 0) && image && image->isOfType(SoGLBigImage::getClassTypeId())) {
    SoShapeStyleElement::setBigImageEnabled(state, TRUE);
  }
  SoShapeStyleElement::setTransparentTexture(state,
                                             SoGLMultiTextureImageElement::hasTransparency(state));
  
  SoGLShaderProgram * prog = SoGLShaderProgramElement::get(state);
  if (prog) {
    SbString str;
    str.sprintf("coin_texunit%d_model", unit);
    prog->updateCoinParameter(state, SbName(str.getString()), ud.glimage ? model : 0);
  }
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:58,代码来源:SoGLMultiTextureImageElement.cpp

示例13: data

QVariant ParametersItem::data ( int role ) const
{
	if( role == Qt::DisplayRole )
	{
		if ( column() == 0 ) return m_text;

		SbString fieldValue = "null";
		m_pField->get( fieldValue );
		return QString( fieldValue.getString() );
	}
	else
		return QStandardItem::data( role );
}
开发者ID:Lillian003,项目名称:tonatiuh,代码行数:13,代码来源:ParametersItem.cpp

示例14: glColor3f

void SoView2DLiftChart::drawSliceIndicator(int x1, int x2, int y, int slice) {
   glColor3f(1, 1, 1);
   glBegin(GL_LINES);
   glVertex2f(x1,     y - 1);
   glVertex2f(x2 + 6, y - 1);
   glEnd();

   // convert float distance to string
   SbString sliceString = float(slice);

   View2DFont* font = SoView2D::globalFont(_dsl->getCurrentCacheContext());
   float fcolor[4] = {color.getValue()[0],color.getValue()[1],color.getValue()[2],1};
   font->drawString(x2 + 10, y - 6, 12, fcolor, sliceString.getString(), 0, true);
}
开发者ID:cguagliano,项目名称:communitymodules,代码行数:14,代码来源:SoView2DLiftChart.cpp

示例15: getLength

SbString
SbString::getSubString(int startChar, int endChar) const
{
    int		len = getLength();

    // Get substring that starts at specified character
    SbString	tmp = &string[startChar];

    // Delete characters from end if necessary
    if (endChar >= 0 && endChar < len - 1)
	tmp.deleteSubString(endChar - startChar + 1);

    return tmp;
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:14,代码来源:SbString.cpp


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