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


C++ System::Process方法代码示例

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


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

示例1: LayOut

void Doc::LayOut( )
{
    this->SetCurrentScoreDef();
    
    Page *contentPage = this->SetDrawingPage( 0 );
    assert( contentPage );
    contentPage->LayOutHorizontally();
    
    System *contentSystem = dynamic_cast<System*>(contentPage->DetachChild( 0 ));
    assert( contentSystem );
    
    System *currentSystem = new System();
    contentPage->AddSystem( currentSystem );
    int shift = 0;
    int systemFullWidth = this->m_drawingPageWidth - this->m_drawingPageLeftMar - this->m_drawingPageRightMar
        - currentSystem->m_systemLeftMar - currentSystem->m_systemRightMar;
    ArrayPtrVoid params;
    params.push_back( contentSystem );
    params.push_back( contentPage );
    params.push_back( &currentSystem );
    params.push_back( &shift );
    params.push_back( &systemFullWidth );
    Functor castOffSystems( &Object::CastOffSystems );
    contentSystem->Process( &castOffSystems, params );
    delete contentSystem;
    
    LogDebug("Layout: %d systems", contentPage->GetSystemCount());
    
    // Reset the scoreDef at the beginning of each system
    this->SetCurrentScoreDef( true );
    contentPage->LayOutVertically( );
    
    // Detach the contentPage
    this->DetachChild( 0 );
    assert( contentPage && !contentPage->m_parent );
    
    Page *currentPage = new Page();
    this->AddPage( currentPage );
    shift = 0;
    int pageFullHeight = this->m_drawingPageHeight - this->m_drawingPageTopMar; // obviously we need a bottom margin
    params.clear();
    params.push_back( contentPage );
    params.push_back( this );
    params.push_back( &currentPage );
    params.push_back( &shift );
    params.push_back( &pageFullHeight );
    Functor castOffPages( &Object::CastOffPages );
    contentPage->Process( &castOffPages, params );
    delete contentPage;
    
    LogDebug("Layout: %d pages", this->GetChildCount());

    // We need to reset the drawing page to NULL
    // because idx will still be 0 but contentPage is dead!
    this->ResetDrawingPage( );
    this->SetCurrentScoreDef( true );
}
开发者ID:ahankinson,项目名称:verovio,代码行数:57,代码来源:doc.cpp

示例2: CalcInitialSlur

float View::CalcInitialSlur(
    FloatingCurvePositioner *curve, Slur *slur, Staff *staff, int layerN, curvature_CURVEDIR curveDir, Point points[4])
{
    // For readability makes them p1 and p2
    Point p1 = points[0];
    Point p2 = points[3];

    /************** height **************/

    // the 'height' of the bezier
    int height;
    if (slur->HasBulge()) {
        height = m_doc->GetDrawingUnit(staff->m_drawingStaffSize) * slur->GetBulge();
    }
    else {
        int dist = abs(p2.x - p1.x);
        height = std::max(int(m_options->m_slurMinHeight.GetValue() * m_doc->GetDrawingUnit(staff->m_drawingStaffSize)),
            dist / m_options->m_slurHeightFactor.GetValue());
        height = std::min(
            int(m_options->m_slurMaxHeight.GetValue() * m_doc->GetDrawingUnit(staff->m_drawingStaffSize)), height);
    }

    // the height of the control points
    height = height * 4 / 3;

    /************** content **************/

    System *system = dynamic_cast<System *>(staff->GetFirstParent(SYSTEM));
    assert(system);
    FindSpannedLayerElementsParams findSpannedLayerElementsParams(slur, slur);
    findSpannedLayerElementsParams.m_minPos = p1.x;
    findSpannedLayerElementsParams.m_maxPos = p2.x;
    findSpannedLayerElementsParams.m_classIds
        = { ACCID, ARTIC_PART, ARTIC, CHORD, FLAG, NOTE, STEM, TIE, TUPLET_BRACKET, TUPLET_NUM };
    ArrayOfComparisons filters;
    // Create ad comparison object for each type / @n
    // For now we only look at one layer (assumed layer1 == layer2)
    AttNIntegerComparison matchStaff(STAFF, staff->GetN());
    AttNIntegerComparison matchLayer(LAYER, layerN);
    filters.push_back(&matchStaff);
    filters.push_back(&matchLayer);

    Functor findSpannedLayerElements(&Object::FindSpannedLayerElements);
    system->Process(&findSpannedLayerElements, &findSpannedLayerElementsParams, NULL, &filters);

    curve->ClearSpannedElements();
    for (auto &element : findSpannedLayerElementsParams.m_elements) {

        Point pRotated;
        Point pLeft;
        pLeft.x = element->GetSelfLeft();
        // if ((pLeft.x > p1->x) && (pLeft.x < p2->x)) {
        //    pLeft.y = (curveDir == curvature_CURVEDIR_above) ? element->GetSelfTop() : element->GetSelfBottom();
        //    spannedElements->push_back(spannedElement);
        //}
        Point pRight;
        pRight.x = element->GetSelfRight();
        // if ((pRight.x > p1->x) && (pRight.x < p2->x)) {
        //    pRight.y = (curveDir == curvature_CURVEDIR_above) ? element->GetSelfTop() : element->GetSelfBottom();
        //    spannedElements->push_back(spannedElement);
        //}
        if (((pLeft.x > p1.x) && (pLeft.x < p2.x)) || ((pRight.x > p1.x) && (pRight.x < p2.x))) {
            CurveSpannedElement *spannedElement = new CurveSpannedElement;
            spannedElement->m_boundingBox = element;
            curve->AddSpannedElement(spannedElement);
        }
    }

    for (auto &positioner : findSpannedLayerElementsParams.m_ties) {
        CurveSpannedElement *spannedElement = new CurveSpannedElement;
        spannedElement->m_boundingBox = positioner;
        curve->AddSpannedElement(spannedElement);
    }

    /************** angle **************/

    const ArrayOfCurveSpannedElements *spannedElements = curve->GetSpannedElements();
    float slurAngle = slur->GetAdjustedSlurAngle(m_doc, p1, p2, curveDir, (spannedElements->size() > 0));
    Point rotatedP2 = BoundingBox::CalcPositionAfterRotation(p2, -slurAngle, p1);

    /************** control points **************/

    Point rotatedC1, rotatedC2;
    slur->GetControlPoints(m_doc, p1, rotatedP2, rotatedC1, rotatedC2, curveDir, height, staff->m_drawingStaffSize);

    points[0] = p1;
    points[1] = BoundingBox::CalcPositionAfterRotation(rotatedC1, slurAngle, p1);
    points[2] = BoundingBox::CalcPositionAfterRotation(rotatedC2, slurAngle, p1);
    points[3] = BoundingBox::CalcPositionAfterRotation(rotatedP2, slurAngle, p1);

    return slurAngle;
}
开发者ID:rism-ch,项目名称:verovio,代码行数:92,代码来源:view_slur.cpp


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