Exemplo n.º 1
0
        /// <summary>
        /// Retrieves collection of feature records for the specified where clause.
        /// </summary>
        /// <param name="whereClause">The where clause specifying objects to be retrieved.</param>
        /// <param name="returnFields">The reference to the collection of field names to
        /// retrieve values for. A wildcard value '*' could be used to retrieve all fields.</param>
        /// <param name="geometryReturningPolicy">A value indicating whether to retrieve feature
        /// geometry.</param>
        /// <returns>A collection of feature records satisfying the specified where clause and with
        /// specified fields filled with values retrieved from feature service.</returns>
        /// <exception cref="System.ArgumentNullException"><paramref name="whereClause"/>,
        /// <paramref name="returnFields"/> or any element in the <paramref name="returnFields"/>
        /// is a null reference.</exception>
        /// <exception cref="System.ArgumentException"><paramref name="geometryReturningPolicy"/>
        /// does not contain either <see cref="GeometryReturningPolicy.WithGeometry"/>
        /// or <see cref="GeometryReturningPolicy.WithoutGeometry"/>.</exception>
        /// <exception cref="ESRI.ArcLogistics.Routing.RestException">error was
        /// returned by the REST API.</exception>
        /// <exception cref="ESRI.ArcLogistics.CommunicationException">failed
        /// to communicate with the REST service.</exception>
        public IEnumerable <TFeatureRecord> QueryData(
            string whereClause,
            IEnumerable <string> returnFields,
            GeometryReturningPolicy geometryReturningPolicy)
        {
            if (whereClause == null)
            {
                throw new ArgumentNullException("whereClause");
            }

            if (returnFields == null || returnFields.Any(field => field == null))
            {
                throw new ArgumentNullException("returnFields");
            }

            var request = new QueryRequest
            {
                WhereClause    = whereClause,
                ReturnFields   = string.Join(",", returnFields),
                ReturnIDsOnly  = false,
                ReturnGeometry = geometryReturningPolicy == GeometryReturningPolicy.WithGeometry,
            };

            return(_QueryData(request));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Retrieves collection of feature records for the specified object IDs.
        /// </summary>
        /// <param name="objectIDs">The reference to the collection of object IDs of feature
        /// records to retrieve.</param>
        /// <param name="returnFields">The reference to the collection of field names to
        /// retrieve values for. A wildcard value '*' could be used to retrieve all fields.</param>
        /// <param name="geometryReturningPolicy">A value indicating whether to retrieve feature
        /// geometry.</param>
        /// <returns>A collection of feature records with the specified object IDs and with
        /// specified fields filled with values retrieved from feature service.</returns>
        /// <exception cref="System.ArgumentNullException"><paramref name="objectIDs"/>,
        /// <paramref name="returnFields"/> or any element in the <paramref name="returnFields"/>
        /// is a null reference.</exception>
        /// <exception cref="System.ArgumentException"><paramref name="geometryReturningPolicy"/>
        /// does not contain either <see cref="GeometryReturningPolicy.WithGeometry"/>
        /// or <see cref="GeometryReturningPolicy.WithoutGeometry"/>.</exception>
        /// <exception cref="ESRI.ArcLogistics.Tracking.TrackingService.TrackingServiceException">
        /// Failed to query data from the feature layer.</exception>
        /// <exception cref="ESRI.ArcLogistics.CommunicationException">failed
        /// to communicate with the REST service.</exception>
        public IEnumerable <TFeatureRecord> QueryData(
            IEnumerable <long> objectIDs,
            IEnumerable <string> returnFields,
            GeometryReturningPolicy geometryReturningPolicy)
        {
            if (objectIDs == null)
            {
                throw new ArgumentNullException("objectIDs");
            }

            if (returnFields == null || returnFields.Any(field => field == null))
            {
                throw new ArgumentNullException("returnFields");
            }

            if (!objectIDs.Any())
            {
                return(Enumerable.Empty <TFeatureRecord>());
            }

            var request = new QueryRequest
            {
                ObjectIDs      = string.Join(",", objectIDs),
                ReturnFields   = string.Join(",", returnFields),
                ReturnIDsOnly  = false,
                ReturnGeometry = geometryReturningPolicy == GeometryReturningPolicy.WithGeometry,
            };

            return(_QueryData(request));
        }