8 #ifndef __VRV_MEASURE_H__
9 #define __VRV_MEASURE_H__
12 #include "atts_shared.h"
14 #include "facsimileinterface.h"
15 #include "horizontalaligner.h"
43 public AttMeterConformanceBar,
44 public AttNNumberLike,
48 using BarlineRenditionPair = std::pair<data_BARRENDITION, data_BARRENDITION>;
56 Measure(MeasureType measuredMusic = MEASURED,
int logMeasureNb = -1);
60 std::string GetClassName()
const override {
return "measure"; }
72 FacsimileInterface *GetFacsimileInterface()
override {
return vrv_cast<FacsimileInterface *>(
this); }
75 return vrv_cast<const FacsimileInterface *>(
this);
87 bool IsNeumeLine()
const {
return (m_measureType == NEUMELINE); }
94 void SetIndex(
int index) { m_index = index; }
132 void SetDrawingXRel(
int drawingXRel);
133 void CacheXRel(
bool restore =
false);
142 bool IsFirstInSystem()
const;
143 bool IsLastInSystem()
const;
161 data_BARRENDITION GetDrawingLeftBarLine()
const {
return m_leftBarLine.GetForm(); }
162 void SetDrawingLeftBarLine(data_BARRENDITION type) { m_leftBarLine.SetForm(type); }
163 data_BARRENDITION GetDrawingRightBarLine()
const {
return m_rightBarLine.GetForm(); }
164 void SetDrawingRightBarLine(data_BARRENDITION type) { m_rightBarLine.SetForm(type); }
165 data_BARRENDITION GetDrawingLeftBarLineByStaffN(
int staffN)
const;
166 data_BARRENDITION GetDrawingRightBarLineByStaffN(
int staffN)
const;
191 Measure *previous, ListOfObjects ¤tInvisible, ListOfObjects &previousInvisible,
int barlineDrawingFlags);
200 BarLine *GetLeftBarLine() {
return &m_leftBarLine; }
201 const BarLine *GetLeftBarLine()
const {
return &m_leftBarLine; }
202 BarLine *GetRightBarLine() {
return &m_rightBarLine; }
203 const BarLine *GetRightBarLine()
const {
return &m_rightBarLine; }
215 int GetLeftBarLineXRel()
const;
216 int GetLeftBarLineLeft()
const;
217 int GetLeftBarLineRight()
const;
218 int GetRightBarLineXRel()
const;
219 int GetRightBarLineLeft()
const;
220 int GetRightBarLineRight()
const;
248 int GetCachedOverflow()
const {
return m_cachedOverflow; }
249 void ResetCachedWidth() { m_cachedWidth = VRV_UNSET; }
250 void ResetCachedOverflow() { m_cachedOverflow = VRV_UNSET; }
268 ScoreDef *GetDrawingScoreDef() {
return m_drawingScoreDef; }
269 const ScoreDef *GetDrawingScoreDef()
const {
return m_drawingScoreDef; }
270 void SetDrawingScoreDef(ScoreDef *drawingScoreDef);
271 void ResetDrawingScoreDef();
278 Ending *GetDrawingEnding() {
return m_drawingEnding; }
279 const Ending *GetDrawingEnding()
const {
return m_drawingEnding; }
280 void SetDrawingEnding(Ending *ending) { m_drawingEnding = ending; }
288 bool HasAlignmentRefWithMultipleLayers()
const {
return m_hasAlignmentRefWithMultipleLayers; }
289 void HasAlignmentRefWithMultipleLayers(
bool hasRef) { m_hasAlignmentRefWithMultipleLayers = hasRef; }
295 std::vector<Staff *> GetFirstStaffGrpStaves(ScoreDef *scoreDef);
317 double GetRealTimeOnsetMilliseconds(
int repeat = VRV_UNSET)
const;
318 Fraction GetScoreTimeOffset(
int repeat = VRV_UNSET)
const;
319 double GetRealTimeOffsetMilliseconds(
int repeat = VRV_UNSET)
const;
327 void AddScoreTimeOnset(
Fraction offset) { m_scoreTimeOnset.push_back(offset); }
328 void ClearRealTimeOnsetMilliseconds() { m_realTimeOnsetMilliseconds.clear(); }
329 void AddRealTimeOnsetMilliseconds(
double milliseconds) { m_realTimeOnsetMilliseconds.push_back(milliseconds); }
330 void ClearScoreTimeOffset() { m_scoreTimeOffset.clear(); }
331 void AddScoreTimeOffset(Fraction offset) { m_scoreTimeOffset.push_back(offset); }
332 void ClearRealTimeOffsetMilliseconds() { m_realTimeOffsetMilliseconds.clear(); }
333 void AddRealTimeOffsetMilliseconds(
double milliseconds) { m_realTimeOffsetMilliseconds.push_back(milliseconds); }
341 double GetCurrentTempo()
const {
return m_currentTempo; }
359 FunctorCode AcceptEnd(
Functor &functor)
override;
360 FunctorCode AcceptEnd(
ConstFunctor &functor)
const override;
365 enum BarlineDrawingFlags {
367 SCORE_DEF_INSERT = 0x2,
368 INVISIBLE_MEASURE_CURRENT = 0x4,
369 INVISIBLE_MEASURE_PREVIOUS = 0x8
403 int m_cachedOverflow;
412 MeasureType m_measureType;
443 bool m_hasAlignmentRefWithMultipleLayers;
449 std::vector<Fraction> m_scoreTimeOnset;
450 std::vector<double> m_realTimeOnsetMilliseconds;
451 std::vector<Fraction> m_scoreTimeOffset;
452 std::vector<double> m_realTimeOffsetMilliseconds;
453 double m_currentTempo;
455 std::map<int, BarlineRenditionPair> m_invisibleStaffBarlines;
This class models the MEI <barLine> element.
Definition: barline.h:34
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 class represents a MEI ending.
Definition: ending.h:33
Definition: facsimileinterface.h:27
Definition: fraction.h:19
This abstract class is the base class for all mutable functors.
Definition: functor.h:101
This class aligns the content of a measure It contains a vector of Alignment.
Definition: horizontalaligner.h:425
This class represents a measure in a page-based score (Doc).
Definition: measure.h:46
int m_drawingXRel
The X relative position of the measure.
Definition: measure.h:392
int GetInnerCenterX() const
Return the center x of the inner of the measure.
bool AddChildAdditionalCheck(Object *child) override
Additional check when adding a child.
std::vector< std::pair< LayerElement *, LayerElement * > > GetInternalTieEndpoints()
Return vector with tie endpoints for ties that start and end in current measure.
bool IsSupportedChild(ClassId classId) override
Methods for adding allowed content.
int GetDrawingX() const override
Get the X drawing position.
MeasureAligner m_measureAligner
The measure aligner that holds the x positions of the content of the measure.
Definition: measure.h:383
int GetIndex() const
Get and set the measure index.
Definition: measure.h:93
Object * Clone() const override
Method call for copying child classes.
Definition: measure.h:58
void SetCurrentTempo(double tempo)
Setter and getter for the current tempo.
Definition: measure.h:340
int GetSectionRestartShift(const Doc *doc) const
Calculates the section restart shift.
int GetCachedWidth() const
Return and reset the cached width / overflow.
Definition: measure.h:247
int GetNonJustifiableLeftMargin() const
Return the non-justifiable left margin for the measure.
Definition: measure.h:209
bool IsMeasuredMusic() const
Return true if measured music (otherwise we have fake measures)
Definition: measure.h:82
int GetInnerWidth() const
Return the inner width of the measure.
int GetMeasureIdx() const
Return the index position of the measure in its system parent.
Definition: measure.h:149
bool HasCachedHorizontalLayout() const
Return true if the Measure has cached values for the horizontal layout.
Definition: measure.h:115
bool IsNeumeLine() const
Return true if the measure represents a neume (section) line.
Definition: measure.h:87
int m_cachedXRel
The cached value for m_drawingXRel for caching horizontal layout.
Definition: measure.h:397
int m_drawingFacsX1
The X absolute position of the measure for facsimile (transcription) encodings.
Definition: measure.h:376
int EnclosesTime(int time) const
Check if the measure encloses the given time (in millisecond) Return the playing repeat time (1-based...
int CalculateRightBarLineWidth(const Doc *doc, int staffSize) const
Return the width of the right barline based on the barline form.
void SetInvisibleStaffBarlines(Measure *previous, ListOfObjects ¤tInvisible, ListOfObjects &previousInvisible, int barlineDrawingFlags)
Create mapping of original barline values to staves in the measure that are neighbored by invisible s...
Fraction GetScoreTimeOnset(int repeat=VRV_UNSET) const
Read-only access to onset and offset.
int GetDrawingOverflow()
Return the right overflow of the control events in the measure.
int GetWidth() const
Return the width of the measure, including the barLine width.
void ResetCachedDrawingX() const override
Reset the cached values of the drawingX values.
void Reset() override
Virtual reset method.
void ClearScoreTimeOnset()
Setter for the time offset.
Definition: measure.h:326
void SetDrawingBarLines(Measure *previous, int barlineDrawingFlags)
Set the drawing barlines for the measure.
bool HasInvisibleStaffBarlines() const
Return whether there is mapping of barline values to invisible staves present in measure.
Definition: measure.h:172
void CloneReset() override
Overriding CloneReset() method to be called after copy / assignment calls.
Staff * GetBottomVisibleStaff()
Return the bottom (last) visible staff in the measure (if any).
FunctorCode Accept(Functor &functor) override
Interface for class functor visitation.
BarlineRenditionPair SelectDrawingBarLines(const Measure *previous) const
Select drawing barlines based on the previous right and current left barlines (to avoid duplicated do...
void AddChildBack(Object *object)
Specific method for measures.
This class represents a basic object.
Definition: object.h:61
int GetIdx() const
Return the index position of the object in its parent (-1 if not found)
This class represents a MEI scoreDef.
Definition: scoredef.h:135
This class represents a staff in a laid-out score (Doc).
Definition: staff.h:107
This class stores the timestamps (TimestampsAttr) in a measure.
Definition: horizontalaligner.h:664