private void Init(AxMapControl mc, int programID) { gp = new Geoprocessor(); mapControl = mc; UpdateMapLayerNameList(mapLayerNameList, mapControl); program = new Program(); program.id = programID; program.select(); project = new Project(); project.id = program.projectID; project.select(); netSize = program.getRelatedNetSize(); conditionList = program.getAllRelatedCondition(); baseFeature = GisUtil.GetBaseFeature(mapControl, project.baseMapIndex); mapFolder = System.IO.Path.GetDirectoryName(project.path); targetFolder = generateFolder(mapFolder); foreach (Condition condition in conditionList) { if (condition.type == C.CONFIG_TYPE_STANDARD) { totalStandardValue += condition.value; } } fishnetPolygonName = "polygon.shp"; fishnetName = "fishnet.shp"; fishnetWidth = netSize.width; fishnetHeight = netSize.height; featureList = new List<Feature>(); }
public void init(int programID, AxMapControl mc, Intersect.ProgramStepUserControl.OnFinish of, MainWindow mw) { inited = true; if (program == null) program = new Program(); program.id = programID; program.select(); if (project == null) project = new Project(); project.id = program.projectID; project.select(); NetSizeUserControl.init(program.id); ConditionUserControl.init(program.id); mapControl = mc; onFinish = of; mainWindow = mw; mapControlMouseDown = null; //在初始化时就要对valid进行判断. Thread t = new Thread(delegate() { System.Threading.Thread.Sleep(500); Dispatcher.BeginInvoke((ThreadStart)delegate() { if (isValid()) { valid = true; onFinish(true); IFeatureClass resultFeatureClass; if ((resultFeatureClass = GisUtil.getFeatureClass(System.IO.Path.GetDirectoryName(project.path), "评价结果.shp")) != null) { IFeatureLayer resultFeatureLayer = new FeatureLayerClass(); resultFeatureLayer.FeatureClass = resultFeatureClass; mapControl.AddLayer(resultFeatureLayer); } else { SiteSelector siteSelector = new SiteSelector(mapControl, program.id); siteSelector.startSelectSite(); } } }); }); t.Start(); }
private void CreateProjectButtonClick(object sender, RoutedEventArgs e) { if (createProjectWindow != null && createProjectWindow.isOpen()) return; createProjectWindow = new CreateProjectWindowWrapper(null, delegate(int id) { if (id == C.ERROR_INT) return; Project project = new Project(); project.id = id; project.select(); projectList.Add(project); }); createProjectWindow.show(); }
public MainWindowWrapper(int projectID) { project = new Project(); project.id = projectID; project.select(); Init(); mainWindow = new MainWindow(); mainWindow.createProgramButtonClickEventHandler += new EventHandler(delegate(object sender, EventArgs e) { createProgram(); }); mainWindow.programNameTextBlockMouseDownEventHandler += new MouseButtonEventHandler(delegate(object sender, MouseButtonEventArgs e) { if (e.ClickCount == 1) { TextBlock textBlock = sender as TextBlock; Grid grid = textBlock.Parent as Grid; StackPanel stackPanel = grid.Parent as StackPanel; programDetailMode(stackPanel); } else if (e.ClickCount == 2) { TextBlock textBlock = sender as TextBlock; Grid grid = textBlock.Parent as Grid; programNameInputMode(grid); } }); mainWindow.programNameButtonClickEventHandler += new EventHandler(delegate(object sender, EventArgs e) { Button button = sender as Button; Grid grid = button.Parent as Grid; grid = grid.Parent as Grid; programNameViewMode(grid); }); mainWindow.ProgramList.ItemsSource = programList; mainWindow.mapControl.OnMouseDown += mapControlMouseDown; }
public void init(int programID, AxMapControl mc, Intersect.ProgramStepUserControl.OnFinish of) { inited = true; if (program == null) program = new Program(); program.id = programID; program.select(); if (project == null) project = new Project(); project.id = program.projectID; project.select(); NetSizeUserControl.init(program.id); ConditionUserControl.init(program.id); mapControl = mc; onFinish = of; mapControlMouseDown = null; //在初始化时就要对valid进行判断. Thread t = new Thread(delegate() { System.Threading.Thread.Sleep(500); Dispatcher.BeginInvoke((ThreadStart)delegate() { if (isValid()) { valid = true; onFinish(true); SiteSelector siteSelector = new SiteSelector(mapControl, program.id); siteSelector.startSelectSite(); } }); }); t.Start(); }
private void DeleteButtonClick(object sender, MouseButtonEventArgs e) { Image image = sender as Image; StackPanel stackPanel = image.Parent as StackPanel; TextBlock textBlock = stackPanel.FindName("ProjectIDTextBlock") as TextBlock; int id = Int32.Parse(textBlock.Text); if (Ut.C("确认删除该项目?")) { Project project = new Project(); project.id = id; project.delete(); foreach (Project proj in projectList) { if (proj.id == id) { projectList.Remove(proj); break; } } Ut.M("删除成功"); } }
protected void Init() { project = new Project(); if (mapLayerNameList == null) mapLayerNameList = new ObservableCollection<string>(); else mapLayerNameList.Clear(); if (villageNameList == null) villageNameList = new ObservableCollection<string>(); else villageNameList.Clear(); if (completeLabelList == null) completeLabelList = new ObservableCollection<Label>(); else completeLabelList.Clear(); if (uncompleteLabelList == null) uncompleteLabelList = new ObservableCollection<Label>(); else uncompleteLabelList.Clear(); if (choosedLabelList == null) choosedLabelList = new ObservableCollection<Label>(); else choosedLabelList.Clear(); if (rasterLabelList == null) rasterLabelList = new ObservableCollection<Label>(); else rasterLabelList.Clear(); Ut.bind(project, "name", BindingMode.TwoWay, projectWindow.NameTextBox , TextBox.TextProperty, new List<ValidationRule>() { new StringValidationRule(Project.NAME_MAX_LENGTH) }, "baseBindingGroup"); Ut.bind(project, "path", BindingMode.TwoWay, projectWindow.PathTextBox , TextBox.TextProperty, new List<ValidationRule>() { new StringValidationRule() }, "baseBindingGroup"); Ut.bind(project, "baseMapIndex", BindingMode.TwoWay, projectWindow.BaseMapLayerComboBox , ComboBox.SelectedIndexProperty, new List<ValidationRule>() { new NotNegativeDoubleValidationRule("请选择基础图层") }, "baseBindingGroup"); }
public void init(int programID) { if (program == null) program = new Program(); program.id = programID; program.select(); if (project == null) project = new Project(); project.id = program.projectID; project.select(); ObservableCollection<Label> labelList; ObservableCollection<Condition> tempList; conditionList = new ObservableCollection<Condition>(); extraConditionList = new ObservableCollection<Condition>(); tempList = program.getAllRelatedCondition(); if (tempList.Count == 0) { //新建的方案, 没有条件. 把标签中使用的添加进去. labelList = project.getAllRelatedLabel(); foreach (Label label in labelList) { if (label.isChoosed) { Condition condition = new Condition(); condition.labelID = label.id; condition.programID = program.id; condition.saveWithoutCheck(); condition.id = Condition.GetLastConditionID(); conditionList.Add(condition); } } } else { foreach (Condition condition in tempList) { int labelID = condition.labelID; Label label = new Label(); label.id = labelID; label.select(); if (label.isChoosed) { conditionList.Add(condition); } else { labelList = project.getAllRelatedLabel(); foreach (Label l in labelList) { condition.labelList.Add(l); } extraConditionList.Add(condition); } } } ConditionListBox.ItemsSource = conditionList; ExtraConditionListBox.ItemsSource = extraConditionList; }
public static ObservableCollection<Project> GetAllProject() { ObservableCollection<Project> pamList = new ObservableCollection<Project>(); string sqlCommand = String.Format("select pID from Project"); Sql sql = new Sql(); SqlDataReader reader = sql.SelectAllProjectAndMap(sqlCommand); while (reader.Read()) { int pmID = Int32.Parse(reader[0].ToString()); Project pam = new Project(); pam.pID = pmID; pam.select(); pamList.Add(pam); } return pamList; }