diff --git a/hoot-js/src/main/cpp/hoot/js/schema/OsmSchemaJs.cpp b/hoot-js/src/main/cpp/hoot/js/schema/OsmSchemaJs.cpp
index 8877b6b..5248262 100644
--- a/hoot-js/src/main/cpp/hoot/js/schema/OsmSchemaJs.cpp
+++ b/hoot-js/src/main/cpp/hoot/js/schema/OsmSchemaJs.cpp
@@ -28,10 +28,6 @@
// hoot
#include <hoot/core/schema/OsmSchema.h>
-#include <hoot/js/JsRegistrar.h>
-#include <hoot/js/elements/ElementJs.h>
-#include <hoot/js/io/DataConvertJs.h>
-#include <hoot/js/elements/OsmMapJs.h>
#include <hoot/core/criterion/AreaCriterion.h>
#include <hoot/core/criterion/LinearCriterion.h>
#include <hoot/core/criterion/BuildingCriterion.h>
@@ -45,7 +41,14 @@
#include <hoot/core/criterion/PolygonCriterion.h>
#include <hoot/core/criterion/NonConflatableCriterion.h>
#include <hoot/core/criterion/NonBuildingAreaCriterion.h>
+#include <hoot/core/criterion/CollectionRelationCriterion.h>
+#include <hoot/core/conflate/river/RiverSnapMerger.h>
+
#include <hoot/js/elements/TagsJs.h>
+#include <hoot/js/JsRegistrar.h>
+#include <hoot/js/elements/ElementJs.h>
+#include <hoot/js/io/DataConvertJs.h>
+#include <hoot/js/elements/OsmMapJs.h>
using namespace v8;
@@ -86,6 +89,8 @@ void OsmSchemaJs::Init(Handle<Object> exports)
FunctionTemplate::New(current, hasType)->GetFunction());
schema->Set(String::NewFromUtf8(current, "explicitTypeMismatch"),
FunctionTemplate::New(current, explicitTypeMismatch)->GetFunction());
+ schema->Set(String::NewFromUtf8(current, "mostSpecificType"),
+ FunctionTemplate::New(current, mostSpecificType)->GetFunction());
schema->Set(String::NewFromUtf8(current, "isArea"),
FunctionTemplate::New(current, isArea)->GetFunction());
schema->Set(String::NewFromUtf8(current, "isPolygon"),
@@ -110,6 +115,8 @@ void OsmSchemaJs::Init(Handle<Object> exports)
FunctionTemplate::New(current, isHighway)->GetFunction());
schema->Set(String::NewFromUtf8(current, "isNonBuildingArea"),
FunctionTemplate::New(current, isNonBuildingArea)->GetFunction());
+ schema->Set(String::NewFromUtf8(current, "isCollectionRelation"),
+ FunctionTemplate::New(current, isCollectionRelation)->GetFunction());
schema->Set(String::NewFromUtf8(current, "score"),
FunctionTemplate::New(current, score)->GetFunction());
schema->Set(String::NewFromUtf8(current, "scoreTypes"),
@@ -120,6 +127,8 @@ void OsmSchemaJs::Init(Handle<Object> exports)
FunctionTemplate::New(current, hasName)->GetFunction());
schema->Set(String::NewFromUtf8(current, "isSpecificallyConflatable"),
FunctionTemplate::New(current, isSpecificallyConflatable)->GetFunction());
+ schema->Set(String::NewFromUtf8(current, "isLongRiverPair"),
+ FunctionTemplate::New(current, isLongRiverPair)->GetFunction());
}
void OsmSchemaJs::getAllTags(const FunctionCallbackInfo<Value>& args)
@@ -360,6 +369,16 @@ void OsmSchemaJs::isNonBuildingArea(const FunctionCallbackInfo<Value>& args)
Boolean::New(current, NonBuildingAreaCriterion(mapJs->getConstMap()).isSatisfied(e)));
}
+void OsmSchemaJs::isCollectionRelation(const FunctionCallbackInfo<Value>& args)
+{
+ Isolate* current = args.GetIsolate();
+ HandleScope scope(current);
+
+ ConstElementPtr e = ObjectWrap::Unwrap<ElementJs>(args[0]->ToObject())->getConstElement();
+
+ args.GetReturnValue().Set(
+ Boolean::New(current, CollectionRelationCriterion().isSatisfied(e)));
+}
void OsmSchemaJs::isSpecificallyConflatable(
const FunctionCallbackInfo<Value>& args)
{
@@ -433,4 +452,27 @@ void OsmSchemaJs::scoreOneWay(const FunctionCallbackInfo<Value>& args)
args.GetReturnValue().Set(Number::New(current, OsmSchema::getInstance().scoreOneWay(kvp1, kvp2)));
}
+void OsmSchemaJs::mostSpecificType(const FunctionCallbackInfo<Value>& args)
+{
+ Isolate* current = args.GetIsolate();
+ HandleScope scope(current);
+
+ ConstElementPtr element = ObjectWrap::Unwrap<ElementJs>(args[0]->ToObject())->getConstElement();
+ const QString kvp = OsmSchema::getInstance().mostSpecificType(element->getTags());
+ args.GetReturnValue().Set(String::NewFromUtf8(current, kvp.toUtf8().data()));
+}
+
+void OsmSchemaJs::isLongRiverPair(const FunctionCallbackInfo<Value>& args)
+{
+ Isolate* current = args.GetIsolate();
+ HandleScope scope(current);
+
+ OsmMapJs* mapJs = ObjectWrap::Unwrap<OsmMapJs>(args[0]->ToObject());
+ ConstElementPtr e1 = ObjectWrap::Unwrap<ElementJs>(args[1]->ToObject())->getConstElement();
+ ConstElementPtr e2 = ObjectWrap::Unwrap<ElementJs>(args[2]->ToObject())->getConstElement();
+
+ args.GetReturnValue().Set(
+ Boolean::New(current, RiverSnapMerger().isLongPair(mapJs->getConstMap(), e1, e2)));
+}
+
}