mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 13:10:05 +00:00
Render placefile Place statement
This commit is contained in:
parent
1c39464228
commit
9f5de14f6b
5 changed files with 148 additions and 29 deletions
|
|
@ -6,6 +6,8 @@
|
|||
#include <vector>
|
||||
|
||||
#include <boost/gil/typedefs.hpp>
|
||||
#include <boost/units/quantity.hpp>
|
||||
#include <boost/units/systems/si/length.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
|
|
@ -33,8 +35,46 @@ public:
|
|||
Placefile(Placefile&&) noexcept;
|
||||
Placefile& operator=(Placefile&&) noexcept;
|
||||
|
||||
enum class ItemType
|
||||
{
|
||||
Place,
|
||||
Icon,
|
||||
Font,
|
||||
Text,
|
||||
Line,
|
||||
Triangles,
|
||||
Image,
|
||||
Polygon,
|
||||
Unknown
|
||||
};
|
||||
|
||||
struct DrawItem
|
||||
{
|
||||
ItemType itemType_ {ItemType::Unknown};
|
||||
boost::units::quantity<boost::units::si::length> threshold_ {};
|
||||
};
|
||||
|
||||
struct PlaceDrawItem : DrawItem
|
||||
{
|
||||
PlaceDrawItem() { itemType_ = ItemType::Place; }
|
||||
|
||||
boost::gil::rgba8_pixel_t color_ {};
|
||||
double latitude_ {};
|
||||
double longitude_ {};
|
||||
double x_ {};
|
||||
double y_ {};
|
||||
std::string text_ {};
|
||||
};
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
/**
|
||||
* @brief Gets the list of draw items defined in the placefile
|
||||
*
|
||||
* @return vector of draw item pointers
|
||||
*/
|
||||
std::vector<std::shared_ptr<DrawItem>> GetDrawItems();
|
||||
|
||||
static std::shared_ptr<Placefile> Load(const std::string& filename);
|
||||
static std::shared_ptr<Placefile> Load(std::istream& is);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/units/base_units/metric/nautical_mile.hpp>
|
||||
#include <boost/units/quantity.hpp>
|
||||
#include <boost/units/systems/si/length.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
|
|
@ -42,21 +40,6 @@ public:
|
|||
double y_ {};
|
||||
};
|
||||
|
||||
struct DrawItem
|
||||
{
|
||||
boost::units::quantity<boost::units::si::length> threshold_ {};
|
||||
};
|
||||
|
||||
struct PlaceDrawItem : DrawItem
|
||||
{
|
||||
boost::gil::rgba8_pixel_t color_ {};
|
||||
double latitude_ {};
|
||||
double longitude_ {};
|
||||
double x_ {};
|
||||
double y_ {};
|
||||
std::string text_ {};
|
||||
};
|
||||
|
||||
void ParseLocation(const std::string& latitudeToken,
|
||||
const std::string& longitudeToken,
|
||||
double& latitude,
|
||||
|
|
@ -93,6 +76,11 @@ bool Placefile::IsValid() const
|
|||
return p->drawItems_.size() > 0;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<Placefile::DrawItem>> Placefile::GetDrawItems()
|
||||
{
|
||||
return p->drawItems_;
|
||||
}
|
||||
|
||||
std::shared_ptr<Placefile> Placefile::Load(const std::string& filename)
|
||||
{
|
||||
logger_->debug("Loading placefile: {}", filename);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue