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


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

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


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

示例2: placeMacrosWithIncrementalUpdate


//.........这里部分代码省略.........
                        macroXStart, macroYStart, macroXEnd, macroYEnd,
                        corner->getHorizontalTile())) {
                        // Does not overlap.
                        break;
                    }
                }
            }

            // corner is not valid.
            // Select another Corner.
            sizeQuadtree->remove(corner);
            temporarilyRemovedCorners->push_back(corner);
            corner = static_cast<Corner *>(sizeQuadtree->getPointRandomlyByXY(macroWidth, macroHeight, true, true));
            if (corner == 0) {
                // No Corner is available.
                placedUnsuccessfully = true;
                indexPlacedUnsuccessfully = i;
                break;
            }
        }
        if (placedUnsuccessfully) {
            break;
        }
        // A valid Corner is selected.
        // Insert removed Corners back to quadtrees.
        for (int j = 0; j < temporarilyRemovedCorners->size(); ++j) {
            sizeQuadtree->insert(temporarilyRemovedCorners->at(j));
        }
        temporarilyRemovedCorners->clear();

        // Copy the valid Corner and replace corners->at(i)
        // because the valid Corner will be deleted after macro is placed.
        corners->at(i) = corner->copyAsNotFromTilePlane();

        // Place macro at corner.
        macro->setXStart(macroXStart);
        macro->setYStart(macroYStart);
        macro->updateRectanglesPosition();
        Tile *horizontalTile = new Tile(macroXStart, macroYStart, macroXEnd, macroYEnd, true);
        Tile *verticalTile = new Tile(macroXStart, macroYStart, macroXEnd, macroYEnd, true);
        Tile *startHorizontalTile;
        Tile *startVerticalTile;
        switch (cornerDirection) {
        case 0:
            // Bl
            startHorizontalTile = corner->getHorizontalTile();
            startVerticalTile = corner->getVerticalTile();
            break;
        case 1:
            // Br
            startHorizontalTile = corner->getHorizontalTile();
            startVerticalTile = cornerVerticalTilePlane->findTile(macroXStart, macroYStart, corner->getVerticalTile());
            break;
        case 2:
            // Tl
            startHorizontalTile = cornerHorizontalTilePlane->findTile(macroXStart, macroYStart, corner->getHorizontalTile());
            startVerticalTile = corner->getVerticalTile();
            break;
        case 3:
            // Tr
            startHorizontalTile = cornerHorizontalTilePlane->findTile(macroXStart, macroYStart, corner->getHorizontalTile());
            startVerticalTile = cornerVerticalTilePlane->findTile(macroXStart, macroYStart, corner->getVerticalTile());
            break;
        }
        cornerHorizontalTilePlane->placeSolidTileGivenBothStartTiles(horizontalTile, startHorizontalTile, startVerticalTile);
        startHorizontalTile = horizontalTile;
        //switch (cornerDirection) {
        //case 0:
        //    // Bl
        //    startVerticalTile = corner->getVerticalTile();
        //    break;
        //case 1:
        //    // Br
        //    startVerticalTile = cornerVerticalTilePlane->findTile(macroXStart, macroYStart, corner->getVerticalTile());
        //    break;
        //case 2:
        //    // Tl
        //    startVerticalTile = corner->getVerticalTile();
        //    break;
        //case 3:
        //    // Tr
        //    startVerticalTile = cornerVerticalTilePlane->findTile(macroXStart, macroYStart, corner->getVerticalTile());
        //    break;
        //}
        cornerVerticalTilePlane->placeSolidTileGivenBothStartTiles(verticalTile, startVerticalTile, startHorizontalTile);
        // Remove macro from sets.
        //widthSortedMacros->erase(macro);
        //heightSortedMacros->erase(macro);
        // Calculate Corners' width and height.
        cornerHorizontalTilePlane->calculateCurrentCornersWidthAndHeight();
        cornerVerticalTilePlane->calculateCurrentCornersWidthAndHeight();

        // Update quadtrees.
        updateQuadtrees();
    }

    delete temporarilyRemovedCorners;

    return !placedUnsuccessfully;
}
开发者ID:areong,项目名称:CornerMacroPlacer,代码行数:101,代码来源:CornerSequence.cpp


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