コード例 #1
0
void SoXipLoadDicom::evaluate()
{
	unloadAll();
    
    SoMFString nameLocal;
    for (int i = 0; i < name.getNum(); i++)
	{
#ifdef WIN32
    //assuming everything is done using the bad backslashes... so we convert all forward slashes to those
    nameLocal.set1Value(i, XipReplaceChar(name[i].getString(), '/', '\\'));
#else //UNIX
    //assuming the other way around since we need forward slashes now...
    nameLocal.set1Value(i, XipReplaceChar(name[i].getString(), '\\', '/'));
#endif //WIN32
    }

	// "interpret" may replace folders with files in the folder or DICOMDIR with images
	SoMFString interpreted;
	SoXipDataDicom::interpret(nameLocal, interpreted);


	for (int i = 0; i < interpreted.getNum(); i++)
	{
		SoXipDataDicom* dicomData = new SoXipDataDicom;
		if (dicomData)
		{
			if (dicomData->open(interpreted[i].getString()))
			{
				mLoadedData.set1Value(mLoadedData.getNum(), dicomData);
			}
		}
	}

	SO_ENGINE_OUTPUT( dicom, SoXipMFDataDicom, copyFrom(mLoadedData) );
}
コード例 #2
0
bool SoXipGLSLPrograms::evaluateFieldBitmaskChange(const SoMFString& field, SoMFString& m_field, int slot)
{
    if (m_field.getNum() != field.getNum())
    {
        m_field.setNum( field.getNum() );
    }

    if (m_field[slot] != field[slot])
    {
        m_field.set1Value(slot, field[slot]);
        return true;
    }

    return false;
    //{
    //    switch (shaderType)
    //    {
    //    case GL_VERTEX_SHADER :
    //        dirty |= (mFieldBitmask & (VP_FILENAMES | VP_DEFINES)) ? true : false;
    //        break;
    //    case GL_GEOMETRY_SHADER_EXT :
    //        dirty |= (mFieldBitmask & (GP_FILENAMES | GP_DEFINES)) ? true : false;
    //        break;
    //    case GL_FRAGMENT_SHADER :
    //        dirty |= (mFieldBitmask & (FP_FILENAMES | FP_DEFINES)) ? true : false;
    //        break;
    //    default:
    //        errstr.append("Unknown shader type");
    //        return false;
    //    }
    //}
}
コード例 #3
0
int SoXipSegmentationOverlayManager::SetupOverlayOption ( SoXipShape *pshape, SoMFString& OO )
{
	if (pshape == NULL) return ( 0 ) ;

	const SbString& classname = shapeClassName.getValue();

	int sh, len ;
	SbString *pstr ;
	char *sz, szTemp[256] ;
	char *szPrefix =  "SoXip" ;
	char *szSuffix =  "/SoXip" ;

	{
		char *szName = (char*)classname.getString () ;
		//
		if (szName == NULL) return ( 0 ) ;
		pstr = (SbString*)OO.getValues ( 0 ) ;
		if (pstr == NULL) return ( 0 ) ;
	
		//! Default operations 
		strncpy ( szTemp, szName, 5 ) ; szTemp[5] = 0 ;
#ifdef WIN32
		if (stricmp ( szTemp, szPrefix ) == 0)
#else
		if (strcasecmp ( szTemp, szPrefix ) == 0)
#endif /* WIN32 */
		{
			pshape->setRank ( -1 ) ;
		}

#ifdef WIN32
		if (stricmp ( szName, "SoXipContour" ) == 0)
#else
		if (strcasecmp ( szName, "SoXipContour" ) == 0)
#endif /* WIN32 */
		{
			SoXipContour *p = (SoXipContour*)pshape ;
			//! Default settings
			//p->closeOnDblClick = false ;
			//p->closed = false ;

			for (sh=0; sh<OO.getNum(); sh++)
			{
				sz = (char*)pstr[sh].getString ( ) ; if (sz == NULL) continue ;
				len = pstr[sh].getLength ( ) ; if (len < 1) continue ;

				//if (stricmp ( sz, "NonClosed" ) == 0)	{ p->closed = false ;	p->closeOnDblClick = false ;	continue ; }
				//if (stricmp ( sz, "Closed" ) == 0)		{ p->closed = true ;	p->closeOnDblClick = true ;		continue ; }
				// SoDebugError::postInfo ( szName, sz ) ;
			}
		}
	}

	return ( 1 ) ;
}
コード例 #4
0
void MFieldEditor::on_buttonBox_clicked(QAbstractButton * button)
{
	if (Ui.buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole)
	{
		QString S;
		SbString oldValue;

		//Buscamos el SoMField que estamos editando
		SoMField *field = current_mfield;

		//Leemos el tipo de este campo
		SoType tipo=field->getTypeId();
		const char*nombre_tipo = tipo.getName();  

		//Actualizamos el contenido del SoMField

		//Si es necesario, ampliamos el tamaño del SoMField
		field->setNum(Ui.table->rowCount()-1);

		//Miramos cuantas columnas tiene la tabla
		int numComp = Ui.table->columnCount();

		//Tratamiento de los campos SoMFString
		if (!strcmp(nombre_tipo, "MFString") )
		{
			//Convertimos el campo a SoMFString
			SoMFString *soMFString = (SoMFString *)field;

			//Recorremos las filas de la tabla
			for(int i=0;i<Ui.table->rowCount()-1;i++)
			{
				//Extraemos el contenido de las celdas
				S = Ui.table->item(i,0)->text();

				//Aplicamos el valor al campo
				soMFString->set1Value(i, SbString(qPrintable(S)));

			} // for(int i=0;i<Ui.table->rowCount()-1;i++)
		}
		else

			//Recorremos las filas de la tabla
			for(int i=0;i<Ui.table->rowCount()-1;i++)
			{
				//Sacamos una copia del field actual, por si hay errores
				field->get1(i, oldValue);
				//qDebug("old: %s\n", oldValue.getString());

				//Extraemos el contenido de la primera celda
				S = Ui.table->item(i,0)->text();

				//Concatenamos el resto de celdas de la fila
				for (int j=1; j < numComp; j++)
				{
					S.append(' ');
					S.append(Ui.table->item(i,j)->text());
				}

				//Leemos la cadena mediante el parser de openInventor
				//fprintf(stderr, "Introduciendo: %s\n", txt);
				if (!field->set1(i, qPrintable(S)))
				{
					//Si hubo un error en la lectura, restablecemos el valor anterior
					field->set1(i, oldValue.getString() );
					QMessageBox::warning( this, tr("Warning"), tr("Error on row:")+S.setNum(i));
					qDebug("Error leyendo campo en fila %d\n", i);
				}

			}//for

	}//if (Ui.buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole)
}