Ejemplo n.º 1
0
v8::Persistent<v8::ObjectTemplate> ECMAScriptContext::Impl::getGlobalTemplate() {
    static bool initilized = false;
    static v8::Persistent<v8::ObjectTemplate> globalTemplate;
    if (initilized)
        return globalTemplate;
#ifdef HAVE_V8_ISOLATE
    globalTemplate = v8::Persistent<v8::ObjectTemplate>::New(v8::Isolate::GetCurrent(), v8::ObjectTemplate::New());
#else
    globalTemplate = v8::Persistent<v8::ObjectTemplate>::New(v8::ObjectTemplate::New());
#endif
    registerClasses(globalTemplate);
    globalTemplate->SetInternalFieldCount(1);
    initilized = true;
    return globalTemplate;
}
Ejemplo n.º 2
0
v8::Handle<v8::ObjectTemplate>
JSFeature::GetAttributesObjectTemplate()
{
    v8::HandleScope handle_scope;

    static v8::Persistent<v8::ObjectTemplate> attr_instance;

    if (attr_instance.IsEmpty())
    {
        attr_instance = v8::Persistent<v8::ObjectTemplate>::New(v8::ObjectTemplate::New());
        attr_instance->Set(v8::String::New(V8_OBJECT_TYPE_PROPERTY), v8::String::New("JSFeature_Attrs"));
        attr_instance->SetInternalFieldCount(1);
        attr_instance->SetNamedPropertyHandler(AttrPropertyCallback);
    }

    return attr_instance;
}
Ejemplo n.º 3
0
v8::Handle<v8::ObjectTemplate>
JSFeature::GetObjectTemplate()
{
    v8::HandleScope handle_scope;

    static v8::Persistent<v8::ObjectTemplate> feat_instance;

    if (feat_instance.IsEmpty())
    {
        feat_instance = v8::Persistent<v8::ObjectTemplate>::New(v8::ObjectTemplate::New());
        feat_instance->Set(v8::String::New(V8_OBJECT_TYPE_PROPERTY), v8::String::New(GetObjectType().c_str()));
        feat_instance->SetInternalFieldCount(1);
        feat_instance->SetNamedPropertyHandler(PropertyCallback);
    }

    return feat_instance;
}
Ejemplo n.º 4
0
v8::Handle<v8::ObjectTemplate>
JSSymbologyGeometry::GetObjectTemplate()
{
    v8::HandleScope handle_scope;

    static v8::Persistent<v8::ObjectTemplate> template_instance;

    if (template_instance.IsEmpty())
    {
        template_instance = v8::Persistent<v8::ObjectTemplate>::New(v8::ObjectTemplate::New());
        template_instance->Set(v8::String::New(V8_OBJECT_TYPE_PROPERTY), v8::String::New(GetObjectType().c_str()));
        template_instance->SetInternalFieldCount(1);
        template_instance->SetNamedPropertyHandler(PropertyCallback);
        template_instance->SetIndexedPropertyHandler(IndexedPropertyCallback);
    }

    return template_instance;
}
Ejemplo n.º 5
0
v8::Handle<v8::ObjectTemplate>
JSGeoExtent::GetObjectTemplate()
{
    v8::HandleScope handle_scope;

    static v8::Persistent<v8::ObjectTemplate> template_instance;

    if (template_instance.IsEmpty())
    {
        template_instance = v8::Persistent<v8::ObjectTemplate>::New(v8::ObjectTemplate::New());
        template_instance->Set(v8::String::New(V8_OBJECT_TYPE_PROPERTY), v8::String::New(GetObjectType().c_str()));
        template_instance->SetInternalFieldCount(1);
        template_instance->SetNamedPropertyHandler(PropertyCallback);

        template_instance->Set(v8::String::New("contains"), v8::FunctionTemplate::New(ContainsCallback));
        template_instance->Set(v8::String::New("intersects"), v8::FunctionTemplate::New(IntersectsCallback));
    }

    return template_instance;
}
Ejemplo n.º 6
0
v8::Handle<v8::ObjectTemplate>
JSSession::GetObjectTemplate()
{
    v8::HandleScope handle_scope;

    static v8::Persistent<v8::ObjectTemplate> template_instance;

    if (template_instance.IsEmpty())
    {
        template_instance = v8::Persistent<v8::ObjectTemplate>::New(v8::ObjectTemplate::New());
        template_instance->Set(v8::String::New(V8_OBJECT_TYPE_PROPERTY), v8::String::New(GetObjectType().c_str()));
        template_instance->SetInternalFieldCount(1);
        template_instance->SetNamedPropertyHandler(PropertyCallback);

#if 0
        template_instance->Set(v8::String::New("resolveURI"), v8::FunctionTemplate::New(ResolveUriCallback));
#endif
    }

    return template_instance;
}
Ejemplo n.º 7
0
v8::Handle<v8::ObjectTemplate>
JSSpatialReference::GetObjectTemplate()
{
    v8::HandleScope handle_scope;

    static v8::Persistent<v8::ObjectTemplate> template_instance;

    if (template_instance.IsEmpty())
    {
        template_instance = v8::Persistent<v8::ObjectTemplate>::New(v8::ObjectTemplate::New());
        template_instance->Set(v8::String::New(V8_OBJECT_TYPE_PROPERTY), v8::String::New(GetObjectType().c_str()));
        template_instance->SetInternalFieldCount(1);
        template_instance->SetNamedPropertyHandler(PropertyCallback);

        template_instance->Set(v8::String::New("isEquivalentTo"), v8::FunctionTemplate::New(EquivalenceCallback));
        template_instance->Set(v8::String::New("createTangentPlaneSRS"), v8::FunctionTemplate::New(TangentPlaneCallback));
        //template_instance->Set(v8::String::New("createTransMercFromLongitude"), v8::FunctionTemplate::New(equivalenceCallback));
        //template_instance->Set(v8::String::New("createUTMFromLongitude"), v8::FunctionTemplate::New(equivalenceCallback));
    }

    return template_instance;
}
Ejemplo n.º 8
0
v8::Handle<v8::ObjectTemplate>
JSMapInfo::GetObjectTemplate()
{
    v8::HandleScope handle_scope;

    static v8::Persistent<v8::ObjectTemplate> template_instance;

    if (template_instance.IsEmpty())
    {
        template_instance = v8::Persistent<v8::ObjectTemplate>::New(v8::ObjectTemplate::New());
        template_instance->Set(v8::String::New(V8_OBJECT_TYPE_PROPERTY), v8::String::New(GetObjectType().c_str()));
        template_instance->SetInternalFieldCount(1);
        template_instance->SetNamedPropertyHandler(PropertyCallback);

#if 0
        template_instance->Set(v8::String::New("toMapPoint"), v8::FunctionTemplate::New(ToMapCallback));
        template_instance->Set(v8::String::New("mapPointToWorldPoint"), v8::FunctionTemplate::New(MapToWorldCallback));
        template_instance->Set(v8::String::New("worldPointToMapPoint"), v8::FunctionTemplate::New(WorldToMapCallback));
#endif
    }

    return template_instance;
}
Ejemplo n.º 9
0
v8::Handle<v8::ObjectTemplate>
JSFilterContext::GetObjectTemplate()
{
    v8::HandleScope handle_scope;

    static v8::Persistent<v8::ObjectTemplate> template_instance;

    if (template_instance.IsEmpty())
    {
        template_instance = v8::Persistent<v8::ObjectTemplate>::New(v8::ObjectTemplate::New());
        template_instance->Set(v8::String::New(V8_OBJECT_TYPE_PROPERTY), v8::String::New(GetObjectType().c_str()));
        template_instance->SetInternalFieldCount(1);
        template_instance->SetNamedPropertyHandler(PropertyCallback);

#if 0
        template_instance->Set(v8::String::New("toLocal"), v8::FunctionTemplate::New(ToLocalCallback));
        template_instance->Set(v8::String::New("toWorld"), v8::FunctionTemplate::New(ToWorldCallback));
        template_instance->Set(v8::String::New("toMap"), v8::FunctionTemplate::New(ToMapCallback));
        template_instance->Set(v8::String::New("fromMap"), v8::FunctionTemplate::New(FromMapCallback));
#endif
    }

    return template_instance;
}
Ejemplo n.º 10
0
 Template(int field_count=1) :
     js_template(v8::Persistent<v8::ObjectTemplate>::New(v8::ObjectTemplate::New())) {
     js_template->SetInternalFieldCount(field_count);
 }