/// <summary> /// Builds the scene. /// </summary> /// <param name="map"></param> /// <param name="zoomFactor"></param> /// <param name="center"></param> /// <param name="view"></param> private void BuildScene(Map map, float zoomFactor, GeoCoordinate center, View2D view) { // get the indexed object at this zoom. HashSet <ArcId> interpretedObjects; if (!_interpretedObjects.TryGetValue((int)zoomFactor, out interpretedObjects)) { interpretedObjects = new HashSet <ArcId>(); _interpretedObjects.Add((int)zoomFactor, interpretedObjects); } // build the boundingbox. var viewBox = view.OuterBox; var box = new GeoCoordinateBox(map.Projection.ToGeoCoordinates(viewBox.Min[0], viewBox.Min[1]), map.Projection.ToGeoCoordinates(viewBox.Max[0], viewBox.Max[1])); foreach (var requestedBox in _requestedBoxes) { if (requestedBox.Contains(box)) { return; } } _requestedBoxes.Add(box); //// set the scene backcolor. //SimpleColor? color = _styleInterpreter.GetCanvasColor (); //_scene.BackColor = color.HasValue // ? color.Value.Value // : SimpleColor.FromArgb (0, 255, 255, 255).Value; // get data. foreach (var arc in _dataSource.GetEdges(box)) { // translate each object into scene object. var arcId = new ArcId() { Vertex1 = arc.Key, Vertex2 = arc.Value.Key }; if (!interpretedObjects.Contains(arcId)) { interpretedObjects.Add(arcId); // create nodes. float latitude, longitude; _dataSource.GetVertex(arcId.Vertex1, out latitude, out longitude); var node1 = new Node(); node1.Id = arcId.Vertex1; node1.Latitude = latitude; node1.Longitude = longitude; _dataSource.GetVertex(arcId.Vertex2, out latitude, out longitude); var node2 = new Node(); node2.Id = arcId.Vertex2; node2.Latitude = latitude; node2.Longitude = longitude; // create way. var way = CompleteWay.Create(-1); if (arc.Value.Value.Forward) { way.Nodes.Add(node1); way.Nodes.Add(node2); } else { way.Nodes.Add(node2); way.Nodes.Add(node1); } way.Tags.AddOrReplace(_dataSource.TagsIndex.Get(arc.Value.Value.Tags)); _styleInterpreter.Translate(_scene, map.Projection, way); interpretedObjects.Add(arcId); } } }
/// <summary> /// Adds a new node. /// </summary> /// <param name="node"></param> public override void AddNode(CompleteNode node) { _mapCSSInterpreter.Translate(_scene, _projection, node); }
/// <summary> /// Adds a new node. /// </summary> /// <param name="node"></param> public override void AddNode(Node node) { _styleInterpreter.Translate(_scene, _projection, node); }