27 #include "../../../../geometry/LinearRing.h" 28 #include "../../common/Utils.h" 35 if(!args.IsConstructCall())
36 return ::v8::ThrowException(::v8::String::New(
"In order to create a LinearRing you need to call its constructor like: var mygc = new TeLinearRing(3, TE_OGC_LINESTRING, 4326)."));
38 if(args.Holder().IsEmpty())
39 return ::v8::ThrowException(::v8::String::New(
"LinearRing constructor must use object notation!"));
41 if((args.Length() != 3) ||
42 args[0].IsEmpty() || !args[0]->IsInt32() ||
43 args[1].IsEmpty() || !args[1]->IsInt32() ||
44 args[2].IsEmpty() || !args[2]->IsInt32())
45 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in LinearRing constructor method!!"));
48 int npts = args[0]->Int32Value();
49 int geomType = args[1]->Int32Value();
50 int srid = args[2]->ToInt32()->Int32Value();
52 std::auto_ptr<te::gm::LinearRing> g(
new te::gm::LinearRing(npts, static_cast<te::gm::GeomType>(geomType), srid));
67 global->Set(::v8::String::New(
"TeLinearRing"), jsgc->GetFunction());
77 ::v8::Local<::v8::FunctionTemplate> result = ::v8::FunctionTemplate::New();
78 result->Inherit(lineTpl);
80 ::v8::Handle<::v8::ObjectTemplate> prototype = result->PrototypeTemplate();
::v8::Local<::v8::Object > Make(T *obj, TF tfunc, const bool isOwner)
It creates a new JavaScript object from a C++ object (obj).
::v8::Persistent<::v8::FunctionTemplate > & GetLinearRingTemplate()
It returns a reference to the persistent template of a LinearRing object.
::v8::Persistent<::v8::FunctionTemplate > & GetLineStringTemplate()
It returns a reference to the persistent template of a LineString object.
A LinearRing is a LineString that is both closed and simple.
void RegisterLinearRing(::v8::Local<::v8::Object > &global)
It register the LinearRing class.
::v8::Handle<::v8::Value > LinearRing_Constructor(const ::v8::Arguments &args)
static::v8::Persistent<::v8::FunctionTemplate > sg_ring_template