11 #include "controlelement.h"
12 #include "offsetinterface.h"
13 #include "timeinterface.h"
30 std::vector<const LayerElement *> elements;
31 std::set<int> layersN;
43 bool endPointsAdjusted;
47 enum class SlurCurveDirection { None, Above, Below, AboveBelow, BelowAbove };
48 enum class PortatoSlurType { None, StemSide, Centered };
59 public AttLineRendBase {
67 Slur(ClassId classId);
71 std::string GetClassName()
const override {
return "slur"; }
78 OffsetSpanningInterface *GetOffsetSpanningInterface()
override {
return vrv_cast<OffsetSpanningInterface *>(
this); }
79 const OffsetSpanningInterface *GetOffsetSpanningInterface()
const override
81 return vrv_cast<const OffsetSpanningInterface *>(
this);
83 TimePointInterface *GetTimePointInterface()
override {
return vrv_cast<TimePointInterface *>(
this); }
84 const TimePointInterface *GetTimePointInterface()
const override
86 return vrv_cast<const TimePointInterface *>(
this);
88 TimeSpanningInterface *GetTimeSpanningInterface()
override {
return vrv_cast<TimeSpanningInterface *>(
this); }
89 const TimeSpanningInterface *GetTimeSpanningInterface()
const override
91 return vrv_cast<const TimeSpanningInterface *>(
this);
99 SlurCurveDirection GetDrawingCurveDir()
const {
return m_drawingCurveDir; }
100 void SetDrawingCurveDir(SlurCurveDirection curveDir) { m_drawingCurveDir = curveDir; }
101 bool HasDrawingCurveDir()
const {
return (m_drawingCurveDir != SlurCurveDirection::None); }
102 curvature_CURVEDIR CalcDrawingCurveDir(
char spanningType)
const;
109 bool HasMixedCurveDir()
const
111 return (m_drawingCurveDir == SlurCurveDirection::AboveBelow)
112 || (m_drawingCurveDir == SlurCurveDirection::BelowAbove);
114 bool HasEndpointAboveStart()
const
116 return (m_drawingCurveDir == SlurCurveDirection::Above)
117 || (m_drawingCurveDir == SlurCurveDirection::AboveBelow);
119 bool HasEndpointBelowStart()
const
121 return (m_drawingCurveDir == SlurCurveDirection::Below)
122 || (m_drawingCurveDir == SlurCurveDirection::BelowAbove);
124 bool HasEndpointAboveEnd()
const
126 return (m_drawingCurveDir == SlurCurveDirection::Above)
127 || (m_drawingCurveDir == SlurCurveDirection::BelowAbove);
129 bool HasEndpointBelowEnd()
const
131 return (m_drawingCurveDir == SlurCurveDirection::Below)
132 || (m_drawingCurveDir == SlurCurveDirection::AboveBelow);
139 bool HasInnerSlur(
const Slur *innerSlur)
const;
169 const Staff *GetBoundaryCrossStaff()
const;
187 FunctorCode AcceptEnd(
Functor &functor)
override;
188 FunctorCode AcceptEnd(
ConstFunctor &functor)
const override;
199 void AddSpannedElements(
214 int x1,
int x2, curvature_CURVEDIR drawingCurveDir,
char spanningType)
const;
216 bool ConsiderMelodicDirection()
const;
218 std::pair<int, int> GetStartEndLocs(
219 const Note *startNote,
const Chord *startChord,
const Note *endNote,
const Chord *endChord)
const;
221 int CalcPitchDifference(
const Staff *staff,
int startLoc,
int endLoc)
const;
223 PortatoSlurType IsPortatoSlur(
const Doc *doc,
const Note *startNote,
const Chord *startChord)
const;
225 bool StartsOnBeam()
const {
return this->HasBoundaryOnBeam(
true); }
226 bool EndsOnBeam()
const {
return this->HasBoundaryOnBeam(
false); }
227 bool HasBoundaryOnBeam(
bool isStart)
const;
229 float GetAdjustedSlurAngle(
const Doc *doc, Point &p1, Point &p2, curvature_CURVEDIR curveDir)
const;
240 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:35
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:69
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
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:69
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 spanning elements, such as slur, hairpin, etc.
Definition: timeinterface.h:145
Measure collisions near the end points.
Definition: slur.h:40
Contains the layer elements used for collision detection.
Definition: slur.h:29