diff --git a/utils/idftools/CMakeLists.txt b/utils/idftools/CMakeLists.txt index 8066188d7b..4334403bfe 100644 --- a/utils/idftools/CMakeLists.txt +++ b/utils/idftools/CMakeLists.txt @@ -2,6 +2,7 @@ include_directories( "${CMAKE_SOURCE_DIR}/lib_dxf" "${CMAKE_SOURCE_DIR}/utils/idftools" ${OPENGL_INCLUDE_DIR} + ${Boost_INCLUDE_DIR} ) link_directories( @@ -17,6 +18,8 @@ add_executable( idfrect idf_rect.cpp ) add_executable( dxf2idf dxf2idfmain.cpp dxf2idf.cpp ) add_executable( idf2vrml idf2vrml.cpp ) +add_dependencies( idf2vrml boost ) + target_link_libraries( dxf2idf lib_dxf idf3 ${wxWidgets_LIBRARIES} ) target_link_libraries( idf2vrml idf3 ${OPENGL_LIBRARIES} ${wxWidgets_LIBRARIES} ) diff --git a/utils/idftools/idf2vrml.cpp b/utils/idftools/idf2vrml.cpp index b15f68437d..8eb2536f11 100644 --- a/utils/idftools/idf2vrml.cpp +++ b/utils/idftools/idf2vrml.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include #include @@ -63,6 +64,7 @@ extern char* optarg; extern int optopt; using namespace std; +using namespace boost; #define CLEANUP do { \ setlocale( LC_ALL, "C" ); \ @@ -122,7 +124,7 @@ bool WriteTriangles( std::ofstream& file, VRML_IDS* vID, VRML_LAYER* layer, bool bool top, double top_z, double bottom_z, int precision, bool compact ); inline void TransformPoint( IDF_SEGMENT& seg, double frac, bool bottom, double dX, double dY, double angle ); -VRML_IDS* GetColor( std::map& cmap, +VRML_IDS* GetColor( boost::ptr_map& cmap, int& index, const std::string& uid ); @@ -743,7 +745,7 @@ bool MakeComponents( IDF3_BOARD& board, std::ofstream& file, bool compact ) bool bottom; IDF3::IDF_LAYER lyr; - std::map< std::string, VRML_IDS*> cmap; // map colors by outline UID + boost::ptr_map< const std::string, VRML_IDS> cmap; // map colors by outline UID VRML_IDS* vcp; IDF3_COMP_OUTLINE* pout; @@ -861,14 +863,14 @@ bool MakeComponents( IDF3_BOARD& board, std::ofstream& file, bool compact ) } -VRML_IDS* GetColor( std::map& cmap, int& index, const std::string& uid ) +VRML_IDS* GetColor( boost::ptr_map& cmap, int& index, const std::string& uid ) { static int refnum = 0; if( index < 2 ) index = 2; // 0 and 1 are special (BOARD, UID=NOGEOM_NOPART) - std::map::iterator cit = cmap.find( uid ); + boost::ptr_map::iterator cit = cmap.find( uid ); if( cit == cmap.end() ) { @@ -886,7 +888,7 @@ VRML_IDS* GetColor( std::map& cmap, int& index, const st if( showObjectMapping ) cout << "* " << ostr.str() << " = '" << uid << "'\n"; - cmap.insert( std::pair(uid, id) ); + cmap.insert( uid, id ); if( index >= NCOLORS ) index = 2; @@ -922,7 +924,7 @@ bool MakeOtherOutlines( IDF3_BOARD& board, std::ofstream& file ) bool bottom; int nvcont; - std::map< std::string, VRML_IDS*> cmap; // map colors by outline UID + boost::ptr_map< const std::string, VRML_IDS> cmap; // map colors by outline UID VRML_IDS* vcp; OTHER_OUTLINE* pout;