本文整理汇总了C++中OGRMultiPolygon::get_Area方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRMultiPolygon::get_Area方法的具体用法?C++ OGRMultiPolygon::get_Area怎么用?C++ OGRMultiPolygon::get_Area使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRMultiPolygon
的用法示例。
在下文中一共展示了OGRMultiPolygon::get_Area方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_area_feature
OGRFeature* create_area_feature(const shared_ptr<Osmium::OSM::Area const>& area)
{
OGRFeature* feature = OGRFeature::CreateFeature(m_layer_polygon->GetLayerDefn());
Osmium::Geometry::MultiPolygon mp(*area);
OGRMultiPolygon* ogrgeom = Osmium::Geometry::create_ogr_geometry(mp);
ogrgeom->transform(m_transformation);
feature->SetGeometryDirectly(ogrgeom);
sprintf(longint, "%ld", area->from_way() ? area->orig_id() : -area->orig_id());
feature->SetField("osm_id", longint);
feature->SetField("z_order", calculate_z_order(area.get()));
feature->SetField("way_area", ogrgeom->get_Area());
return feature;
}
示例2: area
double Polygon::area() const
{
throwNoGeos();
OGRwkbGeometryType t = m_geom->getGeometryType();
// Not until GDAL 2.3
/**
if (t == wkbPolygon || t == wkbPolygon25D)
return m_geom->toPolygon()->get_Area();
else if (t == wkbMultiPolygon || t == wkbMultiPolygon25D)
return m_geom->toMultiPolygon()->get_Area();
**/
if (t == wkbPolygon || t == wkbPolygon25D)
{
OGRPolygon *p = static_cast<OGRPolygon *>(m_geom.get());
return p->get_Area();
}
else if (t == wkbMultiPolygon || t == wkbMultiPolygon25D)
{
OGRMultiPolygon *p = static_cast<OGRMultiPolygon *>(m_geom.get());
return p->get_Area();
}
return 0;
}