xapian-core
1.4.27
|
Base class for calculating distances between two lat/long coordinates. More...
#include <geospatial.h>
Public Member Functions | |
virtual | ~LatLongMetric () |
Destructor. More... | |
virtual double | pointwise_distance (const LatLongCoord &a, const LatLongCoord &b) const =0 |
Return the distance between two coordinates, in metres. More... | |
double | operator() (const LatLongCoords &a, const LatLongCoords &b) const |
Return the distance between two coordinate lists, in metres. More... | |
double | operator() (const LatLongCoords &a, const std::string &b) const |
Return the distance between two coordinate lists, in metres. More... | |
double | operator() (const LatLongCoords &a, const char *b_ptr, size_t b_len) const |
Return the distance between two coordinate lists, in metres. More... | |
virtual LatLongMetric * | clone () const =0 |
Clone the metric. More... | |
virtual std::string | name () const =0 |
Return the full name of the metric. More... | |
virtual std::string | serialise () const =0 |
Serialise object parameters into a string. More... | |
virtual LatLongMetric * | unserialise (const std::string &serialised) const =0 |
Create object given string serialisation returned by serialise(). More... | |
Base class for calculating distances between two lat/long coordinates.
Experimental - see https://xapian.org/docs/deprecation#experimental-features
Definition at line 303 of file geospatial.h.
|
virtual |
Destructor.
Definition at line 38 of file latlong_metrics.cc.
|
pure virtual |
Clone the metric.
Implemented in Xapian::GreatCircleMetric.
Referenced by Xapian::LatLongDistancePostingSource::clone().
|
pure virtual |
Return the full name of the metric.
This is used when serialising and unserialising metrics; for example, for performing remote searches.
If the subclass is in a C++ namespace, the namespace should be included in the name, using "::" as a separator. For example, for a LatLongMetric subclass called "FooLatLongMetric" in the "Xapian" namespace the result of this call should be "Xapian::FooLatLongMetric".
Implemented in Xapian::GreatCircleMetric.
Referenced by Xapian::Registry::Internal::add_defaults(), Xapian::Registry::register_lat_long_metric(), and Xapian::LatLongDistancePostingSource::serialise().
double LatLongMetric::operator() | ( | const LatLongCoords & | a, |
const LatLongCoords & | b | ||
) | const |
Return the distance between two coordinate lists, in metres.
The distance between the coordinate lists is defined to be the minimum pairwise distance between coordinates in the lists.
InvalidArgumentError | either of the lists is empty. |
a | The first coordinate list. |
b | The second coordinate list. |
Definition at line 43 of file latlong_metrics.cc.
References Xapian::LatLongCoords::begin(), Xapian::LatLongCoords::empty(), and Xapian::LatLongCoords::end().
|
inline |
Return the distance between two coordinate lists, in metres.
One of the coordinate lists is supplied in serialised form.
The distance between the coordinate lists is defined to be the minimum pairwise distance between coordinates in the lists.
InvalidArgumentError | either of the lists is empty. |
a | The first coordinate list. |
b | The second coordinate list, in serialised form. |
Definition at line 337 of file geospatial.h.
References name, and Xapian::LatLongCoords::size().
double LatLongMetric::operator() | ( | const LatLongCoords & | a, |
const char * | b_ptr, | ||
size_t | b_len | ||
) | const |
Return the distance between two coordinate lists, in metres.
One of the coordinate lists is supplied in serialised form.
The distance between the coordinate lists is defined to be the minimum pairwise distance between coordinates in the lists.
InvalidArgumentError | either of the lists is empty. |
a | The first coordinate list. |
b_ptr | The start of the serialised form of the second coordinate list. |
b_len | The length of the serialised form of the second coordinate list. |
Definition at line 72 of file latlong_metrics.cc.
References Xapian::LatLongCoords::begin(), Xapian::LatLongCoords::empty(), Xapian::LatLongCoords::end(), and Xapian::LatLongCoord::unserialise().
|
pure virtual |
Return the distance between two coordinates, in metres.
Implemented in Xapian::GreatCircleMetric.
|
pure virtual |
Serialise object parameters into a string.
The serialised parameters should represent the configuration of the metric.
Implemented in Xapian::GreatCircleMetric.
Referenced by Xapian::LatLongDistancePostingSource::serialise().
|
pure virtual |
Create object given string serialisation returned by serialise().
serialised | A serialised instance of this LatLongMetric subclass. |
Implemented in Xapian::GreatCircleMetric.
Referenced by DEFINE_TESTCASE(), and Xapian::LatLongDistancePostingSource::unserialise_with_registry().