Ejemplo n.º 1
0
        public static void QueryFeaturesTest()
        {
            MapServiceFidTests.Initialize();
            LayerDescription layerDescription = null;

            LayerDescription[] layerDescriptions = MapServiceFidTests._mapinfo.DefaultMapDescription.LayerDescriptions;
            for (int i = 0; i < layerDescriptions.Length; i++)
            {
                LayerDescription layerDescription2 = layerDescriptions[i];
                if (layerDescription2.LayerID == 13)
                {
                    layerDescription = layerDescription2;
                    break;
                }
            }
            string        geomFieldName = MapServiceFidTests.GetGeomFieldName(MapServiceFidTests._mapinfo, layerDescription.LayerID);
            SpatialFilter spatialfilter = MapServiceFidTests.BuildSpatialFilter((EnvelopeN)MapServiceFidTests._mapinfo.Extent, geomFieldName, MapServiceFidTests._mapinfo.DefaultMapDescription.SpatialReference);

            MapServiceFidTests.completeSpRef = MapServiceFidTests._mapinfo.DefaultMapDescription.SpatialReference;
            int num = 4326;

            MapServiceFidTests.wkidSpRef = MapServiceFidTests.SpRefFromWKID(ref num);
            string wKT = MapServiceFidTests.completeSpRef.WKT;

            MapServiceFidTests.wktSpRef = MapServiceFidTests.SpRefFromWKT(ref wKT);
            string text = "PROJCS[\"WGS_1984_Web_Mercator_Auxiliary_Sphere\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Mercator_Auxiliary_Sphere\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",0.0],PARAMETER[\"Standard_Parallel_1\",0.0],PARAMETER[\"Auxiliary_Sphere_Type\",0.0],UNIT[\"Meter\",1.0],AUTHORITY[\"EPSG\",3857]]";

            MapServiceFidTests.alternateSpRef = MapServiceFidTests.SpRefFromWKT(ref text);
            MapServiceFidTests.TestAlt(layerDescription, spatialfilter);
        }
Ejemplo n.º 2
0
        public static SpatialFilter BuildSpatialFilter(EnvelopeN env, string geomField, SpatialReference spRef)
        {
            SpatialFilter result;

            try
            {
                SpatialFilter spatialFilter = new SpatialFilter();
                env.SpatialReference         = spRef;
                spatialFilter.FilterGeometry = env;
                if (!string.IsNullOrEmpty(geomField))
                {
                    spatialFilter.GeometryFieldName = geomField;
                }
                spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelEnvelopeIntersects;
                if (!string.IsNullOrEmpty(env.SpatialReference.WKT))
                {
                    string wKT = env.SpatialReference.WKT;
                    spatialFilter.OutputSpatialReference = MapServiceFidTests.SpRefFromWKT(ref wKT);
                }
                else if (env.SpatialReference.WKIDSpecified)
                {
                    int wKID = env.SpatialReference.WKID;
                    spatialFilter.OutputSpatialReference = MapServiceFidTests.SpRefFromWKID(ref wKID);
                }
                result = spatialFilter;
            }
            catch
            {
                result = null;
            }
            return(result);
        }
Ejemplo n.º 3
0
        public static SpatialReference SpRefFromWKID(ref int wkid)
        {
            SpatialReference result;

            try
            {
                if (!MapServiceFidTests.IsGeographicWKID(wkid))
                {
                    result = new ProjectedCoordinateSystem
                    {
                        WKID          = wkid,
                        WKIDSpecified = true
                    };
                }
                else
                {
                    result = new GeographicCoordinateSystem
                    {
                        WKID          = wkid,
                        WKIDSpecified = true
                    };
                }
            }
            catch
            {
                result = null;
            }
            return(result);
        }
Ejemplo n.º 4
0
        public static void TheTest(LayerDescription activelayerdesc, SpatialFilter spatialfilter, SpatialReference sp1, SpatialReference sp2)
        {
            string oIDFieldName = MapServiceFidTests.GetOIDFieldName(MapServiceFidTests._mapinfo, activelayerdesc.LayerID);

            spatialfilter.OutputSpatialReference = sp1;
            EnvelopeN envelopeN = spatialfilter.FilterGeometry as EnvelopeN;

            envelopeN.SpatialReference   = sp2;
            spatialfilter.FilterGeometry = envelopeN;
            FIDSet      fIDSet      = MapServiceFidTests.BuildFIDSet(MapServiceFidTests.name, activelayerdesc, spatialfilter);
            QueryFilter queryFilter = MapServiceFidTests.BuildQueryFromFIDSet(fIDSet, sp1);

            queryFilter.OutputSpatialReference = sp1;
            RecordSet        recordSet        = MapServiceFidTests.QueryFeatures(activelayerdesc, queryFilter, false);
            RecordSet        rs               = MapServiceFidTests.QueryFeatures(activelayerdesc, queryFilter, true);
            int              num              = MapServiceFidTests.FindGeometryFieldIndex(recordSet);
            SpatialReference spatialReference = recordSet.Fields.FieldArray[num].GeometryDef.SpatialReference;

            recordSet = MapServiceFidTests.ProjectRecordSet(MapServiceFidTests._mapinfo.FullExtent, recordSet, num, spatialReference, sp2);
            rs        = MapServiceFidTests.ProjectRecordSet(MapServiceFidTests._mapinfo.FullExtent, rs, num, spatialReference, sp2);
            FIDSet fIDSet2 = MapServiceFidTests.BuildDeltaFIDSet(fIDSet, recordSet, oIDFieldName);

            while (fIDSet2.FIDArray.Length > 0)
            {
                queryFilter = MapServiceFidTests.BuildQueryFromFIDSet(fIDSet2, sp1);
                queryFilter.OutputSpatialReference = sp1;
                recordSet = MapServiceFidTests.QueryFeatures(activelayerdesc, queryFilter, false);
                rs        = MapServiceFidTests.QueryFeatures(activelayerdesc, queryFilter, true);
                fIDSet2   = MapServiceFidTests.BuildDeltaFIDSet(fIDSet2, recordSet, oIDFieldName);
            }
        }
Ejemplo n.º 5
0
        private static void DumpSpatialFilter(SpatialFilter sf)
        {
            EnvelopeN env = (EnvelopeN)sf.FilterGeometry;

            MapServiceFidTests.DumpEnvelope(env);
            MapServiceFidTests.DumpSpatialReference(sf.OutputSpatialReference);
            if (!string.IsNullOrEmpty(sf.WhereClause))
            {
                return;
            }
            string arg_31_0 = sf.WhereClause;
        }
Ejemplo n.º 6
0
 public static void TestSix(LayerDescription activelayerdesc, SpatialFilter spatialfilter)
 {
     MapServiceFidTests.TheTest(activelayerdesc, spatialfilter, MapServiceFidTests.wktSpRef, MapServiceFidTests.wkidSpRef);
 }
Ejemplo n.º 7
0
 public static void TestOne(LayerDescription activelayerdesc, SpatialFilter spatialfilter)
 {
     MapServiceFidTests.TheTest(activelayerdesc, spatialfilter, MapServiceFidTests.completeSpRef, MapServiceFidTests.completeSpRef);
 }
Ejemplo n.º 8
0
 private static void DumpEnvelope(EnvelopeN env)
 {
     MapServiceFidTests.DumpSpatialReference(env.SpatialReference);
 }