4 #include <unordered_map> 25 #ifndef SYMBOL_COLLECTION_H 27 #define SYMBOL_COLLECTION_H 30 namespace datastructure {
43 unordered_map<int, Symbol*> symbols;
51 mutable float domainxmin = 0.0;
52 mutable float domainxmax = 100.0;
53 mutable float domainymin = 0.0;
54 mutable float domainymax = 100.0;
55 bool autoscaledomain =
false;
71 autoscaledomain =
false;
89 return "SymbolCollection";
111 void updateAxisDomains(
const Symbol* s)
const {
115 if (dims[0] < domainxmin) {
116 domainxmin = dims[0];
118 if (dims[1] > domainxmax) {
119 domainxmax = dims[1];
123 if (dims[2] < domainymin) {
124 domainymin = dims[2];
126 if (dims[3] > domainymax) {
127 domainymax = dims[3];
142 virtual const string getDataStructureRepresentation()
const {
145 for (
auto& entry : symbols)
146 updateAxisDomains(entry.second);
149 string symbol_json = string();
150 for (
auto& entry : symbols) {
152 entry.second->getSymbolRepresentation() +
COMMA;
155 if (symbols.size()) {
156 symbol_json.erase(symbol_json.size() - 1);
160 to_string(domainxmin) +
COMMA + to_string(domainxmax) +
164 to_string(domainymin) +
COMMA + to_string(domainymax) +
void addSymbol(Symbol *s)
This method adds a symbol to the collection.
Definition: SymbolCollection.h:97
This is the superclass of all data structure types in BRIDGES.
Definition: DataStructure.h:73
virtual const string getDStype() const
This method gets the data structure type.
Definition: SymbolCollection.h:88
const string COLON
Definition: DataStructure.h:51
const string OPEN_BOX
Definition: DataStructure.h:54
const string CLOSE_CURLY
Definition: DataStructure.h:53
This is an abstract class for deriving a number of Symbol shape objects, for use in a SymbolCollectio...
Definition: Symbol.h:33
SymbolCollection()
Definition: SymbolCollection.h:80
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 CLOSE_BOX
Definition: DataStructure.h:55
void setViewport(float xmin, float xmax, float ymin, float ymax)
set the dimensions of the view
Definition: SymbolCollection.h:69
the ShapeCollection represents a collection of symbols (shapes, polygons, and text) to visualize in B...
Definition: SymbolCollection.h:38
virtual vector< float > getDimensions() const =0
Virtual method to get the bounding box (dimensions) of the shape.
const string COMMA
Definition: DataStructure.h:50
const string QUOTE
Definition: DataStructure.h:49
int getIdentifier()
return the symbol identifier.
Definition: Symbol.h:131