コード例 #1
0
        /**
         *
         */
        private BuildingObject GetCoordinatesById(XmlNodeList nodeTags, List <long> nodeTagIds, XmlNode wayTag, float buildingHeight)
        {
            if (buildingHeight == DefaultBuildingHeight)
            {
                buildingHeight = 1;
            }

            //ids for coordinate pairing from way tag
            var locationIDs     = LoaderUtils.GetWayTagIDs(wayTag);
            var latLngObjects   = new LatLngObject[locationIDs.Count];
            var numOfFoundedIDs = 0;

            for (var k = 0; k < nodeTags.Count; k++)
            {
                //cached id from node tag
                var id = nodeTagIds[k];
                int locationIndex;
                if ((locationIndex = locationIDs.IndexOf(id)) != -1)
                {
                    var nodeTag = nodeTags[k];
                    var lat     = float.Parse(nodeTag.Attributes["lat"].Value);
                    var lon     = float.Parse(nodeTag.Attributes["lon"].Value);
                    latLngObjects[locationIndex] = new LatLngObject(lat, lon);
                    ++numOfFoundedIDs;
                }

                //pokud všechny souřadnice byly spárovány s IDčkama od budovy
                if (locationIDs.Count == numOfFoundedIDs)
                {
                    break;
                }
            }

            return(new BuildingObject(latLngObjects.ToList(), buildingHeight));
        }
コード例 #2
0
        /**
         *
         */
        private RoadObject GetCoordinatesById(XmlNodeList nodeTags, List <long> nodeTagIds, XmlNode wayTag, int vehicleType, int roadType)
        {
            //ids for coordinate pairing from way tag
            var locationIDs     = LoaderUtils.GetWayTagIDs(wayTag);
            var latLngObjects   = new LatLngObject[locationIDs.Count];
            var numOfFoundedIDs = 0;

            for (var k = 0; k < nodeTags.Count; k++)
            {
                //cached id from node tag
                var id = nodeTagIds[k];
                int locationIndex;
                if ((locationIndex = locationIDs.IndexOf(id)) != -1)
                {
                    var nodeTag = nodeTags[k];
                    var lat     = float.Parse(nodeTag.Attributes["lat"].Value);
                    var lon     = float.Parse(nodeTag.Attributes["lon"].Value);
                    latLngObjects[locationIndex] = new LatLngObject(lat, lon);
                    ++numOfFoundedIDs;
                }

                //pokud všechny souřadnice byly spárovány s IDčkama od budovy
                if (locationIDs.Count == numOfFoundedIDs)
                {
                    break;
                }
            }

            var roadObject = new RoadObject
            {
                LatLngCoordinates = latLngObjects.ToList(),
                RoadType          = roadType,
                VehicleType       = vehicleType
            };

            return(roadObject);
        }