Class OneDimDistance

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

class OneDimDistance : public gwm::Distance

Class for calculating spatial distance according to coordinate reference system.

Public Functions

OneDimDistance()
explicit OneDimDistance(bool isGeographic)

Construct a new OneDimDistance object.

Parameters:

isGeographic – Whether the coordinate reference system is geographical.

OneDimDistance(const OneDimDistance &distance)

Construct a new OneDimDistance object.

Parameters:

distance – Refernce to object for copying.

inline virtual Distance *clone() const override

Clone this Distance object. Newly created pointer.

inline virtual DistanceType type() override

Return the type of this object. Type of distance.

virtual void makeParameter(std::initializer_list<DistParamVariant> plist) override

Create Parameter for Caclulating CRS Distance.

Parameters:

plist – A list of parameters containing 2 items:

  • arma::vec focus coordinates (one column)

  • arma::vec data coordinates (one column)

Returns:

DistanceParameter* The pointer to parameters.

virtual arma::vec distance(arma::uword focus) override

Calculate distance vector for a focus point. Focused point’s index. Require focus < total Distance vector for the focused point.

arma::vec noAbsdistance(arma::uword focus)

Calculate distance for points (focus) just like distance.

Parameters:

focus – the index of points to be calculated. A list of parameters should be contained, and 2 items: Matrix of focus point’ coordinate & Matrix of data point’ coordinate.

Returns:

arma::vec Distance vector with not absolute value.

virtual double maxDistance() override

Get maximum distance among all points. Maximum distance.

virtual double minDistance() override

Get minimum distance among all points Maximum distance.

Public Static Functions

static inline arma::vec AbstractDistance(const double &out_loc, const arma::vec &in_locs)

Calculate spatial distance for points with geographical coordinate reference system.

Parameters:
  • out_loc – Matrix of focus point’ coordinate. The shape of it must be 1x2 and the first column is longitudes, the second column is latitudes.

  • in_locs – Matrix of data points’ coordinates. The shape of it must be nx2 and the first column is longitudes, the second column is latitudes.

Returns:

arma::vec Distance vector for out_loc.

Protected Attributes

std::unique_ptr<Parameter> mParameter = nullptr

Parameters.

struct Parameter : public gwm::Distance::Parameter

Struct of parameters used in spatial distance calculating according to coordinate reference system. Usually a pointer to object of this class is passed to OneDimDistance::distance().

Public Functions

inline Parameter(const arma::vec &fp, const arma::vec &dp)

Construct a new OneDimDistanceParameter object.

Parameters:
  • fp – Reference to focus points.

  • dp – Reference to data points.

Public Members

arma::vec focusPoints

Matrix of focus points’ coordinates. The shape of it must be nx2 and the first column is longitudes or x-coordinate, the second column is latitudes or y-coordinate.

arma::vec dataPoints

Matrix of data points’ coordinates. The shape of it must be nx2 and the first column is longitudes or x-coordinate, the second column is latitudes or y-coordinate.