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,
26  public TimeSpanningInterface,
27  public AttHairpinLog,
28  public AttHairpinVis,
29  public AttLineRendBase,
30  public AttPlacementRelStaff,
31  public AttVerticalGroup {
32 public:
37  Hairpin();
39  virtual ~Hairpin();
40  Object *Clone() const override { return new Hairpin(*this); }
41  void Reset() override;
42  std::string GetClassName() const override { return "hairpin"; }
44 
48  TimePointInterface *GetTimePointInterface() override { return vrv_cast<TimePointInterface *>(this); }
50  const TimePointInterface *GetTimePointInterface() const override
51  {
52  return vrv_cast<const TimePointInterface *>(this);
53  }
54  TimeSpanningInterface *GetTimeSpanningInterface() override { return vrv_cast<TimeSpanningInterface *>(this); }
55  const TimeSpanningInterface *GetTimeSpanningInterface() const override
56  {
57  return vrv_cast<const TimeSpanningInterface *>(this);
58  }
60 
64  int GetDrawingLength() const { return m_drawingLength; }
66  void SetDrawingLength(int length) { m_drawingLength = length; }
67  bool HasDrawingLength() const { return (m_drawingLength > 0); }
69 
70  int CalcHeight(const Doc *doc, int staffSize, char spanningType, const FloatingPositioner *leftHairpin,
71  const FloatingPositioner *rightHaipin) const;
72 
76  void SetLeftLink(ControlElement *leftLink);
78  ControlElement *GetLeftLink() { return m_leftLink; }
79  const ControlElement *GetLeftLink() const { return m_leftLink; }
80  void SetRightLink(ControlElement *rightLink);
81  ControlElement *GetRightLink() { return m_rightLink; }
82  const ControlElement *GetRightLink() const { return m_rightLink; }
84 
89  std::pair<int, int> GetBarlineOverlapAdjustment(int doubleUnit, int leftX, int rightX, int spanningType) const;
90 
91  //----------//
92  // Functors //
93  //----------//
94 
98  FunctorCode Accept(Functor &functor) override;
100  FunctorCode Accept(ConstFunctor &functor) const override;
101  FunctorCode AcceptEnd(Functor &functor) override;
102  FunctorCode AcceptEnd(ConstFunctor &functor) const override;
104 
105 protected:
106  //
107 private:
108  //
109 public:
110  //
111 private:
116  ControlElement *m_leftLink;
117 
122  ControlElement *m_rightLink;
123 
127  int m_drawingLength;
128 };
129 
130 } // namespace vrv
131 
132 #endif
vrv::Object
This class represents a basic object.
Definition: object.h:59
vrv::Hairpin::Clone
Object * Clone() const override
Method call for copying child classes.
Definition: hairpin.h:40
vrv::Hairpin::Reset
void Reset() override
Virtual reset method.
vrv::ControlElement
This class represents elements appearing within a measure.
Definition: controlelement.h:28
vrv::TimeSpanningInterface
This class is an interface for spanning elements, such as slur, hairpin, etc.
Definition: timeinterface.h:141
vrv::Hairpin::Accept
FunctorCode Accept(Functor &functor) override
Interface for class functor visitation.
vrv::Hairpin::GetBarlineOverlapAdjustment
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,...
vrv::Hairpin
This class models the MEI <hairpin> element.
Definition: hairpin.h:25