本文整理汇总了C++中Geometry::Wrap方法的典型用法代码示例。如果您正苦于以下问题:C++ Geometry::Wrap方法的具体用法?C++ Geometry::Wrap怎么用?C++ Geometry::Wrap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Geometry
的用法示例。
在下文中一共展示了Geometry::Wrap方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NODE_THROW
Handle<Value> Geometry::New(const Arguments& args)
{
HandleScope scope;
Geometry *f;
if (!args.IsConstructCall()) {
return NODE_THROW("Cannot call constructor as function, you need to use 'new' keyword");
}
if (args[0]->IsExternal()) {
Local<External> ext = Local<External>::Cast(args[0]);
void* ptr = ext->Value();
f = static_cast<Geometry *>(ptr);
} else {
return NODE_THROW("Geometry doesnt have a constructor, use Geometry.createFromWkt(), Geometry.create() or type-specific constructor. ie. new ogr.Point()");
OGRwkbGeometryType geometry_type;
NODE_ARG_ENUM(0, "geometry type", OGRwkbGeometryType, geometry_type);
OGRGeometry *geom = OGRGeometryFactory::createGeometry(geometry_type);
f = new Geometry(geom);
}
f->Wrap(args.This());
return args.This();
}
示例2: Geometry
Handle<Value> Geometry::New(const Arguments& args) {
Geometry *geom;
HandleScope scope;
geom = new Geometry();
geom->Wrap(args.This());
return args.This();
}
示例3: Geometry
Handle<Object> Geometry::WrapNewGEOSGeometry(GEOSGeometry *geos_geom)
{
HandleScope scope;
Local<Object> geom_obj = geometry_template_->InstanceTemplate()->NewInstance();
Geometry *geom = new Geometry(geos_geom);
geom->Wrap(geom_obj);
return scope.Close(geom_obj);
}
示例4: ThrowException
Handle<Value> Geometry::New(const Arguments& args)
{
HandleScope scope;
if (!args.IsConstructCall())
return ThrowException(String::New("Cannot call constructor as function, you need to use 'new' keyword"));
if (args[0]->IsExternal()) {
Local<External> ext = Local<External>::Cast(args[0]);
void* ptr = ext->Value();
Geometry *f = static_cast<Geometry *>(ptr);
f->Wrap(args.This());
return args.This();
}
return args.This();
}
示例5: ThrowException
Handle<Value> Geometry::New(const Arguments& args)
{
HandleScope scope;
//if (!args.IsConstructCall())
// return ThrowException(String::New("Cannot call constructor as function, you need to use 'new' keyword"));
if (args[0]->IsExternal())
{
//std::clog << "external!\n";
Local<External> ext = Local<External>::Cast(args[0]);
void* ptr = ext->Value();
Geometry* g = static_cast<Geometry*>(ptr);
g->Wrap(args.This());
return args.This();
}
else
{
return ThrowException(Exception::Error(
String::New("a mapnik.Geometry cannot be created directly - rather you should create mapnik.Path objects which can contain one or more geometries")));
}
return args.This();
}