Example #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);
            }
        }
Example #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="mt"></param>
 /// <param name="st"></param>
 /// <param name="lanes"></param>
 /// <param name="option"></param>
 public RoadStyle(MajorRoadType mt, SidewalkType st, int lanes, int option)
 {
     Type     = mt;
     Sidewalk = st;
     _lanes   = (byte)(lanes & 0xff);
     _option  = (byte)(option & 0xff);
 }