diff --git a/Applications/ApplicationsLib/ProjectData.cpp b/Applications/ApplicationsLib/ProjectData.cpp index f786a1347126919e2786d464675832215c0452a0..03c1e746cbfdc15a8996beb97fa7f7dbaff9c3bb 100644 --- a/Applications/ApplicationsLib/ProjectData.cpp +++ b/Applications/ApplicationsLib/ProjectData.cpp @@ -27,7 +27,7 @@ #include "NumLib/ODESolver/TimeDiscretizationBuilder.h" // FileIO -#include "FileIO/XmlIO/Boost/BoostXmlGmlInterface.h" +#include "GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.h" #include "FileIO/readMeshFromFile.h" #include "BaseLib/ConfigTree.h" @@ -43,7 +43,7 @@ static void readGeometry(std::string const& fname, GeoLib::GEOObjects & geo_objects) { DBUG("Reading geometry file \'%s\'.", fname.c_str()); - FileIO::BoostXmlGmlInterface gml_reader(geo_objects); + GeoLib::IO::BoostXmlGmlInterface gml_reader(geo_objects); gml_reader.readFile(fname); } } diff --git a/Applications/DataExplorer/VtkVis/VtkAlgorithmProperties.cpp b/Applications/DataExplorer/VtkVis/VtkAlgorithmProperties.cpp index 832aa19a2eb4ff2908f5befb2f25268dbab6a3fa..c7da7a18fa88b5ef1e89340c81a3f8e15224fc5f 100644 --- a/Applications/DataExplorer/VtkVis/VtkAlgorithmProperties.cpp +++ b/Applications/DataExplorer/VtkVis/VtkAlgorithmProperties.cpp @@ -22,7 +22,7 @@ #include <vtkTexture.h> #include "VtkColorLookupTable.h" -#include "XmlIO/Qt/XmlLutReader.h" +#include "FileIO/XmlIO/Qt/XmlLutReader.h" VtkAlgorithmProperties::VtkAlgorithmProperties(QObject* parent /*= nullptr*/) : QObject(parent) diff --git a/Applications/DataExplorer/VtkVis/VtkCompositeColormapToImageFilter.cpp b/Applications/DataExplorer/VtkVis/VtkCompositeColormapToImageFilter.cpp index 94da373c4815f7b0da4626e1a37d5b46b3d829d2..0fcf34a3ba0ca243ea7a7c6d62b99b520caf2f04 100644 --- a/Applications/DataExplorer/VtkVis/VtkCompositeColormapToImageFilter.cpp +++ b/Applications/DataExplorer/VtkVis/VtkCompositeColormapToImageFilter.cpp @@ -25,7 +25,7 @@ #include <QFileDialog> #include "VtkColorLookupTable.h" -#include "XmlIO/Qt/XmlLutReader.h" +#include "FileIO/XmlIO/Qt/XmlLutReader.h" VtkCompositeColormapToImageFilter::VtkCompositeColormapToImageFilter( vtkAlgorithm* inputAlgorithm ) : VtkCompositeFilter(inputAlgorithm) diff --git a/Applications/DataExplorer/mainwindow.cpp b/Applications/DataExplorer/mainwindow.cpp index d3ddff7881b2042229108968dc5727e2a09d188a..ed176d126a436a7a0724e408e33a5a135f6e40f9 100644 --- a/Applications/DataExplorer/mainwindow.cpp +++ b/Applications/DataExplorer/mainwindow.cpp @@ -63,13 +63,13 @@ #include "FileIO/FEFLOWInterface.h" #include "FileIO/GMSInterface.h" #include "FileIO/Legacy/MeshIO.h" +#include "FileIO/readMeshFromFile.h" #include "FileIO/GMSHInterface.h" #include "FileIO/TetGenInterface.h" #include "FileIO/PetrelInterface.h" -#include "FileIO/XmlIO/Qt/XmlGmlInterface.h" #include "FileIO/XmlIO/Qt/XmlGspInterface.h" -#include "FileIO/XmlIO/Qt/XmlStnInterface.h" -#include "FileIO/readMeshFromFile.h" +#include "GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h" +#include "GeoLib/IO/XmlIO/Qt/XmlStnInterface.h" // MeshLib #include "Node.h" @@ -480,14 +480,14 @@ void MainWindow::loadFile(ImportFileType::type t, const QString &fileName) } else if (fi.suffix().toLower() == "gml") { - XmlGmlInterface xml(_project.getGEOObjects()); + GeoLib::IO::XmlGmlInterface xml(_project.getGEOObjects()); if (!xml.readFile(fileName)) OGSError::box("Failed to load geometry.\n Please see console for details."); } // OpenGeoSys observation station files (incl. boreholes) else if (fi.suffix().toLower() == "stn") { - XmlStnInterface xml(_project.getGEOObjects()); + GeoLib::IO::XmlStnInterface xml(_project.getGEOObjects()); if (!xml.readFile(fileName)) OGSError::box("Failed to load station data.\n Please see console for details."); @@ -787,14 +787,14 @@ void MainWindow::writeGeometryToFile(QString gliName, QString fileName) return; } #endif - XmlGmlInterface xml(_project.getGEOObjects()); + GeoLib::IO::XmlGmlInterface xml(_project.getGEOObjects()); xml.setNameForExport(gliName.toStdString()); xml.writeToFile(fileName.toStdString()); } void MainWindow::writeStationListToFile(QString listName, QString fileName) { - XmlStnInterface xml(_project.getGEOObjects()); + GeoLib::IO::XmlStnInterface xml(_project.getGEOObjects()); xml.setNameForExport(listName.toStdString()); xml.writeToFile(fileName.toStdString()); } diff --git a/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp b/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp index 1daacdf9a3a527e8ba3a5cd51ad260c7b83f0b63..c48647d7340b934cb86a25ea7f1980a268237072 100644 --- a/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp +++ b/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp @@ -29,9 +29,8 @@ // BaseLib #include "LogogSimpleFormatter.h" -// FileIO -#include "XmlIO/Qt/XmlGmlInterface.h" -#include "XmlIO/Qt/XmlStnInterface.h" +#include "GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h" +#include "GeoLib/IO/XmlIO/Qt/XmlStnInterface.h" // GeoLib #include "GEOObjects.h" @@ -88,11 +87,11 @@ void convertPoints (DBFHandle dbf_handle, geo_objs.addPointVec(std::move(points), points_group_name); if (station) { - FileIO::XmlStnInterface xml (geo_objs); + GeoLib::IO::XmlStnInterface xml (geo_objs); xml.setNameForExport(points_group_name); xml.writeToFile(out_fname); } else { - FileIO::XmlGmlInterface xml (geo_objs); + GeoLib::IO::XmlGmlInterface xml (geo_objs); xml.setNameForExport(points_group_name); xml.writeToFile(out_fname); } diff --git a/Applications/Utils/GeoTools/MoveGeometry.cpp b/Applications/Utils/GeoTools/MoveGeometry.cpp index 8eb08452b88de996045ca4540c3367942fa53a38..af34d35dffa914b859bb0afbcb02e3b8934b2d87 100644 --- a/Applications/Utils/GeoTools/MoveGeometry.cpp +++ b/Applications/Utils/GeoTools/MoveGeometry.cpp @@ -19,7 +19,7 @@ #include "BaseLib/LogogSimpleFormatter.h" #include "MathLib/Vector3.h" -#include "FileIO/XmlIO/Qt/XmlGmlInterface.h" +#include "GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h" #include "GeoLib/GEOObjects.h" #include <QCoreApplication> @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) cmd.parse( argc, argv ); GeoLib::GEOObjects geo_objects; - FileIO::XmlGmlInterface xml(geo_objects); + GeoLib::IO::XmlGmlInterface xml(geo_objects); if (!xml.readFile(geo_input_arg.getValue())) { delete logogCout; diff --git a/Applications/Utils/GeoTools/TriangulatePolyline.cpp b/Applications/Utils/GeoTools/TriangulatePolyline.cpp index 61be7b5261345fc3a599371b891c32c99db5cb5f..c8249e712b288504cd9e7793b112af040a3e83e3 100644 --- a/Applications/Utils/GeoTools/TriangulatePolyline.cpp +++ b/Applications/Utils/GeoTools/TriangulatePolyline.cpp @@ -18,7 +18,7 @@ #include "BaseLib/BuildInfo.h" #include "BaseLib/LogogSimpleFormatter.h" -#include "FileIO/XmlIO/Qt/XmlGmlInterface.h" +#include "GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h" #include "GeoLib/AnalyticalGeometry.h" #include "GeoLib/GEOObjects.h" #include "GeoLib/Polyline.h" @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) std::string const& polyline_name(name_arg.getValue()); GeoLib::GEOObjects geo_objects; - FileIO::XmlGmlInterface xml(geo_objects); + GeoLib::IO::XmlGmlInterface xml(geo_objects); if (!xml.readFile(file_name)) { ERR ("Failed to load geometry file."); diff --git a/Applications/Utils/MeshEdit/MapGeometryToMeshSurface.cpp b/Applications/Utils/MeshEdit/MapGeometryToMeshSurface.cpp index 345402610d2233c906bc626f3cf7c3e8a1511515..d0e6a88a6644c525ddea6911ac32237586b7c03b 100644 --- a/Applications/Utils/MeshEdit/MapGeometryToMeshSurface.cpp +++ b/Applications/Utils/MeshEdit/MapGeometryToMeshSurface.cpp @@ -24,7 +24,7 @@ // FileIO #include "FileIO/readMeshFromFile.h" -#include "FileIO/XmlIO/Boost/BoostXmlGmlInterface.h" +#include "GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.h" // GeoLib #include "GeoLib/GEOObjects.h" @@ -71,7 +71,7 @@ int main (int argc, char* argv[]) // *** read geometry GeoLib::GEOObjects geometries; { - FileIO::BoostXmlGmlInterface xml_io(geometries); + GeoLib::IO::BoostXmlGmlInterface xml_io(geometries); if (xml_io.readFile(input_geometry_fname.getValue())) { INFO("Read geometry from file \"%s\".", input_geometry_fname.getValue().c_str()); @@ -98,7 +98,7 @@ int main (int argc, char* argv[]) } { - FileIO::BoostXmlGmlInterface xml_io(geometries); + GeoLib::IO::BoostXmlGmlInterface xml_io(geometries); xml_io.setNameForExport(new_geo_name); xml_io.writeToFile(output_geometry_fname.getValue()); } diff --git a/Applications/Utils/MeshEdit/appendLinesAlongPolyline.cpp b/Applications/Utils/MeshEdit/appendLinesAlongPolyline.cpp index 67d3b000c54a4b52f54c12b1da79d32550b94c9f..4fb4c529d2b193fc076a501dac06486aed4c2e22 100644 --- a/Applications/Utils/MeshEdit/appendLinesAlongPolyline.cpp +++ b/Applications/Utils/MeshEdit/appendLinesAlongPolyline.cpp @@ -23,7 +23,7 @@ // FileIO #include "Legacy/MeshIO.h" #include "readMeshFromFile.h" -#include "XmlIO/Boost/BoostXmlGmlInterface.h" +#include "GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.h" // MeshLib #include "Mesh.h" @@ -57,7 +57,7 @@ int main (int argc, char* argv[]) // read GEO objects GeoLib::GEOObjects geo_objs; - FileIO::BoostXmlGmlInterface xml(geo_objs); + GeoLib::IO::BoostXmlGmlInterface xml(geo_objs); xml.readFile(geoFileArg.getValue()); std::vector<std::string> geo_names; diff --git a/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp b/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp index e03d5b8660f0f16438410a6bd76b7878361c8832..9708c1c265bdcef3bb540e5414f9f48d9ed704d5 100644 --- a/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp +++ b/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp @@ -28,7 +28,7 @@ // geometry #include "GEOObjects.h" #include "GeoLib/IO/Legacy/OGSIOVer4.h" -#include "XmlIO/Qt/XmlGmlInterface.h" +#include "GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h" // mesh #include "Legacy/MeshIO.h" @@ -50,7 +50,7 @@ void OGSFileConverter::convertGML2GLI(const QStringList &input, const QString &o return; GeoLib::GEOObjects geo_objects; - FileIO::XmlGmlInterface xml(geo_objects); + GeoLib::IO::XmlGmlInterface xml(geo_objects); for (QStringList::const_iterator it=input.begin(); it!=input.end(); ++it) { @@ -81,7 +81,7 @@ void OGSFileConverter::convertGLI2GML(const QStringList &input, const QString &o return; GeoLib::GEOObjects geo_objects; - FileIO::XmlGmlInterface xml(geo_objects); + GeoLib::IO::XmlGmlInterface xml(geo_objects); for (QStringList::const_iterator it=input.begin(); it!=input.end(); ++it) { diff --git a/BaseLib/CMakeLists.txt b/BaseLib/CMakeLists.txt index 0db5a1ac0b827e1acc8571e8f64c29132697df13..cea7b04c4e0cbfb5b8974e109657221130af26a2 100644 --- a/BaseLib/CMakeLists.txt +++ b/BaseLib/CMakeLists.txt @@ -3,6 +3,14 @@ GET_SOURCE_FILES(SOURCES_IO IO) set(SOURCES ${SOURCES} ${SOURCES_IO}) +GET_SOURCE_FILES(SOURCES_IO_BASE_XML IO/XmlIO) +set(SOURCES ${SOURCES} ${SOURCES_IO_BASE_XML}) + +if(QT4_FOUND) + GET_SOURCE_FILES(SOURCES_IO_QT_XML IO/XmlIO/Qt) + set(SOURCES ${SOURCES} ${SOURCES_IO_QT_XML}) +endif() + list(APPEND SOURCES "${CMAKE_CURRENT_BINARY_DIR}/BuildInfo.cpp" BuildInfo.h) # Create the library @@ -18,6 +26,13 @@ if(MSVC) target_link_libraries(BaseLib WinMM) # needed for timeGetTime endif() +if(QT4_FOUND) + target_link_libraries(BaseLib PUBLIC Qt4::QtXml Qt4::QtXmlPatterns) + if(WIN32 AND CMAKE_CROSSCOMPILING AND OPENSSL_FOUND) + target_link_libraries(BaseLib PUBLIC Qt4::QtNetwork ${OPENSSL_LIBRARIES} ws2_32) + endif() +endif() + if(TARGET Eigen) add_dependencies(BaseLib Eigen) endif() diff --git a/FileIO/XmlIO/Qt/XMLQtInterface.cpp b/BaseLib/IO/XmlIO/Qt/XMLQtInterface.cpp similarity index 97% rename from FileIO/XmlIO/Qt/XMLQtInterface.cpp rename to BaseLib/IO/XmlIO/Qt/XMLQtInterface.cpp index 93c72f3a9ae587acb0dd15180a11c093270ead05..57374b0d5bae558c7f74fc219782d832e4db5d38 100644 --- a/FileIO/XmlIO/Qt/XMLQtInterface.cpp +++ b/BaseLib/IO/XmlIO/Qt/XMLQtInterface.cpp @@ -24,7 +24,9 @@ #include <logog/include/logog.hpp> -namespace FileIO +namespace BaseLib +{ +namespace IO { XMLQtInterface::XMLQtInterface(const std::string &schemaFile) : @@ -142,4 +144,5 @@ bool XMLQtInterface::isHashGood(const QByteArray &hash) const return true; } -} // end namespace FileIO +} // end namespace IO +} // end namespace BaseLib diff --git a/FileIO/XmlIO/Qt/XMLQtInterface.h b/BaseLib/IO/XmlIO/Qt/XMLQtInterface.h similarity index 95% rename from FileIO/XmlIO/Qt/XMLQtInterface.h rename to BaseLib/IO/XmlIO/Qt/XMLQtInterface.h index d325e73cdd5d2c814e5d7e0f655ad60b219502e7..fb52d5131a5b8a9d192f82b54e00b2522eaa9594 100644 --- a/FileIO/XmlIO/Qt/XMLQtInterface.h +++ b/BaseLib/IO/XmlIO/Qt/XMLQtInterface.h @@ -23,7 +23,9 @@ class QDomDocument; class QDomNode; class QDomElement; -namespace FileIO +namespace BaseLib +{ +namespace IO { class XMLQtInterface @@ -60,6 +62,7 @@ protected: QString _fileName; }; -} // end namespace FileIO +} // end namespace IO +} // end namespace BaseLib #endif /* XMLQTINTERFACE_H_ */ diff --git a/FileIO/XmlIO/XMLInterface.cpp b/BaseLib/IO/XmlIO/XMLInterface.cpp similarity index 93% rename from FileIO/XmlIO/XMLInterface.cpp rename to BaseLib/IO/XmlIO/XMLInterface.cpp index 58f3d88d6f16d7b9e61c7e38ab6040935f1e37e5..85f1d83fd09fb4083cc6e3d9ce42deec3b0f68c0 100644 --- a/FileIO/XmlIO/XMLInterface.cpp +++ b/BaseLib/IO/XmlIO/XMLInterface.cpp @@ -14,7 +14,9 @@ #include "XMLInterface.h" -namespace FileIO +namespace BaseLib +{ +namespace IO { XMLInterface::XMLInterface() : @@ -22,3 +24,4 @@ XMLInterface::XMLInterface() : {} } +} diff --git a/FileIO/XmlIO/XMLInterface.h b/BaseLib/IO/XmlIO/XMLInterface.h similarity index 96% rename from FileIO/XmlIO/XMLInterface.h rename to BaseLib/IO/XmlIO/XMLInterface.h index 6527c61f47543df2b9e652ea15f072121afa0dc3..fabd4f7fb6d9edfaf4f13ffb33dd15d0bd38338e 100644 --- a/FileIO/XmlIO/XMLInterface.h +++ b/BaseLib/IO/XmlIO/XMLInterface.h @@ -19,7 +19,9 @@ #include "BaseLib/IO/Writer.h" -namespace FileIO +namespace BaseLib +{ +namespace IO { /** * \brief Base class for writing any information to and from XML files. @@ -37,6 +39,7 @@ protected: std::string _exportName; }; +} } #endif // XMLINTERFACE_H diff --git a/FileIO/XmlIO/Qt/XmlGspInterface.cpp b/FileIO/XmlIO/Qt/XmlGspInterface.cpp index 6ea431c7f3eab7c58fc548f86c8f749486ea3492..4c5c038fa5583142f6229cbf36c569c3454bf707 100644 --- a/FileIO/XmlIO/Qt/XmlGspInterface.cpp +++ b/FileIO/XmlIO/Qt/XmlGspInterface.cpp @@ -21,8 +21,8 @@ #include "GeoLib/GEOObjects.h" -#include "XmlGmlInterface.h" -#include "XmlStnInterface.h" +#include "GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h" +#include "GeoLib/IO/XmlIO/Qt/XmlStnInterface.h" #include "BaseLib/FileTools.h" #include "BaseLib/FileFinder.h" @@ -69,7 +69,7 @@ int XmlGspInterface::readFile(const QString &fileName) const QString file_node(fileList.at(i).nodeName()); if (file_node.compare("geo") == 0) { - XmlGmlInterface gml(_project.getGEOObjects()); + GeoLib::IO::XmlGmlInterface gml(_project.getGEOObjects()); const QDomNodeList childList = fileList.at(i).childNodes(); for(int j = 0; j < childList.count(); j++) { @@ -86,7 +86,7 @@ int XmlGspInterface::readFile(const QString &fileName) } else if (file_node.compare("stn") == 0) { - XmlStnInterface stn(_project.getGEOObjects()); + GeoLib::IO::XmlStnInterface stn(_project.getGEOObjects()); const QDomNodeList childList = fileList.at(i).childNodes(); for(int j = 0; j < childList.count(); j++) if (childList.at(j).nodeName().compare("file") == 0) @@ -136,7 +136,7 @@ bool XmlGspInterface::write() for (std::vector<std::string>::const_iterator it(geoNames.begin()); it != geoNames.end(); ++it) { // write GLI file - XmlGmlInterface gml(geoObjects); + GeoLib::IO::XmlGmlInterface gml(geoObjects); std::string name(*it); gml.setNameForExport(name); if (gml.writeToFile(std::string(path + name + ".gml"))) @@ -157,7 +157,7 @@ bool XmlGspInterface::write() for (auto const& mesh : mesh_vector) { // write mesh file - Legacy::MeshIO meshIO; + FileIO::Legacy::MeshIO meshIO; meshIO.setMesh((&mesh)->get()); std::string fileName(path + mesh->getName()); meshIO.writeToFile(fileName); @@ -177,7 +177,7 @@ bool XmlGspInterface::write() for (std::vector<std::string>::const_iterator it(stnNames.begin()); it != stnNames.end(); ++it) { // write STN file - XmlStnInterface stn(geoObjects); + GeoLib::IO::XmlStnInterface stn(geoObjects); std::string name(*it); stn.setNameForExport(name); diff --git a/FileIO/XmlIO/Qt/XmlGspInterface.h b/FileIO/XmlIO/Qt/XmlGspInterface.h index 02350cf9616de654aa7dd13591a9f837e0a83aab..e936c1ce2bea245c914791bce105b4bfda640daa 100644 --- a/FileIO/XmlIO/Qt/XmlGspInterface.h +++ b/FileIO/XmlIO/Qt/XmlGspInterface.h @@ -20,8 +20,8 @@ #include <QString> -#include "../XMLInterface.h" -#include "XMLQtInterface.h" +#include "BaseLib/IO/XmlIO/XMLInterface.h" +#include "BaseLib/IO/XmlIO/Qt/XMLQtInterface.h" #include "DataHolderLib/Project.h" @@ -31,7 +31,8 @@ namespace FileIO /** * \brief Reads and writes project information to and from XML files. */ -class XmlGspInterface : public XMLInterface, public XMLQtInterface +class XmlGspInterface : public BaseLib::IO::XMLInterface, + public BaseLib::IO::XMLQtInterface { public: XmlGspInterface(DataHolderLib::Project &project); @@ -54,6 +55,6 @@ private: DataHolderLib::Project& _project; }; -} +} // end namespace FileIO #endif // XMLGSPINTERFACE_H diff --git a/FileIO/XmlIO/Qt/XmlNumInterface.h b/FileIO/XmlIO/Qt/XmlNumInterface.h index de2f274f7e0d2716a03eb36043761c6e522f7ee2..00c093a7cc70354876cab26de0750fff161243ec 100644 --- a/FileIO/XmlIO/Qt/XmlNumInterface.h +++ b/FileIO/XmlIO/Qt/XmlNumInterface.h @@ -15,13 +15,13 @@ #ifndef XMLNUMINTERFACE_H #define XMLNUMINTERFACE_H -#include "../XMLInterface.h" -#include "XMLQtInterface.h" +#include "BaseLib/IO/XmlIO/XMLInterface.h" +#include "BaseLib/IO/XmlIO/Qt/XMLQtInterface.h" namespace FileIO { -class XmlNumInterface : public XMLInterface, public XMLQtInterface +class XmlNumInterface : public BaseLib::IO::XMLInterface, public BaseLib::IO::XMLQtInterface { public: XmlNumInterface(); diff --git a/GeoLib/CMakeLists.txt b/GeoLib/CMakeLists.txt index 7528b7a16e1314f1fbe1946cf4d2ca0d1d3e01ed..820dd21cd99140b22baf49fd07836f3b5a85cb13 100644 --- a/GeoLib/CMakeLists.txt +++ b/GeoLib/CMakeLists.txt @@ -1,9 +1,19 @@ # Source files GET_SOURCE_FILES(SOURCES_GeoLib) +set(SOURCES ${SOURCES_GeoLib}) + GET_SOURCE_FILES(SOURCES_IO IO) GET_SOURCE_FILES(SOURCES_IO_Legacy IO/Legacy) +set(SOURCES ${SOURCES} ${SOURCES_IO} ${SOURCES_IO_Legacy}) + +GET_SOURCE_FILES(SOURCES_IO_BASE_XML IO/XmlIO) +GET_SOURCE_FILES(SOURCES_IO_BOOST_XML IO/XmlIO/Boost) +set(SOURCES ${SOURCES} ${SOURCES_IO_BASE_XML} ${SOURCES_IO_BOOST_XML}) -set(SOURCES ${SOURCES_GeoLib} ${SOURCES_IO} ${SOURCES_IO_Legacy}) +if(QT4_FOUND) + GET_SOURCE_FILES(SOURCES_IO_QT_XML IO/XmlIO/Qt) + set(SOURCES ${SOURCES} ${SOURCES_IO_QT_XML}) +endif() # Create the library add_library(GeoLib STATIC ${SOURCES} @@ -15,6 +25,13 @@ target_link_libraries(GeoLib MathLib ) +if(QT4_FOUND) + target_link_libraries(GeoLib PUBLIC Qt4::QtXml Qt4::QtXmlPatterns) + if(WIN32 AND CMAKE_CROSSCOMPILING AND OPENSSL_FOUND) + target_link_libraries(GeoLib PUBLIC Qt4::QtNetwork ${OPENSSL_LIBRARIES} ws2_32) + endif() +endif() + if(TARGET Boost) add_dependencies(GeoLib Boost) endif() diff --git a/FileIO/XmlIO/Boost/BoostXmlGmlInterface.cpp b/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp similarity index 99% rename from FileIO/XmlIO/Boost/BoostXmlGmlInterface.cpp rename to GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp index 77b43478962ce0e171730f92a741b4af46c4ff8b..8e6c4edf08426784b21f77bab1113d8b63a26cce 100644 --- a/FileIO/XmlIO/Boost/BoostXmlGmlInterface.cpp +++ b/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp @@ -26,7 +26,9 @@ #include "GeoLib/Surface.h" #include "GeoLib/Triangle.h" -namespace FileIO +namespace GeoLib +{ +namespace IO { BoostXmlGmlInterface::BoostXmlGmlInterface(GeoLib::GEOObjects& geo_objs) : @@ -338,4 +340,5 @@ void BoostXmlGmlInterface::addPolylinesToPropertyTree( } } -} // end namespace FileIO +} // end namespace IO +} // end namespace GeoLib diff --git a/FileIO/XmlIO/Boost/BoostXmlGmlInterface.h b/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.h similarity index 90% rename from FileIO/XmlIO/Boost/BoostXmlGmlInterface.h rename to GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.h index 4fe364ea88adb7f7607a10c2094581639c171b37..a7633c13307eb0af6292ccbbd3dff1ace981ab93 100644 --- a/FileIO/XmlIO/Boost/BoostXmlGmlInterface.h +++ b/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.h @@ -21,21 +21,19 @@ #include "BaseLib/ConfigTree.h" -#include "FileIO/XmlIO/XMLInterface.h" +#include "BaseLib/IO/XmlIO/XMLInterface.h" namespace GeoLib { - class GEOObjects; - class Point; - class Polyline; - class Surface; -} +class GEOObjects; +class Point; +class Polyline; +class Surface; - -namespace FileIO +namespace IO { -class BoostXmlGmlInterface : public XMLInterface +class BoostXmlGmlInterface : public BaseLib::IO::XMLInterface { public: BoostXmlGmlInterface(GeoLib::GEOObjects& geo_objs); @@ -75,6 +73,7 @@ private: GeoLib::GEOObjects &_geo_objects; }; -} // end namespace FileIO +} // end namespace IO +} // end namespace GeoLib #endif /* BOOSTXMLGMLINTERFACE_H_ */ diff --git a/FileIO/XmlIO/Qt/XmlGmlInterface.cpp b/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp similarity index 99% rename from FileIO/XmlIO/Qt/XmlGmlInterface.cpp rename to GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp index 12501bc8782f3803d1fa943ae2d45c5b565ce163..36e488caef86addc9fd0204e02a62dc0a8fa3224 100644 --- a/FileIO/XmlIO/Qt/XmlGmlInterface.cpp +++ b/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp @@ -23,7 +23,9 @@ #include "BaseLib/FileFinder.h" #include "GeoLib/Triangle.h" -namespace FileIO +namespace GeoLib +{ +namespace IO { XmlGmlInterface::XmlGmlInterface(GeoLib::GEOObjects& geo_objs) : XMLInterface(), XMLQtInterface(BaseLib::FileFinder().getPath("OpenGeoSysGLI.xsd")), _geo_objs(geo_objs) @@ -404,4 +406,6 @@ bool XmlGmlInterface::write() return true; } + +} } diff --git a/FileIO/XmlIO/Qt/XmlGmlInterface.h b/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h similarity index 90% rename from FileIO/XmlIO/Qt/XmlGmlInterface.h rename to GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h index 6235fd4c7a32e0b722296b2307e160d4568ae08e..7c695ba277856cdfeb687a9ee344c1b6b8c1690a 100644 --- a/FileIO/XmlIO/Qt/XmlGmlInterface.h +++ b/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h @@ -17,18 +17,21 @@ #include <QString> -#include "../XMLInterface.h" -#include "XMLQtInterface.h" +#include "BaseLib/IO/XmlIO/XMLInterface.h" +#include "BaseLib/IO/XmlIO/Qt/XMLQtInterface.h" #include "GeoLib/GEOObjects.h" -namespace FileIO +namespace GeoLib +{ +namespace IO { /** * \brief Reads and writes GeoObjects to and from XML files. */ -class XmlGmlInterface : public XMLInterface, public XMLQtInterface +class XmlGmlInterface : public BaseLib::IO::XMLInterface, + public BaseLib::IO::XMLQtInterface { public: XmlGmlInterface(GeoLib::GEOObjects& geo_objs); @@ -85,6 +88,7 @@ private: std::map<std::size_t, std::size_t> _idx_map; }; -} +} // end namespace IO +} // end namespace BaseLib #endif // XMLGMLINTERFACE_H diff --git a/FileIO/XmlIO/Qt/XmlStnInterface.cpp b/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp similarity index 99% rename from FileIO/XmlIO/Qt/XmlStnInterface.cpp rename to GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp index 416f9d2680140db78a48ddd1dabdff9901becdbd..4835acc84d6164e24f874b6bfa2f78145e943d20 100644 --- a/FileIO/XmlIO/Qt/XmlStnInterface.cpp +++ b/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp @@ -28,7 +28,9 @@ #include "GeoLib/StationBorehole.h" #include "GeoLib/GEOObjects.h" -namespace FileIO +namespace GeoLib +{ +namespace IO { XmlStnInterface::XmlStnInterface(GeoLib::GEOObjects& geo_objs) : XMLInterface(), XMLQtInterface(BaseLib::FileFinder().getPath("OpenGeoSysSTN.xsd")), _geo_objs(geo_objs) @@ -475,4 +477,6 @@ void XmlStnInterface::rapidReadStratigraphy( const rapidxml::xml_node<>* strat_r WARN("XmlStnInterface::rapidReadStratigraphy(): Attribute missing in <horizon> tag."); } } -} + +} // end namespace IO +} // end namespace GeoLib diff --git a/FileIO/XmlIO/Qt/XmlStnInterface.h b/GeoLib/IO/XmlIO/Qt/XmlStnInterface.h similarity index 87% rename from FileIO/XmlIO/Qt/XmlStnInterface.h rename to GeoLib/IO/XmlIO/Qt/XmlStnInterface.h index e5e9c042530e093cf7fe664557594047796bebb2..7bce4df6a95a5c71ed850711eb1bb39b9811872e 100644 --- a/FileIO/XmlIO/Qt/XmlStnInterface.h +++ b/GeoLib/IO/XmlIO/Qt/XmlStnInterface.h @@ -19,22 +19,22 @@ #include "RapidXML/rapidxml.hpp" -#include "../XMLInterface.h" -#include "XMLQtInterface.h" +#include "BaseLib/IO/XmlIO/XMLInterface.h" +#include "BaseLib/IO/XmlIO/Qt/XMLQtInterface.h" namespace GeoLib { - class GEOObjects; - class Point; - class StationBorehole; -} +class GEOObjects; +class Point; +class StationBorehole; -namespace FileIO +namespace IO { /** * \brief Reads and writes Observation Sites to and from XML files. */ -class XmlStnInterface : public XMLInterface, public XMLQtInterface +class XmlStnInterface : public BaseLib::IO::XMLInterface, + public BaseLib::IO::XMLQtInterface { public: XmlStnInterface(GeoLib::GEOObjects& geo_objs); @@ -71,6 +71,7 @@ private: GeoLib::GEOObjects& _geo_objs; }; -} +} // end namespace IO +} // end namespace GeoLib #endif // XMLSTNINTERFACE_H diff --git a/GeoLib/IO/readGeometryFromFile.cpp b/GeoLib/IO/readGeometryFromFile.cpp index e22a269d407432fabb42c80f15a0c0e7fa17187c..5cfb82b0c9dbd44d63111022786ca6d10eedde5e 100644 --- a/GeoLib/IO/readGeometryFromFile.cpp +++ b/GeoLib/IO/readGeometryFromFile.cpp @@ -14,7 +14,7 @@ #include "BaseLib/FileTools.h" -#include "FileIO/XmlIO/Boost/BoostXmlGmlInterface.h" +#include "GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.h" #include "GeoLib/IO/Legacy/OGSIOVer4.h" #include "GeoLib/GEOObjects.h" @@ -27,7 +27,7 @@ void readGeometryFromFile(std::string const& fname, GeoLib::GEOObjects & geo_objs) { if (BaseLib::getFileExtension(fname).compare("gml") == 0) { - FileIO::BoostXmlGmlInterface xml(geo_objs); + GeoLib::IO::BoostXmlGmlInterface xml(geo_objs); xml.readFile(fname); } else { std::vector<std::string> errors; diff --git a/GeoLib/IO/writeGeometryToFile.cpp b/GeoLib/IO/writeGeometryToFile.cpp index a41461c1dca218c6d2f0bd3b0e54277eebd5f181..518bcea09033dd1865adedf106e31116db441914 100644 --- a/GeoLib/IO/writeGeometryToFile.cpp +++ b/GeoLib/IO/writeGeometryToFile.cpp @@ -12,7 +12,7 @@ #include "BaseLib/FileTools.h" -#include "FileIO/XmlIO/Boost/BoostXmlGmlInterface.h" +#include "GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.h" #include "GeoLib/IO/Legacy/OGSIOVer4.h" #include "GeoLib/GEOObjects.h" @@ -26,7 +26,7 @@ void writeGeometryToFile(std::string const& geo_name, { std::string const extension(BaseLib::getFileExtension(fname)); if (extension == "gml" || extension == "GML") { - FileIO::BoostXmlGmlInterface xml(geo_objs); + GeoLib::IO::BoostXmlGmlInterface xml(geo_objs); xml.setNameForExport(geo_name); xml.writeToFile(fname); } else if (extension == "gli" || extension == "GLI") { diff --git a/Tests/FileIO/TestBoostGmlInterface.cpp b/Tests/FileIO/TestBoostGmlInterface.cpp index 39253ff7fdb687b08c26e5e990e0041cd4c8f574..fcb4d3023e7aaedd792550f155628e004c0e46d2 100644 --- a/Tests/FileIO/TestBoostGmlInterface.cpp +++ b/Tests/FileIO/TestBoostGmlInterface.cpp @@ -19,7 +19,7 @@ #include "Tests/FileIO/TestGmlInterface.h" #include "BaseLib/BuildInfo.h" -#include "FileIO/XmlIO/Boost/BoostXmlGmlInterface.h" +#include "GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.h" #include "GeoLib/GEOObjects.h" TEST_F(TestGmlInterface, BoostXmlGmlWriterReaderTest) @@ -28,7 +28,7 @@ TEST_F(TestGmlInterface, BoostXmlGmlWriterReaderTest) std::string test_data_file(BaseLib::BuildInfo::tests_tmp_path + "TestXmlGmlReader.gml"); - FileIO::BoostXmlGmlInterface xml(geo_objects); + GeoLib::IO::BoostXmlGmlInterface xml(geo_objects); xml.setNameForExport(geo_name); int result = xml.writeToFile(test_data_file); EXPECT_EQ(result, 1); diff --git a/Tests/FileIO_Qt/TestQtGmlInterface.cpp b/Tests/FileIO_Qt/TestQtGmlInterface.cpp index 0d5fd5cf19d3b13d155f245897b9d97a5e8dc79b..3941a3846db87cdfb8bfb1429a81de496b1782eb 100644 --- a/Tests/FileIO_Qt/TestQtGmlInterface.cpp +++ b/Tests/FileIO_Qt/TestQtGmlInterface.cpp @@ -19,7 +19,7 @@ #include "Tests/FileIO/TestGmlInterface.h" #include "BaseLib/BuildInfo.h" -#include "FileIO/XmlIO/Qt/XmlGmlInterface.h" +#include "GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h" #include "GeoLib/GEOObjects.h" TEST_F(TestGmlInterface, QtXmlGmlWriterReaderTest) @@ -28,7 +28,7 @@ TEST_F(TestGmlInterface, QtXmlGmlWriterReaderTest) std::string test_data_file(BaseLib::BuildInfo::tests_tmp_path + "TestXmlGmlReader.gml"); - FileIO::XmlGmlInterface xml(geo_objects); + GeoLib::IO::XmlGmlInterface xml(geo_objects); xml.setNameForExport(geo_name); int result = xml.writeToFile(test_data_file); EXPECT_EQ(result, 1);