27 #include "../../../../geometry/Coord2D.h" 28 #include "../../../../geometry/MultiSurface.h" 29 #include "../../../../geometry/Point.h" 30 #include "../../common/Utils.h" 37 if(args.Holder().IsEmpty())
38 return ::v8::ThrowException(::v8::String::New(
"In order to use getArea method you must use object notation: \"area = obj.getArea();\""));
43 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in getArea method!"));
47 ::v8::Local<::v8::Number> ja = ::v8::Number::New(a);
56 if(args.Holder().IsEmpty())
57 return ::v8::ThrowException(::v8::String::New(
"In order to use getCentroid method you must use object notation: \"pt = obj.getCentroid();\""));
62 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in getCentroid method!"));
70 return hs.Close(jsgeom);
77 if(args.Holder().IsEmpty())
78 return ::v8::ThrowException(::v8::String::New(
"In order to use getCentroidCoord method you must use object notation: \"c = obj.getCentroidCoord();\""));
83 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in getCentroidCoord method!"));
91 return hs.Close(jsgeom);
98 if(args.Holder().IsEmpty())
99 return ::v8::ThrowException(::v8::String::New(
"In order to use getPointOnSurface method you must use object notation: \"pt = obj.getPointOnSurface();\""));
104 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in getPointOnSurface method!"));
112 return hs.Close(jsgeom);
117 ::v8::HandleScope hs;
119 if(args.Holder().IsEmpty())
120 return ::v8::ThrowException(::v8::String::New(
"In order to use getCoordOnSurface method you must use object notation: \"c = obj.getCoordOnSurface();\""));
125 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in getCoordOnSurface method!"));
133 return hs.Close(jsgeom);
143 ::v8::Local<::v8::FunctionTemplate> result = ::v8::FunctionTemplate::New();
144 result->Inherit(geomTpl);
146 ::v8::Handle<::v8::ObjectTemplate> prototype = result->PrototypeTemplate();
148 prototype->Set(::v8::String::NewSymbol(
"getArea"), ::v8::FunctionTemplate::New(
MultiSurface_GetArea));
::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 > & GetPointTemplate()
It returns a reference to the persistent template of a Point object.
::v8::Handle<::v8::Value > MultiSurface_GetPointOnSurface(const ::v8::Arguments &args)
static::v8::Persistent<::v8::FunctionTemplate > sg_msurface_template
::v8::Handle<::v8::Value > MultiSurface_GetCentroid(const ::v8::Arguments &args)
Point * getCentroid() const
It returns the mathematical centroid for this MultiSurface as a point.
::v8::Persistent<::v8::FunctionTemplate > & GetCoord2DTemplate()
It returns a reference to the persistent template of a Coord2D object.
Coord2D * getCoordOnSurface() const
It returns a coordinate guaranteed to be on this MultiSurface.
Coord2D * getCentroidCoord() const
It returns the mathematical centroid for this MultiSurface as a coordinate.
::v8::Handle<::v8::Value > MultiSurface_GetCoordOnSurface(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > MultiSurface_GetCentroidCoord(const ::v8::Arguments &args)
Point * getPointOnSurface() const
It returns a point guaranteed to be on this MultiSurface.
double getArea() const
It returns the area of this MultiSurface, as measured in the spatial reference system of this multisu...
MultiSurface is a class that represents a 2-dimensional GeometryCollection whose elements are surface...
::v8::Handle<::v8::Value > MultiSurface_GetArea(const ::v8::Arguments &args)
::v8::Persistent<::v8::FunctionTemplate > & GetMultiSurfaceTemplate()
It returns a reference to the persistent template of a MultiSurface object.
::v8::Persistent<::v8::FunctionTemplate > & GetGeometryCollectionTemplate()
It returns a reference to the persistent template of a GeometryCollection object. ...