public static CityDocument Open(string fileName)
        {
            CityDocument doc = new CityDocument();

            doc.FileName = fileName;
            doc.HasFile  = true;
            doc.Content  = CityDistrict.LoadCml(fileName);
            doc.Snapshot();
            return(doc);
        }
        public DisplayManager(CityDistrict cityModel, bool withoutFactors = false)
        {
            OptionsManager.Singleton.Load();

            _cityModel = new AnalysisDistrict(cityModel, withoutFactors);
            _pathModel = new TongJi.Network.PathFinder(_cityModel.Roads.Select(x => x.Alignment).ToList());

            _current = this;

            ColorMapper = new BiColorGradientMapper();
        }
        public AnalysisDistrict(CityDistrict source, bool withoutFactors = false)
        {
            Name        = source.Name;
            _properties = source.Properties;

            Extents   = source.Extents;
            BasePrice = source.BasePrice;

            Roads   = source.Roads;
            Parcels = source.Parcels;

            Factors = new List <IFactor>();
            //SetInitiate(new UniformInitiate(BasePrice));
            if (!withoutFactors)
            {
                CitySpots   = source.CitySpots;
                CityLinears = source.CityLinears;
                CityRegions = source.CityRegions;
                SetTurbulence();
            }
        }
Beispiel #4
0
        public static CityDistrict LoadCml(string path)
        {
            XDocument xd    = XDocument.Load(path);
            XElement  xcity = xd.Element("TongjiCity");

            XElement xroads   = xcity.Element("Roads");
            XElement xparcels = xcity.Element("Parcels");
            XElement xspots   = xcity.Element("CitySpots");
            XElement xlinears = xcity.ElementX("CityLinears"); // 向下兼容
            XElement xregions = xcity.ElementX("CityRegions");

            CityDistrict city = new CityDistrict();

            city.Extents = new Extent2D(xcity.AttValue("Extents"));

            xroads.Elements().ToList().ForEach(x => city.Roads.Add(new CityRoad(x)));
            xparcels.Elements().ToList().ForEach(x => city.Parcels.Add(new CityParcel(x)));
            xspots.Elements().ToList().ForEach(x => city.CitySpots.Add(new SpotEntity(x)));
            xlinears.Elements().ToList().ForEach(x => city.CityLinears.Add(new LinearEntity(x)));
            xregions.Elements().ToList().ForEach(x => city.CityRegions.Add(new RegionEntity(x)));

            return(city);
        }