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


C++ OGRLinearRing::setPointsM方法代码示例

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


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

示例1: importFromWKTListOnly


//.........这里部分代码省略.........
        {
/* -------------------------------------------------------------------- */
/*      Do we need to grow the ring array?                              */
/* -------------------------------------------------------------------- */
            if( oCC.nCurveCount == nMaxRings )
            {
                nMaxRings = nMaxRings * 2 + 1;
                oCC.papoCurves = static_cast<OGRCurve **>(
                    CPLRealloc(oCC.papoCurves,
                               nMaxRings * sizeof(OGRLinearRing*)));
            }
            oCC.papoCurves[oCC.nCurveCount] = new OGRLinearRing();
            oCC.nCurveCount++;

            pszInput = OGRWktReadToken( pszNext, szToken );
            if( !EQUAL(szToken, ",") )
                break;

            continue;
        }

/* -------------------------------------------------------------------- */
/*      Read points for one ring from input.                            */
/* -------------------------------------------------------------------- */
        int nPoints = 0;
        int flagsFromInput = flags;
        if( flagsFromInput == 0 )
        {
            // Flags was not set, this is not called by us.
            if( bHasM )
                flagsFromInput |= OGR_G_MEASURED;
            if( bHasZ )
                flagsFromInput |= OGR_G_3D;
        }

        pszInput = OGRWktReadPointsM( pszInput, &paoPoints, &padfZ, &padfM,
                                      &flagsFromInput,
                                      &nMaxPoints, &nPoints );
        if( pszInput == NULL || nPoints == 0 )
        {
            CPLFree(padfM);
            return OGRERR_CORRUPT_DATA;
        }
        if( (flagsFromInput & OGR_G_3D) && !(flags & OGR_G_3D) )
        {
            flags |= OGR_G_3D;
            bHasZ = TRUE;
        }
        if( (flagsFromInput & OGR_G_MEASURED) && !(flags & OGR_G_MEASURED) )
        {
            flags |= OGR_G_MEASURED;
            bHasM = TRUE;
        }

/* -------------------------------------------------------------------- */
/*      Do we need to grow the ring array?                              */
/* -------------------------------------------------------------------- */
        if( oCC.nCurveCount == nMaxRings )
        {
            nMaxRings = nMaxRings * 2 + 1;
            oCC.papoCurves = static_cast<OGRCurve **>(
                CPLRealloc(oCC.papoCurves, nMaxRings * sizeof(OGRLinearRing*)));
        }

/* -------------------------------------------------------------------- */
/*      Create the new ring, and assign to ring list.                   */
/* -------------------------------------------------------------------- */
        OGRLinearRing* poLR = new OGRLinearRing();
        oCC.papoCurves[oCC.nCurveCount] = poLR;

        if( bHasM && bHasZ )
            poLR->setPoints(nPoints, paoPoints, padfZ, padfM);
        else if( bHasM )
            poLR->setPointsM(nPoints, paoPoints, padfM);
        else if( bHasZ )
            poLR->setPoints(nPoints, paoPoints, padfZ);
        else
            poLR->setPoints(nPoints, paoPoints);

        oCC.nCurveCount++;

/* -------------------------------------------------------------------- */
/*      Read the delimiter following the ring.                          */
/* -------------------------------------------------------------------- */

        pszInput = OGRWktReadToken( pszInput, szToken );
    } while( szToken[0] == ',' );

    CPLFree( padfM );

/* -------------------------------------------------------------------- */
/*      freak if we don't get a closing bracket.                        */
/* -------------------------------------------------------------------- */

    if( szToken[0] != ')' )
        return OGRERR_CORRUPT_DATA;

    *ppszInput = const_cast<char *>(pszInput);
    return OGRERR_NONE;
}
开发者ID:Mavrx-inc,项目名称:gdal,代码行数:101,代码来源:ogrpolygon.cpp


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