MUSX Document Model
Loading...
Searching...
No Matches
musx::util::Tie Class Reference

Static class containing utilites for ties. More...

#include <Tie.h>

Classes

struct  ContourControlPoint
 Control point parameters for a tie contour. More...
 
struct  ContourControlPoints
 Control points for a tie contour (left/right endpoints). More...
 
struct  ContourGeometry
 Caller-supplied horizontal geometry used for contour span classification. More...
 
struct  ContourMetrics
 Combined contour metrics for tie geometry and control points. More...
 
struct  ContourResult
 Result of contour style classification. More...
 

Public Types

enum class  EndPointKind { Notehead , MeasureBoundary , SystemBoundary }
 Classifies what the tie endpoint attaches to for contour-length calculations. More...
 

Static Public Member Functions

static dom::CurveContourDirection calcDefaultDirection (const dom::NoteInfoPtr &noteInfo, bool forTieEnd=false)
 Calculates the default tie direction for the specified note.
 
static dom::CurveContourDirection calcEffectiveDirection (const dom::NoteInfoPtr &noteInfo, bool forTieEnd=false)
 Calculates the effective tie direction taking into account overrides and special rules.
 
static std::optional< std::pair< dom::TieConnectStyleType, dom::TieConnectStyleType > > calcConnectStyleTypes (const dom::NoteInfoPtr &noteInfo, bool forTieEnd)
 Calculates the connect style types for both endpoints of a tie.
 
static bool calcIsOuterConnectStyle (dom::TieConnectStyleType type)
 Returns true if the connect style is an outer placement.
 
static std::optional< dom::details::TieAlterBase::ConnectionTypecalcConnectionType (const dom::NoteInfoPtr &noteInfo, bool forTieEnd, bool forEndPoint, bool forPageView=true)
 Calculates the default connection type for a tie endpoint.
 
static dom::options::TieOptions::ConnectStyle calcEndpointOffsets (const dom::NoteInfoPtr &noteInfo, bool forTieEnd, bool forEndPoint, std::optional< dom::CurveContourDirection > direction=std::nullopt, bool forPageView=true)
 Resolves endpoint offsets for a tie endpoint from default policy and tie-alter overrides.
 
static std::optional< ContourResultcalcContourStyleType (const dom::NoteInfoPtr &noteInfo, const ContourGeometry &geometry, bool forTieEnd=false)
 Calculates the tie control style span using caller-supplied horizontal geometry.
 
static std::optional< ContourControlPointscalcDefaultContourControlPoints (const dom::NoteInfoPtr &noteInfo, dom::options::TieOptions::ControlStyleType styleType, dom::Evpu length)
 Calculates default contour control points (inset/height) for a given control style.
 
static std::optional< ContourControlPointscalcEffectiveContourControlPoints (const dom::NoteInfoPtr &noteInfo, bool forTieEnd, dom::options::TieOptions::ControlStyleType styleType, dom::Evpu length)
 Calculates effective contour control points (inset/height) for a tie.
 
static std::optional< ContourMetricscalcEffectiveContourMetrics (const dom::NoteInfoPtr &noteInfo, const ContourGeometry &geometry, bool forTieEnd=false)
 Calculates span classification and control points in one call.
 

Detailed Description

Static class containing utilites for ties.

Member Enumeration Documentation

◆ EndPointKind

enum class musx::util::Tie::EndPointKind
strong

Classifies what the tie endpoint attaches to for contour-length calculations.

Enumerator
Notehead 

Endpoint attaches to a notehead.

MeasureBoundary 

Endpoint attaches to a measure boundary (not a notehead).

SystemBoundary 

Endpoint attaches to a system boundary (start/end of system).

Member Function Documentation

◆ calcConnectionType()

std::optional< details::TieAlterBase::ConnectionType > musx::util::Tie::calcConnectionType ( const dom::NoteInfoPtr noteInfo,
bool  forTieEnd,
bool  forEndPoint,
bool  forPageView = true 
)
static

Calculates the default connection type for a tie endpoint.

Parameters
noteInfoThe note whose endpoint is being analyzed.
forTieEndTrue for tie-end stub ties, false for regular tie-forward ties.
forEndPointTrue if calculating the end point; false for the start point.
forPageViewTrue if calculating with page view system breaks, false for scroll/studio view.
Returns
The connection type, or std::nullopt if no applicable tie exists.

◆ calcConnectStyleTypes()

std::optional< std::pair< TieConnectStyleType, TieConnectStyleType > > musx::util::Tie::calcConnectStyleTypes ( const dom::NoteInfoPtr noteInfo,
bool  forTieEnd 
)
static

Calculates the connect style types for both endpoints of a tie.

Parameters
noteInfoThe note whose tie is being analyzed.
forTieEndTrue for tie-end stub ties, false for regular tie-forward ties.
Returns
A pair containing start and end connect style types, or std::nullopt if no tie exists.

◆ calcContourStyleType()

std::optional< Tie::ContourResult > musx::util::Tie::calcContourStyleType ( const dom::NoteInfoPtr noteInfo,
const ContourGeometry geometry,
bool  forTieEnd = false 
)
static

Calculates the tie control style span using caller-supplied horizontal geometry.

Parameters
noteInfoThe note whose tie context is being evaluated.
forTieEndTrue for tie-end stub ties, false for regular tie-forward ties.
geometryHorizontal endpoint geometry in EVPU. startAdjustment and endAdjustment let the caller inject layout-engine-specific endpoint adjustments (for example system-boundary behavior or custom spacing policy) while this function still applies tie placement rules around noteheads.
Returns
std::nullopt if no applicable tie can be resolved; otherwise the selected span style and computed EVPU length.

◆ calcDefaultContourControlPoints()

std::optional< Tie::ContourControlPoints > musx::util::Tie::calcDefaultContourControlPoints ( const dom::NoteInfoPtr noteInfo,
dom::options::TieOptions::ControlStyleType  styleType,
dom::Evpu  length 
)
static

Calculates default contour control points (inset/height) for a given control style.

Parameters
noteInfoThe note whose tie options are consulted.
styleTypeThe control style type to evaluate (Short/Medium/Long/TieEnds).
lengthThe tie length in EVPU used for interpolation when enabled.
Returns
Calculated control points, or std::nullopt if inputs/styles are unavailable.

When tie options enable interpolation and styleType is MediumSpan, heights are interpolated between Short/Medium or Medium/Long depending on length. Relative inset ratios are interpolated only when the inset style is Percent; fixed insets remain the MediumSpan fixed values.

◆ calcDefaultDirection()

CurveContourDirection musx::util::Tie::calcDefaultDirection ( const dom::NoteInfoPtr noteInfo,
bool  forTieEnd = false 
)
static

Calculates the default tie direction for the specified note.

Parameters
noteInfoThe note whose default tie direction is being calculated.
forTieEndTrue for tie-end stub ties, false for regular tie-forward ties.
Returns
The contour direction that Finale would choose for the tie, or dom::CurveContourDirection::Unspecified when the contour cannot be determined.

◆ calcEffectiveContourControlPoints()

std::optional< Tie::ContourControlPoints > musx::util::Tie::calcEffectiveContourControlPoints ( const dom::NoteInfoPtr noteInfo,
bool  forTieEnd,
dom::options::TieOptions::ControlStyleType  styleType,
dom::Evpu  length 
)
static

Calculates effective contour control points (inset/height) for a tie.

Parameters
noteInfoThe note whose tie options and tie alterations are consulted.
forTieEndTrue for tie-end stub ties, false for regular tie-forward ties.
styleTypeThe control style type to evaluate (Short/Medium/Long/TieEnds).
lengthThe tie length in EVPU used for interpolation when enabled.
Returns
Calculated control points, or std::nullopt if inputs/styles are unavailable.

If a tie alteration record exists and control point adjustments are enabled, this returns the alteration control points (and inset style from the alteration). Otherwise it falls back to calcDefaultContourControlPoints.

◆ calcEffectiveContourMetrics()

std::optional< Tie::ContourMetrics > musx::util::Tie::calcEffectiveContourMetrics ( const dom::NoteInfoPtr noteInfo,
const ContourGeometry geometry,
bool  forTieEnd = false 
)
static

Calculates span classification and control points in one call.

Parameters
noteInfoThe note whose tie options and tie alterations are consulted.
geometryHorizontal endpoint geometry in EVPU.
forTieEndTrue for tie-end stub ties, false for regular tie-forward ties.
Returns
Combined contour metrics, or std::nullopt if inputs/styles are unavailable.

◆ calcEffectiveDirection()

CurveContourDirection musx::util::Tie::calcEffectiveDirection ( const dom::NoteInfoPtr noteInfo,
bool  forTieEnd = false 
)
static

Calculates the effective tie direction taking into account overrides and special rules.

Parameters
noteInfoThe note whose effective tie direction is being calculated.
forTieEndTrue for tie-end stub ties, false for regular tie-forward ties.
Returns
The contour direction that currently applies to the tie, or dom::CurveContourDirection::Unspecified when the contour cannot be determined.

◆ calcEndpointOffsets()

options::TieOptions::ConnectStyle musx::util::Tie::calcEndpointOffsets ( const dom::NoteInfoPtr noteInfo,
bool  forTieEnd,
bool  forEndPoint,
std::optional< dom::CurveContourDirection direction = std::nullopt,
bool  forPageView = true 
)
static

Resolves endpoint offsets for a tie endpoint from default policy and tie-alter overrides.

Parameters
noteInfoThe note whose tie alterations are consulted.
forTieEndTrue for tie-end stub ties, false for regular tie-forward ties.
forEndPointTrue for end-point offset, false for start-point offset.
directionOptional tie contour direction. If omitted or Unspecified, effective direction is calculated.
forPageViewTrue to apply page-view system-break rules in endpoint connection evaluation.
Returns
The effective endpoint offsets in EVPU.

◆ calcIsOuterConnectStyle()

bool musx::util::Tie::calcIsOuterConnectStyle ( dom::TieConnectStyleType  type)
static

Returns true if the connect style is an outer placement.

Parameters
typeThe connect style to classify.
Returns
True if type is an outer placement, otherwise false.