Verovio
Source code documentation
hairpin.h
1 // Name: hairpin.h
3 // Author: Laurent Pugin
4 // Created: 2016
5 // Copyright (c) Authors and others. All rights reserved.
7 
8 #ifndef __VRV_HAIRPIN_H__
9 #define __VRV_HAIRPIN_H__
10 
11 #include "atts_cmn.h"
12 #include "atts_visual.h"
13 #include "controlelement.h"
14 #include "timeinterface.h"
15 
16 namespace vrv {
17 
18 //----------------------------------------------------------------------------
19 // Hairpin
20 //----------------------------------------------------------------------------
21 
25 class Hairpin : public ControlElement,
27  public TimeSpanningInterface,
28  public AttHairpinLog,
29  public AttHairpinVis,
30  public AttLineRendBase,
31  public AttPlacementRelStaff,
32  public AttVerticalGroup {
33 public:
39  Hairpin();
40  virtual ~Hairpin();
41  Object *Clone() const override { return new Hairpin(*this); }
42  void Reset() override;
43  std::string GetClassName() const override { return "hairpin"; }
45 
50  OffsetSpanningInterface *GetOffsetSpanningInterface() override { return vrv_cast<OffsetSpanningInterface *>(this); }
51  const OffsetSpanningInterface *GetOffsetSpanningInterface() const override
52  {
53  return vrv_cast<const OffsetSpanningInterface *>(this);
54  }
55  TimePointInterface *GetTimePointInterface() override { return vrv_cast<TimePointInterface *>(this); }
56  const TimePointInterface *GetTimePointInterface() const override
57  {
58  return vrv_cast<const TimePointInterface *>(this);
59  }
60  TimeSpanningInterface *GetTimeSpanningInterface() override { return vrv_cast<TimeSpanningInterface *>(this); }
61  const TimeSpanningInterface *GetTimeSpanningInterface() const override
62  {
63  return vrv_cast<const TimeSpanningInterface *>(this);
64  }
66 
71  int GetDrawingLength() const { return m_drawingLength; }
72  void SetDrawingLength(int length) { m_drawingLength = length; }
73  bool HasDrawingLength() const { return (m_drawingLength > 0); }
75 
76  int CalcHeight(const Doc *doc, int staffSize, char spanningType, const FloatingPositioner *leftHairpin,
77  const FloatingPositioner *rightHaipin) const;
78 
83  void SetLeftLink(ControlElement *leftLink);
84  ControlElement *GetLeftLink() { return m_leftLink; }
85  const ControlElement *GetLeftLink() const { return m_leftLink; }
86  void SetRightLink(ControlElement *rightLink);
87  ControlElement *GetRightLink() { return m_rightLink; }
88  const ControlElement *GetRightLink() const { return m_rightLink; }
90 
95  std::pair<int, int> GetBarlineOverlapAdjustment(int doubleUnit, int leftX, int rightX, int spanningType) const;
96 
97  //----------//
98  // Functors //
99  //----------//
100 
105  FunctorCode Accept(Functor &functor) override;
106  FunctorCode Accept(ConstFunctor &functor) const override;
107  FunctorCode AcceptEnd(Functor &functor) override;
108  FunctorCode AcceptEnd(ConstFunctor &functor) const override;
110 
111 protected:
112  //
113 private:
114  //
115 public:
116  //
117 private:
122  ControlElement *m_leftLink;
123 
128  ControlElement *m_rightLink;
129 
133  int m_drawingLength;
134 };
135 
136 } // namespace vrv
137 
138 #endif
This abstract class is the base class for all const functors.
Definition: functor.h:126
This class represents elements appearing within a measure.
Definition: controlelement.h:35
This abstract class is the base class for all mutable functors.
Definition: functor.h:101
This class models the MEI <hairpin> element.
Definition: hairpin.h:32
void Reset() override
Virtual reset method.
Object * Clone() const override
Method call for copying child classes.
Definition: hairpin.h:41
FunctorCode Accept(Functor &functor) override
Interface for class functor visitation.
std::pair< int, int > GetBarlineOverlapAdjustment(int doubleUnit, int leftX, int rightX, int spanningType) const
Get left/right adjustments that needs to be done to the hairpin with set coordinates (leftX,...
This class represents a basic object.
Definition: object.h:64
This class is an interface for elements having spanning visual offsets, such as slur,...
Definition: offsetinterface.h:72
This class is an interface for spanning elements, such as slur, hairpin, etc.
Definition: timeinterface.h:145