00001 // Filename: eggCurve.cxx 00002 // Created by: drose (15Feb00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include "eggCurve.h" 00020 00021 #include <string_utils.h> 00022 #include <notify.h> 00023 00024 TypeHandle EggCurve::_type_handle; 00025 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Function: EggCurve::string_curve_type 00029 // Access: Public, Static 00030 // Description: Returns the CurveType value associated with the given 00031 // string representation, or CT_invalid if the string 00032 // does not match any known CurveType value. 00033 //////////////////////////////////////////////////////////////////// 00034 EggCurve::CurveType EggCurve:: 00035 string_curve_type(const string &string) { 00036 if (cmp_nocase_uh(string, "xyz") == 0) { 00037 return CT_xyz; 00038 } else if (cmp_nocase_uh(string, "hpr") == 0) { 00039 return CT_hpr; 00040 } else if (cmp_nocase_uh(string, "t") == 0) { 00041 return CT_t; 00042 } else { 00043 return CT_none; 00044 } 00045 } 00046 00047 //////////////////////////////////////////////////////////////////// 00048 // Function: CurveType output operator 00049 // Description: 00050 //////////////////////////////////////////////////////////////////// 00051 ostream &operator << (ostream &out, EggCurve::CurveType t) { 00052 switch (t) { 00053 case EggCurve::CT_none: 00054 return out << "none"; 00055 case EggCurve::CT_xyz: 00056 return out << "XYZ"; 00057 case EggCurve::CT_hpr: 00058 return out << "HPR"; 00059 case EggCurve::CT_t: 00060 return out << "T"; 00061 } 00062 00063 nassertr(false, out); 00064 return out << "(**invalid**)"; 00065 } 00066