Commit 3fa6bfc5 authored by Volker Krause's avatar Volker Krause
Browse files

Add export macros for KOSM

In preparation of installing this as a shared library.
parent a234976f
......@@ -28,6 +28,12 @@ add_library(KOSM STATIC
ztile.cpp
${pbf_srcs}
)
generate_export_header(KOSM BASE_NAME KOSM)
set_target_properties(KOSM PROPERTIES
VERSION ${KOSMINDOORMAP_VERSION_STRING}
SOVERSION ${KOSMINDOORMAP_SOVERSION}
EXPORT_NAME KOSM
)
target_include_directories(KOSM PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>")
target_include_directories(KOSM PRIVATE ${Protobuf_INCLUDE_DIRS})
......
......@@ -7,12 +7,14 @@
#ifndef OSM_DATASETMERGEBUFFER_H
#define OSM_DATASETMERGEBUFFER_H
#include <kosm_export.h>
#include "datatypes.h"
namespace OSM {
/** Holds OSM elements produced by a parser prior to merging into OSM::DataSet. */
class DataSetMergeBuffer
class KOSM_EXPORT DataSetMergeBuffer
{
public:
void clear();
......
......@@ -7,6 +7,7 @@
#ifndef OSM_DATATYPES_H
#define OSM_DATATYPES_H
#include "kosm_export.h"
#include "internal.h"
#include <QByteArray>
......@@ -18,6 +19,7 @@
#include <cstring>
#include <vector>
/** Low-level types and functions to work with raw OSM data as efficiently as possible. */
namespace OSM {
class DataSet;
......@@ -212,7 +214,7 @@ public:
};
/** An OSM node. */
class Node {
class KOSM_EXPORT Node {
public:
constexpr inline bool operator<(const Node &other) const { return id < other.id; }
......@@ -224,7 +226,7 @@ public:
};
/** An OSM way. */
class Way {
class KOSM_EXPORT Way {
public:
constexpr inline bool operator<(const Way &other) const { return id < other.id; }
......@@ -289,7 +291,7 @@ private:
};
/** An OSM relation. */
class Relation {
class KOSM_EXPORT Relation {
public:
constexpr inline bool operator<(const Relation &other) const { return id < other.id; }
......@@ -302,7 +304,7 @@ public:
};
/** A set of nodes, ways and relations. */
class DataSet {
class KOSM_EXPORT DataSet {
public:
explicit DataSet();
DataSet(const DataSet&) = delete;
......@@ -468,7 +470,7 @@ inline bool operator<(const Elem &elem, Id id)
}
QDebug operator<<(QDebug debug, OSM::Coordinate coord);
QDebug operator<<(QDebug debug, OSM::BoundingBox bbox);
KOSM_EXPORT QDebug operator<<(QDebug debug, OSM::Coordinate coord);
KOSM_EXPORT QDebug operator<<(QDebug debug, OSM::BoundingBox bbox);
#endif // OSM_DATATYPES_H
......@@ -7,6 +7,8 @@
#ifndef OSM_ELEMENT_H
#define OSM_ELEMENT_H
#include "kosm_export.h"
#include "datatypes.h"
#include "internal.h"
......@@ -17,7 +19,7 @@ namespace OSM {
/** A reference to any of OSM::Node/OSM::Way/OSM::Relation.
* Lifetime of the referenced object needs to extend beyond the lifetime of this.
*/
class Element
class KOSM_EXPORT Element
{
public:
inline constexpr Element() : m_elem(nullptr, static_cast<uint8_t>(Type::Null)) {}
......@@ -91,7 +93,7 @@ QByteArray Element::tagValue(K key, Args... args, const QLocale &locale) const
/** A std::unique_ptr-like object for OSM element types. */
class UniqueElement
class KOSM_EXPORT UniqueElement
{
public:
explicit inline UniqueElement() = default;
......
......@@ -7,6 +7,8 @@
#ifndef OSM_GEOMATH_H
#define OSM_GEOMATH_H
#include "kosm_export.h"
#include "datatypes.h"
#include <cmath>
......@@ -25,16 +27,16 @@ constexpr inline double radToDeg(double rad)
}
/** Distance between two coordinates. */
double distance(double lat1, double lon1, double lat2, double lon2);
KOSM_EXPORT double distance(double lat1, double lon1, double lat2, double lon2);
/** Distance between @p coord1 and @p coord2 in meter. */
double distance(Coordinate coord1, Coordinate coord2);
KOSM_EXPORT double distance(Coordinate coord1, Coordinate coord2);
/** Distance in meters between a line segment defined by @p l1 and @p l2 to a point @p p. */
double distance(Coordinate l1, Coordinate l2, Coordinate p);
/** Distance between the given polygon and coordinate, in meter. */
double distance(const std::vector<const OSM::Node*> &path, Coordinate coord);
KOSM_EXPORT double distance(const std::vector<const OSM::Node*> &path, Coordinate coord);
}
......
......@@ -7,6 +7,8 @@
#ifndef OSM_O5MPARSER_H
#define OSM_O5MPARSER_H
#include "kosm_export.h"
#include <cstddef>
#include <cstdint>
#include <vector>
......@@ -21,7 +23,7 @@ class DataSetMergeBuffer;
/** Zero-copy parser of O5M binary files.
* @see https://wiki.openstreetmap.org/wiki/O5m
*/
class O5mParser
class KOSM_EXPORT O5mParser
{
public:
explicit O5mParser(DataSet *dataSet);
......
......@@ -7,6 +7,8 @@
#ifndef KOSM_OSMPBFPARSER_H
#define KOSM_OSMPBFPARSER_H
#include "kosm_export.h"
#include "datatypes.h"
namespace OSMPBF {
......@@ -19,7 +21,7 @@ namespace OSM {
/** Parser of .osm.pbf files.
* @see https://wiki.openstreetmap.org/wiki/PBF_Format
*/
class OsmPbfParser
class KOSM_EXPORT OsmPbfParser
{
public:
explicit OsmPbfParser(DataSet *dataSet);
......
......@@ -7,6 +7,8 @@
#ifndef OSM_OVERPASSQUERY_H
#define OSM_OVERPASSQUERY_H
#include "kosm_export.h"
#include "datatypes.h"
#include <QObject>
......@@ -20,7 +22,7 @@ namespace OSM {
* @note Use this wrongly can cause excessive load on Overpass servers,
* so only use this when you know what you are doing!
*/
class OverpassQuery : public QObject
class KOSM_EXPORT OverpassQuery : public QObject
{
Q_OBJECT
public:
......
......@@ -7,6 +7,8 @@
#ifndef OSM_OVERPASSQUERYMANAGER_H
#define OSM_OVERPASSQUERYMANAGER_H
#include "kosm_export.h"
#include <QObject>
#include <memory>
......@@ -17,7 +19,7 @@ class OverpassQuery;
class OverpassQueryManagerPrivate;
/** Executes OverpassQuery jobs. */
class OverpassQueryManager : public QObject
class KOSM_EXPORT OverpassQueryManager : public QObject
{
Q_OBJECT
public:
......
......@@ -7,6 +7,8 @@
#ifndef OSM_PATHUTIL_H
#define OSM_PATHUTIL_H
#include <kosm_export.h>
#include "datatypes.h"
#include <vector>
......@@ -30,8 +32,8 @@ static void appendNodesFromWay(const DataSet &dataSet, std::vector<const Node*>
}
/** Assemble a continuous path into @p path from the given @p ways. */
void assemblePath(const DataSet &dataSet, std::vector<const Way*> &&ways, std::vector<const Node*> &path);
void assemblePath(const DataSet &dataSet, const std::vector<OSM::Element> &ways, std::vector<const Node*> &path);
KOSM_EXPORT void assemblePath(const DataSet &dataSet, std::vector<const Way*> &&ways, std::vector<const Node*> &path);
KOSM_EXPORT void assemblePath(const DataSet &dataSet, const std::vector<OSM::Element> &ways, std::vector<const Node*> &path);
}
......
......@@ -7,6 +7,8 @@
#ifndef OSM_XMLPARSER_H
#define OSM_XMLPARSER_H
#include <kosm_export.h>
#include <QString>
class QIODevice;
......@@ -16,7 +18,7 @@ namespace OSM {
class DataSet;
class XmlParser
class KOSM_EXPORT XmlParser
{
public:
explicit XmlParser(DataSet *dataSet);
......
......@@ -7,13 +7,15 @@
#ifndef OSM_XMLWRITER_H
#define OSM_XMLWRITER_H
#include <kosm_export.h>
class QIODevice;
namespace OSM {
class DataSet;
/** Serialite a OSM::DataSet into OSM XML. */
namespace XmlWriter
namespace KOSM_EXPORT XmlWriter
{
void write(const OSM::DataSet &dataSet, QIODevice *out);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment