-using namespace std;
-// File : GEOM_GEN_i.cc file
-// Created :
-// Author : Lucien PIGNOLONI
-// Project : SALOME
-// Copyright : OPEN CASCADE
-// $Header$
+// GEOM GEOM : implementaion of GEOM_Gen.idl and GEOM_Shape.idl
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : GEOM_GEN_i.cc file
+// Author : Lucien PIGNOLONI
+// Module : GEOM
+// $Header$
+using namespace std;
#include "GEOM_Gen_i.hh"
#include "Partition_Spliter.hxx"
//============================================================================
char* GEOM_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
const char* IORString,
- CORBA::Boolean isMultiFile)
+ CORBA::Boolean isMultiFile,
+ CORBA::Boolean isASCII)
{
GEOM::GEOM_Shape_var aShape = GEOM::GEOM_Shape::_narrow(_orb->string_to_object(IORString));
if (!CORBA::is_nil(aShape)) {
//============================================================================
char* GEOM_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
const char* aLocalPersistentID,
- CORBA::Boolean isMultiFile)
+ CORBA::Boolean isMultiFile,
+ CORBA::Boolean isASCII)
{
SALOMEDS::Study_var myStudy = theSObject->GetStudy();
GetCurrentStudy(myStudy->StudyId());
CORBA::String_var ent = strdup(entry.ToCString());
/* Create the main object recursively */
- MainIOR = LocalPersistentIDToIOR(theSObject, ent, isMultiFile ) ;
+ MainIOR = LocalPersistentIDToIOR(theSObject, ent, isMultiFile, isASCII) ;
} else {
GC.ReturnNameIOR( mainLabel, MainIOR );
}
return aStreamFile._retn();
}
+SALOMEDS::TMPFile* GEOM_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent,
+ const char* theURL,
+ bool isMultiFile) {
+ SALOMEDS::TMPFile_var aStreamFile = Save(theComponent, theURL, isMultiFile);
+ return aStreamFile._retn();
+}
+
+
CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
const SALOMEDS::TMPFile& theStream,
const char* theURL,
bool isMultiFile) {
+
+ if (theStream.length() <= 9) {
+ MESSAGE("The TMPFile is too short : " << theStream.length() << " bytes ");
+ return false;
+ }
+
// Get a temporary directory for a file
TCollection_AsciiString aTmpDir = isMultiFile?TCollection_AsciiString((char*)theURL):SALOMEDS_Tool::GetTmpDir();
// Conver the byte stream theStream to a file and place it in tmp directory
SALOMEDS::ListOfFileNames_var aSeq = SALOMEDS_Tool::PutStreamToFiles(theStream,
aTmpDir.ToCString(),
isMultiFile);
+
// Prepare a file name to open
TCollection_AsciiString aNameWithExt(aSeq[0]);
TCollection_AsciiString aFullName = aTmpDir + aNameWithExt;
+
// Open document
if (myOCAFApp->Open(aFullName, myCurrentOCAFDoc) != CDF_RS_OK) return false;
+
// Remove the created file and tmp directory
if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.ToCString(), aSeq.in(), true);
int StudyID = Study->StudyId();
myStudyIDToDoc.Bind( StudyID, myCurrentOCAFDoc );
myStudyID = StudyID;
+
/* We clear all IOR (nameIOR) attributes of all objects before reconstruction */
/* This information will be setted when each object is reconstructed */
GEOMDS_Commands GC( myCurrentOCAFDoc->Main() ) ;
return true;
}
+CORBA::Boolean GEOM_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent,
+ const SALOMEDS::TMPFile& theStream,
+ const char* theURL,
+ bool isMultiFile) {
+ return Load(theComponent, theStream, theURL, isMultiFile);
+}
+
// //============================================================================
// // function : Save()
// // purpose : save OCAF/Geom document
/* Insert arguments in ocaf */
GEOM::GEOM_Gen::ListOfIOR_var ListShapes = new GEOM::GEOM_Gen::ListOfIOR;
ListShapes->length(2);
- ListShapes[0] = GetStringFromIOR(myShape) ;
- ListShapes[1] = GetStringFromIOR(shapePlane) ;
+ ListShapes[0] = GetStringFromIOR(GEOM::GEOM_Shape::_duplicate(myShape)) ;
+ ListShapes[1] = GetStringFromIOR(GEOM::GEOM_Shape::_duplicate(shapePlane)) ;
InsertInLabelMoreArguments(tds, result, ListShapes, myCurrentOCAFDoc) ;
return result ;
}
/* Insert arguments in ocaf */
GEOM::GEOM_Gen::ListOfIOR_var ListShapes = new GEOM::GEOM_Gen::ListOfIOR;
ListShapes->length(2);
- ListShapes[0] = GetStringFromIOR(pathShape) ;
- ListShapes[1] = GetStringFromIOR(baseShape) ;
+ ListShapes[0] = GetStringFromIOR(GEOM::GEOM_Shape::_duplicate(pathShape)) ;
+ ListShapes[1] = GetStringFromIOR(GEOM::GEOM_Shape::_duplicate(baseShape)) ;
InsertInLabelMoreArguments(tds, result, ListShapes, myCurrentOCAFDoc) ;
}
return result ;