0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / GccEnt / GccEnt.cxx
CommitLineData
b311480e 1// Copyright (c) 1995-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
7fd59977 14
15//=========================================================================
0d969553 16// Methods of packing allowing to qualify objects. +
7fd59977 17// +
18//=========================================================================
19
42cf5bc1 20#include <GccEnt.hxx>
21#include <GccEnt_QualifiedCirc.hxx>
22#include <GccEnt_QualifiedLin.hxx>
23#include <gp_Circ2d.hxx>
24#include <gp_Lin2d.hxx>
9294c8f7 25#include <TCollection_AsciiString.hxx>
26
27namespace
28{
29 static Standard_CString GccEnt_Table_PrintPosition[5] =
30 {
31 "UNQUALIFIED", "ENCLOSING", "ENCLOSED", "OUTSIDE", "NOQUALIFIER"
32 };
33}
34
35//=======================================================================
36//function : PositionToString
37//purpose :
38//=======================================================================
39Standard_CString GccEnt::PositionToString (GccEnt_Position thePosition)
40{
41 return GccEnt_Table_PrintPosition[thePosition];
42}
43
44//=======================================================================
45//function : PositionFromString
46//purpose :
47//=======================================================================
48Standard_Boolean GccEnt::PositionFromString (Standard_CString thePositionString,
49 GccEnt_Position& thePosition)
50{
51 TCollection_AsciiString aName (thePositionString);
52 aName.UpperCase();
53 for (Standard_Integer aTypeIter = 0; aTypeIter <= GccEnt_noqualifier; ++aTypeIter)
54 {
55 Standard_CString aTypeName = GccEnt_Table_PrintPosition[aTypeIter];
56 if (aName == aTypeName)
57 {
58 thePosition = GccEnt_Position(aTypeIter);
59 return Standard_True;
60 }
61 }
62 return Standard_False;
63}
7fd59977 64
65GccEnt_QualifiedLin
66 GccEnt::Unqualified(const gp_Lin2d& Line) {
67 return GccEnt_QualifiedLin(Line,GccEnt_unqualified);
68 }
69
70GccEnt_QualifiedCirc
71 GccEnt::Unqualified(const gp_Circ2d& Circle) {
72 return GccEnt_QualifiedCirc(Circle,GccEnt_unqualified);
73 }
74
75GccEnt_QualifiedCirc
76 GccEnt::Enclosing(const gp_Circ2d& Circle) {
77 return GccEnt_QualifiedCirc(Circle,GccEnt_enclosing);
78 }
79
80GccEnt_QualifiedLin
81 GccEnt::Enclosed(const gp_Lin2d& Line) {
82 return GccEnt_QualifiedLin(Line,GccEnt_enclosed);
83 }
84
85GccEnt_QualifiedCirc
86 GccEnt::Enclosed(const gp_Circ2d& Circle) {
87 return GccEnt_QualifiedCirc(Circle,GccEnt_enclosed);
88 }
89
90GccEnt_QualifiedCirc
91 GccEnt::Outside(const gp_Circ2d& Circle) {
92 return GccEnt_QualifiedCirc(Circle,GccEnt_outside);
93 }
94
95GccEnt_QualifiedLin
96 GccEnt::Outside(const gp_Lin2d& Line) {
97 return GccEnt_QualifiedLin(Line,GccEnt_outside);
98 }