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


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

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


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

示例1: LineMergeDirectedEdge

void
LineMergeGraph::addEdge(const LineString *lineString)
{
	if (lineString->isEmpty()) return;

#if GEOS_DEBUG
	cerr<<"Adding LineString "<<lineString->toString()<<endl;
#endif

	CoordinateSequence *coordinates = 
		CoordinateSequence::removeRepeatedPoints(lineString->getCoordinatesRO());

	const Coordinate& startCoordinate=coordinates->getAt(0);
	const Coordinate& endCoordinate=coordinates->getAt(coordinates->getSize()-1);

	planargraph::Node* startNode=getNode(startCoordinate);
	planargraph::Node* endNode=getNode(endCoordinate);
#if GEOS_DEBUG
	cerr<<" startNode: "<<*startNode<<endl;
	cerr<<" endNode: "<<*endNode<<endl;
#endif

	planargraph::DirectedEdge *directedEdge0=new LineMergeDirectedEdge(startNode,
			endNode,coordinates->getAt(1),
			true);
	newDirEdges.push_back(directedEdge0);

	planargraph::DirectedEdge *directedEdge1=new LineMergeDirectedEdge(endNode,
			startNode,coordinates->getAt(coordinates->getSize()-2),
			false);
	newDirEdges.push_back(directedEdge1);

	planargraph::Edge *edge=new LineMergeEdge(lineString);
	newEdges.push_back(edge);
	edge->setDirectedEdges(directedEdge0, directedEdge1);

#if GEOS_DEBUG
	cerr<<" planargraph::Edge: "<<*edge<<endl;
#endif

	add(edge);

#if GEOS_DEBUG
	cerr<<" After addition to the graph:"<<endl;
	cerr<<"  startNode: "<<*startNode<<endl;
	cerr<<"  endNode: "<<*endNode<<endl;
#endif

	delete coordinates;
}
开发者ID:asapnet,项目名称:geos,代码行数:50,代码来源:LineMergeGraph.cpp

示例2: _moveToLineAsCoordinate

Coordinate WayAverager::_moveToLineAsCoordinate(long ni, double nWeight, const LineString* ls,
                                                double lWeight)
{
  shared_ptr<Node> n = _map.getNode(ni);
  Point* point(GeometryFactory::getDefaultInstance()->createPoint(n->toCoordinate()));

  // find the two closest points
  CoordinateSequence* cs = DistanceOp::closestPoints(point, const_cast<LineString*>(ls));

  Coordinate result = Coordinate(cs->getAt(0).x * nWeight + cs->getAt(1).x * lWeight,
                                 cs->getAt(0).y * nWeight + cs->getAt(1).y * lWeight);

  delete cs;
  delete point;

  return result;
}
开发者ID:andyneff,项目名称:hootenanny,代码行数:17,代码来源:WayAverager.cpp

示例3: dimension

CoordinateArraySequence::CoordinateArraySequence(
    const CoordinateSequence &c )
	:
	CoordinateSequence(c),
	vect(new vector<Coordinate>(c.size())),
  dimension(c.getDimension())
{
  for (size_t i = 0, n = vect->size(); i < n; ++i) {
      (*vect)[i] = c.getAt(i);
  }
}
开发者ID:drownedout,项目名称:datamap,代码行数:11,代码来源:CoordinateArraySequence.cpp

示例4: _findNearestPointOnFeature

Coordinate BaseComparator::_findNearestPointOnFeature(shared_ptr<OsmMap> map, Coordinate c)
{
  Coordinate result;

  // find the nearest feature
  long wId = map->getIndex().findNearestWay(c);
  shared_ptr<Way> w = map->getWay(wId);

  // find the nearest point on that feature.
  shared_ptr<Point> p(GeometryFactory::getDefaultInstance()->createPoint(c));
  shared_ptr<LineString> ls = ElementConverter(map).convertToLineString(w);
  CoordinateSequence* cs = DistanceOp::closestPoints(p.get(), ls.get());

  cs->getAt(0, result);

  delete cs;

  return result;
}
开发者ID:giserh,项目名称:hootenanny,代码行数:19,代码来源:BaseComparator.cpp

示例5: _init

void VectorLayerEditor::_init()
{
    if(_inited)
        return;

    // Load geometry
    AmigoApplicationData &appData = AmigoApplication::instance().getData();
    if(auto project = appData.getUser().projects.findProject(_editorParams.projectId))
    {
        std::vector<std::string> wkbOut;
        std::shared_ptr<APIv1::Dataset> ds = std::dynamic_pointer_cast<APIv1::Dataset>(project->datasets.findDataset(_editorParams.datasetId));
        if(ds)
        {
            if(_editorParams.savedWkb.empty())
            {
                project->db.geoQueryWKB(ds->table_name, _editorParams.jsonRecord, wkbOut, ds->online_only);
                AMIGO_LOG_I(TAG, "::_init() wkbOut.size()=%d\n", wkbOut.size());
            }
            else
            {
                AMIGO_LOG_I(TAG, "::_init() restore '%s'\n", _editorParams.savedWkb.c_str());
                _geometry = GeometryHandler::parseWKBHex(_editorParams.savedWkb);
            }

            if(_geometry == NULL)
            {
                if(wkbOut.size()==1 && wkbOut[0].size()>0)
                {
                    AMIGO_LOG_I(TAG, "::_init() '%s'\n", wkbOut[0].c_str());
                    _geometry = GeometryHandler::parseWKBHex(wkbOut[0]);
                } else {
                    // There is no geometry
                    _createEmptyGeometry();
                }
            }

            if(_geometry!=NULL)
            {
                GeometryTypeId gtype = _geometry->getGeometryTypeId();
                int type;
                switch (gtype) {
                case GEOS_POINT:
                    type = ShapeEditor::T_POINT;
                    break;

                case GEOS_LINESTRING:
                    type = ShapeEditor::T_LINE;
                    break;

                case GEOS_LINEARRING:
                    type = ShapeEditor::T_LINE;
                    break;

                case GEOS_POLYGON:
                    type = ShapeEditor::T_POLYGON;
                    break;

                case GEOS_MULTIPOINT:
                    type = ShapeEditor::T_POINTS;
                    break;

                case GEOS_MULTILINESTRING:
                    type = ShapeEditor::T_LINES;
                    break;

                case GEOS_MULTIPOLYGON:
                    type = ShapeEditor::T_POLYGONS;
                    break;

                case GEOS_GEOMETRYCOLLECTION:
                    type = ShapeEditor::T_POINTS;
                    break;

                default:
                    type = ShapeEditor::T_POINTS;
                    break;
                };
                AMIGO_LOG_I(TAG, "::_init() type=%d, gtype=%d\n", type, gtype);
                _coords.clear();
                for(size_t g = 0; g < _geometry->getNumGeometries(); g++)
                {
                    PointList pList;
                    CoordinateSequence *cs = _geometry->getGeometryN(g)->getCoordinates();
                    // Remove closing point in polygons
                    unsigned size = cs->getSize() - ((type == ShapeEditor::T_POLYGONS || type == ShapeEditor::T_POLYGON)? 1 : 0);
                    for(unsigned i=0; i < size; i++ )
                    {
                        Coordinate c;
                        cs->getAt(i, c);
                        double alt = Globe::instance()->getGlobeSceneHandler()->getElevationAt( c.y, c.x);
                        pList.push_back( iiMath::vec3(c.y, c.x, alt) );
                    }
                    _coords.push_back(pList);
                    delete cs;
                }
                _shapeEditor.load(type, _coords);
            }
        }
        else
        {
//.........这里部分代码省略.........
开发者ID:gfbipnet,项目名称:amigoclient,代码行数:101,代码来源:VectorLayerEditor.cpp


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