11 #include "controlelement.h"
12 #include "timeinterface.h"
29 std::vector<const LayerElement *> elements;
30 std::set<int> layersN;
42 bool endPointsAdjusted;
46 enum class SlurCurveDirection { None, Above, Below, AboveBelow, BelowAbove };
47 enum class PortatoSlurType { None, StemSide, Centered };
57 public AttLineRendBase {
65 Slur(ClassId classId);
69 std::string GetClassName()
const override {
return "slur"; }
76 TimePointInterface *GetTimePointInterface()
override {
return vrv_cast<TimePointInterface *>(
this); }
77 const TimePointInterface *GetTimePointInterface()
const override
79 return vrv_cast<const TimePointInterface *>(
this);
81 TimeSpanningInterface *GetTimeSpanningInterface()
override {
return vrv_cast<TimeSpanningInterface *>(
this); }
82 const TimeSpanningInterface *GetTimeSpanningInterface()
const override
84 return vrv_cast<const TimeSpanningInterface *>(
this);
92 SlurCurveDirection GetDrawingCurveDir()
const {
return m_drawingCurveDir; }
93 void SetDrawingCurveDir(SlurCurveDirection curveDir) { m_drawingCurveDir = curveDir; }
94 bool HasDrawingCurveDir()
const {
return (m_drawingCurveDir != SlurCurveDirection::None); }
95 curvature_CURVEDIR CalcDrawingCurveDir(
char spanningType)
const;
102 bool HasMixedCurveDir()
const
104 return (m_drawingCurveDir == SlurCurveDirection::AboveBelow)
105 || (m_drawingCurveDir == SlurCurveDirection::BelowAbove);
107 bool HasEndpointAboveStart()
const
109 return (m_drawingCurveDir == SlurCurveDirection::Above)
110 || (m_drawingCurveDir == SlurCurveDirection::AboveBelow);
112 bool HasEndpointBelowStart()
const
114 return (m_drawingCurveDir == SlurCurveDirection::Below)
115 || (m_drawingCurveDir == SlurCurveDirection::BelowAbove);
117 bool HasEndpointAboveEnd()
const
119 return (m_drawingCurveDir == SlurCurveDirection::Above)
120 || (m_drawingCurveDir == SlurCurveDirection::BelowAbove);
122 bool HasEndpointBelowEnd()
const
124 return (m_drawingCurveDir == SlurCurveDirection::Below)
125 || (m_drawingCurveDir == SlurCurveDirection::AboveBelow);
132 bool HasInnerSlur(
const Slur *innerSlur)
const;
162 const Staff *GetBoundaryCrossStaff()
const;
180 FunctorCode AcceptEnd(
Functor &functor)
override;
181 FunctorCode AcceptEnd(
ConstFunctor &functor)
const override;
192 void AddSpannedElements(
207 int x1,
int x2, curvature_CURVEDIR drawingCurveDir,
char spanningType)
const;
209 bool ConsiderMelodicDirection()
const;
211 std::pair<int, int> GetStartEndLocs(
212 const Note *startNote,
const Chord *startChord,
const Note *endNote,
const Chord *endChord)
const;
214 int CalcPitchDifference(
const Staff *staff,
int startLoc,
int endLoc)
const;
216 PortatoSlurType IsPortatoSlur(
const Doc *doc,
const Note *startNote,
const Chord *startChord)
const;
218 bool StartsOnBeam()
const {
return this->HasBoundaryOnBeam(
true); }
219 bool EndsOnBeam()
const {
return this->HasBoundaryOnBeam(
false); }
220 bool HasBoundaryOnBeam(
bool isStart)
const;
222 float GetAdjustedSlurAngle(
const Doc *doc, Point &p1, Point &p2, curvature_CURVEDIR curveDir)
const;
233 SlurCurveDirection m_drawingCurveDir;
Simple class for representing bezier cCurve.
Definition: devicecontextbase.h:258
This class represents a collection of notes in the same layer with the same onset time.
Definition: chord.h:44
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:33
This class is a hold the data and corresponds to the model of a MVC design pattern.
Definition: doc.h:41
This class represents a basic object for a curve (slur, tie) in the layout domain.
Definition: floatingobject.h:329
This class represents a basic object in the layout domain.
Definition: floatingobject.h:165
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 models the MEI <note> element.
Definition: note.h:67
This class represents a basic object.
Definition: object.h:61
void Reset() override
Virtual reset method.
void AddPositionerToArticulations(FloatingCurvePositioner *curve)
Add curve positioner to articulations.
void InitBezierControlSides(BezierCurve &bezier, curvature_CURVEDIR curveDir) const
Set the bezier control sides depending on the curve direction.
FunctorCode Accept(Functor &functor) override
Interface for class functor visitation.
void CalcInitialCurve(const Doc *doc, FloatingCurvePositioner *curve, NearEndCollision *nearEndCollision=NULL)
Calculate the initial slur bezier curve and store it in the curve positioner.
Object * Clone() const override
Method call for copying child classes.
Definition: slur.h:67
void CalcSpannedElements(FloatingCurvePositioner *curve)
Recalculate the spanned elements of the curve positioner.
std::pair< const Layer *, const LayerElement * > GetBoundaryLayer() const
Determine the slur's layer/cross staff by only considering the boundary.
Staff * CalculatePrincipalStaff(const Staff *staff, int xMin, int xMax)
Calculate the staff where the slur's floating curve positioner lives.
This class represents a staff in a laid-out score (Doc).
Definition: staff.h:107
This class is an interface for elements having a single time point, such as tempo,...
Definition: timeinterface.h:39
This class is an interface for spanning elements, such as slur, hairpin, etc.
Definition: timeinterface.h:145
Measure collisions near the end points.
Definition: slur.h:39
Contains the layer elements used for collision detection.
Definition: slur.h:28