public void CountRoads(bool on)
 {
     if (on)
     {
         Roads.ForEach(r => Factors.Add(r));
     }
     else
     {
         Roads.ForEach(r => Factors.Remove(r));
     }
 }
Exemple #2
0
        public void SaveCml(string path)
        {
            XElement xroads   = new XElement("Roads");
            XElement xparcels = new XElement("Parcels");
            XElement xspots   = new XElement("CitySpots");
            XElement xlinears = new XElement("CityLinears");
            XElement xregions = new XElement("CityRegions");

            XElement xe = new XElement("TongjiCity", xroads, xparcels, xspots, xlinears, xregions);

            xe.Add(new XAttribute("Extents", Extents.ToString()));
            xe.Add(new XAttribute("CmlVersion", CurrentCmlVersion));

            Roads.ForEach(x => xroads.Add(x.ToXElement()));
            Parcels.ForEach(x => xparcels.Add(x.ToXElement()));
            CitySpots.ForEach(x => xspots.Add(x.ToXElement()));
            CityLinears.ForEach(x => xlinears.Add(x.ToXElement()));
            CityRegions.ForEach(x => xregions.Add(x.ToXElement()));

            xe.Save(path);
        }
Exemple #3
0
        private void RemoveOffsets()
        {
            using (var acTrans = TransactionFactory.CreateFromNew())
            {
                foreach (ObjectId obj in JunctionOffsetCollection.Collection)
                {
                    if (!obj.IsErased)
                    {
                        acTrans.GetObject(obj, OpenMode.ForWrite, true).Erase();
                    }
                }

                JunctionOffsetCollection.Clear();

                if (Roads != null && Roads.Count > 0)
                {
                    Roads.ForEach(r => r.Reset());
                }
                acTrans.Commit();
            }
        }
Exemple #4
0
        public override void ActivateObjects()
        {
            //TODO: Needs reviewing...
            if (_finalized)
            {
                return;
            }

            Roads.ForEach(delegate(Road road)
            {
                var centreLines = road.CentreLines.ToList();
                centreLines.ForEach(c => c.CreateActiveObject());
            }
                          );

            if (ValidateRoads())
            {
                Junctions = BuildJunctionsFromRoads(Roads);
            }
            else
            {
                FinalizeLayout();
            }
        }