Пример #1
0
        //customLayers/{customLayersID}
        //returns json with simplified layerinfo (name, id, extent)
        private byte[] CustomLayer(NameValueCollection boundVariables, string outputFormat, string requestProperties, out string responseProperties)
        {
            responseProperties = "{\"Content-Type\" : \"application/json\"}";

            if (null == boundVariables["customLayersID"])
            {
                JsonObject obj = new JsonObject();

                // put collection code here
                CustomLayerInfo[] layerInfos = GetLayerInfos();

                JsonObject[] jos = new JsonObject[layerInfos.Length];

                for (int i = 0; i < layerInfos.Length; i++)
                {
                    jos[i] = layerInfos[i].ToJsonObject();
                }

                obj.AddArray("customLayers", jos);

                return(Encoding.UTF8.GetBytes(obj.ToJson()));
            }

            //layerID
            int layerID = Convert.ToInt32(boundVariables["customLayersID"]);

            //execute
            CustomLayerInfo layerInfo = GetLayerInfo(layerID);

            string json = layerInfo.ToJsonObject().ToJson();

            return(Encoding.UTF8.GetBytes(json));
        }
Пример #2
0
        private CustomLayerInfo[] GetLayerInfos()
        {
            int c = this.layerInfos.Count;

            CustomLayerInfo[] customLayerInfos = new CustomLayerInfo[c];

            for (int i = 0; i < c; i++)
            {
                IMapLayerInfo layerInfo = layerInfos.get_Element(i);
                customLayerInfos[i] = new CustomLayerInfo(layerInfo);
            }

            return(customLayerInfos);
        }
    private CustomLayerInfo[] GetLayerInfos()
    {
      int c = this.layerInfos.Count;

      CustomLayerInfo[] customLayerInfos = new CustomLayerInfo[c];

      for (int i = 0; i < c; i++)
      {
        IMapLayerInfo layerInfo = layerInfos.get_Element(i);
        customLayerInfos[i] = new CustomLayerInfo(layerInfo);
      }

      return customLayerInfos;
    }