Exemplo n.º 1
0
        /// <summary>
        /// Loads feature layer description from the specified URL.
        /// </summary>
        /// <param name="featureLayerUrl">The URL of the feature layer to load
        /// description for.</param>
        /// <returns>A reference to the feature layer description obtained at the
        /// specified URL.</returns>
        private LayerDescription _LoadLayerDescription(Uri featureLayerUrl)
        {
            Debug.Assert(featureLayerUrl != null);

            var request = new ESRI.ArcLogistics.Tracking.TrackingService.Requests.RequestBase();
            var query   = RestHelper.BuildQueryString(request, Enumerable.Empty <Type>(), true);
            var options = new HttpRequestOptions
            {
                Method          = HttpMethod.Get,
                UseGZipEncoding = true,
            };

            var layerDescription = _requestSender.SendRequest <LayerDescription>(
                featureLayerUrl.AbsoluteUri,
                query,
                options);

            return(layerDescription);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new instance of the <see cref="FeatureService"/> class with the specified
        /// url.
        /// </summary>
        /// <param name="serviceUrl">The URL of the feature service to be created.</param>
        /// <param name="server">The reference to the feature services server object.</param>
        /// <returns>A reference to the feature service object for the specified URL.</returns>
        /// <exception cref="System.ArgumentNullException"><paramref name="serviceUrl"/>
        /// argument is a null reference.</exception>
        public static IFeatureService Create(Uri serviceUrl, AgsServer server)
        {
            if (serviceUrl == null)
            {
                throw new ArgumentNullException("serviceUrl");
            }

            var requestSender = new FeatureServiceRequestSender(server);

            var serviceQueryUri = string.Format(SERVICE_QUERY_FORMAT, serviceUrl.AbsoluteUri);
            var options         = new HttpRequestOptions
            {
                Method          = HttpMethod.Get,
                UseGZipEncoding = true,
            };

            var request = new ESRI.ArcLogistics.Tracking.TrackingService.Requests.RequestBase();
            var query   = RestHelper.BuildQueryString(request, Enumerable.Empty <Type>(), true);

            var info = requestSender.SendRequest <ServiceInfo>(serviceQueryUri, query, options);

            return(new FeatureService(new Uri(serviceQueryUri), info, requestSender));
        }