27 #include "../../../../common/Globals.h" 28 #include "../../../../geometry/Envelope.h" 29 #include "../../../../geometry/Geometry.h" 30 #include "../../../../geometry/GeometryCollection.h" 31 #include "../../../../geometry/LineString.h" 32 #include "../../../../geometry/MultiLineString.h" 33 #include "../../../../geometry/MultiPoint.h" 34 #include "../../../../geometry/MultiPolygon.h" 35 #include "../../../../geometry/Point.h" 36 #include "../../../../geometry/Polygon.h" 37 #include "../../common/Utils.h" 38 #include "../datatype/DataType.h" 45 #include <boost/cstdint.hpp> 51 if(args.Holder().IsEmpty())
52 return ::v8::ThrowException(::v8::String::New(
"In order to use getDimension method you must use object notation: \"d = obj.getDimension();\""));
54 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
57 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in getDimension method!"));
61 ::v8::Local<::v8::Integer> jd = ::v8::Integer::New(static_cast<boost::int32_t>(d));
70 if(args.Holder().IsEmpty())
71 return ::v8::ThrowException(::v8::String::New(
"In order to use getCoordinateDimension method you must use object notation: \"d = obj.getCoordinateDimension();\""));
73 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
76 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in getCoordinateDimension method!"));
80 ::v8::Local<::v8::Integer> jd = ::v8::Integer::New(d);
89 if(args.Holder().IsEmpty())
90 return ::v8::ThrowException(::v8::String::New(
"In order to use getGeometryType method you must use object notation: \"t = obj.getGeometryType();\""));
92 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
95 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in getGeometryType method!"));
99 ::v8::Local<::v8::String> jgt = ::v8::String::New(gt.c_str());
101 return hs.Close(jgt);
106 ::v8::HandleScope hs;
108 if(args.Holder().IsEmpty())
109 return ::v8::ThrowException(::v8::String::New(
"In order to use getGeomTypeId method you must use object notation: \"tid = obj.getGeomTypeId();\""));
111 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
114 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in getGeomTypeId method!"));
118 ::v8::Local<::v8::Integer> jgt = ::v8::Integer::New(static_cast<boost::int32_t>(gt));
120 return hs.Close(jgt);
125 ::v8::HandleScope hs;
127 if(args.Holder().IsEmpty())
128 return ::v8::ThrowException(::v8::String::New(
"In order to use getSRID method you must use object notation: \"srid = obj.getSRID();\""));
130 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
133 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in getSRID method!"));
137 ::v8::Local<::v8::Integer> jsrid = ::v8::Integer::New(static_cast<boost::int32_t>(srid));
139 return hs.Close(jsrid);
144 ::v8::HandleScope hs;
146 if(args.Holder().IsEmpty())
147 return ::v8::ThrowException(::v8::String::New(
"In order to use setSRID method you must use object notation: \"obj.setSRID(4326);\""));
149 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsInt32())
150 return ::v8::ThrowException(::v8::String::New(
"In order to use setSRID method you must use object notation: \"obj.setSRID(4326);\""));
152 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
155 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in setSRID method!"));
157 int srid = args[0]->ToInt32()->Value();
161 return hs.Close(::v8::Undefined());
166 ::v8::HandleScope hs;
168 if(args.Holder().IsEmpty())
169 return ::v8::ThrowException(::v8::String::New(
"In order to use transform method you must use object notation: \"obj.transform(4326);\""));
171 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsInt32())
172 return ::v8::ThrowException(::v8::String::New(
"In order to use transform method you must use object notation: \"obj.transform(4326);\""));
174 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
177 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in transform method!"));
179 int srid = args[0]->ToInt32()->Value();
183 return hs.Close(::v8::Undefined());
188 ::v8::HandleScope hs;
190 if(args.Holder().IsEmpty())
191 return ::v8::ThrowException(::v8::String::New(
"In order to use getEnvelope method you must use object notation: \"e = obj.getEnvelope();\""));
193 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
196 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in getEnvelope method!"));
198 std::auto_ptr<te::gm::Geometry> e(g->
getEnvelope());
209 ::v8::HandleScope hs;
211 if(args.Holder().IsEmpty())
212 return ::v8::ThrowException(::v8::String::New(
"In order to use getMBR method you must use object notation: \"e = obj.getMBR();\""));
214 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
217 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in getMBR method!"));
228 ::v8::HandleScope hs;
230 if(args.Holder().IsEmpty())
231 return ::v8::ThrowException(::v8::String::New(
"In order to use computeMBR method you must use object notation: \"obj.computeMBR();\""));
233 bool cascade =
false;
235 if((args.Length() == 1) && !args[0].IsEmpty() && args[0]->IsInt32())
236 cascade = args[0]->ToBoolean()->Value();
238 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
241 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in computeMBR method!"));
245 return hs.Close(::v8::Undefined());
250 ::v8::HandleScope hs;
252 if(args.Holder().IsEmpty())
253 return ::v8::ThrowException(::v8::String::New(
"In order to use asText method you must use object notation: \"wkt = obj.asText();\""));
255 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
258 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in asText method!"));
260 std::string wkt = g->
asText();
262 ::v8::Local<::v8::String> jwkt = ::v8::String::New(wkt.c_str());
264 return hs.Close(jwkt);
269 ::v8::HandleScope hs;
271 if(args.Holder().IsEmpty())
272 return ::v8::ThrowException(::v8::String::New(
"In order to use asBinary method you must use object notation: \"wkb = obj.asBinary();\""));
274 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
277 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in asBinary method!"));
279 std::size_t size = 0;
283 ::v8::Local<::v8::String> jwkb = ::v8::String::New(wkb, size);
287 return hs.Close(jwkb);
292 ::v8::HandleScope hs;
294 if(args.Holder().IsEmpty())
295 return ::v8::ThrowException(::v8::String::New(
"In order to use getWkbSize method you must use object notation: \"size = obj.getWkbSize();\""));
297 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
300 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in getWkbSize method!"));
304 ::v8::Local<::v8::Integer> jsize = ::v8::Integer::New(static_cast<boost::int32_t>(size));
306 return hs.Close(jsize);
311 ::v8::HandleScope hs;
313 if(args.Holder().IsEmpty())
314 return ::v8::ThrowException(::v8::String::New(
"In order to use getWkb method you must use object notation: \"wkb = obj.getWkb(byteorder);\""));
318 if(args.Length() == 1)
320 if(args[0].IsEmpty() || !args[0]->IsInt32())
321 return ::v8::ThrowException(::v8::String::New(
"In order to use getWkb method you must use object notation: \"wkb = obj.getWkb(byteorder);\""));
323 byteOrder =
static_cast<char>(args[0]->ToInt32()->Value());
326 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
329 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in getWkb method!"));
333 char* wkb =
new char[size];
335 g->
getWkb(wkb, byteOrder);
337 ::v8::Local<::v8::String> jwkb = ::v8::String::New(wkb, size);
341 return hs.Close(jwkb);
346 ::v8::HandleScope hs;
348 if(args.Holder().IsEmpty())
349 return ::v8::ThrowException(::v8::String::New(
"In order to use getHWkb method you must use object notation: \"hwkb = obj.getHWkb(byteorder);\""));
353 if(args.Length() == 1)
355 if(args[0].IsEmpty() || !args[0]->IsInt32())
356 return ::v8::ThrowException(::v8::String::New(
"In order to use getHWkb method you must use object notation: \"hwkb = obj.getHWkb(byteorder);\""));
358 byteOrder =
static_cast<char>(args[0]->ToInt32()->Value());
361 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
364 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in getHWkb method!"));
368 char* wkb =
new char[size];
370 g->
getWkb(wkb, byteOrder);
376 ::v8::Local<::v8::String> jhwkb = ::v8::String::New(hwkb, 2 * size + 1);
380 return hs.Close(jhwkb);
385 ::v8::HandleScope hs;
387 if(args.Holder().IsEmpty())
388 return ::v8::ThrowException(::v8::String::New(
"In order to use isEmpty method you must use object notation: \"empty = obj.isEmpty();\""));
390 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
393 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in isEmpty method!"));
397 ::v8::Handle<::v8::Boolean> jis = ::v8::Boolean::New(is);
399 return hs.Close(jis);
404 ::v8::HandleScope hs;
406 if(args.Holder().IsEmpty())
407 return ::v8::ThrowException(::v8::String::New(
"In order to use isSimple method you must use object notation: \"s = obj.isSimple();\""));
409 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
412 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in isSimple method!"));
416 ::v8::Handle<::v8::Boolean> jis = ::v8::Boolean::New(is);
418 return hs.Close(jis);
423 ::v8::HandleScope hs;
425 if(args.Holder().IsEmpty())
426 return ::v8::ThrowException(::v8::String::New(
"In order to use isValid method you must use object notation: \"v = obj.isValid();\""));
428 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
431 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in isValid method!"));
435 ::v8::Handle<::v8::Boolean> jis = ::v8::Boolean::New(is);
437 return hs.Close(jis);
442 ::v8::HandleScope hs;
444 if(args.Holder().IsEmpty())
445 return ::v8::ThrowException(::v8::String::New(
"In order to use is3D method you must use object notation: \"v = obj.is3D();\""));
447 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
450 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in is3D method!"));
454 ::v8::Handle<::v8::Boolean> jis = ::v8::Boolean::New(is);
456 return hs.Close(jis);
461 ::v8::HandleScope hs;
463 if(args.Holder().IsEmpty())
464 return ::v8::ThrowException(::v8::String::New(
"In order to use isMeasured method you must use object notation: \"v = obj.isMeasured();\""));
466 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
469 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in isMeasured method!"));
473 ::v8::Handle<::v8::Boolean> jis = ::v8::Boolean::New(is);
475 return hs.Close(jis);
480 ::v8::HandleScope hs;
482 if(args.Holder().IsEmpty())
483 return ::v8::ThrowException(::v8::String::New(
"In order to use getBoundary method you must use object notation: \"o = obj.getBoundary();\""));
485 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
488 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in getBoundary method!"));
490 std::auto_ptr<te::gm::Geometry> boundary(g->
getBoundary());
496 return hs.Close(jboundary);
501 ::v8::HandleScope hs;
503 if(args.Holder().IsEmpty())
504 return ::v8::ThrowException(::v8::String::New(
"In order to use getNPoints method you must use object notation: \"np = obj.getNPoints();\""));
506 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
509 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in getNPoints method!"));
513 ::v8::Handle<::v8::Integer> jnp = ::v8::Integer::New(static_cast<boost::int32_t>(np));
515 return hs.Close(jnp);
520 ::v8::HandleScope hs;
522 if(args.Holder().IsEmpty())
523 return ::v8::ThrowException(::v8::String::New(
"In order to use equals method you must use object notation: \"rel = obj.equals(another_obj);\""));
525 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsObject())
526 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in equals method!"));
528 te::gm::Geometry* thisGeom = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
530 te::gm::Geometry* rhsGeom = te::v8::common::Unwrap<te::gm::Geometry>(args[0]->ToObject());
532 if((thisGeom == 0) || (rhsGeom == 0))
533 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in equals method!"));
535 bool rel = thisGeom->
equals(rhsGeom);
537 ::v8::Handle<::v8::Boolean> jrel = ::v8::Boolean::New(rel);
539 return hs.Close(jrel);
544 ::v8::HandleScope hs;
546 if(args.Holder().IsEmpty())
547 return ::v8::ThrowException(::v8::String::New(
"In order to use disjoint method you must use object notation: \"rel = obj.disjoint(another_obj);\""));
549 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsObject())
550 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in disjoint method!"));
552 te::gm::Geometry* thisGeom = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
554 te::gm::Geometry* rhsGeom = te::v8::common::Unwrap<te::gm::Geometry>(args[0]->ToObject());
556 if((thisGeom == 0) || (rhsGeom == 0))
557 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in disjoint method!"));
559 bool rel = thisGeom->
disjoint(rhsGeom);
561 ::v8::Handle<::v8::Boolean> jrel = ::v8::Boolean::New(rel);
563 return hs.Close(jrel);
568 ::v8::HandleScope hs;
570 if(args.Holder().IsEmpty())
571 return ::v8::ThrowException(::v8::String::New(
"In order to use intersects method you must use object notation: \"rel = obj.intersects(another_obj);\""));
573 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsObject())
574 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in intersects method!"));
576 te::gm::Geometry* thisGeom = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
578 te::gm::Geometry* rhsGeom = te::v8::common::Unwrap<te::gm::Geometry>(args[0]->ToObject());
580 if((thisGeom == 0) || (rhsGeom == 0))
581 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in intersects method!"));
585 ::v8::Handle<::v8::Boolean> jrel = ::v8::Boolean::New(rel);
587 return hs.Close(jrel);
592 ::v8::HandleScope hs;
594 if(args.Holder().IsEmpty())
595 return ::v8::ThrowException(::v8::String::New(
"In order to use touches method you must use object notation: \"rel = obj.touches(another_obj);\""));
597 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsObject())
598 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in touches method!"));
600 te::gm::Geometry* thisGeom = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
602 te::gm::Geometry* rhsGeom = te::v8::common::Unwrap<te::gm::Geometry>(args[0]->ToObject());
604 if((thisGeom == 0) || (rhsGeom == 0))
605 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in touches method!"));
607 bool rel = thisGeom->
touches(rhsGeom);
609 ::v8::Handle<::v8::Boolean> jrel = ::v8::Boolean::New(rel);
611 return hs.Close(jrel);
616 ::v8::HandleScope hs;
618 if(args.Holder().IsEmpty())
619 return ::v8::ThrowException(::v8::String::New(
"In order to use crosses method you must use object notation: \"rel = obj.crosses(another_obj);\""));
621 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsObject())
622 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in crosses method!"));
624 te::gm::Geometry* thisGeom = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
626 te::gm::Geometry* rhsGeom = te::v8::common::Unwrap<te::gm::Geometry>(args[0]->ToObject());
628 if((thisGeom == 0) || (rhsGeom == 0))
629 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in crosses method!"));
631 bool rel = thisGeom->
crosses(rhsGeom);
633 ::v8::Handle<::v8::Boolean> jrel = ::v8::Boolean::New(rel);
635 return hs.Close(jrel);
640 ::v8::HandleScope hs;
642 if(args.Holder().IsEmpty())
643 return ::v8::ThrowException(::v8::String::New(
"In order to use within method you must use object notation: \"rel = obj.within(another_obj);\""));
645 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsObject())
646 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in within method!"));
648 te::gm::Geometry* thisGeom = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
650 te::gm::Geometry* rhsGeom = te::v8::common::Unwrap<te::gm::Geometry>(args[0]->ToObject());
652 if((thisGeom == 0) || (rhsGeom == 0))
653 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in within method!"));
655 bool rel = thisGeom->
within(rhsGeom);
657 ::v8::Handle<::v8::Boolean> jrel = ::v8::Boolean::New(rel);
659 return hs.Close(jrel);
664 ::v8::HandleScope hs;
666 if(args.Holder().IsEmpty())
667 return ::v8::ThrowException(::v8::String::New(
"In order to use contains method you must use object notation: \"rel = obj.contains(another_obj);\""));
669 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsObject())
670 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in contains method!"));
672 te::gm::Geometry* thisGeom = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
674 te::gm::Geometry* rhsGeom = te::v8::common::Unwrap<te::gm::Geometry>(args[0]->ToObject());
676 if((thisGeom == 0) || (rhsGeom == 0))
677 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in contains method!"));
679 bool rel = thisGeom->
contains(rhsGeom);
681 ::v8::Handle<::v8::Boolean> jrel = ::v8::Boolean::New(rel);
683 return hs.Close(jrel);
688 ::v8::HandleScope hs;
690 if(args.Holder().IsEmpty())
691 return ::v8::ThrowException(::v8::String::New(
"In order to use overlaps method you must use object notation: \"rel = obj.overlaps(another_obj);\""));
693 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsObject())
694 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in overlaps method!"));
696 te::gm::Geometry* thisGeom = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
698 te::gm::Geometry* rhsGeom = te::v8::common::Unwrap<te::gm::Geometry>(args[0]->ToObject());
700 if((thisGeom == 0) || (rhsGeom == 0))
701 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in overlaps method!"));
703 bool rel = thisGeom->
overlaps(rhsGeom);
705 ::v8::Handle<::v8::Boolean> jrel = ::v8::Boolean::New(rel);
707 return hs.Close(jrel);
712 ::v8::HandleScope hs;
714 if(args.Holder().IsEmpty())
715 return ::v8::ThrowException(::v8::String::New(
"In order to use relate method you must use object notation: \"rel = obj.relation(another_obj);\""));
717 te::gm::Geometry* thisGeom = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
720 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in relate method!"));
722 if(args.Length() == 1)
724 if(args[0].IsEmpty() || !args[0]->IsObject())
725 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in relate method!"));
727 te::gm::Geometry* rhsGeom = te::v8::common::Unwrap<te::gm::Geometry>(args[0]->ToObject());
730 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in relate method!"));
732 std::string rel = thisGeom->
relate(rhsGeom);
734 ::v8::Local<::v8::String> jrel = ::v8::String::New(rel.c_str());
736 return hs.Close(jrel);
738 else if(args.Length() == 2)
740 if(args[0].IsEmpty() || !args[0]->IsObject() || args[1].IsEmpty() || !args[1]->IsString())
741 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in relate method!"));
743 te::gm::Geometry* rhsGeom = te::v8::common::Unwrap<te::gm::Geometry>(args[0]->ToObject());
746 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in relate method!"));
748 v8::String::Utf8Value jrel(args[1]->
ToString());
750 bool isRel = thisGeom->
relate(rhsGeom, *jrel);
752 ::v8::Handle<::v8::Boolean> jisRel = ::v8::Boolean::New(isRel);
754 return hs.Close(jisRel);
757 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in relate method!"));
762 ::v8::HandleScope hs;
764 if(args.Holder().IsEmpty())
765 return ::v8::ThrowException(::v8::String::New(
"In order to use covers method you must use object notation: \"rel = obj.covers(another_obj);\""));
767 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsObject())
768 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in covers method!"));
770 te::gm::Geometry* thisGeom = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
772 te::gm::Geometry* rhsGeom = te::v8::common::Unwrap<te::gm::Geometry>(args[0]->ToObject());
774 if((thisGeom == 0) || (rhsGeom == 0))
775 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in covers method!"));
777 bool rel = thisGeom->
covers(rhsGeom);
779 ::v8::Handle<::v8::Boolean> jrel = ::v8::Boolean::New(rel);
781 return hs.Close(jrel);
786 ::v8::HandleScope hs;
788 if(args.Holder().IsEmpty())
789 return ::v8::ThrowException(::v8::String::New(
"In order to use coveredBy method you must use object notation: \"rel = obj.coveredBy(another_obj);\""));
791 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsObject())
792 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in covers method!"));
794 te::gm::Geometry* thisGeom = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
796 te::gm::Geometry* rhsGeom = te::v8::common::Unwrap<te::gm::Geometry>(args[0]->ToObject());
798 if((thisGeom == 0) || (rhsGeom == 0))
799 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in coveredBy method!"));
803 ::v8::Handle<::v8::Boolean> jrel = ::v8::Boolean::New(rel);
805 return hs.Close(jrel);
813 ::v8::HandleScope hs;
815 if(args.Holder().IsEmpty())
816 return ::v8::ThrowException(::v8::String::New(
"In order to use distance method you must use object notation: \"dist = obj.distance(another_obj);\""));
818 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsObject())
819 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in distance method!"));
821 te::gm::Geometry* thisGeom = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
823 te::gm::Geometry* rhsGeom = te::v8::common::Unwrap<te::gm::Geometry>(args[0]->ToObject());
825 if((thisGeom == 0) || (rhsGeom == 0))
826 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in distance method!"));
828 double dist = thisGeom->
distance(rhsGeom);
830 ::v8::Local<::v8::Number> jdist = ::v8::Number::New(dist);
832 return hs.Close(jdist);
839 ::v8::HandleScope hs;
841 if(args.Holder().IsEmpty())
842 return ::v8::ThrowException(::v8::String::New(
"In order to use convexHull method you must use object notation: \"ch = obj.convexHull();\""));
844 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
847 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in getEnvelope method!"));
849 std::auto_ptr<te::gm::Geometry> ch(g->
convexHull());
855 return hs.Close(jch);
860 ::v8::HandleScope hs;
862 if(args.Holder().IsEmpty())
863 return ::v8::ThrowException(::v8::String::New(
"In order to use intersection method you must use object notation: \"newGeom = obj.intersection(another_obj);\""));
865 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsObject())
866 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in intersection method!"));
868 te::gm::Geometry* thisGeom = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
870 te::gm::Geometry* rhsGeom = te::v8::common::Unwrap<te::gm::Geometry>(args[0]->ToObject());
872 if((thisGeom == 0) || (rhsGeom == 0))
873 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in intersection method!"));
875 std::auto_ptr<te::gm::Geometry> newGeom(thisGeom->
intersection(rhsGeom));
881 return hs.Close(jnewGeom);
886 ::v8::HandleScope hs;
888 if(args.Holder().IsEmpty())
889 return ::v8::ThrowException(::v8::String::New(
"In order to use union method you must use object notation: \"newGeom = obj.union(another_obj);\""));
891 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsObject())
892 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in union method!"));
894 te::gm::Geometry* thisGeom = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
896 te::gm::Geometry* rhsGeom = te::v8::common::Unwrap<te::gm::Geometry>(args[0]->ToObject());
898 if((thisGeom == 0) || (rhsGeom == 0))
899 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in union method!"));
901 std::auto_ptr<te::gm::Geometry> newGeom(thisGeom->
Union(rhsGeom));
907 return hs.Close(jnewGeom);
912 ::v8::HandleScope hs;
914 if(args.Holder().IsEmpty())
915 return ::v8::ThrowException(::v8::String::New(
"In order to use difference method you must use object notation: \"newGeom = obj.difference(another_obj);\""));
917 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsObject())
918 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in difference method!"));
920 te::gm::Geometry* thisGeom = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
922 te::gm::Geometry* rhsGeom = te::v8::common::Unwrap<te::gm::Geometry>(args[0]->ToObject());
924 if((thisGeom == 0) || (rhsGeom == 0))
925 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in difference method!"));
927 std::auto_ptr<te::gm::Geometry> newGeom(thisGeom->
difference(rhsGeom));
933 return hs.Close(jnewGeom);
938 ::v8::HandleScope hs;
940 if(args.Holder().IsEmpty())
941 return ::v8::ThrowException(::v8::String::New(
"In order to use symDifference method you must use object notation: \"newGeom = obj.symDifference(another_obj);\""));
943 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsObject())
944 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in symDifference method!"));
946 te::gm::Geometry* thisGeom = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
948 te::gm::Geometry* rhsGeom = te::v8::common::Unwrap<te::gm::Geometry>(args[0]->ToObject());
950 if((thisGeom == 0) || (rhsGeom == 0))
951 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in symDifference method!"));
953 std::auto_ptr<te::gm::Geometry> newGeom(thisGeom->
symDifference(rhsGeom));
959 return hs.Close(jnewGeom);
964 ::v8::HandleScope hs;
966 if(args.Holder().IsEmpty())
967 return ::v8::ThrowException(::v8::String::New(
"In order to use dWithin method you must use object notation: \"result = obj.dWithin(another_obj, 10.0);\""));
969 if((args.Length() != 2) || args[0].IsEmpty() || !args[0]->IsObject() || args[1].IsEmpty() || !args[1]->IsNumber())
970 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in dWithin method!"));
972 te::gm::Geometry* thisGeom = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
974 te::gm::Geometry* rhsGeom = te::v8::common::Unwrap<te::gm::Geometry>(args[0]->ToObject());
976 if((thisGeom == 0) || (rhsGeom == 0))
977 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in dWithin method!"));
979 double d = args[0]->ToNumber()->Value();
981 bool result = thisGeom->
dWithin(rhsGeom, d);
983 ::v8::Handle<::v8::Boolean> jresult = ::v8::Boolean::New(result);
985 return hs.Close(jresult);
990 ::v8::HandleScope hs;
992 if(args.Holder().IsEmpty())
993 return ::v8::ThrowException(::v8::String::New(
"In order to use clone method you must use object notation: \"newGeom = obj.clone();\""));
995 te::gm::Geometry* g = te::v8::common::Unwrap<te::gm::Geometry>(args.Holder());
998 return ::v8::ThrowException(::v8::String::New(
"Invalid geometry in clone method!"));
1000 std::auto_ptr<te::gm::Geometry> ng(g->
clone());
1006 return hs.Close(jng);
1011 ::v8::HandleScope hs;
1013 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsString())
1014 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type for getGeomFromWKB method!"));
1016 v8::String::Utf8Value wkb(args[0]->
ToString());
1018 std::auto_ptr<te::gm::Geometry> geom(te::gm::Geometry::getGeomFromWKB(*wkb));
1024 return hs.Close(jgeom);
1029 ::v8::HandleScope hs;
1031 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsString())
1032 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type for getGeomFromHWKB method!"));
1034 v8::String::Utf8Value hwkb(args[0]->
ToString());
1036 std::auto_ptr<te::gm::Geometry> geom(te::gm::Geometry::getGeomFromWKB(*hwkb));
1042 return hs.Close(jgeom);
1047 ::v8::HandleScope hs;
1049 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsString())
1050 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type for getGeomFromWKT method!"));
1052 v8::String::Utf8Value wkt(args[0]->
ToString());
1054 std::auto_ptr<te::gm::Geometry> geom(te::gm::Geometry::getGeomFromWKT(*wkt));
1060 return hs.Close(jgeom);
1065 ::v8::HandleScope hs;
1067 if((args.Length() != 2) || args[0].IsEmpty() || !args[0]->IsObject() || args[1].IsEmpty() || !args[1]->IsInt32())
1068 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type for getGeomFromEnvelope method!"));
1070 ::v8::Local<::v8::Object> jenvelope = args[0]->ToObject();
1071 ::v8::Local<::v8::Int32> srid = args[1]->ToInt32();
1073 te::gm::Envelope* envelope = te::v8::common::Unwrap<te::gm::Envelope>(jenvelope);
1075 std::auto_ptr<te::gm::Geometry> geom(te::gm::Geometry::getGeomFromEnvelope(envelope, srid->Int32Value()));
1081 return hs.Close(jgeom);
1086 ::v8::HandleScope hs;
1088 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsString())
1089 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type for getGeomTypeId method!"));
1091 v8::String::Utf8Value gt(args[0]->
ToString());
1095 ::v8::Local<::v8::Integer> jt = ::v8::Int32::New(static_cast<int>(t));
1097 return hs.Close(jt);
1102 ::v8::HandleScope hs;
1104 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsString())
1105 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type for isGeomType method!"));
1107 v8::String::Utf8Value gt(args[0]->
ToString());
1111 ::v8::Handle<::v8::Boolean> jis = ::v8::Boolean::New(is);
1113 return hs.Close(jis);
1118 ::v8::HandleScope hs;
1120 ::v8::Local<::v8::ObjectTemplate> jsgeom = ::v8::ObjectTemplate::New();
1127 jsgeom->Set(::v8::String::NewSymbol(
"isGeomType"), ::v8::FunctionTemplate::New(
Geometry_IsGeomType));
1129 global->Set(::v8::String::New(
"TeGeometry"), jsgeom->NewInstance());
1139 ::v8::Local<::v8::FunctionTemplate> result = ::v8::FunctionTemplate::New();
1140 result->Inherit(adTpl);
1142 ::v8::Handle<::v8::ObjectTemplate> prototype = result->PrototypeTemplate();
1144 prototype->Set(::v8::String::NewSymbol(
"getDimension"), ::v8::FunctionTemplate::New(
Geometry_GetDimension));
1147 prototype->Set(::v8::String::NewSymbol(
"getGeomTypeId"), ::v8::FunctionTemplate::New(
Geometry_GetGeomTypeId));
1148 prototype->Set(::v8::String::NewSymbol(
"getSRID"), ::v8::FunctionTemplate::New(
Geometry_GetSRID));
1149 prototype->Set(::v8::String::NewSymbol(
"setSRID"), ::v8::FunctionTemplate::New(
Geometry_SetSRID));
1150 prototype->Set(::v8::String::NewSymbol(
"transform"), ::v8::FunctionTemplate::New(
Geometry_Transform));
1151 prototype->Set(::v8::String::NewSymbol(
"getEnvelope"), ::v8::FunctionTemplate::New(
Geometry_GetEnvelope));
1152 prototype->Set(::v8::String::NewSymbol(
"getMBR"), ::v8::FunctionTemplate::New(
Geometry_GetMBR));
1153 prototype->Set(::v8::String::NewSymbol(
"computeMBR"), ::v8::FunctionTemplate::New(
Geometry_ComputeMBR));
1154 prototype->Set(::v8::String::NewSymbol(
"asText"), ::v8::FunctionTemplate::New(
Geometry_AsText));
1155 prototype->Set(::v8::String::NewSymbol(
"asBinary"), ::v8::FunctionTemplate::New(
Geometry_AsBinary));
1156 prototype->Set(::v8::String::NewSymbol(
"getWkbSize"), ::v8::FunctionTemplate::New(
Geometry_GetWkbSize));
1157 prototype->Set(::v8::String::NewSymbol(
"getWkb"), ::v8::FunctionTemplate::New(
Geometry_GetWkb));
1158 prototype->Set(::v8::String::NewSymbol(
"getHWkb"), ::v8::FunctionTemplate::New(
Geometry_GetHWkb));
1159 prototype->Set(::v8::String::NewSymbol(
"isEmpty"), ::v8::FunctionTemplate::New(
Geometry_IsEmpty));
1160 prototype->Set(::v8::String::NewSymbol(
"isSimple"), ::v8::FunctionTemplate::New(
Geometry_IsSimple));
1161 prototype->Set(::v8::String::NewSymbol(
"isValid"), ::v8::FunctionTemplate::New(
Geometry_IsValid));
1162 prototype->Set(::v8::String::NewSymbol(
"is3D"), ::v8::FunctionTemplate::New(
Geometry_Is3D));
1163 prototype->Set(::v8::String::NewSymbol(
"isMeasured"), ::v8::FunctionTemplate::New(
Geometry_IsMeasured));
1164 prototype->Set(::v8::String::NewSymbol(
"getBoundary"), ::v8::FunctionTemplate::New(
Geometry_GetBoundary));
1165 prototype->Set(::v8::String::NewSymbol(
"getNPoints"), ::v8::FunctionTemplate::New(
Geometry_GetNPoints));
1166 prototype->Set(::v8::String::NewSymbol(
"equals"), ::v8::FunctionTemplate::New(
Geometry_Equals));
1167 prototype->Set(::v8::String::NewSymbol(
"disjoint"), ::v8::FunctionTemplate::New(
Geometry_Disjoint));
1168 prototype->Set(::v8::String::NewSymbol(
"intersects"), ::v8::FunctionTemplate::New(
Geometry_Intersects));
1169 prototype->Set(::v8::String::NewSymbol(
"touches"), ::v8::FunctionTemplate::New(
Geometry_Touches));
1170 prototype->Set(::v8::String::NewSymbol(
"crosses"), ::v8::FunctionTemplate::New(
Geometry_Crosses));
1171 prototype->Set(::v8::String::NewSymbol(
"within"), ::v8::FunctionTemplate::New(
Geometry_Within));
1172 prototype->Set(::v8::String::NewSymbol(
"contains"), ::v8::FunctionTemplate::New(
Geometry_Contains));
1173 prototype->Set(::v8::String::NewSymbol(
"overlaps"), ::v8::FunctionTemplate::New(
Geometry_Overlaps));
1174 prototype->Set(::v8::String::NewSymbol(
"relate"), ::v8::FunctionTemplate::New(
Geometry_Relate));
1175 prototype->Set(::v8::String::NewSymbol(
"covers"), ::v8::FunctionTemplate::New(
Geometry_Covers));
1176 prototype->Set(::v8::String::NewSymbol(
"coveredBy"), ::v8::FunctionTemplate::New(
Geometry_CoveredBy));
1179 prototype->Set(::v8::String::NewSymbol(
"distance"), ::v8::FunctionTemplate::New(
Geometry_Distance));
1181 prototype->Set(::v8::String::NewSymbol(
"convexHull"), ::v8::FunctionTemplate::New(
Geometry_ConvexHull));
1182 prototype->Set(::v8::String::NewSymbol(
"intersection"), ::v8::FunctionTemplate::New(
Geometry_Intersection));
1183 prototype->Set(::v8::String::NewSymbol(
"Union"), ::v8::FunctionTemplate::New(
Geometry_Union));
1184 prototype->Set(::v8::String::NewSymbol(
"difference"), ::v8::FunctionTemplate::New(
Geometry_Difference));
1185 prototype->Set(::v8::String::NewSymbol(
"symDifference"), ::v8::FunctionTemplate::New(
Geometry_SymDifference));
1186 prototype->Set(::v8::String::NewSymbol(
"dWithin"), ::v8::FunctionTemplate::New(
Geometry_DWithin));
1187 prototype->Set(::v8::String::NewSymbol(
"clone"), ::v8::FunctionTemplate::New(
Geometry_Clone));
1197 ::v8::HandleScope hs;
1199 ::v8::Local<::v8::Object> jsgeom;
1298 ::v8::ThrowException(::v8::String::New(
"The informed geometry type is unknown!"));
1301 return hs.Close(jsgeom);
::v8::Persistent<::v8::FunctionTemplate > & GetMultiPointTemplate()
It returns a reference to the persistent template of a MultiPoint object.
::v8::Local<::v8::Object > Make(T *obj, TF tfunc, const bool isOwner)
It creates a new JavaScript object from a C++ object (obj).
::v8::Handle<::v8::Value > Geometry_Overlaps(const ::v8::Arguments &args)
::v8::Persistent<::v8::FunctionTemplate > & GetPointTemplate()
It returns a reference to the persistent template of a Point object.
virtual Geometry * difference(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns a geometric object that represents the point set difference with another geometry...
::v8::Handle<::v8::Value > Geometry_SymDifference(const ::v8::Arguments &args)
MultiPolygon is a MultiSurface whose elements are Polygons.
::v8::Handle<::v8::Value > Geometry_GetNPoints(const ::v8::Arguments &args)
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
::v8::Handle<::v8::Value > Geometry_IsGeomType(const ::v8::Arguments &args)
virtual Geometry * symDifference(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns a geometric object that represents the point set symetric difference with another geometry...
::v8::Handle<::v8::Value > Geometry_SetSRID(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Geometry_AsText(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Geometry_GetEnvelope(const ::v8::Arguments &args)
virtual double distance(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns the shortest distance between any two points in the two geometry objects.
::v8::Handle<::v8::Value > Geometry_ConvexHull(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Geometry_Relate(const ::v8::Arguments &args)
virtual Dimensionality getDimension() const _NOEXCEPT_OP(true)=0
It returns the geometric object dimension (0, 1 or 2).
::v8::Handle<::v8::Value > Geometry_CoveredBy(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Geometry_IsSimple(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Geometry_AsBinary(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Geometry_GetWkb(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Geometry_GetWkbSize(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Geometry_GetGeometryType(const ::v8::Arguments &args)
bool isMeasured() const _NOEXCEPT_OP(true)
It returns true if this geometric object has m coordinate values.
GeomType getGeomTypeId() const _NOEXCEPT_OP(true)
It returns the geometry subclass type identifier.
::v8::Handle<::v8::Value > Geometry_Clone(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Geometry_Intersects(const ::v8::Arguments &args)
virtual Geometry * intersection(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns a geometric object that represents the point set intersection with another geometry...
virtual bool dWithin(const Geometry *const rhs, const double &distance) const _NOEXCEPT_OP(false)
It returns true if the geometries are within the specified distance.
::v8::Handle<::v8::Value > Geometry_Crosses(const ::v8::Arguments &args)
static const MachineByteOrder sm_machineByteOrder
A flag that indicates the machine byte order (Big Endian or Little Endian).
virtual bool disjoint(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns true if the geometry object is spatially disjoint from rhs geometry.
::v8::Handle<::v8::Value > Geometry_Intersection(const ::v8::Arguments &args)
virtual bool relate(const Geometry *const rhs, const std::string &matrix) const _NOEXCEPT_OP(false)
It returns true if this geometry object is spatially related to rhs geometry according to the pattern...
::v8::Handle<::v8::Value > Geometry_DWithin(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Geometry_StaticGetGeomTypeId(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Geometry_GetGeomTypeId(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Geometry_GetGeomFromHWKB(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Geometry_Disjoint(const ::v8::Arguments &args)
virtual Geometry * Union(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns a geometric object that represents the point set union with another geometry.
virtual bool intersects(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns true if the geometry object spatially intersects rhs geometry.
virtual bool touches(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns true if the geometry object spatially touches rhs geometry.
virtual bool isSimple() const _NOEXCEPT_OP(false)
It returns true if this geometric object has no anomalous points, such as self intersection or self t...
std::size_t getWkbSize() const _NOEXCEPT_OP(true)
It returns the size required by a WKB representation for this geometric object.
::v8::Persistent<::v8::FunctionTemplate > & GetLineStringTemplate()
It returns a reference to the persistent template of a LineString object.
::v8::Persistent<::v8::FunctionTemplate > & GetEnvelopeTemplate()
It returns a reference to the persistent template of a Envelope object.
::v8::Persistent<::v8::FunctionTemplate > & GetMultiPolygonTemplate()
It returns a reference to the persistent template of a MultiPolygon object.
::v8::Handle<::v8::Value > Geometry_GetGeomFromWKT(const ::v8::Arguments &args)
virtual bool overlaps(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns true if this geometry object spatially overlaps rhs geometry.
::v8::Handle<::v8::Value > Geometry_Difference(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Geometry_Distance(const ::v8::Arguments &args)
te::gm::GeometryCollection * gc
::v8::Handle<::v8::Value > Geometry_GetBoundary(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Geometry_Contains(const ::v8::Arguments &args)
int getSRID() const _NOEXCEPT_OP(true)
It returns the Spatial Reference System ID associated to this geometric object.
virtual void computeMBR(bool cascade) const _NOEXCEPT_OP(true)=0
It computes the minimum bounding rectangle for the geometry.
::v8::Handle<::v8::Value > Geometry_GetGeomFromWKB(const ::v8::Arguments &args)
MultiPoint is a GeometryCollection whose elements are restricted to points.
Geometry * getEnvelope() const _NOEXCEPT_OP(true)
It returns the minimum bounding rectangle (MBR) for the geometry.
LineString is a curve with linear interpolation between points.
::v8::Handle<::v8::Value > Geometry_GetGeomFromEnvelope(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Geometry_Covers(const ::v8::Arguments &args)
A point with x and y coordinate values.
const Envelope * getMBR() const _NOEXCEPT_OP(true)
It returns the minimum bounding rectangle for the geometry in an internal representation.
virtual bool isValid() const _NOEXCEPT_OP(false)
It tells if the geometry is well formed.
An Envelope defines a 2D rectangular region.
::v8::Handle<::v8::Value > Geometry_Union(const ::v8::Arguments &args)
std::string asText() const _NOEXCEPT_OP(true)
It returns an string with the Well-Known Text Representation for the geometry.
Dimensionality
From Wikipedia: "in mathematics, the dimension of an object is an intrinsic property, independent of the space in which the object may happen to be embedded".
void RegisterGeometry(::v8::Local<::v8::Object > &global)
It register a singleton for the Geometry class.
virtual bool within(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns true if the geometry object is spatially within rhs geometry.
::v8::Handle<::v8::Value > Geometry_GetHWkb(const ::v8::Arguments &args)
static te::dt::DateTime d(2010, 8, 9, 15, 58, 39)
virtual bool isEmpty() const _NOEXCEPT_OP(false)
It returns true if this geometric object is the empty Geometry.
::v8::Handle<::v8::Value > Geometry_IsMeasured(const ::v8::Arguments &args)
::v8::Persistent<::v8::FunctionTemplate > & GetPolygonTemplate()
It returns a reference to the persistent template of a Polygon object.
virtual bool contains(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns true if this geometry object spatially contains rhs geometry.
virtual AbstractData * clone() const =0
It returns a clone of this object.
::v8::Handle<::v8::Value > Geometry_GetSRID(const ::v8::Arguments &args)
bool is3D() const _NOEXCEPT_OP(true)
It returns true if this geometric object has z coordinate values.
char * asBinary(std::size_t &size) const _NOEXCEPT_OP(false)
It serializes the geometric object to a Well-known Binary Representation (WKB).
::v8::Handle<::v8::Value > Geometry_IsEmpty(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Geometry_GetCoordinateDimension(const ::v8::Arguments &args)
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
::v8::Persistent<::v8::FunctionTemplate > & GetAbstractDataTemplate()
It returns a reference to the persistent template of an AbstractData object.
::v8::Handle<::v8::Value > Geometry_GetMBR(const ::v8::Arguments &args)
MultiLineString is a MultiCurve whose elements are LineStrings.
::v8::Persistent<::v8::FunctionTemplate > & GetGeometryTemplate()
It returns a reference to the persistent template of a Geometry object.
::v8::Handle<::v8::Value > Geometry_Transform(const ::v8::Arguments &args)
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
::v8::Handle<::v8::Value > Geometry_Within(const ::v8::Arguments &args)
static bool isGeomType(const std::string &stype)
It tells if the given string is a geometry data type.
::v8::Handle<::v8::Value > Geometry_Touches(const ::v8::Arguments &args)
::v8::Local<::v8::Object > Geometry_Make(te::gm::Geometry *g, const bool isOwner)
Given a C++ geometry this function creates a new JavaScript geometry cast to the right geometry subty...
virtual void setSRID(int srid) _NOEXCEPT_OP(true)=0
It sets the Spatial Reference System ID of the geometry and all its parts if it is a GeometryCollecti...
virtual Geometry * getBoundary() const _NOEXCEPT_OP(false)
It returns the geometry boundary.
virtual std::size_t getNPoints() const _NOEXCEPT_OP(true)=0
it returns the number of points (vertexes) in the geometry.
::v8::Persistent<::v8::FunctionTemplate > & GetMultiLineStringTemplate()
It returns a reference to the persistent template of a MultiLineString object.
::v8::Handle<::v8::Value > Geometry_Is3D(const ::v8::Arguments &args)
static::v8::Persistent<::v8::FunctionTemplate > sg_geometry_template
virtual bool crosses(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns true if the geometry object spatially crosses rhs geometry.
::v8::Handle<::v8::Value > Geometry_ComputeMBR(const ::v8::Arguments &args)
It is a collection of other geometric objects.
virtual void transform(int srid) _NOEXCEPT_OP(false)=0
It converts the coordinate values of the geometry to the new spatial reference system.
char * Binary2Hex(const char *s, std::size_t size)
Each char from the array of characters in binary format is converted into a pair of hex characters...
::v8::Handle<::v8::Value > Geometry_GetDimension(const ::v8::Arguments &args)
::v8::Persistent<::v8::FunctionTemplate > & GetGeometryCollectionTemplate()
It returns a reference to the persistent template of a GeometryCollection object. ...
int getCoordinateDimension() const _NOEXCEPT_OP(true)
It returns the number of measurements or axes needed to describe a position in a coordinate system...
std::string ToString(const XMLCh *const value)
It converts the XML string to a standard C++ string.
::v8::Handle<::v8::Value > Geometry_IsValid(const ::v8::Arguments &args)
virtual Geometry * convexHull() const _NOEXCEPT_OP(false)
This method calculates the Convex Hull of a geometry.
virtual bool coveredBy(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns true if this geometry object is spatially covered by rhs geometry.
virtual bool equals(const Geometry *const rhs, const bool exact=false) const _NOEXCEPT_OP(false)
It returns true if the geometry object is spatially equal to rhs geometry.
virtual bool covers(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns true if this geometry object spatially covers the rhs geometry.
void getWkb(char *wkb, te::common::MachineByteOrder byteOrder) const _NOEXCEPT_OP(false)
It serializes the geometry to a WKB representation into the specified buffer.
::v8::Handle<::v8::Value > Geometry_Equals(const ::v8::Arguments &args)
virtual const std::string & getGeometryType() const _NOEXCEPT_OP(true)=0
It returns the name of the geometry subclass.