00001 /* 00002 Copyright (C) 2005-2006 Feeling Software Inc. 00003 MIT License: http://www.opensource.org/licenses/mit-license.php 00004 */ 00010 #ifndef _FCD_GEOMETRY_SPLINE_H_ 00011 #define _FCD_GEOMETRY_SPLINE_H_ 00012 00013 #include "FCDocument/FCDObject.h" 00014 00015 class FCDocument; 00016 class FCDGeometry; 00017 00019 typedef vector<FMVector3> FCDCVs; 00021 typedef vector<double> FCDKnots; 00022 00038 class FCOLLADA_EXPORT FCDGeometrySpline : public FCDObject 00039 { 00040 private: 00041 DeclareObjectType; 00042 FCDGeometry* parent; 00043 FCDCVs cvs; 00044 FCDKnots knots; 00045 bool isClosed; 00046 00047 public: 00051 FCDGeometrySpline(FCDocument* document, FCDGeometry* parent); 00052 00054 virtual ~FCDGeometrySpline(); 00055 00058 FCDGeometry* GetParent() { return parent; } 00059 const FCDGeometry* GetParent() const { return parent; } 00063 inline FCDCVs& GetCVs() { return cvs; } 00064 inline const FCDCVs& GetCVs() const { return cvs; } 00068 inline size_t GetCVCount() const { return cvs.size(); } 00069 00074 inline FMVector3* GetCV(size_t index) { FUAssert(index < GetCVCount(), return NULL); return &(cvs.at(index)); } 00075 inline const FMVector3* GetCV(size_t index) const { FUAssert(index < GetCVCount(), return NULL); return &(cvs.at(index)); } 00079 inline FCDKnots& GetKnots() { return knots; } 00080 inline const FCDKnots& GetKnots() const { return knots; } 00084 inline size_t GetKnotCount() const { return knots.size(); } 00085 00089 inline double GetKnot(size_t index) const { FUAssert(index < GetKnotCount(), return 0.0); return knots.at(index); } 00090 00093 inline bool IsClosed() const { return isClosed; } 00094 00097 inline bool IsOpen() const { return !isClosed; } 00098 00101 inline void SetCVs(const FCDCVs& _cvs) { cvs = _cvs; } 00102 00105 inline void SetKnots(const FCDKnots& _knots) { knots = _knots; } 00106 00109 inline void SetClosed(bool _isClosed) { isClosed = _isClosed; } 00110 00115 FUStatus LoadFromXML(xmlNode* splineNode); 00116 00120 xmlNode* WriteToXML(xmlNode* parentNode) const; 00121 }; 00122 00123 #endif // _FCD_GEOMETRY_SPLINE_H_