X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FGEOM_I%2FGEOM_IInsertOperations_i.cc;h=382465d83750c3a7ce3010c51199d37ecfa1b01a;hb=c3caa78045034061617c8d3eca4a8c49f015616b;hp=b32b3eb717457407857f29ab3b4e210d04ab90ff;hpb=615e23820b78f6378c730027fdacedfbb553324d;p=modules%2Fgeom.git diff --git a/src/GEOM_I/GEOM_IInsertOperations_i.cc b/src/GEOM_I/GEOM_IInsertOperations_i.cc index b32b3eb71..382465d83 100644 --- a/src/GEOM_I/GEOM_IInsertOperations_i.cc +++ b/src/GEOM_I/GEOM_IInsertOperations_i.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -18,6 +18,7 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// #ifdef WNT #pragma warning( disable:4786 ) @@ -35,6 +36,7 @@ #include "GEOM_Object.hxx" #include +#include //============================================================================= /*! @@ -215,3 +217,52 @@ void GEOM_IInsertOperations_i::ExportTranslators theFormats = aFormatsArray._retn(); thePatterns = aPatternsArray._retn(); } + +CORBA::Long GEOM_IInsertOperations_i::LoadTexture(const char* theTextureFile) +{ + GetOperations()->SetNotDone(); + return GetOperations()->LoadTexture( theTextureFile ); +} + +CORBA::Long GEOM_IInsertOperations_i::AddTexture(CORBA::Long theWidth, CORBA::Long theHeight, + const SALOMEDS::TMPFile& theTexture) +{ + GetOperations()->SetNotDone(); + Handle(TDataStd_HArray1OfByte) aTexture; + if ( theTexture.length() > 0 ) { + aTexture = new TDataStd_HArray1OfByte( 1, theTexture.length() ); + for ( int i = 0; i < theTexture.length(); i++ ) + aTexture->SetValue( i+1, (Standard_Byte)theTexture[i] ); + } + return GetOperations()->AddTexture( theWidth, theHeight, aTexture ); +} + +SALOMEDS::TMPFile* GEOM_IInsertOperations_i::GetTexture(CORBA::Long theID, + CORBA::Long& theWidth, + CORBA::Long& theHeight) +{ + int aWidth, aHeight; + Handle(TDataStd_HArray1OfByte) aTextureImpl = GetOperations()->GetTexture( theID, aWidth, aHeight ); + theWidth = aWidth; + theHeight = aHeight; + SALOMEDS::TMPFile_var aTexture; + if ( !aTextureImpl.IsNull() ) { + aTexture = new SALOMEDS::TMPFile; + aTexture->length( aTextureImpl->Length() ); + for ( int i = aTextureImpl->Lower(); i <= aTextureImpl->Upper(); i++ ) + aTexture[i-aTextureImpl->Lower()] = aTextureImpl->Value( i ); + } + return aTexture._retn(); +} + +GEOM::ListOfLong* GEOM_IInsertOperations_i::GetAllTextures() +{ + std::list localIDs = GetOperations()->GetAllTextures(); + GEOM::ListOfLong_var anIDs = new GEOM::ListOfLong(localIDs.size()); + anIDs->length(localIDs.size()); + std::list::const_iterator anIt; + int i = 0; + for( anIt = localIDs.begin(); anIt != localIDs.end(); ++anIt, i++) + anIDs[i] = *anIt; + return anIDs._retn(); +}