public void init(int programID, AxMapControl mc, AxToolbarControl tc, MainWindow mw)
        {
            inited = true;

            program = new Program();
            program.id = programID;
            program.select();

            mapControl = mc;
            toolbarControl = tc;
            mainWindow = mw;
            mainRoadList = program.getAllRelatedMainRoad();
            if (mainRoadList == null)
                mainRoadList = new ObservableCollection<MainRoad>();

            foreach (MainRoad mainRoad in mainRoadList)
            {
                GisUtil.DrawPolylineElement(mainRoad.lineElement, mapControl);   
            }

            valid = isValid();
            dirty = false;

            mapControlMouseDown = null;
            MainRoadListBox.ItemsSource = mainRoadList;
        }
예제 #2
0
        public void init(int programID, AxMapControl mc, AxToolbarControl tc, MainWindow mw)
        {
            inited = true;

            program = new Program();
            program.id = programID;
            program.select();

            mapControl = mc;
            toolbarControl = tc;
            mainWindow = mw;

            OnFinish configUserControlOnFinish = delegate(bool finish)
            {
                TabItem configTabItem = ProgramTabControl.FindName("ConfigTabItem") as TabItem;
                Grid grid = configTabItem.Header as Grid;
                TextBlock textBlock = grid.Children[0] as TextBlock;
                if(finish)
                {
                    textBlock.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#7CFC00"));                    
                }
                else
                {
                    textBlock.Foreground = new SolidColorBrush(Colors.Black);                                        
                }
            };
            ConfigUserControl.init(programID, mapControl, configUserControlOnFinish, mainWindow);

            OnFinish siteSelectorUserControlOnFinish = delegate(bool finish)
            {
                TabItem configTabItem = ProgramTabControl.FindName("SiteSelectorTabItem") as TabItem;
                Grid grid = configTabItem.Header as Grid;
                TextBlock textBlock = grid.Children[0] as TextBlock;
                if (finish)
                {
                    textBlock.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#7CFC00"));
                }
                else
                {
                    textBlock.Foreground = new SolidColorBrush(Colors.Black);
                }
            };
            SiteSelectorUserControl.init(programID, siteSelectorUserControlOnFinish, mapControl, toolbarControl, mainWindow);
            OnFinish housePlacerUserControl = delegate(bool finish)
            {
                TabItem housePlacerTabItem = ProgramTabControl.FindName("HousePlacerTabItem") as TabItem;
                Grid grid = housePlacerTabItem.Header as Grid;
                TextBlock textBlock = grid.Children[0] as TextBlock;
                if (finish)
                {
                    textBlock.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#7CFC00"));
                }
                else
                {
                    textBlock.Foreground = new SolidColorBrush(Colors.Black);
                }
            };
            HousePlacerUserControl.init(programID, mapControl, housePlacerUserControl, mainWindow);
        }
        public void init(int programID, AxMapControl mc, AxToolbarControl tc, Intersect.ProgramStepUserControl.OnFinish of, MainWindow mw)
        {
            inited = true;

            villageColorRandomer = new VillageColorRandomer();
            program = new Program();
            program.id = programID;
            program.select();
            villageList = program.getAllRelatedVillage();
            if (villageList == null)
            {
                villageList = new ObservableCollection<Village>();
            }
            else
            {
                foreach (Village village in villageList)
                {
                    village.polygonElementColorString = villageColorRandomer.randomColor();
                    InnerRoad innerRoad = village.getRelatedInnerRoad();
                    village.innerRoad = innerRoad;
                }
            }

            mapControl = mc;
            toolbarControl = tc;
            mainWindow = mw;
            foreach (Village village in villageList)
            {
                GisUtil.drawPolygonElement(village.polygonElement, mapControl);
                GisUtil.UpdatePolygonElementColor(village.polygonElement, mapControl
                    , VillageColorRandomer.GetRedFromColorString(village.polygonElementColorString)
                    , VillageColorRandomer.GetGreenFromColorString(village.polygonElementColorString)
                    , VillageColorRandomer.GetBlueFromColorString(village.polygonElementColorString));
                if (village.innerRoad.lineElement != null)
                    GisUtil.DrawPolylineElement(village.innerRoad.lineElement, mapControl);
                if (village.inUse)
                {
                    string reverseColorString = VillageColorRandomer.GetReverseVillageColorString(village.polygonElementColorString);
                    GisUtil.UpdatePolygonElementOutline(village.polygonElement, mapControl
                        , VillageColorRandomer.GetRedFromColorString(reverseColorString)
                        , VillageColorRandomer.GetGreenFromColorString(reverseColorString)
                        , VillageColorRandomer.GetBlueFromColorString(reverseColorString));
                }
            }

            valid = isValid();
            dirty = false;

            onFinish = of;

            mapControlMouseDown = null;
            VillageListBox.ItemsSource = villageList;
        }
예제 #4
0
        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();
        }
        public void init(int programID, AxMapControl mc, AxToolbarControl tc, MainWindow mw)
        {
            if (inited)
                return;
            inited = true;

            program = new Program();
            program.id = programID;
            program.select();

            mapControl = mc;
            toolbarControl = tc;
            mainWindow = mw;

            innerRoadList = program.getAllRelatedInnerRoad();
            if (innerRoadList == null)
            {
                innerRoadList = new ObservableCollection<InnerRoad>();
                ObservableCollection<Village> villageList = program.getAllRelatedVillage();
                foreach (Village village in villageList)
                {
                    if (village.inUse)
                    {
                        InnerRoad innerRoad = new InnerRoad();
                        innerRoad.programID = program.id;
                        innerRoad.villageID = village.id;
                        innerRoadList.Add(innerRoad);
                    }
                }
            }
            else
            {
                foreach (InnerRoad innerRoad in innerRoadList)
                {
                    GisUtil.DrawPolylineElement(innerRoad.lineElement, mapControl);
                }
            }

            valid = isValid();
            dirty = false;

            mapControlMouseDown = null;
            InnerRoadListBox.ItemsSource = innerRoadList;
        }
예제 #6
0
        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, Intersect.ProgramStepUserControl.OnFinish of, AxMapControl mc, AxToolbarControl tc, MainWindow mainWindow)
        {
            inited = true;
            onFinish = of;

            Pager.nowStep = 1;
            Pager.totalStep = 2;
            Pager.update();

            Pager.nextStepButtonCheck = nextStepCheckValid;
            Pager.nextStepButtonClick += new EventHandler(nextStepClick);
            Pager.previewStepButtonClick += new EventHandler(previewStepClick);

            mapControl = mc;
            toolbarControl = tc;
            mapControlMouseDown = onMapControlMouseDown;
            SelectMainRoadUserControl.init(programID, mapControl, toolbarControl, mainWindow);
            SelectVillageUserControl.init(programID, mapControl, toolbarControl, of, mainWindow);

            Thread t = new Thread(delegate()
            {
                System.Threading.Thread.Sleep(500);
                Dispatcher.BeginInvoke((ThreadStart)delegate()
                {
                    if (isValid())
                    {
                        onFinish(true);
                    }
                });
            });
            t.Start();
        }
예제 #8
0
        public void init(int programID, AxMapControl mc, Intersect.ProgramStepUserControl.OnFinish of, MainWindow mw)
        {
            inited = true;
            onFinish = of;

            program = new Program();
            program.id = programID;
            program.select();

            housePlacerIndexCount = 0;

            villageList = program.getAllRelatedVillage();
            if (villageList == null)
            {
                villageList = new ObservableCollection<Village>();
            }
            else
            {
                ObservableCollection<Village> inUseVillageList = new ObservableCollection<Village>();
                foreach (Village village in villageList)
                {
                    if (village.inUse)
                    {
                        inUseVillageList.Add(village);
                        CommonHouse commonHouse = village.getRelatedCommonHouse();
                        if (commonHouse == null)
                        {
                            commonHouse = CommonHouse.GetDefaultCommonHouse();
                            commonHouse.villageID = village.id;
                        }
                        village.commonHouse = commonHouse;
                        ObservableCollection<House> houseList = village.getAllRelatedHouse();
                        if (houseList == null)
                            houseList = new ObservableCollection<House>();
                        else
                        {
                            foreach (House house in houseList)
                            {
                                house.housePlacerListIndex = housePlacerIndexCount++;
                            }
                        }
                        village.houseList = houseList;
                        village.innerRoad = village.getRelatedInnerRoad();
                    }
                }
                villageList = inUseVillageList;
            }

            mapControl = mc;
            mainWindow = mw;

            dirty = false;
            prePlaced = false;

            mapControlMouseDown = null;
            HousePlacerListBox.ItemsSource = villageList;

            Thread t = new Thread(delegate()
            {
                System.Threading.Thread.Sleep(500);
                Dispatcher.BeginInvoke((ThreadStart)delegate()
                {
                    if (isValid())
                    {
                        valid = true;
                        onFinish(true);
                    }
                });
            });
            t.Start();
        }