00001
00002
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00022
00029 #include <exotkUtils_Geom.hxx>
00030 #ifndef _Geom_Surface_HeaderFile
00031 #include <Geom_Surface.hxx>
00032 #endif
00033 #ifndef _Geom_Curve_HeaderFile
00034 #include <Geom_Curve.hxx>
00035 #endif
00036 #ifndef _TCollection_AsciiString_HeaderFile
00037 #include <TCollection_AsciiString.hxx>
00038 #endif
00039 #ifndef _Geom_RectangularTrimmedSurface_HeaderFile
00040 #include <Geom_RectangularTrimmedSurface.hxx>
00041 #endif
00042 #ifndef _GeomAbs_SurfaceType_HeaderFile
00043 #include <GeomAbs_SurfaceType.hxx>
00044 #endif
00045 #ifndef _GeomAbs_CurveType_HeaderFile
00046 #include <GeomAbs_CurveType.hxx>
00047 #endif
00048 #ifndef _GeomAdaptor_Surface_HeaderFile
00049 #include <GeomAdaptor_Surface.hxx>
00050 #endif
00051 #ifndef _GeomAdaptor_Curve_HeaderFile
00052 #include <GeomAdaptor_Curve.hxx>
00053 #endif
00054 #ifndef _Geom_TrimmedCurve_HeaderFile
00055 #include <Geom_TrimmedCurve.hxx>
00056 #endif
00057
00058 TCollection_AsciiString exotkUtils_Geom::NameFromSurfaceType(const Handle_Geom_Surface& aSurface)
00059 {
00060 TCollection_AsciiString theName;
00061 if (!aSurface.IsNull())
00062 {
00063 if (aSurface->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface)))
00064 {
00065 Handle_Geom_RectangularTrimmedSurface theSurface = Handle_Geom_RectangularTrimmedSurface::DownCast(aSurface);
00066 Handle_Geom_Surface theBasisSurface = theSurface->BasisSurface();
00067 theName = NameFromSurfaceType(theBasisSurface);
00068 }
00069 else
00070 {
00071 GeomAbs_SurfaceType theType = GeomAdaptor_Surface(aSurface).GetType();
00072 theName = NameFromSurfaceType(theType);
00073 }
00074 }
00075 return theName;
00076 }
00077 TCollection_AsciiString exotkUtils_Geom::NameFromCurveType(const Handle_Geom_Curve& aCurve)
00078 {
00079 TCollection_AsciiString theName;
00080 if (!aCurve.IsNull())
00081 {
00082 if (aCurve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve)))
00083 {
00084 Handle_Geom_TrimmedCurve theCurve = Handle_Geom_TrimmedCurve::DownCast(aCurve);
00085 Handle_Geom_Curve theBasisCurve = theCurve->BasisCurve();
00086 theName = NameFromCurveType(theBasisCurve);
00087 }
00088 else
00089 {
00090 GeomAbs_CurveType theType = GeomAdaptor_Curve(aCurve).GetType();
00091 theName = NameFromCurveType(theType);
00092 }
00093 }
00094 return theName;
00095 }
00096 TCollection_AsciiString exotkUtils_Geom::NameFromSurfaceType(const enum GeomAbs_SurfaceType aSurfaceType)
00097 {
00098 TCollection_AsciiString theName;
00099 switch ( aSurfaceType )
00100 {
00101 case GeomAbs_Plane:
00102 theName = TCollection_AsciiString("Planar");
00103 break;
00104 case GeomAbs_Cylinder:
00105 theName = TCollection_AsciiString("Cylindrical");
00106 break;
00107 case GeomAbs_Cone:
00108 theName = TCollection_AsciiString("Conical");
00109 break;
00110 case GeomAbs_Sphere:
00111 theName = TCollection_AsciiString("Spherical");
00112 break;
00113 case GeomAbs_Torus:
00114 theName = TCollection_AsciiString("Toroidal");
00115 break;
00116 case GeomAbs_BezierSurface:
00117 theName = TCollection_AsciiString("Bezier");
00118 break;
00119 case GeomAbs_BSplineSurface:
00120 theName = TCollection_AsciiString("BSpline");
00121 break;
00122 case GeomAbs_SurfaceOfRevolution:
00123 theName = TCollection_AsciiString("Revolution");
00124 break;
00125 case GeomAbs_SurfaceOfExtrusion:
00126 theName = TCollection_AsciiString("Extrusion");
00127 break;
00128 case GeomAbs_OffsetSurface:
00129 theName = TCollection_AsciiString("Offset");
00130 break;
00131 default:
00132 theName = TCollection_AsciiString("Unknown");
00133 break;
00134 }
00135 return theName;
00136 }
00137 TCollection_AsciiString exotkUtils_Geom::NameFromCurveType(const enum GeomAbs_CurveType aCurveType)
00138 {
00139 TCollection_AsciiString theName;
00140 switch ( aCurveType )
00141 {
00142 case GeomAbs_Line:
00143 theName = TCollection_AsciiString("Linear");
00144 break;
00145 case GeomAbs_Circle:
00146 theName = TCollection_AsciiString("Circular");
00147 break;
00148 case GeomAbs_Ellipse:
00149 theName = TCollection_AsciiString("Elliptic");
00150 break;
00151 case GeomAbs_Hyperbola:
00152 theName = TCollection_AsciiString("Hyperbolic");
00153 break;
00154 case GeomAbs_Parabola:
00155 theName = TCollection_AsciiString("Parabolic");
00156 break;
00157 case GeomAbs_BezierCurve:
00158 theName = TCollection_AsciiString("Bezier");
00159 break;
00160 case GeomAbs_BSplineCurve:
00161 theName = TCollection_AsciiString("BSpline");
00162 break;
00163 default:
00164 theName = TCollection_AsciiString("Unknown");
00165 break;
00166 }
00167 return theName;
00168 }