protected virtual FragmentList process(Feature input, FilterEnv env)
        {
            FragmentList output;

            // the text string:
            string text;

            if (getTextScript() != null)
            {
                ScriptResult r = env.getScriptEngine().run(getTextScript(), input, env);
                if (r.isValid())
                {
                    text = r.asString();
                }
                else
                {
                    env.getReport().error(r.asString());
                }
            }

            // resolve the size:
            double font_size = 16.0;

            if (getFontSizeScript() != null)
            {
                ScriptResult r = env.getScriptEngine().run(getFontSizeScript(), input, env);
                if (r.isValid())
                {
                    font_size = r.asDouble(font_size);
                }
                else
                {
                    env.getReport().error(r.asString());
                }
            }

            // the text color:
            Vector4D color = getColorForFeature(input, env);

            // calculate the 3D centroid of the feature:
            // TODO: move this to the geoshapelist class
            Vector3D point = new Vector3D(input.getExtent().getCentroid());
            ZCalc    zc;

            input.getShapes().accept(zc);
            point.z() = zc.z_count > 0 ? zc.z_sum / (double)zc.z_count : 0.0;

            // build the drawable:
            osgText.Text t = new osgText.Text();
            t.setAutoRotateToScreen(true);
            t.setCharacterSizeMode(osgText.Text.SCREEN_COORDS);
            t.setAlignment(osgText.Text.CENTER_CENTER);
            t.setText(text.c_str());
            t.setColor(color);
            t.setCharacterSize((float)font_size);
            t.setPosition(point);
            t.setBackdropType(osgText.Text.OUTLINE);
            t.setBackdropColor(osg.Vec4(0, 0, 0, 1));

#if PENDING
            // testing the flat-label approach here:
            osg.Matrix cell2map       = env.getInputSRS().getInverseReferenceFrame();
            osg.Vec3d  feature_center = point * cell2map;
            feature_center.normalize();
            osg.Vec3d cell_center = osg.Vec3d(0, 0, 1) * cell2map;
            cell_center.normalize();
            osg.Quat q;
            q.makeRotate(cell_center, feature_center);
            t.setRotation(q);
            t.setAutoRotateToScreen(false);
            // end of flat label approach
#endif

            if (font.valid())
            {
                t.setFont(font.get());
            }

            if (getDisableDepthTest())
            {
                t.getOrCreateStateSet().setAttribute(new osg.Depth(osg.Depth.ALWAYS, 0, 1, false), osg.StateAttribute.ON);
            }

            output.Add(new Fragment(t));

            return(output);
        }
        protected virtual FragmentList process(Feature input, FilterEnv env)
        {
            FragmentList output;

            // the text string:
            string text;
            if (getTextScript() != null)
            {
                ScriptResult r = env.getScriptEngine().run(getTextScript(), input, env);
                if (r.isValid())
                    text = r.asString();
                else
                    env.getReport().error(r.asString());
            }

            // resolve the size:
            double font_size = 16.0;
            if (getFontSizeScript() != null)
            {
                ScriptResult r = env.getScriptEngine().run(getFontSizeScript(), input, env);
                if (r.isValid())
                    font_size = r.asDouble(font_size);
                else
                    env.getReport().error(r.asString());
            }

            // the text color:
            Vector4D color = getColorForFeature(input, env);

            // calculate the 3D centroid of the feature:
            // TODO: move this to the geoshapelist class
            Vector3D point = new Vector3D(input.getExtent().getCentroid());
            ZCalc zc;
            input.getShapes().accept(zc);
            point.z() = zc.z_count > 0 ? zc.z_sum / (double)zc.z_count : 0.0;

            // build the drawable:
            osgText.Text t = new osgText.Text();
            t.setAutoRotateToScreen(true);
            t.setCharacterSizeMode(osgText.Text.SCREEN_COORDS);
            t.setAlignment(osgText.Text.CENTER_CENTER);
            t.setText(text.c_str());
            t.setColor(color);
            t.setCharacterSize((float)font_size);
            t.setPosition(point);
            t.setBackdropType(osgText.Text.OUTLINE);
            t.setBackdropColor(osg.Vec4(0, 0, 0, 1));

            #if PENDING
            // testing the flat-label approach here:
            osg.Matrix cell2map = env.getInputSRS().getInverseReferenceFrame();
            osg.Vec3d feature_center = point * cell2map;
            feature_center.normalize();
            osg.Vec3d cell_center = osg.Vec3d(0,0,1) * cell2map;
            cell_center.normalize();
            osg.Quat q;
            q.makeRotate( cell_center, feature_center );
            t.setRotation( q );
            t.setAutoRotateToScreen( false );
            // end of flat label approach
            #endif

            if (font.valid())
            {
                t.setFont(font.get());
            }

            if (getDisableDepthTest())
            {
                t.getOrCreateStateSet().setAttribute(new osg.Depth(osg.Depth.ALWAYS, 0, 1, false), osg.StateAttribute.ON);
            }

            output.Add(new Fragment(t));

            return output;
        }