Salome HOME
Update copyright
[modules/geom.git] / src / GEOMImpl / GEOMImpl_IInsertOperations.cxx
1 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #include <Standard_Stream.hxx>
24
25 #include <GEOMImpl_IInsertOperations.hxx>
26
27 #include "utilities.h"
28 #include <OpUtil.hxx>
29 #include <Utils_ExceptHandlers.hxx>
30
31 #include <TFunction_DriverTable.hxx>
32 #include <TFunction_Driver.hxx>
33 #include <TFunction_Logbook.hxx>
34 #include <TDF_Tool.hxx>
35
36 #include <GEOM_Function.hxx>
37 #include <GEOM_PythonDump.hxx>
38
39 #include <GEOMImpl_CopyDriver.hxx>
40 #include <GEOMImpl_ExportDriver.hxx>
41 #include <GEOMImpl_ImportDriver.hxx>
42
43 #include <GEOMImpl_ICopy.hxx>
44 #include <GEOMImpl_IImportExport.hxx>
45
46 #include <GEOMImpl_Types.hxx>
47
48 #include <TopoDS.hxx>
49 #include <TopoDS_Vertex.hxx>
50 #include <BRep_Tool.hxx>
51 #include <gp_Pnt.hxx>
52 #include <TDataStd_HArray1OfByte.hxx>
53
54 #include <Standard_Failure.hxx>
55 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
56
57 //=============================================================================
58 /*!
59  *   constructor:
60  */
61 //=============================================================================
62
63 GEOMImpl_IInsertOperations::GEOMImpl_IInsertOperations(GEOM_Engine* theEngine, int theDocID)
64 : GEOM_IOperations(theEngine, theDocID)
65 {
66   MESSAGE("GEOMImpl_IInsertOperations::GEOMImpl_IInsertOperations");
67 }
68
69 //=============================================================================
70 /*!
71  *  destructor
72  */
73 //=============================================================================
74
75 GEOMImpl_IInsertOperations::~GEOMImpl_IInsertOperations()
76 {
77   MESSAGE("GEOMImpl_IInsertOperations::~GEOMImpl_IInsertOperations");
78 }
79
80
81
82 //=============================================================================
83 /*!
84  *  MakeCopy
85  */
86 //=============================================================================
87 Handle(GEOM_Object) GEOMImpl_IInsertOperations::MakeCopy(Handle(GEOM_Object) theOriginal)
88 {
89   SetErrorCode(KO);
90
91   if (theOriginal.IsNull()) return NULL;
92
93   //Add a new Copy object
94   Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
95
96   //Add a Copy function for creation a copy object
97   Handle(GEOM_Function) aFunction = aCopy->AddFunction(GEOMImpl_CopyDriver::GetID(), COPY_WITH_REF);
98
99   //Check if the function is set correctly
100   if(aFunction->GetDriverGUID() != GEOMImpl_CopyDriver::GetID()) return NULL;
101
102   GEOMImpl_ICopy aCI(aFunction);
103
104   Handle(GEOM_Function) aRefFunction = theOriginal->GetLastFunction();
105   if (aRefFunction.IsNull()) return NULL;
106
107   aCI.SetOriginal(aRefFunction);
108
109   //Compute the Copy value
110   try {
111 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
112     OCC_CATCH_SIGNALS;
113 #endif
114     if (!GetSolver()->ComputeFunction(aFunction)) {
115       SetErrorCode("Copy driver failed");
116       return NULL;
117     }
118   }
119   catch (Standard_Failure) {
120     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
121     SetErrorCode(aFail->GetMessageString());
122     return NULL;
123   }
124
125   //Make a Python command
126   GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeCopy(" << theOriginal << ")";
127
128   SetErrorCode(OK);
129   return aCopy;
130 }
131
132 //=============================================================================
133 /*!
134  *  Export
135  */
136 //=============================================================================
137 void GEOMImpl_IInsertOperations::Export
138                      (const Handle(GEOM_Object)      theOriginal,
139                       const TCollection_AsciiString& theFileName,
140                       const TCollection_AsciiString& theFormatName)
141 {
142   SetErrorCode(KO);
143
144   if (theOriginal.IsNull()) return;
145
146   Handle(GEOM_Function) aRefFunction = theOriginal->GetLastFunction();
147   if (aRefFunction.IsNull()) return;  //There is no function which creates an object to be exported
148
149   //Add an Export function
150   Handle(GEOM_Function) aFunction = theOriginal->AddFunction(GEOMImpl_ExportDriver::GetID(), EXPORT_SHAPE);
151   if (aFunction.IsNull()) return;
152
153   //Check if the function is set correctly
154   if (aFunction->GetDriverGUID() != GEOMImpl_ExportDriver::GetID()) return;
155
156   Handle(TCollection_HAsciiString) aHLibName;
157   if (!IsSupported(Standard_False, theFormatName, aHLibName)) {
158     return;
159   }
160   TCollection_AsciiString aLibName = aHLibName->String();
161
162   //Set parameters
163   GEOMImpl_IImportExport aCI (aFunction);
164   aCI.SetOriginal(aRefFunction);
165   aCI.SetFileName(theFileName);
166   aCI.SetFormatName(theFormatName);
167   aCI.SetPluginName(aLibName);
168
169   //Perform the Export
170   try {
171 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
172     OCC_CATCH_SIGNALS;
173 #endif
174     if (!GetSolver()->ComputeFunction(aFunction)) {
175       SetErrorCode("Not enough space on disk, or you haven't permissions to write this directory");
176       return;
177     }
178   }
179   catch (Standard_Failure) {
180     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
181     SetErrorCode(aFail->GetMessageString());
182     return;
183   }
184
185   //Make a Python command
186   GEOM::TPythonDump(aFunction) << "geompy.Export(" << theOriginal << ", \""
187     << theFileName.ToCString() << "\", \"" << theFormatName.ToCString() << "\")";
188
189   SetErrorCode(OK);
190 }
191
192 //=============================================================================
193 /*!
194  *  Import
195  */
196 //=============================================================================
197 Handle(GEOM_Object) GEOMImpl_IInsertOperations::Import
198                                  (const TCollection_AsciiString& theFileName,
199                                   const TCollection_AsciiString& theFormatName)
200 {
201   SetErrorCode(KO);
202
203   if (theFileName.IsEmpty() || theFormatName.IsEmpty()) return NULL;
204
205   //Add a new result object
206   Handle(GEOM_Object) result = GetEngine()->AddObject(GetDocID(), GEOM_IMPORT);
207
208   //Add an Import function
209   Handle(GEOM_Function) aFunction = result->AddFunction(GEOMImpl_ImportDriver::GetID(), IMPORT_SHAPE);
210   if (aFunction.IsNull()) return result;
211
212   //Check if the function is set correctly
213   if (aFunction->GetDriverGUID() != GEOMImpl_ImportDriver::GetID()) return result;
214
215   Handle(TCollection_HAsciiString) aHLibName;
216   if (!IsSupported(Standard_True, theFormatName.SubString(1,4), aHLibName)) {
217     return result;
218   }
219   TCollection_AsciiString aLibName = aHLibName->String();
220
221   //Set parameters
222   GEOMImpl_IImportExport aCI (aFunction);
223   aCI.SetFileName(theFileName);
224   aCI.SetFormatName(theFormatName);
225   aCI.SetPluginName(aLibName);
226   //cout<<"IIO: theFormatName = "<<theFormatName.ToCString()<<endl;
227
228   //Perform the Import
229   try {
230 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
231     OCC_CATCH_SIGNALS;
232 #endif
233     if (!GetSolver()->ComputeFunction(aFunction)) {
234       SetErrorCode("Import driver failed");
235       return NULL;
236     }
237   }
238   catch (Standard_Failure) {
239     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
240     SetErrorCode(aFail->GetMessageString());
241     return NULL;
242   }
243
244   //Make a Python command
245   if( theFormatName != "IGES_UNIT" ) {
246     GEOM::TPythonDump(aFunction) << result << " = geompy.ImportFile(\""
247       << theFileName.ToCString() << "\", \"" << theFormatName.ToCString() << "\")";
248   }
249
250   SetErrorCode(OK);
251
252   if( theFormatName == "IGES_UNIT" ) {
253     TopoDS_Shape S = aFunction->GetValue();
254     TopoDS_Vertex V = TopoDS::Vertex(S);
255     gp_Pnt P = BRep_Tool::Pnt(V);
256     double scale = P.X();
257     TCollection_AsciiString aUnitName = "UNIT_M";
258     if( fabs(scale-0.01) < 1.e-6 )
259       aUnitName = "UNIT_CM";
260     else if( fabs(scale-0.001) < 1.e-6 )
261       aUnitName = "UNIT_MM";
262     //cout<<"IIO: aUnitName = "<<aUnitName.ToCString()<<endl;
263     SetErrorCode(aUnitName);
264   }
265
266   return result;
267 }
268
269 //=============================================================================
270 /*!
271  *  ImportTranslators
272  */
273 //=============================================================================
274 Standard_Boolean GEOMImpl_IInsertOperations::ImportTranslators
275                      (Handle(TColStd_HSequenceOfAsciiString)& theFormats,
276                       Handle(TColStd_HSequenceOfAsciiString)& thePatterns)
277 {
278   if (theFormats.IsNull())
279     theFormats = new TColStd_HSequenceOfAsciiString;
280   else
281     theFormats->Clear();
282
283   if (thePatterns.IsNull())
284     thePatterns = new TColStd_HSequenceOfAsciiString;
285   else
286     thePatterns->Clear();
287
288   if (!InitResMgr()) return Standard_False;
289
290   // Read Import formats list from install directory
291   if (myResMgr->Find("Import")) {
292     TCollection_AsciiString aFormats (myResMgr->Value("Import"));
293     TCollection_AsciiString aToken = aFormats.Token("| \t", 1);
294     int i = 1;
295     for (; !aToken.IsEmpty(); aToken = aFormats.Token("| \t", ++i)) {
296       theFormats->Append(aToken);
297     }
298   }
299
300   // Read Import formats from user directory
301   if (myResMgrUser->Find("Import")) {
302     TCollection_AsciiString aFormats (myResMgrUser->Value("Import"));
303     TCollection_AsciiString aToken = aFormats.Token("| \t", 1);
304     int i = 1;
305     for (; !aToken.IsEmpty(); aToken = aFormats.Token("| \t", ++i)) {
306       int aLenFormats = theFormats->Length();
307       bool isFound = false;
308       for(int aInd=1;aInd<=aLenFormats;aInd++){
309         if( theFormats->Value(aInd) == aToken){
310           isFound = true;
311           break;
312         }
313       }
314       if(!isFound)
315         theFormats->Append(aToken);
316     }
317   }
318
319   // Read Patterns for each supported format
320   int j = 1, len = theFormats->Length();
321   for (; j <= len; j++) {
322     TCollection_AsciiString aKey, aPattern;
323     aKey = theFormats->Value(j) + ".ImportPattern";
324     if (myResMgr->Find(aKey.ToCString()))
325       aPattern = myResMgr->Value(aKey.ToCString());
326     else if(myResMgrUser->Find(aKey.ToCString()))
327       aPattern = myResMgrUser->Value(aKey.ToCString());
328     else {
329       aKey = theFormats->Value(j) + ".Pattern";
330       if (myResMgr->Find(aKey.ToCString()))
331         aPattern = myResMgr->Value(aKey.ToCString());
332       else if(myResMgrUser->Find(aKey.ToCString()))
333         aPattern = myResMgrUser->Value(aKey.ToCString());
334       else {
335         aPattern = theFormats->Value(j);
336         aPattern += " Files ( *.* )";
337       }
338     }
339     thePatterns->Append(aPattern);
340   }
341
342   return (!theFormats->IsEmpty());
343 }
344
345 //=============================================================================
346 /*!
347  *  ExportTranslators
348  */
349 //=============================================================================
350 Standard_Boolean GEOMImpl_IInsertOperations::ExportTranslators
351                      (Handle(TColStd_HSequenceOfAsciiString)& theFormats,
352                       Handle(TColStd_HSequenceOfAsciiString)& thePatterns)
353 {
354   if (theFormats.IsNull())
355     theFormats = new TColStd_HSequenceOfAsciiString;
356   else
357     theFormats->Clear();
358
359   if (thePatterns.IsNull())
360     thePatterns = new TColStd_HSequenceOfAsciiString;
361   else
362     thePatterns->Clear();
363
364   if (!InitResMgr()) return Standard_False;
365
366   // Read Export formats list from install directory
367   if (myResMgr->Find("Export")) {
368     TCollection_AsciiString aFormats (myResMgr->Value("Export"));
369     TCollection_AsciiString aToken = aFormats.Token("| \t", 1);
370     int i = 1;
371     for (; !aToken.IsEmpty(); aToken = aFormats.Token("| \t", ++i)) {
372       theFormats->Append(aToken);
373     }
374   }
375
376   // Read Export formats list from user directory
377   if (myResMgrUser->Find("Export")) {
378     TCollection_AsciiString aFormats (myResMgrUser->Value("Export"));
379     TCollection_AsciiString aToken = aFormats.Token("| \t", 1);
380     int i = 1;
381     for (; !aToken.IsEmpty(); aToken = aFormats.Token("| \t", ++i)) {
382       int aLenFormats = theFormats->Length();
383       bool isFound = false;
384       for(int aInd=1;aInd<=aLenFormats;aInd++){
385         if( theFormats->Value(aInd) == aToken){
386           isFound = true;
387           break;
388         }
389       }
390       if(!isFound)
391         theFormats->Append(aToken);
392     }
393   }
394
395   // Read Patterns for each supported format
396   int j = 1, len = theFormats->Length();
397   for (; j <= len; j++) {
398     TCollection_AsciiString aKey, aPattern;
399     aKey = theFormats->Value(j) + ".ExportPattern";
400     if (myResMgr->Find(aKey.ToCString()))
401       aPattern = myResMgr->Value(aKey.ToCString());
402     else if (myResMgrUser->Find(aKey.ToCString()))
403       aPattern = myResMgrUser->Value(aKey.ToCString());
404     else {
405       aKey = theFormats->Value(j) + ".Pattern";
406       if (myResMgr->Find(aKey.ToCString()))
407         aPattern = myResMgr->Value(aKey.ToCString());
408       else if (myResMgrUser->Find(aKey.ToCString()))
409         aPattern = myResMgrUser->Value(aKey.ToCString());
410       else {
411         aPattern = theFormats->Value(j);
412         aPattern += " Files ( *.* )";
413       }
414     }
415     thePatterns->Append(aPattern);
416   }
417
418   return (!theFormats->IsEmpty());
419 }
420
421 //=============================================================================
422 /*!
423  *  IsSupported
424  */
425 //=============================================================================
426 Standard_Boolean GEOMImpl_IInsertOperations::IsSupported
427                             (const Standard_Boolean isImport,
428                              const TCollection_AsciiString& theFormat,
429                              Handle(TCollection_HAsciiString)& theLibName)
430 {
431   if (!InitResMgr()) return Standard_False;
432
433   // Import/Export mode
434   TCollection_AsciiString aMode;
435   //Standard_CString aMode;
436   if (isImport) aMode = "Import";
437   else aMode = "Export";
438
439   // Read supported formats for the certain mode from install directory
440   if (myResMgr->Find(aMode.ToCString())) {
441     TCollection_AsciiString aFormats (myResMgr->Value(aMode.ToCString()));
442     if (aFormats.Search(theFormat) > -1) {
443       // Read library name for the supported format
444       TCollection_AsciiString aKey (theFormat);
445       aKey += ".";
446       aKey += aMode;
447       if (myResMgr->Find(aKey.ToCString())) {
448         TCollection_AsciiString aLibName (myResMgr->Value(aKey.ToCString()));        
449 #ifndef WNT
450         aLibName += ".so";     
451 #else
452         aLibName += ".dll";
453 #endif
454         theLibName = new TCollection_HAsciiString (aLibName);
455         return Standard_True;
456       }
457     }
458   }
459   
460   // Read supported formats for the certain mode from user directory
461   if (myResMgrUser->Find(aMode.ToCString())) {
462     TCollection_AsciiString aFormats (myResMgrUser->Value(aMode.ToCString()));
463     if (aFormats.Search(theFormat) > -1) {
464       // Read library name for the supported format
465       TCollection_AsciiString aKey (theFormat);
466       aKey += ".";
467       aKey += aMode;
468       if (myResMgrUser->Find(aKey.ToCString())) {
469         TCollection_AsciiString aLibName (myResMgrUser->Value(aKey.ToCString()));
470         theLibName = new TCollection_HAsciiString (aLibName);
471         return Standard_True;
472       }
473     }
474   }
475   
476   return Standard_False;
477 }
478
479 //=============================================================================
480 /*!
481  *  InitResMgr
482  */
483 //=============================================================================
484 Standard_Boolean GEOMImpl_IInsertOperations::InitResMgr()
485 {
486   bool isResourceFound     = false;
487   bool isResourceFoundUser = false;
488   TCollection_AsciiString aUserResDir,aResDir;
489   
490   if (myResMgr.IsNull()) {
491     // Initialize the Resource Manager
492     TCollection_AsciiString aNull;
493     aResDir = TCollection_AsciiString(getenv("GEOM_ROOT_DIR"));
494 #ifdef WNT
495     aResDir += "\\share\\salome\\resources\\geom";
496 #else
497     aResDir += "/share/salome/resources/geom";
498 #endif
499     
500     myResMgr = new Resource_Manager ("ImportExport", aResDir, aNull, Standard_False);
501
502     isResourceFound = true;
503     if (!myResMgr->Find("Import") && !myResMgr->Find("Export")) {
504       // instead of complains in Resource_Manager
505       isResourceFound = false;
506       INFOS("No valid file \"ImportExport\" found in " << aResDir.ToCString());
507     }
508   } else
509     isResourceFound = true;
510
511   if (myResMgrUser.IsNull()) {
512     char * dir = getenv("GEOM_ENGINE_RESOURCES_DIR");
513     TCollection_AsciiString aNull;
514     if ( dir )
515     {
516       aUserResDir = dir;
517     }
518     else
519     {
520       aUserResDir = getenv("HOME");
521 #ifdef WNT
522       aUserResDir += "\\.salome\\resources";
523 #else
524       aUserResDir += "/.salome/resources";
525 #endif
526     }
527
528     myResMgrUser = new Resource_Manager ("ImportExport", aNull, aUserResDir, Standard_False);
529
530     isResourceFoundUser = true;
531     
532     if (!myResMgrUser->Find("Import") && !myResMgrUser->Find("Export")) {
533       // instead of complains in Resource_Manager
534       isResourceFoundUser = false;
535     }
536       
537   } else
538     isResourceFoundUser = true;
539     
540   if(!isResourceFound && !isResourceFoundUser){
541     INFOS("No valid file \"ImportExport\" found in " << aResDir.ToCString());
542     INFOS("No valid file \"ImportExport\" found in " << aUserResDir.ToCString() );
543   }
544
545   return ( myResMgr->Find("Import") || myResMgr->Find("Export") ||
546            myResMgrUser->Find("Import") || myResMgrUser->Find("Export"));
547 }
548
549 int GEOMImpl_IInsertOperations::LoadTexture(const TCollection_AsciiString& theTextureFile)
550 {
551   SetErrorCode(KO);
552
553   if (theTextureFile.IsEmpty()) return 0;
554
555   Handle(TDataStd_HArray1OfByte) aTexture;
556
557   FILE* fp = fopen(theTextureFile.ToCString(), "r");
558   if (!fp) return 0;
559
560   std::list<std::string> lines;
561   char buffer[4096];
562   int maxlen = 0;
563   while (!feof(fp)) {
564     if ((fgets(buffer, 4096, fp)) == NULL) break;
565     int aLen = strlen(buffer);
566     if (buffer[aLen-1] == '\n') buffer[aLen-1] = '\0';
567     lines.push_back(buffer);
568     maxlen = std::max(maxlen, (int)strlen(buffer));
569   }
570
571   fclose(fp);
572
573   int lenbytes = maxlen/8;
574   if (maxlen%8) lenbytes++;
575
576   if (lenbytes == 0 || lines.empty())
577     return 0;
578
579   std::list<unsigned char> bytedata;
580   std::list<std::string>::const_iterator it;
581   for (it = lines.begin(); it != lines.end(); ++it) {
582     std::string line = *it;
583     int lenline = (line.size()/8 + (line.size()%8 ? 1 : 0)) * 8;
584     for (int i = 0; i < lenline/8; i++) {
585       unsigned char byte = 0;
586       for (int j = 0; j < 8; j++)
587         byte = (byte << 1) + ( i*8+j < line.size() && line[i*8+j] != '0' ? 1 : 0 );
588       bytedata.push_back(byte);
589     }
590     for (int i = lenline/8; i < lenbytes; i++)
591       bytedata.push_back((unsigned char)0);
592   }
593
594   if (bytedata.empty() || bytedata.size() != lines.size()*lenbytes)
595     return 0;
596
597   aTexture = new TDataStd_HArray1OfByte(1, lines.size()*lenbytes);
598   std::list<unsigned char>::iterator bdit;
599   int i;
600   for (i = 1, bdit = bytedata.begin(); bdit != bytedata.end(); ++bdit, ++i)
601     aTexture->SetValue(i, (Standard_Byte)(*bdit));
602
603   int aTextureId = GetEngine()->addTexture(GetDocID(), lenbytes*8, lines.size(), aTexture, theTextureFile);
604   if (aTextureId > 0) SetErrorCode(OK);
605   return aTextureId;
606 }
607   
608 int GEOMImpl_IInsertOperations::AddTexture(int theWidth, int theHeight, 
609                                            const Handle(TDataStd_HArray1OfByte)& theTexture)
610 {
611   SetErrorCode(KO);
612   int aTextureId = GetEngine()->addTexture(GetDocID(), theWidth, theHeight, theTexture);
613   if (aTextureId > 0) SetErrorCode(OK);
614   return aTextureId;
615 }
616
617 Handle(TDataStd_HArray1OfByte) GEOMImpl_IInsertOperations::GetTexture(int theTextureId,
618                                                                       int& theWidth, int& theHeight)
619 {
620   SetErrorCode(KO);
621   
622   Handle(TDataStd_HArray1OfByte) aTexture;
623   theWidth = theHeight = 0;
624   TCollection_AsciiString aFileName;
625
626   if (theTextureId <= 0)
627     return aTexture;
628
629   aTexture = GetEngine()->getTexture(GetDocID(), theTextureId, theWidth, theHeight, aFileName);
630
631   if (theWidth > 0 && theHeight > 0 && aTexture->Length() > 0) SetErrorCode(OK);
632
633   return aTexture;
634 }
635
636 std::list<int> GEOMImpl_IInsertOperations::GetAllTextures()
637 {
638   SetErrorCode(KO);
639   std::list<int> id_list = GetEngine()->getAllTextures(GetDocID());
640   SetErrorCode(OK);
641   return id_list;
642 }