BasicSegmentString.inl 1.42 KB
Newer Older
xuebingbing's avatar
xuebingbing committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
/**********************************************************************
 *
 * GEOS - Geometry Engine Open Source
 * http://geos.osgeo.org
 *
 * Copyright (C) 2009 Sandro Santilli <strk@kbt.io>
 *
 * This is free software; you can redistribute and/or modify it under
 * the terms of the GNU Lesser General Licence as published
 * by the Free Software Foundation.
 * See the COPYING file for more information.
 *
 **********************************************************************
 *
 * Last port: noding/BasicSegmentString.java rev. 1.1 (JTS-1.9)
 *
 **********************************************************************/

#ifndef GEOS_NODING_BASICSEGMENTSTRING_INL
#define GEOS_NODING_BASICSEGMENTSTRING_INL

#include <cstddef>

#include <geos/noding/BasicSegmentString.h>
#include <geos/noding/Octant.h>

namespace geos {
namespace noding {

/*public*/
INLINE int
BasicSegmentString::getSegmentOctant(size_t index) const
{
    if(index >= size() - 1) {
        return -1;
    }
    return Octant::octant(getCoordinate(index), getCoordinate(index + 1));
}

/* virtual public */
INLINE const geom::Coordinate&
BasicSegmentString::getCoordinate(size_t i) const
{
    return pts->getAt(i);
}

/* virtual public */
INLINE geom::CoordinateSequence*
BasicSegmentString::getCoordinates() const
{
    return pts;
}

/* virtual public */
INLINE bool
BasicSegmentString::isClosed() const
{
    return pts->getAt(0) == pts->getAt(size() - 1);
}

}
}

#endif