00001
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #pragma once
00022 #ifndef VOLUMILL_TOOLPATHRECORDS_H
00023 #define VOLUMILL_TOOLPATHRECORDS_H
00024
00025 #include <vector>
00026 #include <boost/variant.hpp>
00027 #include <Geom/Points.h>
00028
00029 namespace exchange
00030 {
00031 struct RapidMove
00032 {
00033 RapidMove () {}
00034 RapidMove (const geom::Point3d& endPt) : m_endPt (endPt) {}
00035 template<class Archive>
00036 void serialize(Archive & ar, const unsigned int )
00037 {
00038 ar & boost::serialization::make_nvp ("endPt", m_endPt);
00039 }
00040 geom::Point3d m_endPt;
00041 };
00042
00043 struct LinearMove
00044 {
00045 LinearMove() {}
00046 LinearMove (const geom::Point3d& endPt) : m_endPt (endPt) {}
00047 template<class Archive>
00048 void serialize(Archive & ar, const unsigned int )
00049 {
00050 ar & boost::serialization::make_nvp ("endPt", m_endPt);
00051 }
00052 geom::Point3d m_endPt;
00053 };
00054
00056 template<bool CW>
00057 struct Arc
00058 {
00059 Arc() : m_radius (0) {}
00060 Arc (const geom::Point3d& endPt, double radius) : m_endPt (endPt), m_radius (radius) {}
00061 template<class Archive>
00062 void serialize(Archive & ar, const unsigned int )
00063 {
00064 ar & boost::serialization::make_nvp ("endPt", m_endPt);
00065 ar & boost::serialization::make_nvp ("radius", m_radius);
00066 }
00067 geom::Point3d m_endPt;
00068 double m_radius;
00069 };
00070
00071 typedef Arc<true> ArcCW;
00072 typedef Arc<false> ArcCCW;
00073
00074 struct FeedRate
00075 {
00076 FeedRate (double feedrate = 0.0) : m_feedrate (feedrate) {}
00077 template<class Archive>
00078 void serialize(Archive & ar, const unsigned int )
00079 {
00080 ar & boost::serialization::make_nvp ("feedrate", m_feedrate);
00081 }
00082 double m_feedrate;
00083 };
00084
00085 struct Warning
00086 {
00087 Warning (int warningId = -1) : m_warningId (warningId) {}
00088 template<class Archive>
00089 void serialize(Archive & ar, const unsigned int )
00090 {
00091 ar & boost::serialization::make_nvp ("warningId", m_warningId);
00092 }
00093 int m_warningId;
00094 };
00095
00096 struct CustomRecord
00097 {
00098 CustomRecord() {}
00099 CustomRecord (const std::string& str) : m_string (str) {}
00100 template<class Archive>
00101 void serialize(Archive & ar, const unsigned int )
00102 {
00103 ar & boost::serialization::make_nvp ("string", m_string);
00104 }
00105 std::string m_string;
00106 };
00107
00108 typedef boost::variant<
00109 RapidMove,
00110 LinearMove,
00111 ArcCW,
00112 ArcCCW,
00113 FeedRate,
00114 Warning,
00115 CustomRecord> ToolpathRecord;
00116
00117 struct ToolpathRecords : public std::vector<ToolpathRecord>
00118 {
00119 template<class Archive>
00120 void serialize(Archive & ar, const unsigned int )
00121 {
00122 typedef std::vector<ToolpathRecord> Records;
00123 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Records);
00124 }
00125 };
00126
00127 void fromToolpathRecordsToXml (std::ostream& os, const ToolpathRecords& records);
00128 void fromXmlToToolpathRecords (std::istream& is, ToolpathRecords* pRecords);
00129 void fromToolpathRecordsToBinary (std::ostream& os, const ToolpathRecords& records);
00130 void fromBinaryToToolpathRecords (std::istream& is, ToolpathRecords* pRecords);
00131 }
00132
00133 #endif