private static int QuickTest2DMVEnvelopeRasterOnly(com.epl.geometry.MultiVertexGeometry geomA, com.epl.geometry.Envelope2D geomBEnv, double tolerance)
 {
     // Use rasterized Geometry only:
     com.epl.geometry.RasterizedGeometry2D    rgeomA;
     com.epl.geometry.MultiVertexGeometryImpl mpImpl = (com.epl.geometry.MultiVertexGeometryImpl)geomA._getImpl();
     com.epl.geometry.GeometryAccelerators    gaccel = mpImpl._getAccelerators();
     if (gaccel != null)
     {
         rgeomA = gaccel.GetRasterizedGeometry();
     }
     else
     {
         return(-1);
     }
     if (rgeomA != null)
     {
         com.epl.geometry.RasterizedGeometry2D.HitType hitres = rgeomA.QueryEnvelopeInGeometry(geomBEnv);
         if (hitres == com.epl.geometry.RasterizedGeometry2D.HitType.Outside)
         {
             return((int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Disjoint);
         }
         if (hitres == com.epl.geometry.RasterizedGeometry2D.HitType.Inside)
         {
             return((int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Contains);
         }
     }
     else
     {
         return(-1);
     }
     return(0);
 }
        public static int QuickTest2D_Accelerated_DisjointOrContains(com.epl.geometry.Geometry geomA, com.epl.geometry.Geometry geomB, double tolerance)
        {
            int gtA = geomA.GetType().Value();
            int gtB = geomB.GetType().Value();

            com.epl.geometry.GeometryAccelerators accel;
            bool endWhileStatement = false;

            do
            {
                if (com.epl.geometry.Geometry.IsMultiVertex(gtA))
                {
                    com.epl.geometry.MultiVertexGeometryImpl impl = (com.epl.geometry.MultiVertexGeometryImpl)geomA._getImpl();
                    accel = impl._getAccelerators();
                    if (accel != null)
                    {
                        com.epl.geometry.RasterizedGeometry2D rgeom = accel.GetRasterizedGeometry();
                        if (rgeom != null)
                        {
                            if (gtB == com.epl.geometry.Geometry.GeometryType.Point)
                            {
                                com.epl.geometry.Point2D ptB = ((com.epl.geometry.Point)geomB).GetXY();
                                com.epl.geometry.RasterizedGeometry2D.HitType hit = rgeom.QueryPointInGeometry(ptB.x, ptB.y);
                                if (hit == com.epl.geometry.RasterizedGeometry2D.HitType.Inside)
                                {
                                    return((int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Contains);
                                }
                                else
                                {
                                    if (hit == com.epl.geometry.RasterizedGeometry2D.HitType.Outside)
                                    {
                                        return((int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Disjoint);
                                    }
                                }
                                break;
                            }
                            com.epl.geometry.Envelope2D envB = new com.epl.geometry.Envelope2D();
                            geomB.QueryEnvelope2D(envB);
                            com.epl.geometry.RasterizedGeometry2D.HitType hit_1 = rgeom.QueryEnvelopeInGeometry(envB);
                            if (hit_1 == com.epl.geometry.RasterizedGeometry2D.HitType.Inside)
                            {
                                return((int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Contains);
                            }
                            else
                            {
                                if (hit_1 == com.epl.geometry.RasterizedGeometry2D.HitType.Outside)
                                {
                                    return((int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Disjoint);
                                }
                            }
                            break;
                        }
                    }
                }
            }while (endWhileStatement);
            accel = null;
            do
            {
                if (com.epl.geometry.Geometry.IsMultiVertex(gtB))
                {
                    com.epl.geometry.MultiVertexGeometryImpl impl = (com.epl.geometry.MultiVertexGeometryImpl)geomB._getImpl();
                    accel = impl._getAccelerators();
                    if (accel != null)
                    {
                        com.epl.geometry.RasterizedGeometry2D rgeom = accel.GetRasterizedGeometry();
                        if (rgeom != null)
                        {
                            if (gtA == com.epl.geometry.Geometry.GeometryType.Point)
                            {
                                com.epl.geometry.Point2D ptA = ((com.epl.geometry.Point)geomA).GetXY();
                                com.epl.geometry.RasterizedGeometry2D.HitType hit = rgeom.QueryPointInGeometry(ptA.x, ptA.y);
                                if (hit == com.epl.geometry.RasterizedGeometry2D.HitType.Inside)
                                {
                                    return((int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Within);
                                }
                                else
                                {
                                    if (hit == com.epl.geometry.RasterizedGeometry2D.HitType.Outside)
                                    {
                                        return((int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Disjoint);
                                    }
                                }
                                break;
                            }
                            com.epl.geometry.Envelope2D envA = new com.epl.geometry.Envelope2D();
                            geomA.QueryEnvelope2D(envA);
                            com.epl.geometry.RasterizedGeometry2D.HitType hit_1 = rgeom.QueryEnvelopeInGeometry(envA);
                            if (hit_1 == com.epl.geometry.RasterizedGeometry2D.HitType.Inside)
                            {
                                return((int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Within);
                            }
                            else
                            {
                                if (hit_1 == com.epl.geometry.RasterizedGeometry2D.HitType.Outside)
                                {
                                    return((int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Disjoint);
                                }
                            }
                            break;
                        }
                    }
                }
            }while (endWhileStatement);
            return(0);
        }