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


C++ Geometry::Wrap方法代码示例

本文整理汇总了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();
}
开发者ID:xkwangy,项目名称:node-gdal,代码行数:25,代码来源:gdal_geometry.cpp

示例2: Geometry

Handle<Value> Geometry::New(const Arguments& args) {
    Geometry *geom;
    HandleScope scope;
    geom = new Geometry();
    geom->Wrap(args.This());
    return args.This();
}
开发者ID:agate,项目名称:node-geos,代码行数:7,代码来源:geometry.cpp

示例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);
}
开发者ID:netconstructor,项目名称:node-geos,代码行数:8,代码来源:geometry.cpp

示例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();
}
开发者ID:blairdgeo,项目名称:node-ogr,代码行数:17,代码来源:ogr_geometry.cpp

示例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();
}
开发者ID:elpampero,项目名称:node-mapnik,代码行数:22,代码来源:mapnik_geometry.cpp


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