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


C++ CoordinateSequence::setAt方法代码示例

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


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

示例1: DefaultCoordinateSequence

/**
 * Create a new "split edge" with the section of points between
 * (and including) the two intersections.
 * The label for the new edge is the same as the label for the parent edge.
 */
SegmentString*
SegmentNodeList::createSplitEdge(SegmentNode *ei0, SegmentNode *ei1)
{
	//Debug.print("\ncreateSplitEdge"); Debug.print(ei0); Debug.print(ei1);
	int npts = ei1->segmentIndex - ei0->segmentIndex + 2;
	Coordinate lastSegStartPt=edge->getCoordinate(ei1->segmentIndex);
	// if the last intersection point is not equal to the its segment start pt,
	// add it to the points list as well.
	// (This check is needed because the distance metric is not totally reliable!)
	// The check for point equality is 2D only - Z values are ignored
	bool useIntPt1=ei1->dist > 0.0 || ! ei1->coord->equals2D(lastSegStartPt);
	if (! useIntPt1) {
		npts--;
	}
	CoordinateSequence *pts = new DefaultCoordinateSequence(npts); 
	int ipt = 0;
	//pts->setAt(Coordinate(*(ei0->coord)),ipt++);
	pts->setAt(*(ei0->coord), ipt++);
	for (int i = ei0->segmentIndex + 1; i <= ei1->segmentIndex; i++) {
		pts->setAt(edge->getCoordinate(i),ipt++);
	}
	if (useIntPt1) 	pts->setAt(*(ei1->coord),ipt++);
	SegmentString *ret = new SegmentString(pts,edge->getContext());
	splitEdges.push_back(ret);
	splitCoordLists.push_back(pts);
	return ret;
}
开发者ID:kanbang,项目名称:Colt,代码行数:32,代码来源:SegmentNodeList.cpp

示例2: create

shared_ptr<LineString> ElementConverter::convertToLineString(const ConstWayPtr& w) const
{
  const std::vector<long>& ids = w->getNodeIds();
  int size = ids.size();
  if (size == 1)
  {
    size = 2;
  }
  CoordinateSequence* cs = GeometryFactory::getDefaultInstance()->getCoordinateSequenceFactory()->
                           create(size, 2);

  for (size_t i = 0; i < ids.size(); i++)
  {
    shared_ptr<const Node> n = _constProvider->getNode(ids[i]);
    cs->setAt(n->toCoordinate(), i);
  }

  // a linestring cannot contain 1 point. Do this to keep it valid.
  if (ids.size() == 1)
  {
    shared_ptr<const Node> n = _constProvider->getNode(ids[0]);
    cs->setAt(n->toCoordinate(), 1);
  }

  shared_ptr<LineString> result(GeometryFactory::getDefaultInstance()->createLineString(cs));

  return result;
}
开发者ID:BSteine,项目名称:hootenanny,代码行数:28,代码来源:ElementConverter.cpp

示例3: CoordinateArraySequence

/*private*/
SegmentString*
SegmentNodeList::createSplitEdge(SegmentNode *ei0, SegmentNode *ei1)
{
	assert(ei0);
	assert(ei1);

	size_t npts = ei1->segmentIndex - ei0->segmentIndex + 2;

	const Coordinate &lastSegStartPt=edge.getCoordinate(ei1->segmentIndex);

	// if the last intersection point is not equal to the its
	// segment start pt, add it to the points list as well.
	// (This check is needed because the distance metric is not
	// totally reliable!)

	// The check for point equality is 2D only - Z values are ignored

	// Added check for npts being == 2 as in that case NOT using second point
	// would mean creating a SegmentString with a single point
	// FIXME: check with mbdavis about this, ie: is it a bug in the caller ?
	//
	bool useIntPt1 = npts == 2 || (ei1->isInterior() || ! ei1->coord.equals2D(lastSegStartPt));

	if (! useIntPt1) {
		npts--;
	}

	CoordinateSequence *pts = new CoordinateArraySequence(npts); 
	size_t ipt = 0;
	pts->setAt(ei0->coord, ipt++);
	for (size_t i=ei0->segmentIndex+1; i<=ei1->segmentIndex; i++)
	{
		pts->setAt(edge.getCoordinate(i),ipt++);
	}
	if (useIntPt1) 	pts->setAt(ei1->coord, ipt++);

	SegmentString *ret = new SegmentString(pts, edge.getData());
#if GEOS_DEBUG
	std::cerr<<" SegmentString created"<<std::endl;
#endif
	splitEdges.push_back(ret);

	// Keep track of created CoordinateSequence to release
	// it at this SegmentNodeList destruction time
	splitCoordLists.push_back(pts);

	return ret;
}
开发者ID:lozpeng,项目名称:applesales,代码行数:49,代码来源:SegmentNodeList.cpp

示例4: Edge

Edge*
Edge::getCollapsedEdge()
{
	testInvariant();
	CoordinateSequence *newPts = new CoordinateArraySequence(2);
	newPts->setAt(pts->getAt(0),0);
	newPts->setAt(pts->getAt(1),1);
	return new Edge(newPts, Label::toLineLabel(label));
}
开发者ID:drownedout,项目名称:datamap,代码行数:9,代码来源:Edge_geomgraph.cpp


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