本文整理汇总了C++中SbString::getString方法的典型用法代码示例。如果您正苦于以下问题:C++ SbString::getString方法的具体用法?C++ SbString::getString怎么用?C++ SbString::getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SbString
的用法示例。
在下文中一共展示了SbString::getString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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();
}
}
示例2: assert
// 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);
}
示例3: addResource
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());
}
}
}
示例4: if
void
SoHandleBoxDragger::updateArrows(void)
{
int i;
SbString str;
SoSwitch *sw;
if (this->constraintState >= CONSTRAINT_X) {
int onval = -1;
switch (this->constraintState) {
case CONSTRAINT_X:
onval = 3;
break;
case CONSTRAINT_Y:
onval = 1;
break;
case CONSTRAINT_Z:
onval = 5;
break;
}
for (i = 1; i <= 6; i++) {
str.sprintf("arrow%dSwitch", i);
sw = SO_GET_ANY_PART(this, str.getString(), SoSwitch);
if (i == onval || i == onval + 1) {
SoInteractionKit::setSwitchValue(sw, 0);
}
else {
SoInteractionKit::setSwitchValue(sw, SO_SWITCH_NONE);
}
}
}
else if (this->whatkind == WHATKIND_TRANSLATOR) {
int num = (this->whatnum-1) & ~1;
for (i = 0; i < 6; i++) {
str.sprintf("arrow%dSwitch", i+1);
sw = SO_GET_ANY_PART(this, str.getString(), SoSwitch);
if (i == num || i == num+1) {
SoInteractionKit::setSwitchValue(sw, SO_SWITCH_NONE);
}
else {
SoInteractionKit::setSwitchValue(sw, 0);
}
}
}
else {
for (i = 1; i <= 6; i++) {
str.sprintf("arrow%dSwitch", i);
sw = SO_GET_ANY_PART(this, str.getString(), SoSwitch);
SoInteractionKit::setSwitchValue(sw, SO_SWITCH_NONE);
}
}
}
示例5: XipReplaceChar
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());
}
示例6: 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);
}
}
示例7: 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;
}
}
示例8: getProgramID
int SoXipGLSLShaderProgramElement::getProgramID(SoState * const state,
const SbString & prgTag)
{
ShaderProgramManager * manager = ShaderProgramManager::getInstance();
int prgHandle = manager->getProgramHandle(prgTag.getString());
return prgHandle;
}
示例9:
__uint64 SoXipGLSLShaderProgramElement::getTimeStamp(SoState * const state,
const SbString & prgTag)
{
ShaderProgramManager * manager = ShaderProgramManager::getInstance();
__uint64 time = manager->getTimeStamp(prgTag.getString());
return time;
}
示例10: setTimeStamps
void SoXipGLSLPrograms::setTimeStamps(ShaderBatch * batch, const SbString& filename)
{
if (!batch)
return;
int tod = ShaderEngine::getSourceFileTimeStamp(filename.getString());
batch->source.setSourceTimeStamp(tod);
batch->dirtyTimestamp = false;
}
示例11: set
int SoXipGLSLShaderProgramElement::set(SoState * const state,
const SbString & prgTag)
{
ShaderProgramManager * manager = ShaderProgramManager::getInstance();
int prgHandle = manager->getProgramHandle(prgTag.getString());
SoInt32Element::set(classStackIndex, state, prgHandle);
return prgHandle;
}
示例12: TEXT
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);
}
}
示例13:
SbBool
SoTexture2::readImage(const SbString& fname, int &w, int &h, int &nc,
unsigned char *&bytes)
//
////////////////////////////////////////////////////////////////////////
{
w = h = nc = 0;
bytes = NULL;
// Empty file means an empty image...
if (fname.getString()[0] == '\0')
return TRUE;
SoInput in;
if (!in.openFile(fname.getString(), TRUE)) {
return FALSE;
}
#ifdef DEBUG
SoDebugError::postInfo("SoTexture2::readImage",
"Reading texture image %s",
fname.getString());
#endif
if (ReadSGIImage(in, w, h, nc, bytes))
return TRUE;
// fiopen() closes the file even if it can't read the data, so
// reopen it
in.closeFile();
if (!in.openFile(fname.getString(), TRUE))
return FALSE;
if (ReadGIFImage(in, w, h, nc, bytes))
return TRUE;
if (ReadJPEGImage(in, w, h, nc, bytes))
return TRUE;
return FALSE;
}
示例14: 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);
}
}
示例15:
LRESULT
SoSimple::onQuit(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
{
if (idleSensorId != 0) ::KillTimer(NULL, idleSensorId);
if (timerSensorId != 0) ::KillTimer(NULL, timerSensorId);
if (delaySensorId != 0) ::KillTimer(NULL, delaySensorId);
idleSensorId = timerSensorId = delaySensorId = 0;
::UnregisterClass(CHAR_TO_NATIVE(gClassName.getString()), NULL);
return 0;
}