Ejemplo n.º 1
0
bool AddDrawer::execute(ExecutionContext *ctx, SymbolTable &symTable)
{
    if (_prepState == sNOTPREPARED)
        if((_prepState = prepare(ctx,symTable)) != sPREPARED)
            return false;
    RootDrawer *rootdrawer = static_cast<RootDrawer *>(_rootDrawer);

    Geodrawer::DrawerInterface *drawer;
    if ( _coverage.isValid())    {
        LayerDrawer *ldrawer = DrawerFactory::create<LayerDrawer>(_coverage->ilwisType(), rootdrawer, rootdrawer, IOOptions());
        if ( !ldrawer){
            return ERROR2(ERR_NO_INITIALIZED_2,"Drawer",_coverage->name());
        }
        ldrawer->coverage(_coverage);
        if ( rootdrawer->drawerCount(Geodrawer::ComplexDrawer::dtMAIN) == 0)
            rootdrawer->coordinateSystem(_coverage->coordinateSystem());
        rootdrawer->addSpatialDrawer(ldrawer,false);
        QVariant var = qVariantFromValue((void *)ldrawer);
        ctx->addOutput(symTable,var,"layerdrawer",_coverage->ilwisType(), Resource());
    }else if ( _drawerCode != ""){
        drawer = Geodrawer::DrawerFactory::create<>(_drawerCode, rootdrawer, rootdrawer, IOOptions());
        rootdrawer->addDrawer(drawer,drawer->drawerType(),drawer->defaultOrder());
    }
    return true;
}
Ejemplo n.º 2
0
bool SetLayerVisibility::execute(ExecutionContext *ctx, SymbolTable &symTable)
{
    try {
    if (_prepState == sNOTPREPARED)
        if((_prepState = prepare(ctx,symTable)) != sPREPARED)
            return false;
    RootDrawer *rootdrawer = static_cast<RootDrawer *>(_rootDrawer);

    if ( _index != iUNDEF){
         UPDrawer& drawer = rootdrawer->drawer(_index, _type);
         drawer->active(_visibility);
    }else if ( _code != sUNDEF){
        UPDrawer& drawer = rootdrawer->drawer(_code, _type)    ;
        drawer->active(_visibility);
    }
    } catch(const VisualizationError& err){
    }
    return false;
}
Ejemplo n.º 3
0
bool SetLineColor::execute(ExecutionContext *ctx, SymbolTable &symTable)
{
    try {
        if (_prepState == sNOTPREPARED)
            if((_prepState = prepare(ctx,symTable)) != sPREPARED)
                return false;
        RootDrawer *rootdrawer = static_cast<RootDrawer *>(_rootDrawer);

        if ( _index != iUNDEF){
            UPDrawer& drawer = rootdrawer->drawer(_index, _type);
            drawer->setAttribute("linecolor", QVariant(_lineColor));
        }else if ( _code != sUNDEF){
            UPDrawer& drawer = rootdrawer->drawer(_code, _type)    ;
            drawer->setAttribute("linecolor", QVariant(_lineColor));
        }
        rootdrawer->redraw();
        logOperation(_expression);
        return true;
    }catch(const VisualizationError& err){
    }
    return false;
}
Ejemplo n.º 4
0
bool SetGridProperties::execute(ExecutionContext *ctx, SymbolTable &symTable)
{
    try {
        if (_prepState == sNOTPREPARED)
            if((_prepState = prepare(ctx,symTable)) != sPREPARED)
                return false;

        RootDrawer *rootdrawer = static_cast<RootDrawer *>(_rootDrawer);
        UPDrawer& griddrawer = rootdrawer->drawer("primarygriddrawer", DrawerInterface::dtPOST);

        if ( _gridColor.isValid())
            griddrawer->setAttribute("gridlinecolor", qVariantFromValue(_gridColor));
        if ( _distance != -1)
            griddrawer->setAttribute("gridcelldistance", qVariantFromValue(_distance));
        if ( _opacity != -1)
            griddrawer->setAttribute("gridlineopacity", qVariantFromValue(_opacity));

        return true;

    } catch(const VisualizationError& err){
    }
    return false;
}