コード例 #1
0
 private void EditPoint(object sender, RoutedEventArgs e)
 {
     if (GraphicsLayer != null)
     {
         if (m_graphics != null)
         {
             GraphicsLayer.RemoveGraphics(m_graphics);
             m_graphics = null;
         }
         CLayerGetByID getGeo = new CLayerGetByID();
         getGeo.GdbIndex   = ActiveLayerObj.ActiveGdbIndex;
         getGeo.LayerIndex = ActiveLayerObj.ActiveLayerIndex;
         getGeo.FeatureID  = m_featureID;
         ActiveLayerObj.GetGeomByFID(getGeo, new UploadStringCompletedEventHandler(DrawFeature));
     }
 }
コード例 #2
0
        private void setFeature(object sender, UploadStringCompletedEventArgs e)
        {
            CLayerSelectAndGetAtt obj = this.IMSCatalog.ActiveLayerObj.OnLayerSelectAndGetAtt(e);

            if (obj == null)
            {
                MessageBox.Show("未获取到要素");
                this.m_graphicsLayer.DrawingType         = DrawingType.Point;
                this.m_graphicsLayer.DrawingOverCallback = new DrawingEventHandler(Drawpoint_callback);
                return;
            }
            CAttDataTable curRltTable = obj.AttDS[this.IMSCatalog.ActiveLayerObj.ActiveGdbIndex].attTables[this.IMSCatalog.ActiveLayerObj.ActiveLayerIndex];

            if (obj.AttDS[this.IMSCatalog.ActiveLayerObj.ActiveGdbIndex].attTables[this.IMSCatalog.ActiveLayerObj.ActiveLayerIndex] != null)
            {
                CAttDataRow[] curRltRows = obj.AttDS[this.IMSCatalog.ActiveLayerObj.ActiveGdbIndex].attTables[this.IMSCatalog.ActiveLayerObj.ActiveLayerIndex].Rows;
                if (curRltRows == null)
                {
                    MessageBox.Show("未获取到要素");
                    this.m_graphicsLayer.DrawingType         = DrawingType.Point;
                    this.m_graphicsLayer.DrawingOverCallback = new DrawingEventHandler(Drawpoint_callback);
                    return;
                }
                CAttDataRow   row    = curRltTable.Rows[0] as CAttDataRow;
                CLayerGetByID getGeo = new CLayerGetByID();
                getGeo.FeatureID  = row.FID;
                getGeo.GdbIndex   = this.IMSCatalog.ActiveLayerObj.ActiveGdbIndex;
                getGeo.LayerIndex = this.IMSCatalog.ActiveLayerObj.ActiveLayerIndex;
                this.IMSCatalog.ActiveLayerObj.GetGeomByFID(getGeo, flashFeature);
            }
            else
            {
                MessageBox.Show("未获取到要素");
                this.m_graphicsLayer.DrawingType         = DrawingType.Point;
                this.m_graphicsLayer.DrawingOverCallback = new DrawingEventHandler(Drawpoint_callback);
            }
        }
コード例 #3
0
        /// <summary>
        /// 删除回调
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ContextMenuClick_Del(object sender, RoutedEventArgs e)
        {
            if (m_catalog.ActiveLayerObj.ActiveLayerIndex < 0 || m_catalog.ActiveLayerObj.ActiveGdbIndex < 0)
            {
                MessageBox.Show("请激活该编辑的图层", "提示", MessageBoxButton.OK);
                return;
            }
            TabItem item = tabControl1.SelectedItem as TabItem;

            if (item != null)
            {
                DataGrid datagrid = item.Content as DataGrid;
                if (datagrid != null)
                {
                    m_lastSelDataGrid = datagrid;
                    int tabIndex = Convert.ToInt32(((System.Windows.FrameworkElement)(((System.Windows.Controls.ContentControl)(tabControl1.SelectedItem)).Content)).Name.ToString().Split('_')[1]);
                    if (tabIndex >= 0 && tabIndex < _lastSelRlt.AttDS[0].attTables.Length)
                    {
                        if (MessageBox.Show("你真的要删除吗?执行后将不能撤消!", "删除确认", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                        {
                            BindClass bc = datagrid.SelectedItem as BindClass;
                            m_lastSelItem = bc;
                            CLayerGetByID getGeo = new CLayerGetByID();
                            getGeo.FeatureID = Convert.ToInt64(bc.key0);
                            if (m_lastSelDataGrid.Tag is TmpInfo)
                            {
                                getGeo.GdbIndex   = (m_lastSelDataGrid.Tag as TmpInfo).GDBIndex;
                                getGeo.LayerIndex = (m_lastSelDataGrid.Tag as TmpInfo).LayerIndex;
                                COpenMap openmap = new COpenMap();
                                m_catalog.ActiveLayerObj.DeleteFeature(getGeo, new UploadStringCompletedEventHandler(OnDeleteFeature));
                            }
                        }
                    }
                }
            }
        }
コード例 #4
0
        private DateTime m_timeLastLeftButtonUp = DateTime.Now;//鼠标左键弹起的时间,判断双击用
        /// <summary>
        /// 鼠标在DataGrid弹起事件回调
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DataGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            DateTime b = DateTime.Now;
            long     c = CommFun.TimeDiff(b, m_timeLastLeftButtonUp);

            m_timeLastLeftButtonUp = b;
            if (c < 280)
            {//双击事件
                if (m_graphicsLayer != null && m_graphics != null)
                {
                    m_graphicsLayer.RemoveGraphics(m_graphics);
                    m_graphics = null;
                }
                DataGrid grid = sender as DataGrid;
                if (grid != null && grid.SelectedItem is BindClass && grid.Tag is TmpInfo && m_graphicsLayer != null)
                {
                    CLayerGetByID getGeo = new CLayerGetByID();
                    getGeo.GdbIndex   = (grid.Tag as TmpInfo).GDBIndex;
                    getGeo.LayerIndex = (grid.Tag as TmpInfo).LayerIndex;
                    getGeo.FeatureID  = Convert.ToInt32((grid.SelectedItem as BindClass).key0);
                    activeLayer.GetGeomByFID(getGeo, new UploadStringCompletedEventHandler(FlashFeature));
                }
            }
        }
コード例 #5
0
        public void SetAttStruct(CAttStruct attStruct, BindClass values = null, LayerDataViewer layerDataViewer = null)
        {
            m_layerDataViewer = layerDataViewer;
            m_attStruct       = attStruct;
            m_featureStyle    = null;
            Clear();
            Label   label;
            TextBox txtbox;

            if (values != null && values.ColumnCount > 0)
            {
                m_featureID = Convert.ToInt32(values.keyarr[0]);
            }
            for (int i = 0; i < m_attStruct.FldNumber; i++)
            {
                grid1.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(30)
                });
                label = new Label()
                {
                    Content = m_attStruct.FldName[i] + ":", Width = 60
                };
                grid1.Children.Add(label);
                Grid.SetRow(label, i);
                txtbox = new TextBox()
                {
                    Width = 120, Height = 23, Text = "0"
                };                                                              //, Name = "Fld_" + m_attStruct.FldName[i] };
                grid1.Children.Add(txtbox);
                m_textBoxArr.Add(txtbox);
                if (values != null && values.ColumnCount > i + 1)
                {
                    txtbox.Text = values.keyarr[i + 1];
                }
                Grid.SetRow(txtbox, i);
                Grid.SetColumn(txtbox, 1);
            }
            if (values == null)
            {
                switch ((m_targetGeo as IWebGeometry).GetGeomType())
                {
                case WebGeomType.Point:
                    m_style = new PointStyle();
                    break;

                case WebGeomType.Line:
                    m_style = new LineStyle();
                    break;

                case WebGeomType.Polygon:
                    m_style = new PolygonStyle();
                    break;
                }
                grid2.Children.Add(m_style as UIElement);
            }
            else
            {
                CLayerGetByID feature = new CLayerGetByID();
                feature.FeatureID  = this.m_featureID;
                feature.GdbIndex   = ActiveLayerObj.ActiveGdbIndex;
                feature.LayerIndex = ActiveLayerObj.ActiveLayerIndex;
                ActiveLayerObj.GetGraphicInfo(feature, OnGetStyle);
            }
            Button btn = new Button()
            {
                Width = 70
            };

            btn.Content = "提交";
            if (values == null)
            {
                btn.Click += new RoutedEventHandler(SubmitForAdd);
            }
            else
            {
                btn.Click += new RoutedEventHandler(SubmitForEdit);
            }
            grid3.Children.Add(btn);
            btn = new Button()
            {
                Width = 70
            };
            btn.Content = "关闭";
            btn.Click  += new RoutedEventHandler(Close);
            grid3.Children.Add(btn);
            Grid.SetColumn(btn, 1);
            if (values != null)
            {
                grid3.ColumnDefinitions.Add(new ColumnDefinition()); //{ Width = new GridLength(120) });
                btn = new Button()
                {
                    Width = 90
                };
                btn.Content = "调整要素位置";
                btn.Click  += new RoutedEventHandler(EditPoint);
                grid3.Children.Add(btn);
                Grid.SetColumn(btn, 2);
            }
            this.Show();
        }