Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <string>
- #include <functional>
- #include <set>
- #include "descriptions.h"
- #include "json.h"
- #include "svg.h"
- struct RenderingSettings {
- double width;
- double height;
- double padding;
- double stop_radius;
- double line_width;
- int stop_label_font_size;
- Svg::Point stop_label_offset;
- Svg::Color underlayer_color;
- double underlayer_width;
- std::vector<Svg::Color> color_palette;
- int bus_label_font_size;
- Svg::Point bus_label_offset;
- std::vector<std::string> layers;
- };
- struct double_compare {
- bool operator() (double lhs, double rhs) const {
- return lhs + std::numeric_limits<double>::epsilon() < rhs;
- }
- };
- class PackInfo : public std::pair<double, double> {
- public:
- using std::pair<double, double>::pair;
- std::set<std::pair<std::string, std::string>> buss_and_stop;
- std::set<std::pair<std::string, std::string>> black_listed_buss_and_stop;
- };
- class MapRenderer {
- public:
- MapRenderer(Descriptions::StopsDict stops_dict,
- Descriptions::BusesDict buses_dict,
- const Json::Dict& rendering_settings_json);
- std::string RenderMap() const;
- enum class RenderLayer {
- BusWay,
- StopLabel,
- StopCircle,
- BusId
- };
- private:
- using Drawer = std::function<void(Svg::Document&)>;
- void InitMap();
- void MakeRenderingSettings(const Json::Dict& rendering_settings_json);
- Svg::Point FromSpherePoint(const Sphere::Point& point) const;
- Svg::Point TransformPoint(const Sphere::Point& point) const;
- double min_lat, min_lon, max_lat, max_lon;
- std::vector<PackInfo> sorted_coords[2];
- std::function<Svg::Point(const Sphere::Point&)> transformer_;
- std::string resultMap;
- Descriptions::StopsDict stops_dict_;
- Descriptions::BusesDict buses_dict_;
- RenderingSettings settings_;
- std::map<RenderLayer, Drawer> renderers_;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement