예제 #1
0
        /// Operation DownloadMapData
        /// <summary>
        /// Gets the map data with the given ID.
        /// <p><strong>Implementation Notes</strong></p>
        /// <ul type="disc">
        /// <li>If mapDataCache is not null, and if mapDataCache has an entry for this mapId, return the MapData for that ID.</li>
        /// <li>Call retriever.DownloadMapData(mapId) to get the MapData.</li>
        /// <li>If mapDataCache is not null, add the retrieved MapData mapDataCache with the mapId as the key.</li>
        /// </ul>           /// </summary>
        /// <exception>MapIdNotFoundException If there is no MapData with the given ID</exception>
        /// <exception>MapDataSourceException If there were errors during this operation</exception>
        /// <param name='mapId'>The ID of the MapData to be retrieved</param>
        /// <returns>Retrieved MapData</returns>
        public MapData DownloadMapData(long mapId)
        {
            if ((mapDataCache != null) && mapDataCache.ContainsKey(mapId))
            {
                return((MapData)mapDataCache[mapId]);
            }
            MapData mapData = retriever.DownloadMapData(mapId);

            if (mapDataCache != null)
            {
                mapDataCache.Add(mapId, mapData);
            }
            return(mapData);
        }
예제 #2
0
        /// Operation DownloadElementTypes
        /// <summary>
        /// Gets all available MapElementTypes. Returns an empty list if none found. It will never return null or a list with null elements.
        /// <p><strong>Implementation Notes</strong></p>
        /// <ul type="disc">
        /// <li>If elementTypeCache is not null, and if elementTypeCache has an entry for &quot;elementTypes&quot;, return the IList of MapElementType for that key.</li>
        /// <li>Call retriever.DownloadElementTypes() to get the IList of MapElementType.</li>
        /// <li>If elementTypeCache is not null, add the retrieved IList of MapElementType to elementTypeCache with &quot;elementTypes&quot; as the key.</li>
        /// </ul>           /// </summary>
        /// <exception>MapDataSourceException If there were errors during this operation</exception>
        /// <returns>List of available MapElementTypes</returns>
        public IList <MapElementType> DownloadElementTypes()
        {
            if ((elementTypeCache != null) && elementTypeCache.ContainsKey("elementTypes"))
            {
                return((IList <MapElementType>)elementTypeCache["elementTypes"]);
            }
            IList <MapElementType> elementTypes = retriever.DownloadElementTypes();

            if (elementTypeCache != null)
            {
                elementTypeCache.Add("elementTypes", elementTypes);
            }

            return(elementTypes);
        }
예제 #3
0
        /// Operation DownloadStyles
        /// <summary>
        /// Gets all styles of the map data with the given ID. Returns an empty list if none found. It will never return null or a list with null elements.
        /// <p><strong>Implementation Notes</strong></p>
        /// <ul type="disc">
        /// <li>If styleCache is not null, and if styleCache has an entry for this mapId, return the IList of MapStyle for that ID.</li>
        /// <li>Call retriever.DownloadStyles(mapId) to get the IList of MapStyle.</li>
        /// <li>If styleCache is not null, add the retrieved IList of MapStyle to styleCache with the mapId as the key.</li>
        /// </ul>           /// </summary>
        /// <exception>MapIdNotFoundException If there is no MapData with the given ID</exception>
        /// <exception>MapDataSourceException If there were errors during this operation</exception>
        /// <param name='mapId'>The ID of the MapData whose styles are to be retrieved</param>
        /// <returns>List of MapStyles of the map data with the given ID</returns>
        public IList <MapStyle> DownloadStyles(long mapId)
        {
            if ((styleCache != null) && styleCache.ContainsKey(mapId))
            {
                return((IList <MapStyle>)styleCache[mapId]);
            }
            IList <MapStyle> styles = retriever.DownloadStyles(mapId);

            if (styleCache != null)
            {
                styleCache.Add(mapId, styles);
            }

            return(styles);
        }
예제 #4
0
        /// Operation DownloadAttributeTypes
        /// <summary>
        /// Gets all available MapAttributeTypes. Returns an empty list if none found. It will never return null or a list with null elements.
        /// <p><strong>Implementation Notes</strong></p>
        /// <ul type="disc">
        /// <li>If attributeTypeCache is not null, and if attributeTypeCache has an entry for &quot;attributeTypes&quot;, return the IList of MapAttributeType for that key.</li>
        /// <li>Call retriever.DownloadAttributeTypes() to get the IList of MapAttributeType.</li>
        /// <li>If attributeTypeCache is not null, add the retrieved IList of MapAttributeType to attributeTypeCache with &quot;attributeTypes&quot; as the key.</li>
        /// </ul>           /// </summary>
        /// <exception>MapDataSourceException If there were errors during this operation</exception>
        /// <returns>List of available MapAttributeTypes</returns>
        public IList <MapAttributeType> DownloadAttributeTypes()
        {
            if ((attributeTypeCache != null) && attributeTypeCache.ContainsKey("attributeTypes"))
            {
                return((IList <MapAttributeType>)attributeTypeCache["attributeTypes"]);
            }
            IList <MapAttributeType> attributeTypes = retriever.DownloadAttributeTypes();

            if (attributeTypeCache != null)
            {
                attributeTypeCache.Add("attributeTypes", attributeTypes);
            }

            return(attributeTypes);
        }
예제 #5
0
        public bool DestroyCacheInstance(string regName)
        {
            if (string.IsNullOrEmpty(regName))
            {
                return(false);
            }

            if (fCache == null)
            {
                return(false);
            }

            SimpleCache cache = (SimpleCache)Cache;

            if (cache.ContainsKey(regName, null))
            {
                cache.Remove(regName);
                return(true);
            }

            return(false);
        }