+ if (bytedata.empty() || bytedata.size() != lines.size()*lenbytes)
+ return 0;
+
+#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
+ aTexture = new TColStd_HArray1OfByte (1, lines.size()*lenbytes);
+#else
+ aTexture = new TDataStd_HArray1OfByte (1, lines.size()*lenbytes);
+#endif
+
+ std::list<unsigned char>::iterator bdit;
+ int i;
+ for (i = 1, bdit = bytedata.begin(); bdit != bytedata.end(); ++bdit, ++i)
+ aTexture->SetValue(i, (Standard_Byte)(*bdit));
+
+ int aTextureId = GetEngine()->addTexture(GetDocID(), lenbytes*8, lines.size(), aTexture, theTextureFile);
+ if (aTextureId > 0) SetErrorCode(OK);
+ return aTextureId;
+}
+
+int GEOMImpl_IInsertOperations::AddTexture(int theWidth, int theHeight,
+#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
+ const Handle(TColStd_HArray1OfByte)& theTexture)
+#else
+ const Handle(TDataStd_HArray1OfByte)& theTexture)
+#endif
+{
+ SetErrorCode(KO);
+ int aTextureId = GetEngine()->addTexture(GetDocID(), theWidth, theHeight, theTexture);
+ if (aTextureId > 0) SetErrorCode(OK);
+ return aTextureId;
+}
+
+#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
+Handle(TColStd_HArray1OfByte) GEOMImpl_IInsertOperations::GetTexture(int theTextureId,
+#else
+Handle(TDataStd_HArray1OfByte) GEOMImpl_IInsertOperations::GetTexture(int theTextureId,
+#endif
+ int& theWidth, int& theHeight)
+{
+ SetErrorCode(KO);
+
+#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
+ Handle(TColStd_HArray1OfByte) aTexture;
+#else
+ Handle(TDataStd_HArray1OfByte) aTexture;
+#endif
+
+ theWidth = theHeight = 0;
+ TCollection_AsciiString aFileName;
+
+ if (theTextureId <= 0)
+ return aTexture;
+
+ aTexture = GetEngine()->getTexture(GetDocID(), theTextureId, theWidth, theHeight, aFileName);
+
+ if (theWidth > 0 && theHeight > 0 && aTexture->Length() > 0) SetErrorCode(OK);
+
+ return aTexture;
+}
+
+std::list<int> GEOMImpl_IInsertOperations::GetAllTextures()
+{
+ SetErrorCode(KO);
+ std::list<int> id_list = GetEngine()->getAllTextures(GetDocID());
+ SetErrorCode(OK);
+ return id_list;