protected virtual void DispatchResource(Earthquake quake, string incidentData, string facilityData, string outputFolder) { _dispatcher = new Dispatcher(); _dispatcher.OutputFolder = outputFolder; if (_dispatcher.Setup(quake, facilityData, incidentData)) { RefugeeSiteCol siteCol = GetSiteCol(); _dispatcher.SetReportName(siteCol); RepositoryCol repoCol = GetRepoCol(); SupplyNetwork supplyNetwork = new SupplyNetwork(); supplyNetwork.SetLocations(siteCol, repoCol, _dispatcher.RoadNetwork); supplyNetwork.Init(_dispatcher.GetRoutesClass()); foreach (var site in siteCol.Sites) { supplyNetwork.SupplyResource(site); } _dispatcher.StoreResult(supplyNetwork.Routes, repoCol, siteCol); this.DialogResult = System.Windows.Forms.DialogResult.OK; } else { this.DialogResult = System.Windows.Forms.DialogResult.Cancel; } }
protected override void DispatchResource(Earthquake quake, string incidentData, string facilityData, string outputFolder) { _dispatcher = new Dispatcher(); _dispatcher.OutputFolder = outputFolder; if (_dispatcher.Setup(quake, facilityData, incidentData)) { _dispatcher.SetReportName("燃气抢修组"); //RefugeeSiteCol siteCol = GetSiteCol(); //RepositoryCol repoCol = GetRepoCol(); SupplyNetwork supplyNetwork = new SupplyNetwork(); supplyNetwork.Init(_dispatcher.GetRoutesClass()); //车 RepositoryCol repoCol = new RepositoryCol(); repoCol.Setup(_dispatcher.RepoFeatureClass, RepositoryCol.GasCarField); RefugeeSiteGasCarCol siteCol = new RefugeeSiteGasCarCol(); siteCol.Setup(_dispatcher); supplyNetwork.SetLocations(siteCol, repoCol, _dispatcher.RoadNetwork); foreach (var site in siteCol.Sites) { supplyNetwork.SupplyResource(site); } //人 repoCol = new RepositoryCol(); repoCol.Setup(_dispatcher.RepoFeatureClass, RepositoryCol.GasManField); RefugeeSiteGasManCol siteManCol = new RefugeeSiteGasManCol(); siteManCol.Setup(_dispatcher); supplyNetwork.SetLocations(siteManCol, repoCol, _dispatcher.RoadNetwork); try { foreach (var site in siteCol.Sites) { supplyNetwork.SupplyResource(site); } } catch (Exception ex) { } _dispatcher.StoreResult(supplyNetwork.Routes, repoCol, siteCol); this.DialogResult = System.Windows.Forms.DialogResult.OK; } else { this.DialogResult = System.Windows.Forms.DialogResult.Cancel; } }
internal bool Setup(Earthquake quake, string facilityData, string incidentData) { string networkWorkspace = System.IO.Path.Combine(Application.StartupPath, @"AnalystData\road");// @"F:\17\private\Disaster\Data\road"; string networkClassName = "road_ND"; #if DEBUG networkClassName = "road_two_regions_ND"; #endif string analystDataPath = System.IO.Path.Combine(Application.StartupPath, "AnalystData");// @"F:\17\private\Disaster\Data\EarthquakeData"; string regionClassName = "地区系数"; string seasonClassName = "季节系数"; Earthquake = quake; if (!SetupOutputDirectory()) { System.Windows.Forms.MessageBox.Show("初始化输出目录失败"); return(false); } IFeatureWorkspace ws = WorkspaceUtil.OpenShapeWorkspace(analystDataPath); _region = GetRegionCoefficient(ws, regionClassName); _season = GetSeasonCoefficient(ws, seasonClassName); _incidentWorkspace = System.IO.Path.GetDirectoryName(incidentData); _incidentClassName = System.IO.Path.GetFileNameWithoutExtension(incidentData); ws = WorkspaceUtil.OpenShapeWorkspace(_incidentWorkspace); _siteFeatureClass = ws.OpenFeatureClass(_incidentClassName); // _refugeSiteCol = GetRefugeeSiteCol(ws, _incidentClassName); _repoWorkspace = System.IO.Path.GetDirectoryName(facilityData); _facilityClassName = System.IO.Path.GetFileNameWithoutExtension(facilityData); ws = WorkspaceUtil.OpenShapeWorkspace(_repoWorkspace); _repoFeatureClass = ws.OpenFeatureClass(_facilityClassName); // _repositoryCol = GetRepositoryCol(ws, _facilityClassName); _roadNetwork = GetRoadNetwork(networkWorkspace, networkClassName); // _supplyNetwork = GetSupplyNetwork(); return(true); }
private void Dispatch() { try { Earthquake quake = new Earthquake() { DateTime = dtEarthquakeDate.Value, Name = txtEarthquakeName.Text }; string incidentData = txtIncidentLoc.Text; string facilityData = txtFacilityLoc.Text; string outputFolder = txtOutputFolder.Text; DispatchResource(quake, incidentData, facilityData, outputFolder); } catch (Exception ex) { LogHelper.Error(ex); this.DialogResult = System.Windows.Forms.DialogResult.Cancel; } }