Пример #1
0
    void object::test<1>()
    {
        CoordinateSequenceAutoPtr cs(csFactory->create((size_t)0, 2));

        ensure(nullptr != cs.get());

        geos::geom::Coordinate c0(0, 0);
        geos::geom::Coordinate c1(0, 0);

        cs->add(c0);
        cs->add(c1);

        ensure_equals(cs->size(), 2u);

        SegmentStringAutoPtr ss(makeSegmentString(cs.release()));
        ensure(nullptr != ss.get());

        ensure_equals(ss->size(), 2u);

        ensure_equals(ss->getData(), (void*)nullptr);

        ensure_equals(ss->getCoordinate(0), c0);

        ensure_equals(ss->getCoordinate(1), c1);

        ensure_equals(ss->isClosed(), true);

        ensure_equals(ss->getNodeList().size(), 0u);

        ensure_equals(ss->getSegmentOctant(0), 0);
    }
void object::test<2>()
{
    CoordinateSequenceAutoPtr cs(csFactory->create((size_t)0, 2));

    ensure(0 != cs.get());

    geos::geom::Coordinate c0(0, 0);
    geos::geom::Coordinate c1(1, 0);

    cs->add(c0);
    cs->add(c1);

    ensure_equals(cs->size(), 2u);

    SegmentStringAutoPtr ss(makeSegmentString(cs.get()));
    ensure(0 != ss.get());

    ensure_equals(ss->size(), 2u);

    ensure_equals(ss->getData(), (void*)0);

    ensure_equals(ss->getCoordinates(), cs.get());

    ensure_equals(ss->getCoordinate(0), c0);

    ensure_equals(ss->getCoordinate(1), c1);

    ensure_equals(ss->isClosed(), false);

    ensure_equals(ss->getSegmentOctant(0), 0);

}
Пример #3
0
    void object::test<5>()
    {
        geos::geom::Coordinate p0(0, 0);
        geos::geom::Coordinate p1(10, 0);


        CoordinateSequenceAutoPtr cs(csFactory->create((size_t)0, 2));
        cs->add(p0);
        cs->add(p1);

        SegmentStringAutoPtr ss(makeSegmentString(cs.release()));

        ensure_equals(ss->getNodeList().size(), 0u);

        // the intersection is invalid, but SegmentString trusts us
        ss->addIntersection(p0, 0);
        ensure_equals(ss->getNodeList().size(), 1u);

        // This node is already present, so shouldn't be
        // accepted as a new one
        ss->addIntersection(p0, 0);
        ensure_equals(ss->getNodeList().size(), 1u);

        ss->addIntersection(p1, 0);
        ensure_equals(ss->getNodeList().size(), 2u);

        ss->addIntersection(p1, 0);
        ensure_equals(ss->getNodeList().size(), 2u);

        ss->addIntersection(p0, 0);
        ensure_equals(ss->getNodeList().size(), 2u);

    }
void object::test<1>()
{
    CoordinateSequenceAutoPtr cs(csFactory->create((size_t)0, 2));

    ensure(0 != cs.get());

    geos::geom::Coordinate c0(0, 0);
    geos::geom::Coordinate c1(0, 0);

    cs->add(c0);
    cs->add(c1);

    ensure_equals(cs->size(), 2u);

    SegmentStringAutoPtr ss(makeSegmentString(cs.get()));
    ensure(0 != ss.get());

    ensure_equals(ss->size(), 2u);

    ensure_equals(ss->getData(), (void*)0);

    ensure_equals(ss->getCoordinates(), cs.get());

    ensure_equals(ss->getCoordinate(0), c0);

    ensure_equals(ss->getCoordinate(1), c1);

    ensure_equals(ss->isClosed(), true);

    // this would throw an exception
    bool octant_failed=false;
    try {
        ss->getSegmentOctant(0);
    } catch (...) {
        octant_failed=true;
    }
    ensure(octant_failed);

}