Ejemplo n.º 1
0
 /**
  * Gets whether two spatial references are mathematically equivalent.
  *
  * @param lhs
  *      First spatial reference
  * @param rhs
  *      Second spatial reference
  * @return
  *      True if they are mathematically equivalent.
  */
 public static bool equivalent(SpatialReference lhs, SpatialReference rhs)
 {
     if (lhs == rhs)
     {
         return(true);
     }
     if (lhs == null || rhs == null)
     {
         return(false);
     }
     return(lhs.equivalentTo(rhs));
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 /**
  * Gets whether two spatial references are mathematically equivalent.
  *
  * @param lhs
  *      First spatial reference
  * @param rhs
  *      Second spatial reference
  * @return
  *      True if they are mathematically equivalent.
  */
 public static bool equivalent(SpatialReference lhs, SpatialReference rhs)
 {
     if (lhs == rhs) return true;
     if (lhs == null || rhs == null) return false;
     return lhs.equivalentTo(rhs);
 }