本文整理汇总了C++中LineString::getPointN方法的典型用法代码示例。如果您正苦于以下问题:C++ LineString::getPointN方法的具体用法?C++ LineString::getPointN怎么用?C++ LineString::getPointN使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LineString
的用法示例。
在下文中一共展示了LineString::getPointN方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
mapnik::geometry::line_string<double> geowave_featureset::create_line_string(LineString line_string)
{
mapnik::geometry::line_string<double> line_string_out;
for (int point_idx = line_string.getNumPoints()-1; point_idx >= 0; --point_idx)
{
Coordinate coord = line_string.getPointN(point_idx).getCoordinate();
line_string_out.add_coord(coord.x(), coord.y());
}
if (line_string.isClosed())
{
Coordinate coord = line_string.getPointN(line_string.getNumPoints()-1).getCoordinate();
line_string_out.add_coord(coord.x(), coord.y());
}
return line_string_out;
}
示例2: geosIntersect
bool geosIntersect(const LineSegment& ls1, Meters buffer, const LineSegment& ls2,
LineSegment& result)
{
boost::shared_ptr<Geometry> g1(ls1.toGeometry(*GeometryFactory::getDefaultInstance())->clone());
boost::shared_ptr<Geometry> g2(ls2.toGeometry(*GeometryFactory::getDefaultInstance())->clone());
boost::shared_ptr<Geometry> g(g1->buffer(buffer, 40));
boost::shared_ptr<Geometry> i(g->intersection(g2.get()));
if (i->isEmpty())
{
result.p0 = Coordinate::getNull();
return false;
}
else if (i->getGeometryTypeId() == GEOS_POINT)
{
Point* p = dynamic_cast<Point*>(i.get());
result.p0 = *(p->getCoordinate());
}
else if (i->getGeometryTypeId() == GEOS_LINESTRING)
{
LineString* ls = dynamic_cast<LineString*>(i.get());
assert(ls->getNumPoints() == 2);
result.p0 = *ls->getPointN(0)->getCoordinate();
result.p1 = *ls->getPointN(1)->getCoordinate();
}
else
{
throw HootException();
}
return true;
}