/// <summary> Ensures that the corresponding element source is loaded. </summary> private void EnsureElementSource(Vector2d point) { var boundingBox = _tileController.GetTile(point).BoundingBox; var elementSource = _elementSourceProvider.Get(boundingBox) .SingleOrDefault(e => !e.IsReadOnly).Wait(); // create in memory element source if (elementSource == null) { // NOTE use bounding box which fits whole world var indexBuilder = new InMemoryIndexBuilder(new BoundingBox( new GeoCoordinate(-90, -180), new GeoCoordinate(90, 180)), IndexSettings.CreateDefault(), _objectPool, Trace); indexBuilder.Build(); elementSource = new ElementSource(indexBuilder) { IsReadOnly = false }; _elementSourceProvider.Add(elementSource); } CommitIfNecessary(elementSource); _currentElementSource = elementSource; _elementSourceEditor.ElementSource = _currentElementSource; }
internal void RegisterThisCandidate(ElementSource source) { if (_thisCandidates == null) { _thisCandidates = new HashSet <ElementSource>(); } _thisCandidates.Add(source); }
public void Setup() { var boundingBox = new BoundingBox(new GeoCoordinate(52.0, 13.0), new GeoCoordinate(52.2, 13.2)); var keyValueStream = new MemoryStream(new byte[256]); keyValueStream.WriteByte(4); keyValueStream.WriteByte(7); var kvIndex = new KeyValueIndex(100, 3); var kvUsage = new KeyValueUsage(new MemoryStream(1000)); var kvStore = new KeyValueStore(kvIndex, kvUsage, keyValueStream); var elementStoreStream = new MemoryStream(new byte[10000]); var elementStore = new ElementStore(kvStore, elementStoreStream, TestHelper.GetObjectPool()); var tree = new RTree <uint>(); var node = new Node() { Id = 1, Coordinate = new GeoCoordinate(52.0, 13.0), Tags = new Dictionary <string, string>() { { "key1", "value1" }, { "key2", "value2" } }.ToTags() }; var nodeOffset = elementStore.Insert(node); tree.Insert(nodeOffset, new PointEnvelop(node.Coordinate)); var way = new Way() { Id = 2, Coordinates = new List <GeoCoordinate>() { new GeoCoordinate(52.1, 13.1), new GeoCoordinate(52.2, 13.2) }, Tags = new Dictionary <string, string>() { { "key1", "value1" }, { "key2", "value2" } }.ToTags() }; var wayOffset = elementStore.Insert(way); tree.Insert(wayOffset, new Envelop(way.Coordinates.First(), way.Coordinates.Last())); _source = new ElementSource(boundingBox, kvUsage, kvIndex, kvStore, elementStore, tree); }
/// <summary> /// 创建 <see cref="ImageBase"/> 实例 /// </summary> /// <param name="str">指定 <see cref="ImageBase"/> 实例的字符串(可为 ID、字符串形式的 URI、相对文件路径)</param> /// <param name="source">指定 <see cref="ImageBase"/> 实例的来源</param> public ImageBase(string str, ElementSource source) { switch (source) { case ElementSource.Id: Id = str; break; case ElementSource.Uri: Uri = new Uri(str); break; case ElementSource.File: FilePath = str; break; default: throw new ArgumentOutOfRangeException(nameof(str)); } }
public static string ToDisplayString(this ElementSource @this) { return(Sources.IdToDisplayString(@this.Id)); }
internal void RegisterThisCandidate(ElementSource source) { if (_thisCandidates == null) _thisCandidates = new HashSet<ElementSource>(); _thisCandidates.Add(source); }
/// <summary> /// 创建 <see cref="FlashImage"/> 实例 /// </summary> /// <param name="str">指定 <see cref="FlashImage"/> 实例的字符串(可为 ID、字符串形式的 URI、相对文件路径)</param> /// <param name="source">指定 <see cref="FlashImage"/> 实例的来源</param> public FlashImage(string str, ElementSource source) : base(str, source) { }