/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #ifndef _PDF_IMPORT_GEO_ #define _PDF_IMPORT_GEO_ #include "DbDatabase.h" #include "oda_files/PdfImportBaseObjectGrabber.h" #include "oda_files/oda_functions.h" #include "DbGeoData.h" #include class BasePdfImportGeoDataTransformer; std::unique_ptr createTransformer2PdfImport(OdDbDatabasePtr& pDb, const std::vector& geo_mes, const float width, const float height); class BasePdfImportGeoDataTransformer { public: BasePdfImportGeoDataTransformer() = delete; BasePdfImportGeoDataTransformer(const std::vector& geo_mes, const float width, const float height); virtual ~BasePdfImportGeoDataTransformer() {}; virtual std::vector Transform(const OdPdfImportPathData* path_data, const unsigned long path_point_count); virtual OdPdfImportPoint Transform(const OdPdfImportPoint* pt); virtual void Transform(const double& x, const double& y, double& new_x, double& new_y) = 0; protected: void computeHomography(const OdGePoint2dArray& src, const OdGePoint2dArray& dst); void applyHomography(const double& x, const double& y, double& new_x, double& new_y); float m_Width{ 1. }; float m_Height{ 1. }; static const double cPdfDPI; std::vector m_Homography; OdDbGeoDataPtr m_pGeoData; }; class PdfImportNewGeoDataTransformer : public BasePdfImportGeoDataTransformer { public: virtual ~PdfImportNewGeoDataTransformer() {}; virtual void Transform(const double& x, const double& y, double& new_x, double& new_y); private: friend std::unique_ptr createTransformer2PdfImport(OdDbDatabasePtr& pDb, const std::vector& geo_mes, const float width, const float height); PdfImportNewGeoDataTransformer(OdDbDatabasePtr& pDb, const std::vector& geo_mes, const float width, const float height); }; class PdfImportExistingGeoDataTransformer : public BasePdfImportGeoDataTransformer { public: virtual ~PdfImportExistingGeoDataTransformer() {}; virtual void Transform(const double& x, const double& y, double& new_x, double& new_y); protected: OdDbGeoCoordinateSystemTransformerPtr m_pTransformer; private: friend std::unique_ptr createTransformer2PdfImport(OdDbDatabasePtr& pDb, const std::vector& geo_mes, const float width, const float height); PdfImportExistingGeoDataTransformer(OdDbObjectId& idGeoData, const std::vector& geo_mes, const float width, const float height); }; #endif //_PDF_IMPORT_GEO_