Exemplo n.º 1
0
FragmentList
BuildGeomFilter::process( FeatureList& input, FilterEnv* env )
{
    // if features are arriving in batch, resolve the color here.
    // otherwise we will resolve it later in process(feature,env).
    is_batch = input.size() > 1;
    batch_feature_color = overall_color;
    if ( is_batch && getColorScript() )
    {
        ScriptResult r = env->getScriptEngine()->run( getColorScript(), env );
        if ( r.isValid() )
            batch_feature_color = r.asVec4();
        else
            env->getReport()->error( r.asString() );
    }

    return FragmentFilter::process( input, env );
}
Exemplo n.º 2
0
osg::Vec4
BuildGeomFilter::getColorForFeature( Feature* feature, FilterEnv* env )
{
    osg::Vec4 result = overall_color;

    if ( is_batch )
    {
        result = batch_feature_color;
    }
    else if ( getColorScript() )
    {
        ScriptResult r = env->getScriptEngine()->run( getColorScript(), feature, env );
        if ( r.isValid() )
            result = r.asVec4();
        else
            env->getReport()->error( r.asString() );
    }

    return result;
}