MUSX Document Model
Loading...
Searching...
No Matches
musx::dom::smartshape::EndPoint Class Reference

Represents an endpoint of the smart shape. More...

#include <SmartShape.h>

+ Inheritance diagram for musx::dom::smartshape::EndPoint:

Public Member Functions

StaffCmper calcStaff () const
 Calculates the staff the endpoint is on.
 
MeasCmper calcMeasure () const
 Calculates the measure the endpoint is in.
 
bool calcIsValid () const
 Finale can leave dead smart shapes around. This function calculates if the endpoint's entry, if any, exists and that the endpoint measure (see calcMeasure) exists in the document.
 
util::Fraction calcPosition () const
 Calculates the staff-level position of the endpoint within its measure, based on whether it is measure- or entry-attached.
 
util::Fraction calcGlobalPosition () const
 Calculates the global position of the endpoint within its measure, based on whether it is measure- or entry-attached.
 
int compareMetricPosition (const EndPoint &other) const
 Compares the metric position of two endpoints.
 
EntryInfoPtr calcAssociatedEntry (bool findExact=false) const
 Calculates the entry associated with the endpoint.
 
MusxInstance< others::SmartShapeMeasureAssigngetMeasureAssignment () const
 Gets the measure assignment for this endpoint or null if none.
 
MusxInstance< details::SmartShapeEntryAssigngetEntryAssignment () const
 Gets the entry assignment for this endpoint or null if none. Always null for measure-assigned endpoints.
 
bool calcIsAssigned () const
 Return true if this endpoint is properly assigned to its measure and to its entry (for entry-attached endpoints).
 
MusxInstance< others::StaffCompositecreateCurrentStaff () const
 Return true if this endpoint is properly assigned to its measure and to its entry (for entry-attached endpoints).
 
 ContainedClassBase (const MusxInstance< EnigmaBase > &parent)
 Constructs a ContainedClassBase object.
 
- Public Member Functions inherited from musx::dom::ContainedClassBase
 ContainedClassBase (const MusxInstance< EnigmaBase > &parent)
 Constructs a ContainedClassBase object.
 
template<typename ParentClass = EnigmaBase>
MusxInstance< ParentClass > getParent () const
 Get the parent.
 
- Public Member Functions inherited from musx::dom::EnigmaBase
Cmper getSourcePartId () const
 Gets the source partId for this instance. If an instance is fully shared with the score, the source is SCORE_PARTID. If an instance is partially shared or non shared, the source is the ID of the part that sourced it.
 
ShareMode getShareMode () const
 Gets the sharing mode for this instance.
 
virtual void integrityCheck (const std::shared_ptr< EnigmaBase > &ptrToThis)
 Performs a final consistency check after population.
 
virtual bool requireAllFields () const
 Returns true if all fields are required for valid input.
 
- Public Member Functions inherited from musx::dom::DocumentElement
virtual ~DocumentElement () noexcept(false)=default
 Virtual destructor for polymorphic behavior.
 
DocumentPtr getDocument () const
 Gets a reference to the Document.
 
Cmper getPartId () const
 Gets the part id associated with this instance.
 

Static Public Member Functions

static const xml::XmlElementArray< EndPoint > & xmlMappingArray ()
 Required for musx::factory::FieldPopulator.
 

Public Attributes

StaffCmper staffId {}
 Staff ID (xml node is <inst>)
 
MeasCmper measId {}
 Measure ID (xml node is <meas>)
 
Edu eduPosition {}
 Edu position of endpoint (xml node is <edu>)
 
EntryNumber entryNumber {}
 Entry number. Zero if the endpoint is not entry-attached. (xml node is <entryNum>)
 

Additional Inherited Members

- Public Types inherited from musx::dom::EnigmaBase
enum class  ShareMode { All , Partial , None }
 Describes how this instance is shared between part and score. More...
 
- Protected Member Functions inherited from musx::dom::ContainedClassBase
ContainedClassBaseoperator= (const ContainedClassBase &other)
 Copy assignment preserves the destination DOM instance's document and parent.
 
ContainedClassBaseoperator= (ContainedClassBase &&other) noexcept
 Move assignment preserves the destination DOM instance's document and parent.
 
- Protected Member Functions inherited from musx::dom::EnigmaBase
 EnigmaBase (const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode)
 Constructs the base class.
 
 EnigmaBase (const EnigmaBase &)=default
 explicit default copy constructor
 
 EnigmaBase (EnigmaBase &&) noexcept=default
 explicit default move constructor
 
EnigmaBaseoperator= (const EnigmaBase &)
 Copy assignment preserves the destination DOM instance's document, source part, and sharing mode.
 
EnigmaBaseoperator= (EnigmaBase &&) noexcept
 Move assignment preserves the destination DOM instance's document, source part, and sharing mode.
 
- Protected Member Functions inherited from musx::dom::DocumentElement
 DocumentElement (const DocumentWeakPtr &document, Cmper partId)
 Constructs the document element.
 
 DocumentElement (const DocumentElement &)=default
 explicit default copy constructor
 
 DocumentElement (DocumentElement &&) noexcept=default
 explicit default move constructor
 
DocumentElementoperator= (const DocumentElement &)
 Copy assignment preserves the destination DOM instance's document and part ID.
 
DocumentElementoperator= (DocumentElement &&) noexcept
 Move assignment preserves the destination DOM instance's document and part ID.
 

Detailed Description

Represents an endpoint of the smart shape.

Member Function Documentation

◆ calcAssociatedEntry()

EntryInfoPtr musx::dom::smartshape::EndPoint::calcAssociatedEntry ( bool  findExact = false) const

Calculates the entry associated with the endpoint.

Note
This function does not check for an actual assignment. It simply returns an entry the endpoint would be associated with if it were assigned. Use calcIsAssigned to determine if the endpoint is actually assigned.
Parameters
findExactIf true, only return an entry whose horizontal position matches the endpoint within 1 EVPU. No fallback search is performed. If false, return the closest entry in the measure, provided it lies within a quarter-beat of the endpoint.
Returns
The entry if the endpoint is entry-attached or measure-attached within 1 Edu of an entry. Null if not.

◆ calcMeasure()

MeasCmper musx::dom::smartshape::EndPoint::calcMeasure ( ) const

Calculates the measure the endpoint is in.

An entry-attached endpoint is in its entry's measure, even when measId disagrees; any other endpoint is in measId. Prefer this over reading measId, with the same exception as calcStaff.

◆ calcStaff()

StaffCmper musx::dom::smartshape::EndPoint::calcStaff ( ) const

Calculates the staff the endpoint is on.

An entry-attached endpoint is on its entry's staff, even when staffId disagrees; any other endpoint is on staffId. Prefer this over reading staffId, except to find the endpoint's assignments, which Finale keeps at the recorded staffId and measId. (See getMeasureAssignment.)

◆ compareMetricPosition()

int musx::dom::smartshape::EndPoint::compareMetricPosition ( const EndPoint other) const

Compares the metric position of two endpoints.

Parameters
otherThe endpoint to compare.
Returns
Integer value where
  • negative (-1) means this is before other.
  • 0 means the endpoints have the same metric position.
  • positive (+1) means this is after other.

◆ ContainedClassBase()

musx::dom::ContainedClassBase::ContainedClassBase ( const MusxInstance< EnigmaBase > &  parent)
inline

Constructs a ContainedClassBase object.

Parameters
parentA shared pointer to the parent document.