Esempio n. 1
0
        public override string GetStepParameters()
        {
            var parameters = new List <string>();

            parameters.Add(GlobalId != null ? GlobalId.ToStepValue() : "$");
            parameters.Add(OwnerHistory != null ? OwnerHistory.ToStepValue() : "$");
            parameters.Add(Name != null ? Name.ToStepValue() : "$");
            parameters.Add(Description != null ? Description.ToStepValue() : "$");
            parameters.Add(ConnectionGeometry != null ? ConnectionGeometry.ToStepValue() : "$");
            parameters.Add(RelatingElement != null ? RelatingElement.ToStepValue() : "$");
            parameters.Add(RelatedElement != null ? RelatedElement.ToStepValue() : "$");

            return(string.Join(", ", parameters.ToArray()));
        }
        public override string GetStepParameters()
        {
            var parameters = new List <string>();

            parameters.Add(GlobalId != null ? GlobalId.ToStepValue() : "$");
            parameters.Add(OwnerHistory != null ? OwnerHistory.ToStepValue() : "$");
            parameters.Add(Name != null ? Name.ToStepValue() : "$");
            parameters.Add(Description != null ? Description.ToStepValue() : "$");
            parameters.Add(RelatingSpace != null ? RelatingSpace.ToStepValue() : "$");
            parameters.Add(RelatedBuildingElement != null ? RelatedBuildingElement.ToStepValue() : "$");
            parameters.Add(ConnectionGeometry != null ? ConnectionGeometry.ToStepValue() : "$");
            parameters.Add(PhysicalOrVirtualBoundary.ToStepValue());
            parameters.Add(InternalOrExternalBoundary.ToStepValue());
            parameters.Add(ParentBoundary != null ? ParentBoundary.ToStepValue() : "$");

            return(string.Join(", ", parameters.ToArray()));
        }
Esempio n. 3
0
        /// <summary>
        /// Builds road graph from map data
        /// </summary>
        /// <param name="map">OSMDB with preprocessed map data from OSM2Routing utility</param>
        public void Build(OSMDB map)
        {
            Dictionary<int, Node> usedNodes = new Dictionary<int, Node>();

            foreach (var segment in map.Ways) {
                Node start = GetOrCreateNode(segment.Nodes[0], usedNodes);
                try {
                    start.MapPoint = map.Nodes[segment.Nodes[0]];
                }
                catch (ArgumentException) {
                    continue; // If the start node was not found in the database, skip this path completely
                }

                Node end = GetOrCreateNode(segment.Nodes[segment.Nodes.Count - 1], usedNodes);
                try {
                    end.MapPoint = map.Nodes[segment.Nodes[segment.Nodes.Count - 1]];
                }
                catch (ArgumentException) {
                    continue; // If the end node was not found in the database, skip this path completely
                }

                double speed = double.Parse(segment.Tags["speed"].Value, System.Globalization.CultureInfo.InvariantCulture);
                int wayId = int.Parse(segment.Tags["way-id"].Value, System.Globalization.CultureInfo.InvariantCulture);

                ConnectionGeometry geometry = new ConnectionGeometry();
                geometry.WayID = wayId;
                foreach (var n in segment.Nodes) {
                    try {
                        OSMNode mapPoint = map.Nodes[n];
                        geometry.Nodes.Add(mapPoint);
                        //geometry.Nodes.Add(new PointGeo(mapPoint.Latitude, mapPoint.Longitude));
                    }
                    catch (ArgumentException) {
                    continue; // If an intermediate node was not found in the database, skip just that node
                    }
                }
                _connectionGeometries.Add(geometry);

                if (segment.Tags["accessible"].Value == "yes") {
                    Connection sc = new Connection(start, end) { Speed = speed, Geometry = geometry };
                    geometry.Connections.Add(sc);
                    _connections.Add(sc);
                }

                if (segment.Tags["accessible-reverse"].Value == "yes") {
                    Connection sc = new Connection(end, start) { Speed = speed, Geometry = geometry };
                    geometry.Connections.Add(sc);
                    _connections.Add(sc);
                }
            }
        }