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


C++ LineString::getCoordinatesRO方法代码示例

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


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

示例1:

bool
SegmentIntersectionTester::hasIntersection(
	const LineString &line, const LineString &testLine)
{
  typedef std::size_t size_type;

	const CoordinateSequence &seq0 = *(line.getCoordinatesRO());
  size_type seq0size = seq0.getSize();

  const CoordinateSequence &seq1 = *(testLine.getCoordinatesRO());
  size_type seq1size = seq1.getSize();

  for (size_type i = 1; i<seq0size && !hasIntersectionVar; ++i)
	{
    seq0.getAt(i - 1, pt00);
    seq0.getAt(i, pt01);

    for (size_type j = 1; j < seq1size && !hasIntersectionVar; ++j)
		{
      seq1.getAt(j-1, pt10);
      seq1.getAt(j, pt11);

			li.computeIntersection(pt00, pt01, pt10, pt11);
			if (li.hasIntersection()) hasIntersectionVar = true;
		}
	}

	return hasIntersectionVar;
}
开发者ID:mwtoews,项目名称:libgeos,代码行数:29,代码来源:SegmentIntersectionTester.cpp

示例2:

/*private*/
bool
RectangleContains::isLineStringContainedInBoundary(const LineString& line)
{
	const CoordinateSequence &seq = *(line.getCoordinatesRO());
	for (unsigned int i=0, n=seq.getSize()-1; i<n; ++i) {
		const Coordinate& p0=seq.getAt(i);
		const Coordinate& p1=seq.getAt(i+1);
		if (! isLineSegmentContainedInBoundary(p0, p1))
			return false;
	}
	return true;
}
开发者ID:h4ck3rm1k3,项目名称:geos,代码行数:13,代码来源:RectangleContains.cpp

示例3: writeByteOrder

void
WKBWriter::writeLineString(const LineString& g)
{
    writeByteOrder();

    writeGeometryType(WKBConstants::wkbLineString, g.getSRID());
    writeSRID(g.getSRID());

    const CoordinateSequence* cs = g.getCoordinatesRO();
    assert(cs);
    writeCoordinateSequence(*cs, true);
}
开发者ID:libgeos,项目名称:libgeos,代码行数:12,代码来源:WKBWriter.cpp

示例4: LinearRingVect

void
RectangleIntersectionBuilder::reconnectPolygons(const Rectangle & rect)
{
  // Build the exterior rings first

  typedef std::vector< geom::Geometry *> LinearRingVect;
  typedef std::pair< geom::LinearRing *, LinearRingVect * > ShellAndHoles;
  typedef std::list< ShellAndHoles > ShellAndHolesList;

  ShellAndHolesList exterior;

  const CoordinateSequenceFactory &_csf = *_gf.getCoordinateSequenceFactory();

  // If there are no lines, the rectangle must have been
  // inside the exterior ring.

  if(lines.empty())
	{
	  geom::LinearRing * ring = rect.toLinearRing(_gf);
	  exterior.push_back(make_pair(ring, new LinearRingVect()));
	}
  else
	{
	  // Reconnect all lines into one or more linearrings
	  // using box boundaries if necessary

    std::vector<Coordinate> *ring = NULL;

	  while(!lines.empty() || ring != NULL)
		{
		  if(ring == NULL)
			{
			  ring = new std::vector<Coordinate>();
			  LineString *line = lines.front();
			  lines.pop_front();
        line->getCoordinatesRO()->toVector(*ring);
			  delete line;
			}

		  // Distance to own endpoint
		  double own_distance = distance(rect, *ring);

		  // Find line to connect to
      // TODO: should we use LineMerge op ?
		  double best_distance = -1;
		  std::list<LineString*>::iterator best_pos = lines.begin();
		  for(std::list<LineString*>::iterator iter=lines.begin(); iter!=lines.end(); ++iter)
			{
			  double d = distance(rect, *ring, *iter);
			  if(best_distance < 0 || d<best_distance)
				{
				  best_distance = d;
				  best_pos = iter;
				}
			}

		  // If own end point is closest, close the ring and continue
		  if(best_distance < 0 || own_distance < best_distance)
			{
			  close_ring(rect,ring);
			  normalize_ring(*ring);
        geom::CoordinateSequence *shell_cs = _csf.create(ring);
        geom::LinearRing *shell = _gf.createLinearRing(shell_cs);
	      exterior.push_back(make_pair(shell, new LinearRingVect()));
			  ring = NULL;
			}
		  else
			{
			  LineString * line = *best_pos;
			  int nr = ring->size();
        const CoordinateSequence& cs = *line->getCoordinatesRO();
			  close_boundary(rect, ring,
							 (*ring)[nr-1].x,
							 (*ring)[nr-1].y,
							 cs[0].x,
               cs[0].y);
        // above function adds the 1st point
        for (size_t i=1; i<cs.size(); ++i)
          ring->push_back(cs[i]);
			  //ring->addSubLineString(line,1);
			  delete line;
			  lines.erase(best_pos);
			}
		}
	}

  // Attach holes to polygons

  for (std::list<geom::Polygon *>::iterator i=polygons.begin(), e=polygons.end(); i!=e; ++i)
	{
    geom::Polygon *poly = *i;
    const geom::LineString *hole = poly->getExteriorRing();

	  if(exterior.size() == 1)
    {
		  exterior.front().second->push_back( hole->clone() );
    }
	  else
		{
      using geos::algorithm::CGAlgorithms;
//.........这里部分代码省略.........
开发者ID:52North,项目名称:IlwisCore,代码行数:101,代码来源:RectangleIntersectionBuilder.cpp


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