本文整理汇总了C++中SpatialReference::get方法的典型用法代码示例。如果您正苦于以下问题:C++ SpatialReference::get方法的具体用法?C++ SpatialReference::get怎么用?C++ SpatialReference::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpatialReference
的用法示例。
在下文中一共展示了SpatialReference::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NODE_THROW
Handle<Value> Geometry::createFromWkb(const Arguments &args)
{
HandleScope scope;
std::string wkb_string;
SpatialReference *srs = NULL;
Handle<Object> wkb_obj;
NODE_ARG_OBJECT(0, "wkb", wkb_obj);
NODE_ARG_WRAPPED_OPT(1, "srs", SpatialReference, srs);
std::string obj_type = TOSTR(wkb_obj->GetConstructorName());
if(obj_type != "Buffer"){
return NODE_THROW("Argument must be a buffer object");
}
unsigned char* data = (unsigned char *) Buffer::Data(wkb_obj);
size_t length = Buffer::Length(wkb_obj);
OGRGeometry *geom = NULL;
OGRSpatialReference *ogr_srs = NULL;
if (srs) {
ogr_srs = srs->get();
}
OGRErr err = OGRGeometryFactory::createFromWkb(data, ogr_srs, &geom, length);
if (err) {
return NODE_THROW_OGRERR(err);
}
return scope.Close(Geometry::New(geom, true));
}
示例2: NODE_THROW_OGRERR
Handle<Value> Geometry::createFromWkt(const Arguments &args)
{
HandleScope scope;
std::string wkt_string;
SpatialReference *srs = NULL;
NODE_ARG_STR(0, "wkt", wkt_string);
NODE_ARG_WRAPPED_OPT(1, "srs", SpatialReference, srs);
char *wkt = (char*) wkt_string.c_str();
OGRGeometry *geom = NULL;
OGRSpatialReference *ogr_srs = NULL;
if (srs) {
ogr_srs = srs->get();
}
OGRErr err = OGRGeometryFactory::createFromWkt(&wkt, ogr_srs, &geom);
if (err) {
return NODE_THROW_OGRERR(err);
}
return scope.Close(Geometry::New(geom, true));
}