Bridges-C++ 3.5.0-dev1
Bridges(C++ API)
Loading...
Searching...
No Matches
USState.h
Go to the documentation of this file.
1#ifndef STATE_H
2#define STATE_H
3
4#include "USCounty.h"
5#include "../Color.h"
6
7#include <string>
8#include <unordered_map>
9
10using std::string;
11
12namespace bridges {
13 namespace dataset {
14 /*
15 * @brief This object stores US State and links to information
16 *
17 * This object is used alongside with the USMap object. Each state
18 * has a stroke color and fill color and list of counties of type County
19 *
20 * See tutorial at https://bridgesuncc.github.io/tutorials/Map.html
21 *
22 * @author Kalpathi Subramanian, Erik Saule
23 * @date Last modified Dec 29, 2024
24 */
25 class USState {
26 string name;
27 datastructure::Color stroke_color;
28 bool view_counties; // flag to visualize county boundaries
29 float stroke_width; // boundary color
30 datastructure::Color fill_color; // fill color of state
31 unordered_map<string, USCounty> counties; // holds county info
32
33 public:
34 USState() = default;
35
36 USState(string st) {
37 name = st;
38 stroke_color = datastructure::Color("green");
39 view_counties = true;
40 stroke_width = 2.;
41 fill_color = datastructure::Color("lightblue");
42 }
51 unordered_map<string, USCounty> getCounties() const {
52 return counties;
53 }
67 unordered_map<string, USCounty>& accessCounties() {
68 return counties;
69 }
70
76 void setCounties(unordered_map<string, USCounty> & c) {
77 counties = c;
78 }
79
80 // getters, setters
81 string getStateName() const {
82 return name;
83 }
84 void setStateName(string n) {
85 name = n;
86 }
87
89 return stroke_color;
90 }
92 stroke_color = c;
93 }
94
96 return fill_color;
97 }
99 fill_color = c;
100 }
101
102 float getStrokeWidth() const {
103 return stroke_width;
104 }
105 void setStrokeWidth(float width) {
106 stroke_width = width;
107 }
108
112 bool getViewCountiesFlag() const {
113 return view_counties;
114 }
115 void setViewCountiesFlag(bool flag) {
116 view_counties = flag;
117 }
118 };
119 };
120};
121#endif
Definition USState.h:25
void setFillColor(datastructure::Color c)
Definition USState.h:98
void setStrokeWidth(float width)
Definition USState.h:105
void setStateName(string n)
Definition USState.h:84
USState(string st)
Definition USState.h:36
void setStrokeColor(datastructure::Color c)
Definition USState.h:91
void setCounties(unordered_map< string, USCounty > &c)
sets the counties for this state
Definition USState.h:76
string getStateName() const
Definition USState.h:81
float getStrokeWidth() const
Definition USState.h:102
unordered_map< string, USCounty > & accessCounties()
obtain reference to the county data for that state
Definition USState.h:67
void setViewCountiesFlag(bool flag)
Definition USState.h:115
unordered_map< string, USCounty > getCounties() const
obtain a copy of the county data for that state
Definition USState.h:51
datastructure::Color getStrokeColor() const
Definition USState.h:88
datastructure::Color getFillColor() const
Definition USState.h:95
bool getViewCountiesFlag() const
this flag lets you turn on/off counties as needed
Definition USState.h:112
This class represents Color, and supports rgba, hexadecimal and named color values.
Definition Color.h:50
Support for drawing Bar charts.
Definition alltypes.h:4