12 #include "atts_shared.h"
13 #include "drawinginterface.h"
14 #include "layerelement.h"
18 class BeamElementCoord;
23 #define MAX_DURATION_PARTIALS 16
25 enum { PARTIAL_NONE = 0, PARTIAL_THROUGH, PARTIAL_RIGHT, PARTIAL_LEFT };
48 data_BEAMPLACE place = BEAMPLACE_NONE,
bool init =
true);
53 const ArrayOfBeamElementCoords *GetElementCoordRefs();
75 int GetStartingX()
const;
76 int GetStartingY()
const;
83 bool StemSameas()
const {
return (m_stemSameasRole != SAMEAS_NONE); }
84 bool StemSameasIsUnset()
const {
return (m_stemSameasRole == SAMEAS_UNSET); }
85 bool StemSameasIsPrimary()
const {
return (m_stemSameasRole == SAMEAS_PRIMARY); }
86 bool StemSameasIsSecondary()
const {
return (m_stemSameasRole == SAMEAS_SECONDARY); }
95 void InitSameasRoles(Beam *sameasBeam, data_BEAMPLACE &drawingPlace);
96 void UpdateSameasRoles(data_BEAMPLACE place);
97 void CalcNoteHeadShiftForStemSameas(Beam *sameasBeam, data_BEAMPLACE place);
110 void AdjustBeamToLedgerLines(
121 void CalcBeamInitForNotePair(
const Note *note1,
const Note *note2,
const Staff *staff,
int &yMax,
int &yMin);
125 int CalcBeamSlopeStep(
144 data_BEAMPLACE place);
147 void CalcBeamStemLength(
const Staff *staff, data_BEAMPLACE place,
bool isHorizontal);
156 int CalcMixedBeamCenterY(
int step,
int unit)
const;
159 std::tuple<int, int, data_DURATION> CalcStemDefiningNote(
const Staff *staff, data_BEAMPLACE place)
const;
165 void CalcMixedBeamPlace(
const Staff *staff);
168 void CalcPartialFlagPlace();
171 void CalcSetValues();
174 bool DoesBeamOverlap(
175 const BeamDrawingInterface *beamInterface,
int topBorder,
int bottomBorder,
int minStemLength)
const;
188 int m_nbNotesOrChords;
190 int m_verticalCenter;
191 int m_ledgerLinesAbove;
192 int m_ledgerLinesBelow;
193 int m_uniformStemLength;
194 data_BEAMPLACE m_weightedPlace;
214 StemSameasDrawingRole m_stemSameasRole;
215 StemSameasDrawingRole *m_stemSameasReverseRole;
236 void SetMeasure(Measure *measure) { m_measure = measure; }
237 Staff *GetStaff() {
return m_staff; }
238 const Staff *GetStaff()
const {
return m_staff; }
239 void SetStaff(Staff *staff) { m_staff = staff; }
240 Layer *GetLayer() {
return m_layer; }
241 const Layer *GetLayer()
const {
return m_layer; }
242 void SetLayer(Layer *layer) { m_layer = layer; }
243 BeamElementCoord *GetBeginCoord() {
return m_begin; }
244 const BeamElementCoord *GetBeginCoord()
const {
return m_begin; }
245 void SetBeginCoord(BeamElementCoord *begin) { m_begin = begin; }
246 BeamElementCoord *GetEndCoord() {
return m_end; }
247 const BeamElementCoord *GetEndCoord()
const {
return m_end; }
248 void SetEndCoord(BeamElementCoord *end) { m_end = end; }
257 int GetSpanningType()
const {
return m_spanningType; }
261 void AppendSpanningCoordinates(
const Measure *measure);
272 int m_spanningType = SPANNING_START_END;
281 public AttBeamedWith,
294 void Reset()
override;
295 std::string GetClassName()
const override {
return "beam"; }
307 BeamDrawingInterface *GetBeamDrawingInterface()
override {
return vrv_cast<BeamDrawingInterface *>(
this); }
310 return vrv_cast<const BeamDrawingInterface *>(
this);
314 int GetNoteCount()
const {
return this->GetChildCount(NOTE); }
325 const ArrayOfBeamElementCoords *GetElementCoords();
338 bool HasStemSameasBeam()
const {
return (m_stemSameas); }
339 Beam *GetStemSameasBeam() {
return m_stemSameas; }
340 const Beam *GetStemSameasBeam()
const {
return m_stemSameas; }
341 void SetStemSameasBeam(Beam *stemSameas) { m_stemSameas = stemSameas; }
367 FunctorCode AcceptEnd(
Functor &functor)
override;
368 FunctorCode AcceptEnd(
ConstFunctor &functor)
const override;
376 void FilterList(ListOfConstObjects &childList)
const override;
404 m_closestNote = NULL;
408 m_beamRelativePlace = BEAMPLACE_NONE;
409 m_partialFlagPlace = BEAMPLACE_NONE;
419 void SetDrawingStemDir(data_STEMDIRECTION stemDir,
const Staff *staff,
const Doc *doc,
const BeamSegment *segment,
427 const Staff *staff, data_STEMDIRECTION stemDir,
bool isHorizontal, data_DURATION preferredDur)
const;
456 data_BEAMPLACE m_beamRelativePlace;
457 char m_partialFlags[MAX_DURATION_PARTIALS];
458 data_BEAMPLACE m_partialFlagPlace;
This class is an interface for MEI beam elements (beam, beamSpan).
Definition: drawinginterface.h:97
int CalculateStemLengthTab(const Staff *staff, data_STEMDIRECTION stemDir) const
Helper for calculating the stem length for tablature beam placed outside the staff.
void UpdateStemLength(StemmedDrawingInterface *stemmedInterface, int y1, int y2, int stemAdjust, bool inMixedBeam)
Update stem length based on the calculated coordinates and stemAdjust value.
StemmedDrawingInterface * GetStemHolderInterface()
Helper to get the StemmedDrawingInterface associated with the m_element (if any) Return the Chord or ...
int CalculateStemLength(const Staff *staff, data_STEMDIRECTION stemDir, bool isHorizontal, data_DURATION preferredDur) const
Helper for calculating the stem length for staff notation and tablature beams within the staff.
data_STEMDIRECTION GetStemDir() const
Return the encoded stem direction.
void SetClosestNoteOrTabDurSym(data_STEMDIRECTION stemDir, bool outsideStaff)
Set the note or closest note for chord or tabdursym for tablature beams placed outside the staff.
int CalculateStemModAdjustment(int stemLength, int directionBias) const
Return stem length adjustment in half units, depending on the @stem.mode attribute.
std::pair< int, int > GetAdditionalBeamCount() const override
See DrawingInterface::GetAdditionalBeamCount.
bool IsTabBeam() const
Return true if the beam has a tabGrp child.
void FilterList(ListOfConstObjects &childList) const override
Filter the flat list and keep only Note and Chords elements.
void CloneReset() override
Overriding CloneReset() method to be called after copy / assignment calls.
FunctorCode Accept(Functor &functor) override
Interface for class functor visitation.
Object * Clone() const override
Method call for copying child classes.
Definition: beam.h:293
int GetBeamPartDuration(int x, bool includeRests=true) const
Return duration of the beam part that is closest to the specified object X position.
bool IsSupportedChild(ClassId classId) override
Add an element (a note or a rest) to a beam.
Class for storing drawing parameters when calculating beams.
Definition: beam.h:36
void RequestStaffSpace(const Doc *doc, const BeamDrawingInterface *beamInterface)
Request staff space for mixed beams if minimal stem length is too short.
void ClearCoordRefs()
Clear the m_beamElementCoords vector and delete all the objects.
ArrayOfBeamElementCoords m_beamElementCoordRefs
An array of coordinates for each element.
Definition: beam.h:202
void InitCoordRefs(const ArrayOfBeamElementCoords *beamElementCoords)
Initializes the m_beamElementCoords vector objects.
int GetAdjacentElementsDuration(int elementX) const
Get longest duration of the elements that are adjacent to the X coordinate passed.
Measure * GetMeasure()
Set/get methods for member variables.
Definition: beam.h:234
void SetSpanningType(int systemIndex, int systemCount)
Set/get methods for spanning type of segment.
This abstract class is the base class for all const functors.
Definition: functor.h:126
This class is a hold the data and corresponds to the model of a MVC design pattern.
Definition: doc.h:41
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 layer in a laid-out score (Doc).
Definition: layer.h:39
This class represents a measure in a page-based score (Doc).
Definition: measure.h:46
This class models the MEI <note> element.
Definition: note.h:67
This class represents a basic object.
Definition: object.h:61
This class represents a staff in a laid-out score (Doc).
Definition: staff.h:107
This class models a stem as a layer element part and as MEI <stem> element.
Definition: stem.h:27
This class is an interface for MEI stemmed element.
Definition: drawinginterface.h:353
This class models the MEI <tabDurSym> element.
Definition: tabdursym.h:29