1 // Created on: 1998-06-10
2 // Created by: data exchange team
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <ShapeExtend.hxx>
19 #include <Message_MsgFile.hxx>
20 #include <Standard_ProgramError.hxx>
21 #include <TCollection_AsciiString.hxx>
23 #include "../SHMessage/SHMessage_SHAPE_us.pxx"
25 //=======================================================================
28 //=======================================================================
29 void ShapeExtend::Init()
31 static Standard_Boolean init = Standard_False;
36 // load Message File for Shape Healing
37 if (!Message_MsgFile::HasMsg ("ShapeFix.FixSmallSolid.MSG0"))
39 if (!Message_MsgFile::LoadFromEnv ("CSF_SHMessage", "SHAPE"))
41 Message_MsgFile::LoadFromString (SHMessage_SHAPE_us, sizeof(SHMessage_SHAPE_us) - 1);
43 if (!Message_MsgFile::HasMsg ("ShapeFix.FixSmallSolid.MSG0"))
45 throw Standard_ProgramError("Critical Error - message resources for ShapeExtend are invalid or undefined!");
50 //=======================================================================
51 //function : EncodeStatus
53 //=======================================================================
55 Standard_Integer ShapeExtend::EncodeStatus (const ShapeExtend_Status status)
58 case ShapeExtend_OK : return 0x0000;
59 case ShapeExtend_DONE1: return 0x0001;
60 case ShapeExtend_DONE2: return 0x0002;
61 case ShapeExtend_DONE3: return 0x0004;
62 case ShapeExtend_DONE4: return 0x0008;
63 case ShapeExtend_DONE5: return 0x0010;
64 case ShapeExtend_DONE6: return 0x0020;
65 case ShapeExtend_DONE7: return 0x0040;
66 case ShapeExtend_DONE8: return 0x0080;
67 case ShapeExtend_DONE : return 0x00ff;
68 case ShapeExtend_FAIL1: return 0x0100;
69 case ShapeExtend_FAIL2: return 0x0200;
70 case ShapeExtend_FAIL3: return 0x0400;
71 case ShapeExtend_FAIL4: return 0x0800;
72 case ShapeExtend_FAIL5: return 0x1000;
73 case ShapeExtend_FAIL6: return 0x2000;
74 case ShapeExtend_FAIL7: return 0x4000;
75 case ShapeExtend_FAIL8: return 0x8000;
76 case ShapeExtend_FAIL : return 0xff00;
81 //=======================================================================
82 //function : DecodeStatus
84 //=======================================================================
86 Standard_Boolean ShapeExtend::DecodeStatus (const Standard_Integer flag,
87 const ShapeExtend_Status status)
89 if ( status == ShapeExtend_OK ) return ( flag == 0 );
90 return ( flag & ShapeExtend::EncodeStatus ( status ) ? Standard_True : Standard_False );