示例#1
0
        protected RoadContribution(XmlElement e) : base("road", e.Attributes["id"].Value)
        {
            XmlNode nd = e.SelectSingleNode("style");

            if (nd == null)
            {
                style = RoadStyle.NullStyle;
            }
            else
            {
                MajorRoadType mt    = MajorRoadType.unknown;
                XmlAttribute  major = nd.Attributes["name"];
                if (major != null)
                {
                    mt = (MajorRoadType)Enum.Parse(mt.GetType(), major.Value, true);
                }
                SidewalkType st       = SidewalkType.none;
                XmlAttribute sidewalk = nd.Attributes["sidewalk"];
                if (sidewalk != null)
                {
                    st = (SidewalkType)Enum.Parse(st.GetType(), sidewalk.Value, true);
                }
                int          l     = 0;
                XmlAttribute lanes = nd.Attributes["lanes"];
                if (lanes != null)
                {
                    l = int.Parse(lanes.Value);
                }
                style = new RoadStyle(mt, st, l);
            }
        }
示例#2
0
        static private string ToStyleDescription(RoadStyle style)
        {
            string text = new string[] { "Undefined", "Path", "Street", "Highway" }[(int)style.Type];

            //! string text = new string[]{"未定義","小道","街路","高速道"}[(int)style.Type];
            if (style.Type == MajorRoadType.street || style.Type == MajorRoadType.highway)
            {
                if (style.CarLanes > 0)
                {
                    text = string.Format("{0}-lane {1}", style.CarLanes, text);
                }
                //! text = string.Format("{0}車線{1}",style.CarLanes,text);
                if (style.Sidewalk == SidewalkType.pavement)
                {
                    text = " with sidewalk" + text;
                }
                //! text = "歩道付き"+text;
            }
            return(text);
        }