 |
Belle II Software
release-05-02-19
|
12 #include <tracking/trackFindingCDC/display/ColorMapping.h>
13 #include <tracking/trackFindingCDC/display/Mapping.h>
14 #include <tracking/trackFindingCDC/display/AttributeMap.h>
29 namespace TrackFindingCDC {
33 template <
class AObject>
41 virtual AttributeMap
map(
int index __attribute__((unused)),
42 AObject&
object __attribute__((unused)))
48 virtual std::string
info()
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);
121 std::string
info()
override
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));
165 void setStroke(
const std::string& mappingName)
167 set(
"stroke", mappingName);
177 set(
"stroke-width", mappingName);
182 std::map<std::string, std::unique_ptr<ObjectMapping> >
m_mappingsByKey;
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;
void setStroke(const std::string &value)
Legacy - Sets the stroke color to the fixed value.
Class template for coloring objects in different Colors.
Mapping< AObject > ObjectMapping
Mapping for the object type.
std::unique_ptr< ObjectMapping > createMapping(const std::string &mappingName) override
Method defining the available mapping names.
void set(const std::string &key, std::unique_ptr< ObjectMapping > mapping)
Sets the given attribute to the attribute mapping.
virtual std::string info()
Informal string summarizing the translation from the object to the attribute value.
AttributeMap m_attributeMap
Memory for the fixed attribute values.
This Class handles the mapping from the colormapping-method name given as a string to the actual ACol...
void setStrokeWidth(const std::string &mappingName)
Legacy method to set the mapping on how to match a object to the stroke width.
std::unique_ptr< ObjectMapping > createMapping(const std::string &mappingName) override
Method defining the available mapping names.
DefaultColorCycleStyling()
Constructor. Sets the stroke mapping the the default color cycle.
virtual std::string info()
Informal string summarizing the translation from the object to the styling attributes.
AttributeMap map(int index __attribute__((unused)), AObject &object __attribute__((unused))) override
Return the fixed attributes on each invocation.
Implementation of a styling composed from several predefined mappings chooseable by their name.
Abstract base class for different kinds of events.
ChooseableStyling< const RecoTrack > Super
Type of the base class.
std::unique_ptr< ObjectMapping > createMapping(const std::string &mappingName) override
Method defining the available mapping names.
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 setStrokeWidth(const std::string &value)
Legacy - Sets the stroke width to the fixed value.
This Class handles the mapping from the colormapping-method name given as a string to the actual colo...
virtual ~Styling()=default
Make destructor of interface virtual.
virtual std::unique_ptr< ObjectMapping > createMapping(const std::string &mappingName)
Create a mapping for the object from a name.
This Class handles the mapping from the colormapping-method name given as a string to the actual colo...
void set(const std::string &key, const std::string &value)
Sets the given attribute to the fixed value.
Class template for coloring objects with stroke colors prepared to be the default color cycle.
virtual AttributeMap map(int index __attribute__((unused)), AObject &object __attribute__((unused)))
Maps the object at the given index to attribute values.
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.
std::string info() override
Returns informal string about the currently set mappings.
void setStroke(const std::string &mappingName)
Legacy method to set the mapping on how to match a object to the stroke color.
ChooseableStyling< const CDCHit > Super
Type of the base class.
ChooseableStyling< const CDCSegment2D > Super
Type of the base class.
virtual std::string map(int index __attribute__((unused)), T &t __attribute__((unused)))
Main function returning an attribute value for an object at the given index.
Implementation of a styling from fixed attribute map.