10#include <tracking/trackFindingCDC/display/ColorMapping.h>
11#include <tracking/trackFindingCDC/display/Mapping.h>
12#include <tracking/trackFindingCDC/display/AttributeMap.h>
27 namespace TrackingUtilities {
30 namespace TrackFindingCDC {
33 template <
class AObject>
41 virtual AttributeMap
map(
int index __attribute__((unused)),
42 AObject&
object __attribute__((unused)))
50 return "(no info available)\n";
55 template <
class AObject>
60 AttributeMap
map(
int index __attribute__((unused)),
61 AObject&
object __attribute__((unused)))
override
67 std::string
info()
override
69 std::ostringstream oss;
71 oss << keyValue.first <<
": " << keyValue.second <<
'\n';
77 void set(
const std::string& key,
const std::string& value)
91 set(
"stroke-width", value);
100 template <
class AObject>
109 AttributeMap
map(
int index, AObject&
object)
override
111 AttributeMap attributeMap;
113 const std::string& key = keyMapping.first;
114 const std::unique_ptr<ObjectMapping>& mapping = keyMapping.second;
115 attributeMap[key] = mapping->map(index,
object);
123 std::ostringstream oss;
125 const std::string& key = keyMapping.first;
126 const std::unique_ptr<ObjectMapping>& mapping = keyMapping.second;
127 oss << key <<
": " << mapping->info();
138 virtual std::unique_ptr<ObjectMapping>
createMapping(
const std::string& mappingName)
140 return std::make_unique<ConstantMapping<AObject>>(mappingName);
144 void set(
const std::string& key, std::unique_ptr<ObjectMapping> mapping)
152 void set(
const std::string& key,
const std::string& mappingName)
154 std::unique_ptr<ObjectMapping> objectMapping = this->
createMapping(mappingName);
156 set(key, std::move(objectMapping));
167 set(
"stroke", mappingName);
177 set(
"stroke-width", mappingName);
186 template <
class AObject>
211 std::unique_ptr<ObjectMapping>
createMapping(
const std::string& mappingName)
override;
229 std::unique_ptr<ObjectMapping>
createMapping(
const std::string& mappingName)
override;
247 std::unique_ptr<ObjectMapping>
createMapping(
const std::string& mappingName)
override;
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
This is the Reconstruction Event-Data Model Track.
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.
ChooseableStyling< const CDCHit > Super
Type of the base class.
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.
ChooseableStyling< const RecoTrack > Super
Type of the base class.
This Class handles the mapping from the colormapping-method name given as a string to the actual ACol...
ChooseableStyling< const TrackingUtilities::CDCSegment2D > Super
Type of the base class.
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.
Mapping< AObject > ObjectMapping
Mapping for the object type.
std::map< std::string, std::unique_ptr< ObjectMapping > > m_mappingsByKey
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.
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 defining a mapping of objects to attribute values e.g. a color.
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.
A reconstructed sequence of two dimensional hits in one super layer.
Abstract base class for different kinds of events.