This Class handles the mapping from the colormapping-method name given as a string to the actual color mapping for RecoTrack.
More...
#include <Styling.h>
|
std::unique_ptr< ObjectMapping > | createMapping (const std::string &mappingName) override |
| Method defining the available mapping names.
|
|
AttributeMap | map (int index, const RecoTrack &object) override |
| Create a map of attributes from the stored attribute maps.
|
|
virtual AttributeMap | map (int index, AObject &object) |
| Maps the object at the given index to attribute values.
|
|
std::string | info () override |
| Returns informal string about the currently set mappings.
|
|
void | set (const std::string &key, std::unique_ptr< ObjectMapping > mapping) |
| Sets the given attribute to the attribute mapping.
|
|
void | set (const std::string &key, const std::string &mappingName) |
| Sets the given attribute to the fixed value.
|
|
void | setStroke (const std::string &mappingName) |
| Legacy method to set the mapping on how to match a object to the stroke color.
|
|
void | setStrokeWidth (const std::string &mappingName) |
| Legacy method to set the mapping on how to match a object to the stroke width.
|
|
This Class handles the mapping from the colormapping-method name given as a string to the actual color mapping for RecoTrack.
Definition at line 198 of file Styling.h.
◆ ObjectMapping
◆ Super
Type of the base class.
Definition at line 202 of file Styling.h.
◆ createMapping()
Method defining the available mapping names.
Reimplemented from ChooseableStyling< const RecoTrack >.
Definition at line 17 of file Styling.cc.
18{
19 if (mappingName == "ListColors") {
20 return std::make_unique<RecoTrackListColorsColorMap>();
21 } else if (mappingName == "MatchingStatus") {
22 return std::make_unique<RecoTrackMatchingStatusColorMap>();
23 } else if (mappingName == "MCMatchingStatus") {
24 return std::make_unique<MCRecoTrackMatchingStatusColorMap>();
25 } else {
27 }
28}
virtual std::unique_ptr< ObjectMapping > createMapping(const std::string &mappingName)
Create a mapping for the object from a name.
◆ info()
|
inlineoverridevirtualinherited |
Returns informal string about the currently set mappings.
Reimplemented from Styling< AObject >.
Definition at line 119 of file Styling.h.
120 {
121 std::ostringstream oss;
122 for (const auto& keyMapping : m_mappingsByKey) {
123 const std::string& key = keyMapping.first;
124 const std::unique_ptr<ObjectMapping>& mapping = keyMapping.second;
125 oss << key << ": " << mapping->info();
126 }
127 return oss.str();
128 }
◆ map() [1/2]
virtual AttributeMap map |
( |
int |
index, |
|
|
AObject & |
object |
|
) |
| |
|
inlinevirtualinherited |
◆ map() [2/2]
AttributeMap map |
( |
int |
index, |
|
|
const RecoTrack & |
object |
|
) |
| |
|
inlineoverrideinherited |
Create a map of attributes from the stored attribute maps.
Definition at line 107 of file Styling.h.
108 {
109 AttributeMap attributeMap;
110 for (const auto& keyMapping : m_mappingsByKey) {
111 const std::string& key = keyMapping.first;
112 const std::unique_ptr<ObjectMapping>& mapping = keyMapping.second;
113 attributeMap[key] = mapping->map(index, object);
114 }
115 return attributeMap;
116 }
◆ set() [1/2]
void set |
( |
const std::string & |
key, |
|
|
const std::string & |
mappingName |
|
) |
| |
|
inlineinherited |
Sets the given attribute to the fixed value.
Definition at line 150 of file Styling.h.
151 {
152 std::unique_ptr<ObjectMapping> objectMapping = this->
createMapping(mappingName);
153 if (objectMapping) {
154 set(key, std::move(objectMapping));
155 }
156 }
◆ set() [2/2]
void set |
( |
const std::string & |
key, |
|
|
std::unique_ptr< ObjectMapping > |
mapping |
|
) |
| |
|
inlineinherited |
Sets the given attribute to the attribute mapping.
Definition at line 142 of file Styling.h.
143 {
144 if (mapping) {
146 }
147 }
std::map< std::string, std::unique_ptr< ObjectMapping > > m_mappingsByKey
Map of attribute keys to mappings to be used.
◆ setStroke()
void setStroke |
( |
const std::string & |
mappingName | ) |
|
|
inlineinherited |
Legacy method to set the mapping on how to match a object to the stroke color.
- Parameters
-
mappingName | The Name of the Mapping to be used. The translation from name to Mapping class must be defined in createMapping. |
Definition at line 163 of file Styling.h.
164 {
165 set("stroke", mappingName);
166 }
◆ setStrokeWidth()
void setStrokeWidth |
( |
const std::string & |
mappingName | ) |
|
|
inlineinherited |
Legacy method to set the mapping on how to match a object to the stroke width.
- Parameters
-
mappingName | The Name of the Mapping to be used. The translation from name to Mapping class must be defined in createMapping. |
Definition at line 173 of file Styling.h.
174 {
175 set("stroke-width", mappingName);
176 }
◆ m_mappingsByKey
std::map<std::string, std::unique_ptr<ObjectMapping> > m_mappingsByKey |
|
protectedinherited |
Map of attribute keys to mappings to be used.
Definition at line 180 of file Styling.h.
The documentation for this class was generated from the following files:
- tracking/trackFindingCDC/display/include/Styling.h
- tracking/trackFindingCDC/display/src/Styling.cc