当前位置: 首页>>代码示例>>C++>>正文


C++ Staff::GetAlignment方法代码示例

本文整理汇总了C++中Staff::GetAlignment方法的典型用法代码示例。如果您正苦于以下问题:C++ Staff::GetAlignment方法的具体用法?C++ Staff::GetAlignment怎么用?C++ Staff::GetAlignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Staff的用法示例。


在下文中一共展示了Staff::GetAlignment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetBoundingBoxYShift

int Object::SetBoundingBoxYShift( ArrayPtrVoid params )
{
    // param 0: the position of the previous staff
    // param 1: the maximum height in the current system
    int *min_pos = static_cast<int*>(params[0]);
    int *system_height = static_cast<int*>(params[1]);
    
    // starting a new system
    System *current_system = dynamic_cast<System*>(this);
    if ( current_system  ) {
        // we reset the system height
        (*system_height) = 0;
        (*min_pos) = 0;
        return FUNCTOR_CONTINUE;
    }
    
    // starting a new measure
    Measure *current_measure = dynamic_cast<Measure*>(this);
    if ( current_measure  ) {
        (*min_pos) = 0;
        return FUNCTOR_CONTINUE;
    }
    
    // starting a new staff
    Staff *current = dynamic_cast<Staff*>(this);
    if ( !current  ) {
        return FUNCTOR_CONTINUE;
    }
    
    // at this stage we assume we have instanciated the alignment pointer
    assert( current->GetAlignment() );
    
    // This is the value that need to be removed to fit everything
    int negative_offset = - current->m_contentBB_y2;
    
    // this will probably never happen
    if ( negative_offset > 0 ) {
        negative_offset = 0;
    }
    
    // check if the staff overlaps with the preceeding one given by (*min_pos)
    int overlap = 0;
    if ( (current->GetAlignment()->GetYRel() - negative_offset) > (*min_pos) ) {
        overlap = (*min_pos) - current->GetAlignment()->GetYRel() + negative_offset;
        current->GetAlignment()->SetYShift( overlap );
    }
    
    //LogDebug("%s min_pos %d; negative offset %d;  drawXRel %d; overlap %d", current->GetClassName().c_str(), (*min_pos), negative_offset, current->GetAlignment()->GetXRel(), overlap );
    
    // the next minimal position if given by the bottom side of the bounding box + the spacing of the element
    (*min_pos) = current->m_contentBB_y1;
    current->GetAlignment()->SetMaxHeight( current->m_contentBB_y1 );
    
    // do not go further down the tree in this case
    return FUNCTOR_SIBLINGS;
}
开发者ID:jamespark04,项目名称:verovio,代码行数:56,代码来源:object.cpp


注:本文中的Staff::GetAlignment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。