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


C++ Road::isError方法代码示例

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


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

示例1: paint

//描画
void MapFrame::paint(QPainter* pp)
{
    Map*                pMap = app.getMap();
    QRect               rectSource, rectDest;
    double              viewBackMagni;
    MAP_INTSECMAP_IT    imi;
    Intsec*             pIntsec;
    stringstream        ss;
    int                 viewX, viewY;
    MAP_ROADMAP_IT      rmi;
    Road*               pRoad;
    DrawLineType        drawLineType;

    //塗りつぶし、ドラッグ画面用
    pp->fillRect(0, 0, width(), height(), Qt::gray);

    //背景描画
    if (app.getBackImage() && !_backPixmap.isNull())
    {
        viewBackMagni = app.getBackMagni() * app.getViewMagni();    // view / back
        rectDest.setCoords(0, 0, width(), height());
        rectSource.setLeft(  (int)((double)(app.getViewMapX() - app.getBackMapX()) / app.getBackMagni()));
        rectSource.setBottom(_backPixmap.size().height() -
                             (int)((double)(app.getViewMapY() - app.getBackMapY()) / app.getBackMagni()));
        rectSource.setRight( rectSource.left()   + (int)((double)width() / viewBackMagni));
        rectSource.setTop(  rectSource.bottom() - (int)((double)height() / viewBackMagni));
        pp->drawPixmap(rectDest, _backPixmap, rectSource);
    }

    //全単路描画
    pMap = app.getMap();
    pRoad = pMap->nextRoad(&rmi, true);
    while (pRoad != NULL)
    {
        if (pRoad->getRoadId() == _roadIdSelect)
        {
            if (_dragType == roadRepl)
            {
//                  qDebug("MapFrame::paint drag road replace selected");
                drawLineType = selectedDark;
            }
            else
                drawLineType = selected;
        }
        else
            drawLineType = normal;
        if (_dragType == intsec)
        {
//              qDebug("MapFrame::paint drag intsec road");
            if (pRoad->getIntsec(ROAD_IT_SMALL)->getIntsecId() == _intsecIdDrag ||
                pRoad->getIntsec(ROAD_IT_LARGE)->getIntsecId() == _intsecIdDrag )
            {
//                  qDebug("MapFrame::paint drag intsec road selected");
                drawLineType = selectedDark;
            }
        }
//          qDebug("MapFrame::paint road (%d,%d) drag %d lineType:%d",
//                 pRoad->getIntsec(ROAD_IT_SMALL)->getIntsecId(),
//                 pRoad->getIntsec(ROAD_IT_LARGE)->getIntsecId(), _intsecIdDrag, drawLineType);
        if (isViewArea(pRoad->getIntsec(ROAD_IT_SMALL)) || isViewArea(pRoad->getIntsec(ROAD_IT_LARGE)))
            drawLine(pp, getViewX(pRoad->getIntsec(ROAD_IT_SMALL)->getMapPosX()),
                         getViewY(pRoad->getIntsec(ROAD_IT_SMALL)->getMapPosY()),
                         getViewX(pRoad->getIntsec(ROAD_IT_LARGE)->getMapPosX()),
                         getViewY(pRoad->getIntsec(ROAD_IT_LARGE)->getMapPosY()),
                         drawLineType, pRoad->isLaneOver4(), pRoad->isError());
        pRoad = pMap->nextRoad(&rmi);
    }

    //交差点ID描画、広域表示では点描画
    if (app.getShowId())
    {
        pIntsec = pMap->nextIntsec(&imi, true);
        while (pIntsec != NULL)
        {
            if (isViewArea(pIntsec))
            {
                if (app.getMainWindow()->getEditMode() != MainWindow::large)
                {
                    ss.str("");
                    ss << pIntsec->getIntsecId();
                    viewX = getViewX(pIntsec->getMapPosX()) + INTSEC_LABELSIZE_H + 2;
                    viewY = getViewY(pIntsec->getMapPosY()) + INTSEC_LABELSIZE_H + 2;
                    pp->setPen(QColor("#FFFFFF"));
                    pp->drawText(viewX - 1, viewY + 1, ss.str().c_str());
                    pp->drawText(viewX - 1, viewY - 1, ss.str().c_str());
                    pp->drawText(viewX + 1, viewY - 1, ss.str().c_str());
                    pp->drawText(viewX + 1, viewY + 1, ss.str().c_str());
                    pp->setPen(QColor("#0000FF"));
                    pp->drawText(viewX,     viewY,     ss.str().c_str());
                }
                else
                {
                    viewX = getViewX(pIntsec->getMapPosX()) - 2;
                    viewY = getViewY(pIntsec->getMapPosY()) - 2;
                    QString colorName;
                    if (pIntsec->getIntsecId() == _intsecIdSelect)
                    {
                        if (pIntsec->isError())
                            colorName = "#FF00FF";
//.........这里部分代码省略.........
开发者ID:kuvo1017,项目名称:advmates,代码行数:101,代码来源:mapframe.cpp

示例2: paintEvent

//描画イベント
void MapFrame::paintEvent(QPaintEvent*)
{
    QPainter            painter(this), painterDRP;
    Map*                pMap = app.getMap();
    int                 intsecIdCon;
    Intsec*             pIntsec;
    Intsec*             pIntsecCon;
    Road*               pRoad;
    INTSEC_ROADMAP_IT   irmi;

//  qDebug("MapFrame::paintEvent (%d,%d)-(%d,%d)",
//         event->rect().right(), event->rect().top(), event->rect().left(), event->rect().bottom());
//  qDebug("MapFrame::paintEvent back pixmap (%d,%d)-%d",
//         _backPixmap.size().width(), _backPixmap.size().height(), _backPixmap.isNull());

    //交差点ドラッグなら接続単路を書く、単路ドラッグならドラッグ線を描く、他はそのまま描画
    // 通常画面を全体画像に入れてその上にドラッグ線を描く、そうでないと数が多い時に非常に遅い
    if (_dragType == intsec || _dragType == road || _dragType == roadRepl)
    {
//      qDebug("MapFrame::paintEvent _dragWholePixmap (%d,%d)-%d",
//             _dragWholePixmap.width(), _dragWholePixmap.height(), _dragWholePixmap.isNull());
        if (_dragWholePixmap.isNull())
        {
//          qDebug("MapFrame::paintEvent create whole pixmap");
            _dragWholePixmap = QPixmap(width(), height());
            painterDRP.begin(&_dragWholePixmap);
            paint(&painterDRP);
            painterDRP.end();
        }
        painter.drawPixmap(0, 0, width(), height(), _dragWholePixmap);
        if (_dragType == intsec)
        {
//          qDebug("MapFrame::paintEvent drag intsec %d", _intsecIdDrag);
            pIntsec = pMap->getIntsec(_intsecIdDrag);
            Q_ASSERT(pIntsec != NULL);
            pRoad = pIntsec->nextRoad(&irmi, true, &intsecIdCon);
            while (pRoad != NULL)
            {
//              qDebug("MapFrame::paintEvent drag intsec road %d-%d", _intsecIdDrag, intsecIdCon);
                pIntsecCon = pMap->getIntsec(intsecIdCon);
                Q_ASSERT(pIntsecCon != NULL);
                drawLine(&painter, _dragRoadX, _dragRoadY,
                         getViewX(pIntsecCon->getMapPosX()),
                         getViewY(pIntsecCon->getMapPosY()), selected,
                         pRoad->isLaneOver4(), pRoad->isError());
                pRoad = pIntsec->nextRoad(&irmi, false, &intsecIdCon);
            }
        }
        else if (_dragType == road)
        {
//          qDebug("MapFrame::paintEvent road line (%d, %d)-(%d, %d)",
//                 _dragRoadX, _dragRoadY, _dragRoadConX, _dragRoadConY);
            drawLine(&painter, _dragRoadX,    _dragRoadY,
                     _dragRoadConX, _dragRoadConY, selected, !app.getMainWindow()->isLane2());
        }
        else if (_dragType == roadRepl)
        {
            pRoad = pMap->getRoad(_intsecIdDrag, _intsecIdReplCon);
//          qDebug("MapFrame::paintEvent road repl %d-%d", _intsecIdDrag, _intsecIdReplCon);
            if (pRoad != NULL)
            {
//              qDebug("MapFrame::paintEvent road repl line (%d, %d)-(%d, %d)",
//                     _dragRoadX, _dragRoadY, _dragRoadConX, _dragRoadConY);
                drawLine(&painter, _dragRoadX,    _dragRoadY,
                         _dragRoadConX, _dragRoadConY, selected,
                         pRoad->isLaneOver4(), pRoad->isError());
            }
            else
            {
//              qDebug("MapFrame::paintEvent road repl null line (%d, %d)-(%d, %d)",
//                     _dragRoadX, _dragRoadY, _dragRoadConX, _dragRoadConY);
                drawLine(&painter, _dragRoadX,    _dragRoadY,
                         _dragRoadConX, _dragRoadConY, selected);       //最後に一瞬だけある
            }
        }
    }
    else
    {
//      qDebug("MapFrame::paintEvent normal");
        paint(&painter);
    }
}
开发者ID:kuvo1017,项目名称:advmates,代码行数:83,代码来源:mapframe.cpp


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