本文整理汇总了C++中SbString::getLength方法的典型用法代码示例。如果您正苦于以下问题:C++ SbString::getLength方法的具体用法?C++ SbString::getLength怎么用?C++ SbString::getLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SbString
的用法示例。
在下文中一共展示了SbString::getLength方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2:
SbString
SoGLARBShaderProgram::getSourceHint(void) const
{
SbString result;
if (this->fragmentShader && this->fragmentShader->isActive()) {
SbString str = this->fragmentShader->sourceHint;
if (str.getLength() > 0) str += " ";
result += str;
}
if (this->vertexShader && this->vertexShader->isActive()) {
SbString str = this->vertexShader->sourceHint;
if (str.getLength() > 0) str += " ";
result += str;
}
return result;
}
示例3: SbString
void
SoXipImageOverlayManager::addOverlays()
{
const SoNode** nodes = overlays.getValues(0);
for( int i = 0; i < overlays.getNum(); ++ i )
{
const SoXipShapeList* shapeList = (const SoXipShapeList *) nodes[i];
if( !shapeList->isOfType( SoXipShapeList::getClassTypeId() ) )
{
SoDebugError::post( __FILE__, "Child not supported" );
return ;
}
int sliceIndex;
if( sscanf( shapeList->label.getValue().getString(), "%d", &sliceIndex ) != 1 )
{
SoDebugError::post( __FILE__, "Invalid label found '%s'", shapeList->label.getValue().getString() );
return ;
}
SoXipShapeList* sliceShapeList = mSliceMap[ sliceIndex ];
if( !sliceShapeList )
{
sliceShapeList = new SoXipShapeList;
sliceShapeList->label.setValue( SbString( sliceIndex ) );
mShapeSwitch->addChild( sliceShapeList );
mSliceMap[ sliceIndex ] = sliceShapeList;
}
int numShapes = shapeList->getNumChildren();
for( int i = 0; i < numShapes; ++ i )
{
// Copy to string to force removing of the connections
SoNode* copyNode = shapeList->getChild (i)->copy();
copyNode->ref();
SbString str = XipOverlayUtils::saveNodeToString( copyNode );
copyNode->unref();
// Reload copy node from this string
SoNode* readNode = XipOverlayUtils::loadNodeFromString( str.getString(), str.getLength() );
((SoXipShape *) readNode)->updateGeometries();
sliceShapeList->addChild( readNode );
}
}
}
示例4: setProperty
void SoXipData::setProperty(const SbString &key, const SbString &value)
{
if (key.getLength() == 0)
{
SoDebugError::postWarning("SoXipData::setProperty", "Key is empty! The value cannot be stored.");
return;
}
if (!mProperties)
{
mProperties = new SbXipDataPropertyMap;
if (!mProperties)
{
SoMemoryError::post("SbXipDataPropertyMap");
return;
}
}
(*mProperties)[key] = value;
}
示例5:
// Write SbString value to output stream. Used from SoSFString and
// SoMFString.
void
sosfstring_write_value(const SoField * f, SoOutput * out, const SbString & val)
{
// VRML97 needs backslashes themselves to be backslash-quoted (like
// in e.g. C strings), which is taken care of here instead of
// downstream, as this is the last place we can find out whether or
// not we're writing a VRML97 node.
const SoFieldContainer * fc = f->getContainer();
if (fc && fc->isOfType(SoNode::getClassTypeId()) &&
(coin_assert_cast<const SoNode *>(fc)->getNodeType() & SoNode::VRML2)) {
// FIXME: SbString should have had a replaceAll() method, so we
// wouldn't have to spell out the iteration loop below. 20040614 mortene.
SbString ws;
for (int i = 0; i < val.getLength(); i++) {
if (val[i] == '\\') { ws += '\\'; }
ws += val[i];
}
out->write(ws);
}
else { // *Not* a VRML97 node, so write backslashes verbatim, as
// dictated by the Inventor file format:
out->write(val);
}
}
示例6:
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();
}
示例7: if
//.........这里部分代码省略.........
Ui.table->setItem(i,0, new QTableWidgetItem(S.setNum(x,'g',5)));
Ui.table->setItem(i,1, new QTableWidgetItem(S.setNum(y,'g',5)));
Ui.table->setItem(i,2, new QTableWidgetItem(S.setNum(z,'g',5)));
/* Esto tambien funciona, pero tal vez es menos eficiente
//Leemos el campo y lo partimos en valores
SbString valueString;
field->get1(i, valueString);
QStringList vv = QString(valueString.getString()).split(" ");
//Insertamos cada valor en la tabla
for(int j=0;j<vv.size(); j++)
Ui.table->setItem(i,j, new QTableWidgetItem(vv[j]));
*/
}
}
//Tratamiento de campos SoMFVec4f
else if (!strcmp(nombre_tipo, "MFVec4f"))
{
//Cabecera de las columnas
Ui.table->setColumnCount(4);
hh << "X" << "Y" << "Z" << "T";
Ui.table->setHorizontalHeaderLabels(hh);
//Rellenamos la tabla
const SbVec4f *values = ((SoMFVec4f *)field)->getValues(0);
float x, y, z, t;
for (int i=0; i<numFilas; i++)
{
values[i].getValue(x,y,z,t);
Ui.table->setItem(i,0, new QTableWidgetItem(S.setNum(x,'g',5)));
Ui.table->setItem(i,1, new QTableWidgetItem(S.setNum(y,'g',5)));
Ui.table->setItem(i,2, new QTableWidgetItem(S.setNum(z,'g',5)));
Ui.table->setItem(i,3, new QTableWidgetItem(S.setNum(t,'g',5)));
}
}
//Tratamiento de campos SoMFFloat, SoMFUInt32, SoMFInt32
else if (!strcmp(nombre_tipo, "MFFloat") || !strcmp(nombre_tipo, "MFUInt32")
|| !strcmp(nombre_tipo, "MFShort") || !strcmp(nombre_tipo, "MFInt32")
|| !strcmp(nombre_tipo, "MFDouble") || !strcmp(nombre_tipo, "MFBool")
|| !strcmp(nombre_tipo, "MFUShort") || !strcmp(nombre_tipo, "MFName") )
{
//Hace falta una columna
Ui.table->setColumnCount(1);
hh << tr("Value");
Ui.table->setHorizontalHeaderLabels(hh);
//Rellenamos la tabla usando la funcion get1 de coin
SbString valueString;
for (int i=0; i<numFilas; i++)
{
field->get1(i, valueString);
Ui.table->setItem(i,0, new QTableWidgetItem(valueString.getString()));
}
}
//Tratamiento de campos SoMFString
else if (!strcmp(nombre_tipo, "MFString"))
{
//Hace falta una columna
Ui.table->setColumnCount(1);
hh << tr("Value");
Ui.table->setHorizontalHeaderLabels(hh);
//Rellenamos la tabla usando la funcion get1 de coin
SbString valueString;
for (int i=0; i<numFilas; i++)
{
field->get1(i, valueString);
//Eliminamos las comillas
valueString.deleteSubString(0,0);
int ln = valueString.getLength();
valueString.deleteSubString(ln-1,ln-1);
Ui.table->setItem(i,0, new QTableWidgetItem(valueString.getString()));
}//for
}
else
{
qDebug("Falta soporte para tipo %s\n", nombre_tipo);
}
//Creamos los items para la ultima fila
for (int j=0; j<Ui.table->columnCount(); j++)
{
Ui.table->setItem(Ui.table->rowCount()-1,j, new QTableWidgetItem());
}
//Conectamos las señales de la tabla
//connect(Ui.table, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_table_customContextMenuRequested(QPoint)));
//connect(Ui.table, SIGNAL(cellChanged(int, int)), this, SLOT(on_table_cellChanged(int, int)));
//Salvamos una copia del puntero
current_mfield = field;
}