示例#1
0
        public override FeatureList process(Feature input, FilterEnv env)
        {
            FeatureList output = new FeatureList();

            if (transform != null && !transform.Identity())
            {
                foreach (GeoShape shape in input.getShapes())
                {
                    XformVisitor visitor = new XformVisitor();
                    visitor.trans = transform;
                    shape.accept(visitor);
                }
            }

            output.Add(input);
            return(output);

#if TODO
            // resolve the xlate shortcut
            Matrix working_matrix = xform_matrix;

            // TODO: this can go into process(FeatureList) instead of running for every feature..
            if (getTranslateScript() != null)
            {
                ScriptResult r = env.getScriptEngine().run(getTranslateScript(), input, env);
                if (r.isValid())
                {
                    working_matrix = Matrix.translate(r.asVec3());
                }
                else
                {
                    env.getReport().error(r.asString());
                }
            }

            if (working_srs != null || (working_matrix != null && !working_matrix.IsIdentity))
            {
                foreach (GeoShape shape in input.getShapes())
                {
                    if (working_matrix != null && !working_matrix.IsIdentity)
                    {
                        XformVisitor visitor;
                        visitor.mat = working_matrix;
                        shape.accept(visitor);
                    }

                    if (working_srs != null && !working_srs.equivalentTo(env.getInputSRS()))
                    {
                        working_srs.transformInPlace(shape);
                    }
                }
            }

            output.Add(input);
            return(output);
#endif
            throw new NotImplementedException();
        }
示例#2
0
        override public FeatureList process(Feature input, FilterEnv env)
        {
            FeatureList output = new FeatureList();

            //resolve the xlate shortcut
            Mogre.Matrix4 workingMatrix = Matrix;

            //TODO: this can go into process (FeatureList) instead of running for every feature..
            if (TranslateScript != null)
            {
                ScriptResult r = env.getScriptEngine().run(TranslateScript, input, env);
                if (r.isValid())
                {
                    workingMatrix.MakeTrans(new Mogre.Vector3((float)r.asVec3().x, (float)r.asVec3().y, (float)r.asVec3().z));
                }
                else
                {
                    env.getReport().error(r.asString());
                }
            }
            if (workingSrs != null || (workingMatrix != null && workingMatrix != Mogre.Matrix4.IDENTITY))
            {
                //TODO foreach (Geometry shape in input.getGeometry())
                //{
                //    if (workingMatrix != null && !workingMatrix.Equals(Mogre.Matrix4.IDENTITY))
                //    {

                //        XformVisitor visitor = new XformVisitor();
                //        visitor.mat = workingMatrix;
                //        shape.accept(visitor);
                //    }
                //    if (workingSrs != null && !(workingSrs.equivalentTo(env.getInputSRS())))
                //    {
                //        workingSrs.transformInPlace(shape);
                //    }
                //}
                if (workingSrs != null && !(workingSrs.equivalentTo(env.getInputSRS())))
                {
                    Geometry temp = GeometryTransform.TransformGeometry(input.getGeometry(), ((SharpMapSpatialReference)workingSrs).MathTransform);
                    input.setGeometry(temp);
                    //workingSrs.transformInPlace(input.getGeometry());
                }
            }
            output.Add(input);
            return(output);
        }