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


C++ Corner::getDirection方法代码示例

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


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

示例1: setMacrosPositionByCorners

void CornerSequence::setMacrosPositionByCorners() {
    for (int i = 0; i < macros->size(); ++i) {
        Macro *macro = macros->at(i);
        macro->setOrientation(orientations->at(i));
        Corner *corner = corners->at(i);
        switch (corner->getDirection()) {
        case 0:
            macro->setXStart(corner->getX());
            macro->setYStart(corner->getY());
            break;
        case 1:
            macro->setXEnd(corner->getX());
            macro->setYStart(corner->getY());
            break;
        case 2:
            macro->setXStart(corner->getX());
            macro->setYEnd(corner->getY());
            break;
        case 3:
            macro->setXEnd(corner->getX());
            macro->setYEnd(corner->getY());
            break;
        }
        macro->updateRectanglesPosition();
    }
}
开发者ID:areong,项目名称:CornerMacroPlacer,代码行数:26,代码来源:CornerSequence.cpp

示例2: placeMacrosWithIncrementalUpdate

bool CornerSequence::placeMacrosWithIncrementalUpdate(int startPosition, int backupPosition) {
    bool placedUnsuccessfully = false;

    // Store Corners removed from sizeQuadtree during finding valid Corners.
    std::vector<Corner *> *temporarilyRemovedCorners = new std::vector<Corner *>();
    
    for (int i = startPosition; i < macros->size(); ++i) {
        //std::cout << i << "\n";
        Macro *macro = macros->at(i);
        macro->setOrientation(orientations->at(i));
        int macroWidth = macro->getWidth();
        int macroHeight = macro->getHeight();
        Corner *corner = corners->at(i);

        //std::cout << "begin Macro " << i << "\n";
        //std::cout << "smallest width emtpy Tile:  ";
        //cornerHorizontalTilePlane->getEmptyTileWithSmallestWidth()->print();
        //std::cout << "smallest height empty Tile: ";
        //cornerVerticalTilePlane->getEmptyTileWithSmallestHeight()->print();
        //std::cout << "smallest width Macro: ";
        //////(*widthSortedMacros->begin())->print();
        //widthSortedMacros->getSmallest()->print();
        //std::cout << "smallest height Macro: ";
        ////(*heightSortedMacros->begin())->print();
        //heightSortedMacros->getSmallest()->print();

        //fillInWastedRegion();

        // Check whether to select another Corner.
        bool toSelectAnotherCorner = false;
        if (corner == 0) {
            toSelectAnotherCorner = true;
        } else if (corner->isNotFromTilePlane()) {
            Corner *inputCorner = corner;
            std::vector<Point *> *foundCorners = positionQuadtree->getPointsAtXY(inputCorner->getX(), inputCorner->getY());
            if (foundCorners == 0) {
                // No matched Corner is found.
                toSelectAnotherCorner = true;
            } else {
                for (int j = 0; j < foundCorners->size(); ++j) {
                    Corner *foundCorner = static_cast<Corner *>(foundCorners->at(j));
                    if (foundCorner->getDirection() == inputCorner->getDirection()) {
                        // The matched Corner is found.
                        corner = foundCorner;
                        break;
                    }
                    // No matched Corner is found.
                    toSelectAnotherCorner = true;
                }
                delete foundCorners;
            }
            delete inputCorner;
            corners->at(i) = 0;
            // If macro ends up being unsuccessfully placed,
            // notFromTilePlane Corners after corner will be deleted in ~CornerSeqence().
        }

        if (toSelectAnotherCorner) {
            corner = static_cast<Corner *>(sizeQuadtree->getPointRandomlyByXY(macroWidth, macroHeight, true, true));
            if (corner == 0) {
                // No Corner is available.
                placedUnsuccessfully = true;
                indexPlacedUnsuccessfully = i;
                break;
            }
        }

        // Check overlap.
        int cornerDirection;
        int macroXStart;
        int macroYStart;
        int macroXEnd;
        int macroYEnd;
        int cornerX;
        int cornerY;
        while (true) {
            // Check corner gap size.
            bool cornerGapSizeIsValid = true;
            if (corner->isType1()) {
                if (corner->isGapOnHorizontalSide()) {
                    if (corner->getGapSize() >= macroWidth) {
                        cornerGapSizeIsValid = false;
                    }
                } else {
                    if (corner->getGapSize() >= macroHeight) {
                        cornerGapSizeIsValid = false;
                    }
                }
            }

            if (cornerGapSizeIsValid) {
                // Calculate macro position.
                cornerX = corner->getX();
                cornerY = corner->getY();
                cornerDirection = corner->getDirection();
                switch (cornerDirection) {
                case 0:
                    // Bl
                    macroXStart = cornerX;
                    macroYStart = cornerY;
//.........这里部分代码省略.........
开发者ID:areong,项目名称:CornerMacroPlacer,代码行数:101,代码来源:CornerSequence.cpp


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