10#include <tracking/trackFindingCDC/display/ColorMapping.h>
11#include <tracking/trackFindingCDC/display/Mapping.h>
12#include <tracking/trackFindingCDC/display/AttributeMap.h>
27 namespace TrackFindingCDC {
31 template <
class AObject>
39 virtual AttributeMap
map(
int index __attribute__((unused)),
40 AObject&
object __attribute__((unused)))
48 return "(no info available)\n";
53 template <
class AObject>
58 AttributeMap
map(
int index __attribute__((unused)),
59 AObject&
object __attribute__((unused)))
override
65 std::string
info()
override
67 std::ostringstream oss;
69 oss << keyValue.first <<
": " << keyValue.second <<
'\n';
75 void set(
const std::string& key,
const std::string& value)
89 set(
"stroke-width", value);
98 template <
class AObject>
107 AttributeMap
map(
int index, AObject&
object)
override
109 AttributeMap attributeMap;
111 const std::string& key = keyMapping.first;
112 const std::unique_ptr<ObjectMapping>& mapping = keyMapping.second;
113 attributeMap[key] = mapping->map(index,
object);
121 std::ostringstream oss;
123 const std::string& key = keyMapping.first;
124 const std::unique_ptr<ObjectMapping>& mapping = keyMapping.second;
125 oss << key <<
": " << mapping->info();
136 virtual std::unique_ptr<ObjectMapping>
createMapping(
const std::string& mappingName)
138 return std::make_unique<ConstantMapping<AObject>>(mappingName);
142 void set(
const std::string& key, std::unique_ptr<ObjectMapping> mapping)
150 void set(
const std::string& key,
const std::string& mappingName)
152 std::unique_ptr<ObjectMapping> objectMapping = this->
createMapping(mappingName);
154 set(key, std::move(objectMapping));
165 set(
"stroke", mappingName);
175 set(
"stroke-width", mappingName);
184 template <
class AObject>
209 std::unique_ptr<ObjectMapping>
createMapping(
const std::string& mappingName)
override;
227 std::unique_ptr<ObjectMapping>
createMapping(
const std::string& mappingName)
override;
245 std::unique_ptr<ObjectMapping>
createMapping(
const std::string& mappingName)
override;
This Class handles the mapping from the colormapping-method name given as a string to the actual colo...
std::unique_ptr< ObjectMapping > createMapping(const std::string &mappingName) override
Method defining the available mapping names.
This Class handles the mapping from the colormapping-method name given as a string to the actual colo...
std::unique_ptr< ObjectMapping > createMapping(const std::string &mappingName) override
Method defining the available mapping names.
This Class handles the mapping from the colormapping-method name given as a string to the actual ACol...
std::unique_ptr< ObjectMapping > createMapping(const std::string &mappingName) override
Method defining the available mapping names.
Implementation of a styling composed from several predefined mappings chooseable by their name.
virtual std::unique_ptr< ObjectMapping > createMapping(const std::string &mappingName)
Create a mapping for the object from a name.
void set(const std::string &key, const std::string &mappingName)
Sets the given attribute to the fixed value.
AttributeMap map(int index, AObject &object) override
Create a map of attributes from the stored attribute maps.
std::map< std::string, std::unique_ptr< ObjectMapping > > m_mappingsByKey
Map of attribute keys to mappings to be used.
void set(const std::string &key, std::unique_ptr< ObjectMapping > mapping)
Sets the given attribute to the attribute mapping.
void setStrokeWidth(const std::string &mappingName)
Legacy method to set the mapping on how to match a object to the stroke width.
void setStroke(const std::string &mappingName)
Legacy method to set the mapping on how to match a object to the stroke color.
std::string info() override
Returns informal string about the currently set mappings.
Class template for coloring objects in different Colors.
Class template for coloring objects with stroke colors prepared to be the default color cycle.
DefaultColorCycleStyling()
Constructor. Sets the stroke mapping the the default color cycle.
Implementation of a styling from fixed attribute map.
void setStrokeWidth(const std::string &value)
Legacy - Sets the stroke width to the fixed value.
AttributeMap map(int index, AObject &object) override
Return the fixed attributes on each invocation.
AttributeMap m_attributeMap
Memory for the fixed attribute values.
void set(const std::string &key, const std::string &value)
Sets the given attribute to the fixed value.
void setStroke(const std::string &value)
Legacy - Sets the stroke color to the fixed value.
std::string info() override
Informal string summarizing the translation from the object to the styling attributes.
Interface for a mapping of object and an index to styling attributes.
virtual AttributeMap map(int index, AObject &object)
Maps the object at the given index to attribute values.
virtual ~Styling()=default
Make destructor of interface virtual.
virtual std::string info()
Informal string summarizing the translation from the object to the styling attributes.
Abstract base class for different kinds of events.