Verovio
Source code documentation
artic.h
1 // Name: artic.h
3 // Author: Laurent Pugin
4 // Created: 2016
5 // Copyright (c) Authors and others. All rights reserved.
7 
8 #ifndef __VRV_ARTIC_H__
9 #define __VRV_ARTIC_H__
10 
11 #include "atts_externalsymbols.h"
12 #include "atts_gestural.h"
13 #include "atts_shared.h"
14 #include "layerelement.h"
15 #include "offsetinterface.h"
16 
17 namespace vrv {
18 
19 //----------------------------------------------------------------------------
20 // Artic
21 //----------------------------------------------------------------------------
22 
23 class Artic : public LayerElement,
24  public OffsetInterface,
25  public AttArticulation,
26  public AttArticulationGes,
27  public AttColor,
28  public AttEnclosingChars,
29  public AttExtSymAuth,
30  public AttExtSymNames,
31  public AttPlacementRelEvent {
32 public:
38  Artic();
39  virtual ~Artic();
40  Object *Clone() const override { return new Artic(*this); }
41  void Reset() override;
42  std::string GetClassName() const override { return "artic"; }
44 
49  OffsetInterface *GetOffsetInterface() override { return vrv_cast<OffsetInterface *>(this); }
50  const OffsetInterface *GetOffsetInterface() const override { return vrv_cast<const OffsetInterface *>(this); }
52 
54  bool HasToBeAligned() const override { return true; }
55 
57  bool IsRelativeToStaff() const override { return true; }
58 
59  data_ARTICULATION GetArticFirst() const;
60 
61  void GetAllArtics(bool direction, std::vector<Artic *> &artics);
62 
67  bool IsInsideArtic() const;
68  bool IsOutsideArtic() const { return !IsInsideArtic(); };
70 
74  bool AlwaysAbove() const;
75 
76  void AddSlurPositioner(FloatingCurvePositioner *positioner, bool start);
77 
82  data_STAFFREL GetDrawingPlace() const { return m_drawingPlace; }
83  void SetDrawingPlace(data_STAFFREL drawingPlace) { m_drawingPlace = drawingPlace; }
85 
89  char32_t GetArticGlyph(data_ARTICULATION artic, data_STAFFREL place) const;
90 
94  std::pair<char32_t, char32_t> GetEnclosingGlyphs() const;
95 
96  //----------------//
97  // Static methods //
98  //----------------//
99 
105  static bool VerticalCorr(char32_t code, data_STAFFREL place);
106 
110  static bool IsCentered(data_ARTICULATION artic);
111 
112  //----------//
113  // Functors //
114  //----------//
115 
120  FunctorCode Accept(Functor &functor) override;
121  FunctorCode Accept(ConstFunctor &functor) const override;
122  FunctorCode AcceptEnd(Functor &functor) override;
123  FunctorCode AcceptEnd(ConstFunctor &functor) const override;
125 
126 private:
127  bool IsInsideArtic(data_ARTICULATION artic) const;
128 
129 public:
130  std::vector<FloatingCurvePositioner *> m_startSlurPositioners;
131  std::vector<FloatingCurvePositioner *> m_endSlurPositioners;
132 
136  static const std::vector<data_ARTICULATION> s_outStaffArtic;
140  static const std::vector<data_ARTICULATION> s_aboveStaffArtic;
141 
142 private:
143  //
144  data_STAFFREL m_drawingPlace;
145 };
146 
147 } // namespace vrv
148 
149 #endif
Definition: artic.h:31
static bool IsCentered(data_ARTICULATION artic)
Static method that returns true if the data_ARTICULATION has to be centered between staff lines.
data_STAFFREL GetDrawingPlace() const
Getter and setter for the drawing place.
Definition: artic.h:82
std::pair< char32_t, char32_t > GetEnclosingGlyphs() const
Retrieve parentheses / brackets from the enclose attribute.
Object * Clone() const override
Method call for copying child classes.
Definition: artic.h:40
bool IsRelativeToStaff() const override
Override the method since it is align to the staff.
Definition: artic.h:57
FunctorCode Accept(Functor &functor) override
Interface for class functor visitation.
static const std::vector< data_ARTICULATION > s_aboveStaffArtic
A static array for storing the articulation that have to be place above the staff is possible.
Definition: artic.h:140
static bool VerticalCorr(char32_t code, data_STAFFREL place)
Static method that retrieves the vertical correction for a SMuFL code with data_STAFFREL.
void Reset() override
Virtual reset method.
char32_t GetArticGlyph(data_ARTICULATION artic, data_STAFFREL place) const
Retrieves the appropriate SMuFL code for a data_ARTICULATION with data_STAFFREL.
bool AlwaysAbove() const
Check if the articList contains data_ARTICULATION has to be place above staff.
bool HasToBeAligned() const override
Override the method since alignment is required.
Definition: artic.h:54
bool IsInsideArtic() const
Return the inside and outside part of an artic if any (NULL otherwiser)
static const std::vector< data_ARTICULATION > s_outStaffArtic
A static array for storing the articulation that have to be placed outside the staff.
Definition: artic.h:136
This abstract class is the base class for all const functors.
Definition: functor.h:126
This class represents a basic object for a curve (slur, tie) in the layout domain.
Definition: floatingobject.h:329
This abstract class is the base class for all mutable functors.
Definition: functor.h:101
This class is a base class for the Layer (<layer>) content.
Definition: layerelement.h:51
This class represents a basic object.
Definition: object.h:64
This class is an interface for elements having a single visual offset, such as arpeg,...
Definition: offsetinterface.h:28