Пример #1
0
        /// <inheritdoc />
        public IObservable <int> Add(MapDataStorageType type, Element element, Stylesheet stylesheet, Range <int> levelOfDetails)
        {
            _trace.Debug(TraceCategory, "Add element to {0} storage", type.ToString());
            double[] coordinates = new double[element.Geometry.Length * 2];
            for (int i = 0; i < element.Geometry.Length; ++i)
            {
                coordinates[i * 2]     = element.Geometry[i].Latitude;
                coordinates[i * 2 + 1] = element.Geometry[i].Longitude;
            }

            string[] tags    = new string[element.Tags.Count * 2];
            var      tagKeys = element.Tags.Keys.ToArray();

            for (int i = 0; i < tagKeys.Length; ++i)
            {
                tags[i * 2]     = tagKeys[i];
                tags[i * 2 + 1] = element.Tags[tagKeys[i]];
            }

            var stylePath = RegisterStylesheet(stylesheet);

            lock (__lockObj)
            {
                addToStoreElement(GetStoreKey(type), stylePath, element.Id,
                                  coordinates, coordinates.Length,
                                  tags, tags.Length,
                                  levelOfDetails.Minimum, levelOfDetails.Maximum, OnErrorHandler);
            }
            return(Observable.Return <int>(100));
        }
Пример #2
0
        /// <inheritdoc />
        public IObservable <int> Add(MapDataStorageType type, string path, Stylesheet stylesheet, QuadKey quadKey)
        {
            var dataPath  = _pathResolver.Resolve(path);
            var stylePath = RegisterStylesheet(stylesheet);

            _trace.Debug(TraceCategory, "Add data from {0} to {1} storage", dataPath, type.ToString());
            lock (__lockObj)
            {
                addToStoreInQuadKey(GetStoreKey(type), stylePath, dataPath, quadKey.TileX, quadKey.TileY,
                                    quadKey.LevelOfDetail, OnErrorHandler);
            }
            return(Observable.Return <int>(100));
        }
Пример #3
0
        /// <inheritdoc />
        public IObservable <int> Add(MapDataStorageType type, string path, Stylesheet stylesheet, Range <int> levelOfDetails)
        {
            var dataPath  = _pathResolver.Resolve(path);
            var stylePath = _pathResolver.Resolve(stylesheet.Path);

            _trace.Debug(TraceCategory, "Add data from {0} to {1} storage", dataPath, type.ToString());
            lock (__lockObj)
            {
                addToStoreInRange(GetStoreKey(type), stylePath, dataPath, levelOfDetails.Minimum,
                                  levelOfDetails.Maximum, OnErrorHandler);
            }
            return(Observable.Return <int>(100));
        }