Ejemplo n.º 1
0
 std::shared_ptr<utymap::mapcss::StyleProvider> getStyleProvider(const utymap::mapcss::StyleSheet &stylesheet) {
   if (styleProvider_==nullptr) {
     utymap::mapcss::MapCssParser parser;
     styleProvider_ = std::make_shared<utymap::mapcss::StyleProvider>(stylesheet, *getStringTable());
   }
   return styleProvider_;
 }
Ejemplo n.º 2
0
 std::shared_ptr<utymap::builders::BuilderContext> createBuilderContext(
     const utymap::QuadKey &quadKey,
     const std::string &stylesheet,
     std::function<void(const utymap::math::Mesh &)> meshCallback = nullptr,
     std::function<void(const utymap::entities::Element &)> elementCallback = nullptr) {
   return std::make_shared<utymap::builders::BuilderContext>(
       quadKey,
       *getStyleProvider(stylesheet),
       *getStringTable(),
       *getMeshPool(),
       *getElevationProvider(),
       meshCallback,
       elementCallback,
       cancelToken);
 }
Ejemplo n.º 3
0
static as_value
get_flash_text_package(const fn_call& fn)
{
    log_debug("Loading flash.text package");
 
    Global_as& gl = getGlobal(fn);

    as_object* pkg = gl.createObject();
    
    string_table& st = getStringTable(fn);
    const string_table::key global = 0;

    textrenderer_class_init(*pkg, ObjectURI(st.find("TextRenderer"), global));

    return pkg;
}
Ejemplo n.º 4
0
as_class::as_class(Global_as& gl, Class* c)
    :
    as_object(gl),
    _class(c),
    _name("[class " + getStringTable(gl).value(c->getName()) + "]")
{}
Ejemplo n.º 5
0
/// Order of property lookup:
//
/// 1. Visible own properties.
/// 2. If DisplayObject, magic properties
/// 3. Visible own properties of all __proto__ objects (a DisplayObject
///    ends the chain).
/// 4. __resolve property of this object and all __proto__ objects (a Display
///    Object ends the chain). This should ignore visibility but doesn't.
bool
as_object::get_member(const ObjectURI& uri, as_value* val)
{
    assert(val);

    const int version = getSWFVersion(*this);

    PrototypeRecursor<IsVisible> pr(this, uri, IsVisible(version));
	
    Property* prop = pr.getProperty();
    if (!prop) {
        if (displayObject()) {
            DisplayObject* d = displayObject();
            if (getDisplayObjectProperty(*d, uri, *val)) return true;
        }
        while (pr()) {
            if ((prop = pr.getProperty())) break;
        }
    }

    // If the property isn't found or doesn't apply to any objects in the
    // inheritance chain, try the __resolve property.
    if (!prop) {

        PrototypeRecursor<Exists> pr(this, NSV::PROP_uuRESOLVE);

        as_value resolve;

        for (;;) {
            Property* res = pr.getProperty();
            if (res) {
                resolve = res->isGetterSetter() ? res->getCache() :
                                                  res->getValue(*this);
                if (version < 7) break;
                if (resolve.is_object()) break;
            }
            // Finished searching.
            if (!pr()) return false;
        }

        // If __resolve exists, call it with the name of the undefined
        // property.
        string_table& st = getStringTable(*this);
        const std::string& undefinedName = st.value(getName(uri));

        fn_call::Args args;
        args += undefinedName;

        // Invoke the __resolve property.
        *val = invoke(resolve, as_environment(getVM(*this)), this, args);

        return true;
    }

    try {
        *val = prop->getValue(*this);
        return true;
    }
    catch (const ActionTypeError& exc) {
        IF_VERBOSE_ASCODING_ERRORS(
            log_aserror(_("Caught exception: %s"), exc.what());
            );
        return false;
    }