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


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

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


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

示例1: fillInWastedRegion

void CornerSequence::fillInWastedRegion() {
    std::cout << "fillInWastedRegion()\n";
    int smallestMacroWidth = widthSortedMacros->getSmallest()->getWidth();
    int smallestMacroHeight = heightSortedMacros->getSmallest()->getHeight();
    while (true) {
        int numFills = 0;
        // Try to fill a horizontal empty Tile.
        Tile *emptyTile = cornerHorizontalTilePlane->getEmptyTileWithSmallestWidth();
        if (emptyTile != 0 && emptyTile->getWidth() < smallestMacroWidth) {
            std::cout << "fill horizontalTile\n";
            emptyTile->print();
            Tile *horizontalTile = new Tile(emptyTile->getXStart(), emptyTile->getYStart(),
                emptyTile->getXEnd(), emptyTile->getYEnd(), true);
            Tile *verticalTile = new Tile(emptyTile->getXStart(), emptyTile->getYStart(),
                emptyTile->getXEnd(), emptyTile->getYEnd(), true);
            horizontalTile->setTemporarilySolid();
            verticalTile->setTemporarilySolid();
            // Find startVerticalTile.
            Corner *corner = emptyTile->getBlCorner();
            Tile *startVerticalTile;
            if (corner == 0) {
                corner = emptyTile->getTlCorner();
            }
            if (corner != 0) {
                startVerticalTile = corner->getVerticalTile();
            } else {
                // If emptyTile has no Corner, than emptyTile's lb and rt
                // are empty Tiles, and lb has top Corners and rt has bottom Corners.
                startVerticalTile = cornerVerticalTilePlane->findTile(emptyTile->getXStart(), emptyTile->getYStart(),
                    emptyTile->getRt()->getBlCorner()->getVerticalTile());
            }
            // Place horizontalTile.
            std::cout << "place horizontal\n";
            cornerHorizontalTilePlane->placeSolidTileGivenBothStartTiles(horizontalTile, emptyTile, startVerticalTile);
            // Place verticalTile.
            std::cout << "place vertical\n";
            cornerVerticalTilePlane->placeSolidTileGivenBothStartTiles(verticalTile, horizontalTile, startVerticalTile);

            cornerHorizontalTilePlane->calculateCurrentCornersWidthAndHeight();
            cornerVerticalTilePlane->calculateCurrentCornersWidthAndHeight();
            std::cout << "updateQuadtrees()\n";
            updateQuadtrees();
            std::cout << "updateQuadtrees() end\n";

            numFills += 1;
        }
        // Try to fill a vertical empty Tile.
        emptyTile = cornerVerticalTilePlane->getEmptyTileWithSmallestHeight();
        if (emptyTile != 0 && emptyTile->getHeight() < smallestMacroHeight) {
            std::cout << "fill verticalTile\n";
            emptyTile->print();
            Tile *horizontalTile = new Tile(emptyTile->getXStart(), emptyTile->getYStart(),
                emptyTile->getXEnd(), emptyTile->getYEnd(), true);
            Tile *verticalTile = new Tile(emptyTile->getXStart(), emptyTile->getYStart(),
                emptyTile->getXEnd(), emptyTile->getYEnd(), true);
            horizontalTile->setTemporarilySolid();
            verticalTile->setTemporarilySolid();
            // Find startHorizontalTile.
            Corner *corner = emptyTile->getBlCorner();
            Tile *startHorizontalTile;
            if (corner == 0) {
                corner = emptyTile->getBrCorner();
            }
            if (corner != 0) {
                corner->print();
                startHorizontalTile = corner->getHorizontalTile();
                cornerHorizontalTilePlane->getBottomRightMostTile()->print();
            } else {
                // If emptyTile has no Corner, than emptyTile's bl and tr
                // are empty Tiles, and bl has right Corners and tr has left Corners.
                startHorizontalTile = cornerHorizontalTilePlane->findTile(emptyTile->getXStart(), emptyTile->getYStart(),
                    emptyTile->getTr()->getBlCorner()->getHorizontalTile());
            }
            // Place horizontalTile.
            std::cout << "place horizontal\n";
            horizontalTile->print();
            startHorizontalTile->print();
            startHorizontalTile->printFourNeighbors();
            cornerHorizontalTilePlane->placeSolidTileGivenBothStartTiles(horizontalTile, startHorizontalTile, emptyTile);
            // Place verticalTile.
            std::cout << "place vertical\n";
            cornerVerticalTilePlane->placeSolidTileGivenBothStartTiles(verticalTile, horizontalTile, emptyTile);

            cornerHorizontalTilePlane->calculateCurrentCornersWidthAndHeight();
            cornerVerticalTilePlane->calculateCurrentCornersWidthAndHeight();
            std::cout << "updateQuadtrees()\n";
            updateQuadtrees();
            std::cout << "updateQuadtrees() end\n";

            numFills += 1;
        }
        // Continue or not.
        if (numFills == 0) {
            break;
        }
    }
}
开发者ID:areong,项目名称:CornerMacroPlacer,代码行数:97,代码来源:CornerSequence.cpp


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