本文整理汇总了C++中osmium::Location::lon方法的典型用法代码示例。如果您正苦于以下问题:C++ Location::lon方法的具体用法?C++ Location::lon怎么用?C++ Location::lon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osmium::Location
的用法示例。
在下文中一共展示了Location::lon方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
Coordinates operator()(osmium::Location location) const {
Coordinates c {location.lon(), location.lat()};
if (m_epsg != 4326) {
c = transform(m_crs_wgs84, m_crs_user, Coordinates(deg_to_rad(location.lon()), deg_to_rad(location.lat())));
if (m_crs_user.is_latlong()) {
c.x = rad_to_deg(c.x);
c.y = rad_to_deg(c.y);
}
}
return c;
}
示例2: operator
Coordinates operator()(osmium::Location location) const {
return Coordinates{location.lon(), location.lat()};
}
示例3: SECTION
#include "catch.hpp"
#include <sstream>
#include <type_traits>
#include <osmium/osm/location.hpp>
TEST_CASE("Location") {
// fails on MSVC and doesn't really matter
// static_assert(std::is_literal_type<osmium::Location>::value, "osmium::Location not literal type");
SECTION("instantiation_with_default_parameters") {
osmium::Location loc;
REQUIRE(!loc);
REQUIRE_THROWS_AS(loc.lon(), osmium::invalid_location);
REQUIRE_THROWS_AS(loc.lat(), osmium::invalid_location);
}
SECTION("instantiation_with_double_parameters") {
osmium::Location loc1(1.2, 4.5);
REQUIRE(!!loc1);
REQUIRE(12000000 == loc1.x());
REQUIRE(45000000 == loc1.y());
REQUIRE(1.2 == loc1.lon());
REQUIRE(4.5 == loc1.lat());
osmium::Location loc2(loc1);
REQUIRE(4.5 == loc2.lat());
osmium::Location loc3 = loc1;
示例4: operator
Coordinates operator()(osmium::Location location) const {
return Coordinates {detail::lon_to_x(location.lon()), detail::lat_to_y(location.lat())};
}
示例5: REQUIRE
#include <osmium/osm/location.hpp>
#include <limits>
#include <sstream>
#include <type_traits>
// fails on MSVC and doesn't really matter
// static_assert(std::is_literal_type<osmium::Location>::value, "osmium::Location not literal type");
TEST_CASE("Location instantiation with default parameters") {
const osmium::Location loc;
REQUIRE_FALSE(loc);
REQUIRE_FALSE(loc.is_defined());
REQUIRE(loc.is_undefined());
REQUIRE_THROWS_AS(loc.lon(), const osmium::invalid_location&);
REQUIRE_THROWS_AS(loc.lat(), const osmium::invalid_location&);
}
TEST_CASE("Location instantiation with double parameters") {
const osmium::Location loc1{1.2, 4.5};
REQUIRE(bool(loc1));
REQUIRE(loc1.is_defined());
REQUIRE_FALSE(loc1.is_undefined());
REQUIRE(12000000 == loc1.x());
REQUIRE(45000000 == loc1.y());
REQUIRE(1.2 == Approx(loc1.lon()));
REQUIRE(4.5 == Approx(loc1.lat()));
const osmium::Location loc2{loc1};
REQUIRE(4.5 == Approx(loc2.lat()));
示例6: lon
/**
* Get longitude of the location in this NodeRef.
*
* @throws osmium::invalid_location if the location is not set.
*/
double lon() const {
return m_location.lon();
}
示例7: Coordinates
Coordinates(const osmium::Location& location) : x(location.lon()), y(location.lat()) {
}
示例9: size
/**
* Calculate size of the box in square degrees.
*
* Note that this measure isn't very useful if you want to know the
* real-world size of the bounding box!
*
* @throws osmium::invalid_location unless all coordinates are valid.
*/
double size() const {
return (m_top_right.lon() - m_bottom_left.lon()) *
(m_top_right.lat() - m_bottom_left.lat());
}