12#include <unordered_map>
16using std::unordered_map;
24#include <rapidjson/document.h>
25#include <rapidjson/stringbuffer.h>
26#include <rapidjson/writer.h>
29 namespace datastructure {
58 vector<string> state_names;
59 vector<USState> state_data;
63 virtual const string getDataStructureRepresentation ()
68 unordered_map<string, string> state_codes = {
75 {
"Connecticut",
"CT"},
77 {
"District of Columbia",
"DC"},
91 {
"Massachusetts",
"MA"},
94 {
"Mississippi",
"MS"},
99 {
"New Hampshire",
"NH"},
100 {
"New Jersey",
"NJ"},
101 {
"New Mexico",
"NM"},
103 {
"North Carolina",
"NC"},
104 {
"North Dakota",
"ND"},
108 {
"Pennsylvania",
"PA"},
109 {
"Puerto Rico",
"PR"},
110 {
"Rhode Island",
"RI"},
111 {
"South Carolina",
"SC"},
112 {
"South Dakota",
"SD"},
118 {
"Virgin Islands",
"VI"},
119 {
"Washington",
"WA"},
120 {
"West Virginia",
"WV"},
154 for (
auto& st : state_data) {
161 + st.getStrokeColor().getCSSRepresentation() +
COMMA +
165 st.getFillColor().getCSSRepresentation() +
COMMA +
172 for (
auto& c : st.getCounties()) {
183 c.second.getStrokeColor().getCSSRepresentation() +
COMMA +
187 c.second.getFillColor().getCSSRepresentation() +
COMMA +
193 if (st.getCounties().size())
194 map_str = map_str.substr(0, map_str.size() - 1);
198 map_str = map_str.substr(0, map_str.size() - 1) +
CLOSE_BOX;
212 state_data = st_data;
233 state_data = st_data;
This is the superclass of all data structure types in BRIDGES.
Definition: DataStructure.h:74
Abstract class for Map API.
Definition: Map.h:16
This class provides an API to building, displaying and manipulating US maps and counties in BRIDGES.
Definition: USMap.h:56
USMap()
Definition: USMap.h:202
virtual const string getMapRepresentation() const override
Generates the JSON representation of the US map.
Definition: USMap.h:147
vector< USState > & getMapData()
Definition: USMap.h:221
void setStateData(vector< USState > st_data)
Definition: USMap.h:231
virtual const string getDStype() const override
Definition: USMap.h:242
const string getProjection() const override
Gets the type of map projection. For US map we currently use albersusa.
Definition: USMap.h:130
USMap(vector< USState > st_data)
Definition: USMap.h:210
const bool getOverlay() const override
Gets the map overlay flag.
Definition: USMap.h:138
std::string JSONencode(const T &d)
Definition: JSONutil.h:38
these methods convert byte arrays in to base64 codes and are used in BRIDGES to represent the color a...
Definition: alltypes.h:4
const string COLON
Definition: DataStructure.h:52
const string OPEN_BOX
Definition: DataStructure.h:55
const string COMMA
Definition: DataStructure.h:51
const string OPEN_CURLY
Definition: DataStructure.h:53
const string CLOSE_BOX
Definition: DataStructure.h:56
const string CLOSE_CURLY
Definition: DataStructure.h:54
const string QUOTE
Definition: DataStructure.h:50