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


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

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


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

示例1: buf

/*static*/
string
WKTWriter::toLineString(const CoordinateSequence& seq)
{
	stringstream buf("LINESTRING ", ios_base::in|ios_base::out);
	unsigned int npts = seq.getSize();
	if ( npts == 0 )
	{
		buf << "EMPTY";
	}
	else
	{
		buf << "(";
		for (unsigned int i=0; i<npts; ++i)
		{
			if (i) buf << ", ";
			buf << seq.getX(i) << " " << seq.getY(i);
#if PRINT_Z
			buf << seq.getZ(i);
#endif
		}
		buf << ")";
	}

	return buf.str();
}
开发者ID:asapnet,项目名称:geos,代码行数:26,代码来源:WKTWriter.cpp

示例2: assert

void
WKBWriter::writeCoordinate(const CoordinateSequence& cs, size_t idx,
                           bool is3d)
{
#if DEBUG_WKB_WRITER
    cout << "writeCoordinate: X:" << cs.getX(idx) << " Y:" << cs.getY(idx) << endl;
#endif
    assert(outStream);

    ByteOrderValues::putDouble(cs.getX(idx), buf, byteOrder);
    outStream->write(reinterpret_cast<char*>(buf), 8);
    ByteOrderValues::putDouble(cs.getY(idx), buf, byteOrder);
    outStream->write(reinterpret_cast<char*>(buf), 8);
    if(is3d) {
        ByteOrderValues::putDouble(
            cs.getOrdinate(idx, CoordinateSequence::Z),
            buf, byteOrder);
        outStream->write(reinterpret_cast<char*>(buf), 8);
    }
}
开发者ID:libgeos,项目名称:libgeos,代码行数:20,代码来源:WKBWriter.cpp

示例3: coordinateSeq3

void coordinateSeq3() {
    CoordinateSequence *cl = new CoordinateArraySequence();
    cl->add(Coordinate(116.5189446,39.9385391));
    cl->add(Coordinate(116.5389472,39.9386038));
    cl->add(Coordinate(116.5589889,39.9387932));
    cl->add(Coordinate(116.5789501,39.9386662));

    cl->add(Coordinate(116.5889538,39.9387273));

    cl->add(Coordinate(116.5289589,39.2387832));
    cl->add(Coordinate(116.548965,39.9388347));
    cl->add(Coordinate(116.5689136,39.9385191));
    cl->add(Coordinate(116.5089711,39.9388873));
    cl->add(Coordinate(116.5459744,39.9389397));
    cl->add(Coordinate(116.5819436,39.9385291));
    MultiPoint *mp = global_factory->createMultiPoint(*cl);

    prep::PreparedGeometry const *pg_ = prep::PreparedGeometryFactory::prepare(mp);
    pg_->getGeometry();

    CoordinateSequence *cr = new CoordinateArraySequence();
    cr->add(Coordinate(116.5889539 + 0.000005, 39.9387274 + 0.000005));
    cr->add(Coordinate(116.5889539 + 0.000005, 39.9387274 - 0.000005));
    cr->add(Coordinate(116.5889539 - 0.000005, 39.9387274 - 0.000005));
    cr->add(Coordinate(116.5889539 - 0.000005, 39.9387274 + 0.000005));
    cr->add(Coordinate(116.5889539 + 0.000005, 39.9387274 + 0.000005));
    MultiPoint *mp2 = global_factory->createMultiPoint(*cr);


    LinearRing *li = global_factory->createLinearRing(cr);
    geos::geom::Polygon *poly1=global_factory->createPolygon(li,NULL);

    //geos::geom::Geometry *pint = mp2->intersection(mp);
    //geos::geom::Geometry *pint = mp2->intersection(poly1);
    geos::geom::Geometry *pint = pg_->getGeometry().intersection(poly1);

    //CoordinateSequence *coord = pint->getCoordinates();	
    CoordinateSequence *coord = pg_->getGeometry().getCoordinates();	

    printf("getNumPoints: %lu\n", pint->getNumPoints());
    printf("Get CoordinateSequence Num: %lu\n", coord->getSize());

    for (int i=0; i<coord->getSize(); i++) {
        printf("Get CoordinateSequence [%d]-(%f, %f)\n", i, coord->getX(i), coord->getY(i));
    }
    delete coord;
    delete pint;
    delete mp;
    delete mp2;
    delete cl;
    delete cr;
}
开发者ID:border,项目名称:notes,代码行数:52,代码来源:example.cpp

示例4: coordinateSeq2

void coordinateSeq2() {
    CoordinateSequence *cl = new CoordinateArraySequence();
    cl->add(Coordinate(100,100));
    cl->add(Coordinate(100,200));
    cl->add(Coordinate(200,200));
    cl->add(Coordinate(200,100));
    cl->add(Coordinate(180,180));
    cl->add(Coordinate(100,100));
    LinearRing *lr = global_factory->createLinearRing(cl);
    geos::geom::Polygon *poly=NULL;
    poly = global_factory->createPolygon(lr,NULL);     

    CoordinateSequence *cr = new CoordinateArraySequence();
    cr->add(geos::geom::Coordinate(150, 150));
    cr->add(geos::geom::Coordinate(190, 190));
    cr->add(geos::geom::Coordinate(150, 250));
    cr->add(geos::geom::Coordinate(250, 250));
    cr->add(geos::geom::Coordinate(250, 150));
    cr->add(geos::geom::Coordinate(150, 150));

    //geos::geom::Polygon *poly1 = create_circle(150, 150, 10);

    LinearRing *li = global_factory->createLinearRing(cr);
    geos::geom::Polygon *poly1=global_factory->createPolygon(li,NULL);

    geos::geom::Geometry *pint = poly1->intersection(poly);
	io::WKTWriter *wkt = new io::WKTWriter();
    string tmp=wkt->write(pint);
    cout<<" (WKT coordinateSeq Intersection) "<<tmp<<endl;

    printf("getNumPoints: %lu\n", pint->getNumPoints());

	vector<Geometry *> *newgeoms = new vector<Geometry *>;
    newgeoms->push_back(pint);

	cout<<endl<<"----- HERE ARE SOME INTERSECTIONS COMBINATIONS ------"<<endl;
	wkt_print_geoms(newgeoms);

    CoordinateSequence *coord = pint->getCoordinates();	
    printf("Get CoordinateSequence Num: %lu\n", coord->getSize());

    for (int i=0; i<coord->getSize(); i++) {
        printf("Get CoordinateSequence [%d]-(%f, %f)\n", i, coord->getX(i), coord->getY(i));
    }
    delete coord;
    delete newgeoms;
}
开发者ID:border,项目名称:notes,代码行数:47,代码来源:example.cpp


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