Esempio n. 1
0
        /// <summary>
        /// 删除回调
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ContextMenuClick_Del(object sender, RoutedEventArgs e)
        {
            if (m_catalog.ActiveMapDoc.ActiveLayerIndex < 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;
                            CGetObjByID getGeo = new CGetObjByID();
                            getGeo.FeatureID  = Convert.ToInt64(bc.key0);
                            getGeo.LayerIndex = tabIndex;
                            COpenMap openmap = new COpenMap();
                            openmap.MapName = new string[] { m_catalog.ActiveMapDoc.MapDocName };
                            getGeo.MapName  = openmap;
                            m_catalog.ActiveMapDoc.DeleteFeature(getGeo, new UploadStringCompletedEventHandler(OnDeleteFeature));
                        }
                    }
                }
            }
        }
Esempio n. 2
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)
                {
                    CGetObjByID getGeo = new CGetObjByID();
                    getGeo.MapDocIndex = 0;
                    getGeo.LayerIndex  = (grid.Tag as TmpInfo).LayerIndex;
                    getGeo.FeatureID   = Convert.ToInt32((grid.SelectedItem as BindClass).key0);
                    COpenMap openmap = new COpenMap();
                    openmap.MapName = new string[1] {
                        activeMapDoc.MapDocName
                    };
                    getGeo.MapName = openmap;
                    activeMapDoc.GetGeomByID(getGeo, new UploadStringCompletedEventHandler(FlashFeature));
                }
            }
        }
Esempio n. 3
0
        private void onGetMapAttStruct(object sender, UploadStringCompletedEventArgs e)
        {
            CAttStruct attStruct = m_catalog.ActiveMapDoc.OnGetMapLayerAttStruct(e);

            this.m_bufferControl.setTargetattStrct(attStruct);
            BindClass   bindobj = ((System.Windows.Controls.DataGrid)(((System.Windows.Controls.ContentControl)(tabControl1.SelectedItem)).Content)).SelectedItem as BindClass;
            CGetObjByID getobj  = new CGetObjByID();

            getobj.MapDocIndex = 0;
            getobj.LayerIndex  = Convert.ToInt32(((System.Windows.FrameworkElement)(((System.Windows.Controls.ContentControl)(tabControl1.SelectedItem)).Content)).Name.ToString().Split('_')[1]);
            getobj.FeatureID   = Convert.ToInt64(bindobj.key0);
            m_catalog.ActiveMapDoc.GetFeatureByID(getobj, new UploadStringCompletedEventHandler(onGetFeatureByID));
        }
        private void updateLayerStatus(object sender, UploadStringCompletedEventArgs e)
        {
            //实例化第一个拓扑分析的要素
            _firstFeature = new SFeatureGeometry();
            //实例化第二个拓扑分析的要素
            _secondFeature = new SFeatureGeometry();
            //实例化第一个拓扑分析要素的显示区的对象
            _firstPoly = new IMSPolygon();
            //实例化第二个拓扑分析要素的县市区的对象
            _secondPoly = new IMSPolygon();
            //根据要素id获取需要的数据
            CGetObjByID targetObj = new CGetObjByID();

            //设置第一个要素的id
            targetObj.FeatureID = firstFeatID;
            //设置第一个要素所在的图层号
            targetObj.LayerIndex = 1;
            //获取第一个要素空间信息
            this.mapDoc.GetGeomByID(targetObj, FirstgetGemos);
        }
Esempio n. 5
0
 private void EditPoint(object sender, RoutedEventArgs e)
 {
     if (GraphicsLayer != null)
     {
         if (m_graphics != null)
         {
             GraphicsLayer.RemoveGraphics(m_graphics);
             m_graphics = null;
         }
         CGetObjByID getGeo = new CGetObjByID();
         getGeo.MapDocIndex = 0;
         getGeo.LayerIndex  = ActiveMapDoc.ActiveLayerIndex;
         getGeo.FeatureID   = m_featureID;
         COpenMap openmap = new COpenMap();
         openmap.MapName = new string[1] {
             ActiveMapDoc.MapDocName
         };
         getGeo.MapName = openmap;
         ActiveMapDoc.GetGeomByID(getGeo, new UploadStringCompletedEventHandler(DrawFeature));
     }
 }
        public void FirstgetGemos(object sender, UploadStringCompletedEventArgs e)
        {
            SFeatureGeometry FirstResultFeature = this.mapDoc.OnGetGeomByID(e);

            if (FirstResultFeature != null)
            {
                this._firstFeature = FirstResultFeature;
                this._firstPoly    = drawGetFeature(FirstResultFeature);
                //获取第二个要素的空间信息
                CGetObjByID targetObj2 = new CGetObjByID();
                //设置拓扑分析的第二个要素的id
                targetObj2.FeatureID = this.secondFeatID;
                //设置第二个要素所在的图层号
                targetObj2.LayerIndex = 1;
                //获取第二个要素空间信息
                this.mapDoc.GetGeomByID(targetObj2, SelectgetGemos);
            }
            else
            {
                MessageBox.Show("获取第一个要素失败!");
                return;
            }
        }
 //缓冲分析
 private void BufferSubmit(object sender, RoutedEventArgs e)
 {
     if (this.successFlag == true)
     {
         bufferName       = "";
         this.successFlag = false;
         //根据要素id及图层索引获取要素的各种信息功能的参数类
         CGetObjByID targetObj = new CGetObjByID();
         targetObj.MapDocIndex = 0;
         //要素id
         targetObj.FeatureID = 2316;
         //图层索引
         targetObj.LayerIndex = 2;
         //初始化缓冲分析类
         CBufferFeature BufferInfo = new CBufferFeature();
         //设置缓冲分析的空间信息所在的文档的信息
         BufferInfo.FeatureInfo = targetObj;
         //设置缓冲半径
         BufferInfo.BufferRadius = Convert.ToDouble(this.radius.Text);
         //设置Trace半径
         BufferInfo.TraceRadius = Convert.ToDouble(this.radius.Text) / 3;
         Random rad = new Random();
         //设置缓冲分析结果图层名
         BufferInfo.ResultLayerName = "BUF" + rad.NextDouble();
         bufferName = BufferInfo.ResultLayerName;
         //设置缓冲分析结果图层类型设置为简单要素类
         BufferInfo.ResultLayerType = XClsType.SFeatureCls;
         //要素缓冲分析
         this.mapDoc.BufferFeature(BufferInfo, new UploadStringCompletedEventHandler(getBufferFeature));
         this.iMSMap1.SetErrorText("");
     }
     else
     {
         this.iMSMap1.SetErrorText("正在缓冲分析,请稍后...");
         return;
     }
 }
        private void setFeature(object sender, UploadStringCompletedEventArgs e)
        {
            CMapSelectAndGetAtt obj = this.IMSCatalog.ActiveMapDoc.OnSelect(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[0].attTables[this.IMSCatalog.ActiveMapDoc.ActiveLayerIndex];

            if (obj.AttDS[0].attTables[this.IMSCatalog.ActiveMapDoc.ActiveLayerIndex] != null)
            {
                CAttDataRow[] curRltRows = obj.AttDS[0].attTables[this.IMSCatalog.ActiveMapDoc.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;
                CGetObjByID getGeo = new CGetObjByID();
                getGeo.FeatureID  = row.FID;
                getGeo.LayerIndex = this.IMSCatalog.ActiveMapDoc.ActiveLayerIndex;
                this.IMSCatalog.ActiveMapDoc.GetGeomByID(getGeo, flashFeature);
            }
            else
            {
                MessageBox.Show("未获取到要素");
                this.m_graphicsLayer.DrawingType         = DrawingType.Point;
                this.m_graphicsLayer.DrawingOverCallback = new DrawingEventHandler(Drawpoint_callback);
            }
        }
Esempio n. 9
0
        public void SetAttStruct(CAttStruct attStruct, BindClass values = null, MapDocDataViewer mapDocDataViewer = null)
        {
            m_mapDocDataViewer = mapDocDataViewer;
            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
            {
                CGetObjByID feature = new CGetObjByID();
                feature.FeatureID  = this.m_featureID;
                feature.LayerIndex = this.ActiveMapDoc.ActiveLayerIndex;
                ActiveMapDoc.GetFeatureStyleInfo(feature, new UploadStringCompletedEventHandler(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();
        }