コード例 #1
0
        private void btn_Delete_Click(object sender, EventArgs e)
        {
            Recordset objRt = null;

            try
            {
                if (m_Application.MessageBox.Show("确定要删除【" + cmb_Workflow.Text + "】吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
                {
                    return;
                }
                txt_Name.Text        = "";
                rtb_Description.Text = m_Tip;
                txt_PlaySpeed.Text   = "10";
                btn_SelectColor.Text = "Workflow";
                rtb_Description.Font = new Font("宋体", 9F, FontStyle.Italic, GraphicsUnit.Point, 134);
                m_lstItems.Clear();
                lst_Items.DataSource = null;

                objRt = (m_Application.Workspace.Datasources["Resource"].Datasets["ArtCraftTable"] as DatasetVector).Query("CraftName='" + cmb_Workflow.Text.Trim() + "'", CursorType.Dynamic);
                if (objRt.RecordCount > 0)
                {
                    objRt.Delete();
                }
                m_Application.Workspace.Resources.LineLibrary.Remove((m_Application.Workspace.Resources.LineLibrary.FindSymbol("Workflow_" + cmb_Workflow.Text.Trim())).ID);
                m_Application.Workspace.Datasources["SpaceData"].Datasets.Delete(cmb_Workflow.Text.Trim());
                m_Application.Workspace.Save();
                foreach (Label lbl in m_lstWorkflow)
                {
                    if (lbl.Text.Equals(cmb_Workflow.Text))
                    {
                        m_lstWorkflow.Remove(lbl);
                        break;
                    }
                }
                cmb_Workflow.DataSource    = null;
                cmb_Workflow.DataSource    = m_lstWorkflow;
                cmb_Workflow.DisplayMember = "Text";
                if (cmb_Workflow.Items.Count > 0)
                {
                    cmb_Workflow.SelectedIndex = 0;
                }
                m_Application.MessageBox.Show("删除成功!");
            }
            catch (Exception ex)
            {
                Log.OutputBox(ex);
            }
            finally
            {
                if (objRt != null)
                {
                    objRt.Close();
                    objRt.Dispose();
                }
            }
        }
コード例 #2
0
        private void GetData()
        {
            Recordset objRt = null;

            try
            {
                dg_Data.Rows.Clear();
                dg_Data.Columns.Clear();
                if (chkTheme.SelectedItem == null)
                {
                    m_Application.MessageBox.Show(Message);
                    return;
                }
                Layer3DDataset layer3DDataset = (chkTheme.SelectedItem as Label).Tag as Layer3DDataset;
                objRt = (layer3DDataset.Dataset as DatasetVector).GetRecordset(false, CursorType.Static);
                for (int i = 0; i < objRt.FieldCount; i++)
                {
                    FieldInfo fieldInfo = objRt.GetFieldInfos()[i];
                    if (fieldInfo.Caption.ToLower().Contains("sm"))
                    {
                        continue;
                    }
                    dg_Data.Columns.Add(fieldInfo.Name, fieldInfo.Caption);
                }

                objRt.MoveFirst();
                while (!objRt.IsEOF)
                {
                    DataGridViewRow row = new DataGridViewRow();
                    row.HeaderCell.Value = objRt.GetID().ToString();
                    for (int j = 0; j < dg_Data.ColumnCount; j++)
                    {
                        DataGridViewTextBoxCell textBoxCell = new DataGridViewTextBoxCell
                        {
                            Value = Convert.ToString(objRt.GetFieldValue(dg_Data.Columns[j].Name))
                        };
                        row.Cells.Add(textBoxCell);
                    }
                    dg_Data.Rows.Add(row);

                    objRt.MoveNext();
                }
            }
            catch (Exception ex)
            {
                Log.OutputBox(ex);
            }
            finally
            {
                if (objRt != null)
                {
                    objRt.Close();
                    objRt.Dispose();
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// 对象选择事件。
        /// GeometrySelectedEvent
        /// </summary>
        public void m_mapControl_GeometrySelected(Object sender, SuperMap.UI.GeometrySelectedEventArgs e)
        {
            if (m_selectMode != SelectMode.SelectBarrier)
            {
                return;
            }
            Selection selection = m_layerPoint.Selection;

            if (selection.Count <= 0)
            {
                selection = m_layerLine.Selection;
            }
            m_style.LineColor  = Color.Red;
            m_style.MarkerSize = new Size2D(6, 6);
            m_style.LineWidth  = 0.5;
            Recordset recordset = selection.ToRecordset();

            try
            {
                Geometry geometry = recordset.GetGeometry();

                // 捕捉到点时,将捕捉到的点添加到障碍点列表中
                // If a point is snapped, the point is added to the barrier list
                if (geometry.Type == GeometryType.GeoPoint)
                {
                    GeoPoint geoPoint = (GeoPoint)geometry;
                    int      id       = recordset.GetID();
                    m_barrierNodes.Add(id);

                    geoPoint.Style = m_style;
                    m_trackingLayer.Add(geoPoint, "barrierNode");
                }

                // 捕捉到线时,将线对象添加到障碍线列表中
                // If a line is snapped, the line is added to the barrier list
                if (geometry.Type == GeometryType.GeoLine)
                {
                    GeoLine geoLine = (GeoLine)geometry;
                    int     id      = recordset.GetID();
                    m_barrierEdges.Add(id);

                    geoLine.Style = m_style;
                    m_trackingLayer.Add(geoLine, "barrierEdge");
                }
                m_mapControl.Map.Refresh();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
            finally
            {
                recordset.Dispose();
            }
        }
コード例 #4
0
        public int PickNodeToLine(int nID)
        {
            m_SelectedGeoNetwork.Clear();
            DatasetVector DvLine = m_workspace.Datasources["Pipeline3D"].Datasets["PipeLine3D"] as DatasetVector;
            DatasetVector DvNode = m_workspace.Datasources["Pipeline3D"].Datasets["PipePoint3D"] as DatasetVector;

            int[]     id        = { nID };
            Recordset recordset = DvNode.Query(id, CursorType.Static);
            Geometry  pGeoNode  = recordset.GetGeometry();

            string strNodeID = "PtID";
            int    nNodeID   = Convert.ToInt32(recordset.GetFieldValue(strNodeID));

            string         strFNode       = "FNode";
            string         strTNode       = "ENode";
            QueryParameter queryparameter = new QueryParameter();

            queryparameter.CursorType = CursorType.Static;

            queryparameter.AttributeFilter = String.Format("{0}={1} or {2}={3}", strFNode, nNodeID, strTNode, nNodeID);
            Recordset Rs = DvLine.Query(queryparameter);

            int nCount = Rs.RecordCount;;

            Rs.MoveFirst();
            while (!Rs.IsEOF)
            {
                GeoLine3D geoline3D = Rs.GetGeometry() as GeoLine3D;

                NetworkGeometry NetWorkGeometry = new NetworkGeometry();
                NetWorkGeometry.nID    = geoline3D.ID;
                NetWorkGeometry.nFNode = Convert.ToInt32(Rs.GetFieldValue(strFNode));
                NetWorkGeometry.nTNode = Convert.ToInt32(Rs.GetFieldValue(strTNode));

                if (!m_SelectedGeoNetwork.Contains(NetWorkGeometry))
                {
                    if (NetWorkGeometry.nTNode == nNodeID)
                    {
                        NetWorkGeometry.geometry = geoline3D;
                        m_SelectedGeoNetwork.Add(NetWorkGeometry);//流入对象在第一位
                    }
                    else
                    {
                        NetWorkGeometry.bIsIn    = false;
                        NetWorkGeometry.geometry = geoline3D;
                        m_SelectedGeoNetwork.Add(NetWorkGeometry);//线对象
                    }
                }

                Rs.MoveNext();
            }
            Rs.Dispose();
            return(nCount);
        }
コード例 #5
0
        private void btn_Commit_Click(object sender, EventArgs e)
        {
            Recordset objRt = null;

            try
            {
                if (chkTheme.SelectedItem == null)
                {
                    m_Application.MessageBox.Show(Message);
                    return;
                }
                Layer3DDataset layer3DDataset = (chkTheme.SelectedItem as Label).Tag as Layer3DDataset;
                objRt = (layer3DDataset.Dataset as DatasetVector).GetRecordset(false, CursorType.Dynamic);
                foreach (DataGridViewRow row in dg_Data.Rows)
                {
                    int id = Convert.ToInt32(row.HeaderCell.Value);
                    if (objRt.SeekID(id) && objRt.Edit())
                    {
                        foreach (DataGridViewColumn column in dg_Data.Columns)
                        {
                            switch (objRt.GetFieldInfos()[column.Name].Type)
                            {
                            case FieldType.WText:
                                objRt.SetFieldValue(column.Name, Convert.ToString(row.Cells[column.Name].Value));
                                break;

                            case FieldType.Double:
                                objRt.SetFieldValue(column.Name, Convert.ToDouble(row.Cells[column.Name].Value));
                                break;

                            case FieldType.Int32:
                                objRt.SetFieldValue(column.Name, Convert.ToInt32(row.Cells[column.Name].Value));
                                break;
                            }
                        }
                        objRt.Update();
                    }
                }
                m_SceneControl.Refresh();
            }
            catch (Exception ex)
            {
                Log.OutputBox(ex);
            }
            finally
            {
                if (objRt != null)
                {
                    objRt.Close();
                    objRt.Dispose();
                }
            }
        }
コード例 #6
0
ファイル: frmMain.cs プロジェクト: gishjl/DataManager
        private DatasetVector DatasetConvertRegionToLine(DatasetVector dtVector2)
        {
            DatasetVector dtVector = null;

            if (dtVector2 != null)
            {
                DatasetVectorInfo dvi = new DatasetVectorInfo();
                dvi.Name = m_selLayer.Dataset.Datasource.Datasets.GetAvailableDatasetName("C_geoLine");
                dvi.Type = DatasetType.Line;

                //DatasetVector
                dtVector = m_selLayer.Dataset.Datasource.Datasets.Create(dvi);
                foreach (FieldInfo fi in dtVector2.FieldInfos)
                {
                    if (dtVector.FieldInfos.IndexOf(fi.Name) < 0 && !fi.IsSystemField)
                    {
                        dtVector.FieldInfos.Add(fi.Clone());
                    }
                }

                Recordset recdst = dtVector.GetRecordset(true, CursorType.Dynamic);

                recdst.Batch.Begin();
                try
                {
                    Recordset recdst2 = dtVector2.GetRecordset(false, CursorType.Static);
                    while (!recdst2.IsEOF)
                    {
                        GeoRegion geoR = recdst2.GetGeometry() as GeoRegion;

                        if (geoR != null)
                        {
                            GeoLine geoLine = geoR.ConvertToLine();
                            recdst.AddNew(geoLine);
                            foreach (FieldInfo fi in dtVector2.FieldInfos)
                            {
                                if (dtVector.FieldInfos.IndexOf(fi.Name) > -1 && !fi.IsSystemField)
                                {
                                    recdst.SetFieldValue(fi.Name, recdst2.GetFieldValue(fi.Name));
                                }
                            }
                            geoR.Dispose();
                        }
                        recdst2.MoveNext();
                    }
                    recdst2.Dispose();
                }
                catch { }
                recdst.Batch.Update();
                recdst.Dispose();
            }
            return(dtVector);
        }
コード例 #7
0
        /// <summary>
        /// MapControl MouseMove事件。
        /// MapControl MouseMove event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_mapControl_MouseMove(object sender, MouseEventArgs e)
        {
            try
            {
                m_mapControl.DoMouseMove(e);
                if (m_mapControl.Action == SuperMap.UI.Action.Select ||
                    m_mapControl.Action == SuperMap.UI.Action.Select2)
                {
                    // 获取鼠标点对应的地图点
                    // Get the map point that corresponds to the mouse point
                    m_mousePoint = new Point(e.X, e.Y);
                    Point2D point2D = m_mapControl.Map.PixelToMap(m_mousePoint);

                    // 根据当前比例尺设置捕捉框的大小
                    // Set the snap box size according to the current scale
                    double    scale     = (3 * 10E-4) / m_mapControl.Map.Scale;
                    Selection selection = m_layerPoint.HitTest(point2D, 4 / 3 * scale);
                    int       index     = m_trackingLayer.IndexOf("geoLine");
                    if (index != -1)
                    {
                        m_trackingLayer.Remove(index);
                    }
                    if (selection != null && selection.Count > 0)
                    {
                        Recordset recordset = selection.ToRecordset();
                        GeoPoint  geoPoint  = (GeoPoint)recordset.GetGeometry();
                        recordset.Dispose();
                        double pointX = geoPoint.X;
                        double pointY = geoPoint.Y;

                        // 构造捕捉框
                        // Build snap box
                        Point2Ds point2Ds = new Point2Ds();
                        point2Ds.Add(new Point2D(pointX - scale, pointY - scale));
                        point2Ds.Add(new Point2D(pointX + scale, pointY - scale));
                        point2Ds.Add(new Point2D(pointX + scale, pointY + scale));
                        point2Ds.Add(new Point2D(pointX - scale, pointY + scale));
                        point2Ds.Add(new Point2D(pointX - scale, pointY - scale));
                        GeoLine geoLine = new GeoLine(point2Ds);

                        // 刷新地图
                        // Refresh the map
                        m_mapControl.SelectionTolerance = 2;
                        m_trackingLayer.Add(geoLine, "geoLine");
                        m_mapControl.Map.Refresh();
                    }
                }
            }
            catch (System.Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }
コード例 #8
0
        private void btn_Save_Click(object sender, EventArgs e)
        {
            Recordset objRt = null;

            try
            {
                btn_Draw.Enabled = true;
                objRt            = (m_Application.Workspace.Datasources["Resource"].Datasets["ArtCraftTable"] as DatasetVector).GetRecordset(false, CursorType.Dynamic);
                switch (m_Type)
                {
                case WorkflowEditType.New:
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("CraftName", txt_Name.Text.Trim());
                    dic.Add("Note", rtb_Description.Text.Equals(m_Tip) ? "" : rtb_Description.Text);
                    dic.Add("CraftID", (objRt.RecordCount + 1).ToString());
                    dic.Add("PlaySpeed", txt_PlaySpeed.Text);
                    dic.Add("Symbol", btn_SelectColor.Text + ',' + btn_SelectColor.Tag);
                    objRt.AddNew(null, dic);
                    objRt.Update();
                    break;

                case WorkflowEditType.Edit:
                    objRt.Edit();
                    objRt.SetFieldValue("CraftName", txt_Name.Text.Trim());
                    objRt.SetFieldValue("Note", rtb_Description.Text.Equals(m_Tip) ? "" : rtb_Description.Text);
                    objRt.SetFieldValue("CraftID", objRt.RecordCount + 1);
                    objRt.SetFieldValue("PlaySpeed", txt_PlaySpeed.Text);
                    objRt.SetFieldValue("Symbol", btn_SelectColor.Text + ',' + btn_SelectColor.Tag);
                    objRt.Update();
                    break;
                }

                Layer3DDataset layer = m_SceneControl.Scene.Layers[txt_Name.Text + "@SpaceData"] as Layer3DDataset;
                for (int i = 0; i < (layer.Theme as Theme3DUnique).Count; i++)
                {
                    Theme3DUniqueItem item = (layer.Theme as Theme3DUnique)[i];
                    item.IsVisible = false;
                }
                m_Application.MessageBox.Show("保存成功!");
            }
            catch (Exception ex)
            {
                Log.OutputBox(ex);
            }
            finally
            {
                if (objRt != null)
                {
                    objRt.Close();
                    objRt.Dispose();
                }
            }
        }
コード例 #9
0
        public void AddModel_Click(Point3D Point3D, int ModelIndex, string strID, string strNOID)
        {
            AddPointToDatasets(Point3D, ModelIndex, strID, strNOID);

            Datasource    datasource   = m_workspace.Datasources[0];
            DatasetVector pointDataset = datasource.Datasets["Point3D"] as DatasetVector;
            Recordset     recordset    = pointDataset.GetRecordset(false, CursorType.Dynamic);

            GeoPoint3D geopoint3D = new GeoPoint3D(Point3D);
            GeoStyle3D geoStyle   = new GeoStyle3D();

            geoStyle.MarkerSymbolID    = UserHelper.Marker3DSymbolID[ModelIndex];
            geoStyle.IsMarkerSizeFixed = false;
            geoStyle.MarkerSize        = 1;
            geoStyle.Marker3DScaleX    = 0.03;
            geoStyle.Marker3DScaleY    = 0.03;
            geoStyle.Marker3DScaleZ    = 0.08;
            geoStyle.IsMarker3D        = true;
            geoStyle.AltitudeMode      = AltitudeMode.RelativeToGround;
            geopoint3D.Style3D         = geoStyle;

            recordset.MoveLast();
            recordset.AddNew(geopoint3D);
            recordset.SetFieldValue(m_filedName, strID);
            recordset.Update();
            recordset.Dispose();

            m_layer3DPoint.IsSelectable = false;
            m_layer3DPoint.UpdateData();
            m_SceneControl.Scene.Refresh();

            //AddKmlLayer();

            //GeoPlacemark geoPlacemark = new GeoPlacemark();
            //m_geoModel = new GeoModel();
            //m_geoModel.FromFile(UserHelper.sModelName[ModelIndex]);
            ////人物模型朝向前进方向,如果原始方向一致则不需要旋转。
            //m_geoModel.Style3D = m_style3D;
            //m_geoModel.RotationZ = 180;
            //m_geoModel.ScaleX = 0.3;
            //m_geoModel.ScaleY = 0.3;
            //m_geoModel.ScaleZ = 0.3;
            //m_geoModel.Position = new Point3D(Point3D.X, Point3D.Y, Point3D.Z);
            //geoPlacemark.Geometry = m_geoModel;
            //Feature3Ds feture3Ds = m_LayerKML.Features;
            //Feature3D feature = new Feature3D();
            //feature.Geometry = geoPlacemark;
            //feature.Description = strID;
            //feature.Name = feature.Description;
            //feture3Ds.Add(feature);
            //feture3Ds.ToKMLFile(m_LayerKML.DataName);
            //m_LayerKML.UpdateData();
        }
コード例 #10
0
ファイル: 主界面.cs プロジェクト: sishui198/Wetland-GIS
        private void toolStripButton8_Click(object sender, EventArgs e)
        {
            if (toolStripTextBox1.Text.Length == 0)
            {
                MessageBox.Show("查询信息不能为空");
                return;
            }
            Int32 layerCount = mapControl1.Map.Layers.Count;

            if (layerCount == 0)
            {
                MessageBox.Show("请先打开一个矢量数据集!");
                return;
            }
            string dl = toolStripComboBox1.SelectedItem.ToString();
            string nf = toolStripComboBox2.SelectedItem.ToString();
            string year;

            if (nf == "2000")
            {
                year = "00";
            }
            else
            {
                year = "09";
            }
            string         tj             = toolStripTextBox1.Text;
            string         sql            = dl + year + tj;
            QueryParameter queryParameter = new QueryParameter();

            queryParameter.AttributeFilter = sql;
            queryParameter.CursorType      = CursorType.Static;
            Boolean       hasGeometry = false;
            DatasetVector dataset     = SampleRun.workspace1.Datasources[0].Datasets["盘锦行政区划"] as DatasetVector;
            Recordset     recordset   = dataset.Query(queryParameter);

            if (recordset.RecordCount > 0)
            {
                hasGeometry = true;
            }
            Selection selection = SampleRun.mapControl1.Map.Layers[0].Selection;

            selection.FromRecordset(recordset);
            recordset.Dispose();
            if (!hasGeometry)
            {
                MessageBox.Show("没有符合查询条件的结果或查询条件有误,请重新确认后查询!");
            }
            queryParameter.Dispose();
            mapControl1.Refresh();
            hasGeometry = false;
        }
コード例 #11
0
        private void cmb_DeviceType2_SelectedIndexChanged(object sender, EventArgs e)
        {
            Recordset objRt = null;

            try
            {
                if (cmb_DeviceType2.SelectedItem == null)
                {
                    return;
                }
                ResourceTypeData data = cmb_DeviceType2.SelectedItem as ResourceTypeData;
                if (!m_Application.Workspace.Datasources["Resource"].Datasets.Contains(data.DatasetName))
                {
                    return;
                }
                dgv_Data.Rows.Clear();
                objRt = (m_Application.Workspace.Datasources["Resource"].Datasets[data.DatasetName] as DatasetVector).GetRecordset(false, CursorType.Static);
                objRt.MoveFirst();
                while (!objRt.IsEOF)
                {
                    DataGridViewRow row = new DataGridViewRow();
                    row.Cells.Add(new DataGridViewCheckBoxCell());
                    DataGridViewTextBoxCell cell1 = new DataGridViewTextBoxCell
                    {
                        Value = Convert.ToString(objRt.GetFieldValue(data.FieldID))
                    };
                    row.Cells.Add(cell1);
                    DataGridViewTextBoxCell cell2 = new DataGridViewTextBoxCell
                    {
                        Value = Convert.ToString(objRt.GetFieldValue(data.FieldName))
                    };
                    row.Cells.Add(cell2);
                    row.Tag = objRt.GetID();
                    dgv_Data.Rows.Add(row);

                    objRt.MoveNext();
                }
            }
            catch (Exception ex)
            {
                Log.OutputBox(ex);
            }
            finally
            {
                if (objRt != null)
                {
                    objRt.Close();
                    objRt.Dispose();
                }
            }
        }
コード例 #12
0
        public void Query()
        {
            try
            {
                mDataVec = mData as DatasetVector;
                Recordset rec = mDataVec.GetRecordset(false, CursorType.Dynamic);
                this.dataGridView1.Columns.Clear();
                this.dataGridView1.Rows.Clear();

                for (int i = 0; i < rec.FieldCount; i++)
                {
                    //定义并获得字段名称
                    String fieldName = rec.GetFieldInfos()[i].Name;
                    //将得到的字段名称添加到dataGridView列中
                    this.dataGridView1.Columns.Add(fieldName, fieldName);
                }

                //初始化row
                DataGridViewRow row = null;

                //根据选中记录的个数,将选中对象的信息添加到dataGridView中显示
                while (!rec.IsEOF)
                {
                    row = new DataGridViewRow();
                    for (int i = 0; i < rec.FieldCount; i++)
                    {
                        //定义并获得字段值
                        Object fieldValue = rec.GetFieldValue(i);

                        //将字段值添加到dataGridView中对应的位置
                        DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell();
                        if (fieldValue != null)
                        {
                            cell.ValueType = fieldValue.GetType();
                            cell.Value     = fieldValue;
                        }
                        row.Cells.Add(cell);
                    }

                    this.dataGridView1.Rows.Add(row);
                    rec.MoveNext();
                }
                this.dataGridView1.Update();
                rec.Dispose();
            }
            catch (System.Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }
コード例 #13
0
        private void AddPointToDatasets(Point3D Point3D, int ModelIndex, string strID, string strNOID)
        {
            CreateDatasets();
            try
            {
                Datasource    datasource   = m_workspace.Datasources[0];
                DatasetVector pointDataset = datasource.Datasets[UserHelper.sDeviceName[ModelIndex]] as DatasetVector;

                if (pointDataset != null)
                {
                    GeoPoint  geoPoint  = new GeoPoint(Point3D.X, Point3D.Y);
                    Recordset recordset = pointDataset.GetRecordset(false, CursorType.Dynamic);
                    recordset.MoveLast();
                    recordset.AddNew(geoPoint);
                    recordset.SetFieldValue(m_filedName, strID);
                    recordset.Update();
                    recordset.Close();
                    recordset.Dispose();
                }

                m_MapControl.Map.Refresh();

                DatasetVector textDataset = datasource.Datasets[UserHelper.sTextName] as DatasetVector;
                if (textDataset != null)
                {
                    Recordset textRecordset = textDataset.GetRecordset(false, CursorType.Dynamic);

                    TextPart part = new TextPart();
                    part.Text = strNOID;
                    Point2D point2D = new Point2D(Point3D.X, Point3D.Y);
                    part.AnchorPoint = point2D;
                    GeoText geoText = new GeoText(part);
                    geoText.TextStyle.ForeColor  = Color.Green;
                    geoText.TextStyle.FontHeight = 8;

                    textRecordset.MoveLast();
                    textRecordset.AddNew(geoText);
                    textRecordset.Update();
                    textRecordset.Close();
                    textRecordset.Dispose();
                }

                m_MapControl.Map.Refresh();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
コード例 #14
0
        private void DeviceTypeManagerControl_Load(object sender, EventArgs e)
        {
            Recordset objRt = null;

            try
            {
                if (m_Application.MainForm.FormManager.ActiveForm is IFormScene formScene)
                {
                    m_SceneControl = formScene.SceneControl;
                }
                if (m_lstType == null)
                {
                    m_lstType = new List <ResourceTypeData>();
                }
                if (m_lstTypeData == null)
                {
                    m_lstTypeData = new List <Label>();
                }
                objRt = (m_Application.Workspace.Datasources["Resource"].Datasets["ResourceTable"] as DatasetVector).GetRecordset(false, CursorType.Static);
                objRt.MoveFirst();
                while (!objRt.IsEOF)
                {
                    ResourceTypeData data = new ResourceTypeData
                    {
                        Caption     = Convert.ToString(objRt.GetFieldValue("SourceName")),
                        Name        = Convert.ToString(objRt.GetFieldValue("SourceID")),
                        FieldID     = Convert.ToString(objRt.GetFieldValue("TableField"))?.Split(',')[0],
                        FieldName   = Convert.ToString(objRt.GetFieldValue("TableField"))?.Split(',')[1],
                        DatasetName = Convert.ToString(objRt.GetFieldValue("TableName")),
                    };
                    m_lstType.Add(data);

                    objRt.MoveNext();
                }
                GetData();
            }
            catch (Exception ex)
            {
                Log.OutputBox(ex);
            }
            finally
            {
                if (objRt != null)
                {
                    objRt.Close();
                    objRt.Dispose();
                }
            }
        }
コード例 #15
0
        public void TestAppend(Datasource datasource)
        {
            //获得用于操作的两个数据集
            DatasetVector datasetVector  = (DatasetVector)datasource.Datasets["World"];
            DatasetVector datasetVector1 = (DatasetVector)datasource.Datasets["Ocean"];

            // 获得名为“Ocean”的数据集的所有记录,将其追加到名为“World”的数据集中
            Recordset recordset = datasetVector1.GetRecordset(false, CursorType.Dynamic);

            if (datasetVector.Append(recordset))
            {
                Console.WriteLine("追加数据集成功");
            }
            recordset.Dispose();
        }
コード例 #16
0
ファイル: gk043.cs プロジェクト: knowledge0603/gkfqd
        /// <summary>
        /// 没有选择对象的时候表格清空
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        //private void m_mapControl_Paint(object sender, PaintEventArgs e)
        //{
        //    try
        //    {
        //        if (mapControl1.Map.Layers[0].Selection.Count < 1)
        //        {
        //            dataGridView1.Columns.Clear();
        //            dataGridView1.Rows.Clear();
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        Trace.WriteLine(ex.Message);
        //    }
        //}

        /// <summary>
        /// 使用记录集填充DataGridView
        /// </summary>
        /// <param name="recordset">获取的记录集</param>
        private void FillDataGridView(Recordset recordset)
        {
            try
            {
                dataGridView1.Columns.Clear();
                dataGridView1.Rows.Clear();

                for (int i = 0; i < recordset.FieldCount; i++)
                {
                    String fieldName = recordset.GetFieldInfos()[i].Name;

                    dataGridView1.Columns.Add(fieldName, fieldName);
                }

                DataGridViewRow row = null;
                //根据选中记录的个数,将选中对象的信息添加到dataGridView中显示
                while (!recordset.IsEOF)
                {
                    row = new DataGridViewRow();
                    for (int i = 0; i < recordset.FieldCount; i++)
                    {
                        //定义并获得字段值
                        Object fieldValue = recordset.GetFieldValue(i);
                        //将字段值添加到dataGridView中对应的位置
                        DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell();
                        if (fieldValue != null)
                        {
                            cell.ValueType = fieldValue.GetType();
                            cell.Value     = fieldValue;
                        }

                        row.Cells.Add(cell);
                    }

                    this.dataGridView1.Rows.Add(row);

                    recordset.MoveNext();
                }

                this.dataGridView1.Update();

                recordset.Dispose();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }
コード例 #17
0
        private void UploadDangerResourceFileControl_Load(object sender, EventArgs e)
        {
            Recordset objRt = null;

            try
            {
                if (m_Application.MainForm.FormManager.ActiveForm is IFormScene formScene)
                {
                    m_SceneControl = formScene.SceneControl;
                }

                dgv_Data.Rows.Clear();
                objRt = (m_Application.Workspace.Datasources["Resource"].Datasets["DangerResource"] as DatasetVector).GetRecordset(false, CursorType.Static);
                objRt.MoveFirst();
                while (!objRt.IsEOF)
                {
                    DataGridViewRow row = new DataGridViewRow();
                    row.Cells.Add(new DataGridViewCheckBoxCell());
                    DataGridViewTextBoxCell cell1 = new DataGridViewTextBoxCell
                    {
                        Value = Convert.ToString(objRt.GetFieldValue("ResourceID"))
                    };
                    row.Cells.Add(cell1);
                    DataGridViewTextBoxCell cell2 = new DataGridViewTextBoxCell
                    {
                        Value = Convert.ToString(objRt.GetFieldValue("ResourceName"))
                    };
                    row.Cells.Add(cell2);
                    row.Tag = objRt.GetID();
                    dgv_Data.Rows.Add(row);

                    objRt.MoveNext();
                }
            }
            catch (Exception ex)
            {
                Log.OutputBox(ex);
            }
            finally
            {
                if (objRt != null)
                {
                    objRt.Close();
                    objRt.Dispose();
                }
            }
        }
コード例 #18
0
ファイル: DlgSkyline.cs プロジェクト: suixiaofeng/LineGraph
        //获取天际线
        private void btn_GetSkyline_Click(object sender, EventArgs e)
        {
            try
            {
                if (m_skyline != null)
                {
                    GeoLine3D line3D = m_skyline.GetSkyline();

                    if (m_workspace.Datasources.Count == 0)
                    {
                        MessageBox.Show("请先打开一个数据源");
                        return;
                    }
                    Datasource datasource = m_workspace.Datasources[0];
                    Datasets   datasets   = datasource.Datasets;

                    String datasetName = "NewLine3D";
                    if (datasource.Datasets.Contains(datasetName))
                    {
                        datasource.Datasets.Delete(datasetName);
                    }
                    DatasetVectorInfo datasetInfo = new DatasetVectorInfo();
                    datasetInfo.Type       = DatasetType.Line3D;
                    datasetInfo.Name       = datasetName;
                    datasetInfo.EncodeType = EncodeType.None;

                    DatasetVector newDataset = datasource.Datasets.Create(datasetInfo);
                    if (newDataset == null)
                    {
                        MessageBox.Show("创建三维面数据集失败!");
                    }
                    if (m_sceneControl.Scene.Type == SceneType.Globe)
                    {
                        newDataset.PrjCoordSys = new PrjCoordSys(PrjCoordSysType.EarthLongitudeLatitude);
                    }
                    Recordset recordset = newDataset.GetRecordset(false, CursorType.Dynamic);
                    recordset.AddNew(line3D);
                    recordset.Update();
                    recordset.Dispose();
                }
            }
            catch (System.Exception ex)
            {
                Console.Write(ex.Message);
            }
        }
コード例 #19
0
        public void CreatBuffer()
        {
            try
            {
                // 获取地图中的选择集,并转换为记录集
                // Get the dataset in the map, and convert it to recordset.
                Selection[] selections = m_srcMapControl.Map.FindSelection(true);
                Selection   selection  = selections[0];
                Recordset   recordset  = selection.ToRecordset();

                this.CopyDataset(m_bufferDataName);

                //PrjCoordSys gaussPrjSys = this.GetTargetPrjCoordSys(type);
                //Boolean result = CoordSysTranslator.Convert(m_processDataset, gaussPrjSys, new CoordSysTransParameter(), CoordSysTransMethod.GeocentricTranslation);


                //设置缓冲区分析参数
                BufferAnalystParameter bufferAnalystParam = new BufferAnalystParameter();
                bufferAnalystParam.EndType       = BufferEndType.Flat;
                bufferAnalystParam.LeftDistance  = 100;
                bufferAnalystParam.RightDistance = 100;

                this.result = m_bufferDataset as DatasetVector;
                //调用创建矢量数据集缓冲区方法
                Boolean istrue = BufferAnalyst.CreateBuffer(recordset, result, bufferAnalystParam, false, true);

                Recordset recordset2 = result.GetRecordset(false, SuperMap.Data.CursorType.Dynamic);

                m_srcMapControl.Map.Layers.Add(result, true);
                m_srcMapControl.Map.Center = result.Bounds.Center;
                m_srcMapControl.Map.Scale  = m_srcMapControl.Map.Scale;
                m_srcMapControl.Map.Refresh();

                recordset2.Dispose();

                // 刷新地图
                // Refresh the map.
                m_srcMapControl.Map.Refresh();

                recordset.Dispose();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }
コード例 #20
0
        /// <summary>
        /// 鼠标移动时绘制捕捉框
        /// Draw the snap box when the mouse moves
        /// </summary>
        /// <param name="point"></param>
        public void SetBound(Point point)
        {
            try
            {
                // 清除跟踪图层上的捕捉框
                // Clear snap box on the tracking layer
                Int32 indexSnapPane = m_trackingLayer.IndexOf("snapPane");
                if (indexSnapPane != -1)
                {
                    m_trackingLayer.Remove(indexSnapPane);
                    m_mapControl.Map.RefreshTrackingLayer();
                }

                // 将屏幕坐标转换为地图坐标
                // Transform the pixel coordinates to the map coordinates
                Point2D mapPoint = m_mapControl.Map.PixelToMap(point);

                Double scale = (3 * 10E-4) / m_mapControl.Map.Scale;
                m_selection = m_layerStop.HitTest(mapPoint, 4 / 3 * scale);
                if (m_selection != null && m_selection.Count > 0)
                {
                    Recordset recordset = m_selection.ToRecordset();
                    GeoPoint  stopPoint = recordset.GetGeometry() as GeoPoint;

                    // 构造捕捉框
                    // Build the snap box
                    Point2Ds points = new Point2Ds();
                    points.Add(new Point2D(stopPoint.X - scale, stopPoint.Y - scale));
                    points.Add(new Point2D(stopPoint.X + scale, stopPoint.Y - scale));
                    points.Add(new Point2D(stopPoint.X + scale, stopPoint.Y + scale));
                    points.Add(new Point2D(stopPoint.X - scale, stopPoint.Y + scale));
                    points.Add(new Point2D(stopPoint.X - scale, stopPoint.Y - scale));
                    GeoLine snapPane = new GeoLine(points);

                    m_mapControl.SelectionTolerance = 2.0;
                    m_trackingLayer.Add(snapPane, "snapPane");
                    m_mapControl.Map.RefreshTrackingLayer();

                    recordset.Dispose();
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }
コード例 #21
0
        private void btnGetCamera_Click(object sender, EventArgs e)
        {
            Recordset objRt = null;

            try
            {
                if (dg_Data.SelectedRows.Count == 0)
                {
                    m_Application.MessageBox.Show("未选中数据!");
                    return;
                }
                DataGridViewRow  row  = dg_Data.SelectedRows[0];
                ResourceTypeData data = cmbDeviceType.SelectedItem as ResourceTypeData;
                objRt = (m_Application.Workspace.Datasources["Resource"].Datasets[data.DatasetName] as DatasetVector).GetRecordset(false, CursorType.Dynamic);
                if (objRt.SeekID(Convert.ToInt32(row.Tag)) && objRt.Edit())
                {
                    objRt.SetFieldValue("Longitude", m_SceneControl.Scene.Camera.Longitude);
                    objRt.SetFieldValue("Latitude", m_SceneControl.Scene.Camera.Latitude);
                    objRt.SetFieldValue("Altitude", m_SceneControl.Scene.Camera.Altitude);
                    objRt.SetFieldValue("Heading", m_SceneControl.Scene.Camera.Heading);
                    objRt.SetFieldValue("Tilt", m_SceneControl.Scene.Camera.Tilt);

                    if (objRt.Update())
                    {
                        m_Application.MessageBox.Show("视角保存成功!");
                    }
                    else
                    {
                        m_Application.MessageBox.Show("视角保存失败!");
                    }
                }
            }
            catch (Exception ex)
            {
                Log.OutputBox(ex);
            }
            finally
            {
                if (objRt != null)
                {
                    objRt.Close();
                    objRt.Dispose();
                }
            }
        }
コード例 #22
0
        private void Button_allval_Click(object sender, EventArgs e)
        {
            try
            {
                if (LV_fieldinfo.SelectedItems.Count == 1)
                {
                    LB_allval.Items.Clear();

                    string selFieldname = LV_fieldinfo.SelectedItems[0].Text;
                    if (selFieldname == "*")
                    {
                        return;
                    }
                    Recordset recordset = mData.GetRecordset(false, CursorType.Dynamic);
                    recordset.MoveFirst();
                    while (!recordset.IsEOF)
                    {
                        object allvalue = recordset.GetFieldValue(selFieldname);
                        if (allvalue == null)
                        {
                            return;
                        }
                        if (LB_allval.Items.Contains("\'" + allvalue + "\'"))
                        {
                            recordset.MoveNext();
                            continue;
                        }
                        else
                        {
                            LB_allval.Items.Add("\'" + allvalue + "\'");
                        }
                        recordset.MoveNext();
                    }
                    recordset.Dispose();
                }
                if (LV_fieldinfo.SelectedItems.Count > 1)
                {
                    MessageBox.Show("只能选择一个字段");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("error:" + ex.Message);
            }
        }
コード例 #23
0
ファイル: 图查属性.cs プロジェクト: sishui198/Wetland-GIS
        private void 图查属性_Load(object sender, EventArgs e)
        {
            dataGridView1.AllowUserToAddRows = false;
            dataGridView1.ReadOnly           = true;
            this.dataGridView1.Columns.Clear();
            this.dataGridView1.Rows.Clear();
            Recordset recordset = Program.re;

            for (int i = 0; i < recordset.FieldCount; i++)
            {
                //定义并获得字段名称
                String fieldName = recordset.GetFieldInfos()[i].Name;

                //将得到的字段名称添加到dataGridView列中
                this.dataGridView1.Columns.Add(fieldName, fieldName);
            }

            //初始化row
            DataGridViewRow row = null;

            //根据选中记录的个数,将选中对象的信息添加到dataGridView中显示
            while (!recordset.IsEOF)
            {
                row = new DataGridViewRow();
                for (int i = 0; i < recordset.FieldCount; i++)
                {
                    //定义并获得字段值
                    Object fieldValue = recordset.GetFieldValue(i);
                    //将字段值添加到dataGridView中对应的位置
                    DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell();
                    if (fieldValue != null)
                    {
                        cell.ValueType = fieldValue.GetType();
                        cell.Value     = fieldValue;
                    }
                    row.Cells.Add(cell);
                }

                this.dataGridView1.Rows.Add(row);

                recordset.MoveNext();
            }
            this.dataGridView1.Update();
            recordset.Dispose();
        }
コード例 #24
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            if (textBoxX1.Text.Length == 0)
            {
                MessageBox.Show("查询信息不能为空");
                return;
            }
            Int32 layerCount = SampleRun.mapControl1.Map.Layers.Count;

            if (layerCount == 0)
            {
                MessageBox.Show("请先打开一个矢量数据集!");
                return;
            }
            QueryParameter queryParameter = new QueryParameter();

            queryParameter.AttributeFilter = textBoxX1.Text;
            queryParameter.CursorType      = CursorType.Static;
            Boolean hasGeometry = false;

            foreach (Layer layer in SampleRun.mapControl1.Map.Layers)
            {
                DatasetVector dataset = layer.Dataset as DatasetVector;
                if (dataset == null)
                {
                    continue;
                }
                Recordset recordset = dataset.Query(queryParameter);
                if (recordset.RecordCount > 0)
                {
                    hasGeometry = true;
                }
                Selection selection = layer.Selection;
                selection.FromRecordset(recordset);
                recordset.Dispose();
            }
            if (!hasGeometry)
            {
                MessageBox.Show("没有符合查询条件的结果或查询条件有误,请重新确认后查询!");
            }
            queryParameter.Dispose();
            SampleRun.mapControl1.Refresh();
            hasGeometry = false;
            this.Close();
        }
コード例 #25
0
        /// <summary>
        /// 鼠标单击事件来实现画点的功能
        /// </summary>
        /// <param routestopName="sender"></param>
        /// <param routestopName="e"></param>
        private void m_sceneControl_MouseClick(object sender, MouseEventArgs e)
        {
            try
            {
                if (e.Button == MouseButtons.Left && isDraw)
                {
                    //画点
                    if (!flag)
                    {
                        Datasource    datasource   = m_workspace.Datasources[0];
                        DatasetVector pointDataset = datasource.Datasets["Point3D"] as DatasetVector;
                        Recordset     recordset    = pointDataset.GetRecordset(false, CursorType.Dynamic);

                        Point3D pt3d = new Point3D();
                        pt3d = m_sceneControl.Scene.PixelToGlobe(e.Location, PixelToGlobeMode.TerrainAndModel);
                        GeoPoint3D geopoint3D = new GeoPoint3D(pt3d);

                        GeoStyle3D geoStyle = new GeoStyle3D();
                        geoStyle.MarkerSymbolID    = m_marker3DIndex;
                        geoStyle.IsMarkerSizeFixed = false;
                        geoStyle.MarkerSize        = 1;
                        geoStyle.Marker3DScaleX    = 1;
                        geoStyle.Marker3DScaleY    = 1;
                        geoStyle.Marker3DScaleZ    = 1;
                        geoStyle.IsMarker3D        = true;
                        geoStyle.AltitudeMode      = AltitudeMode.RelativeToGround;
                        geopoint3D.Style3D         = geoStyle;

                        recordset.MoveLast();
                        recordset.AddNew(geopoint3D);
                        recordset.Update();
                        recordset.Dispose();

                        m_layer3DPoint.IsSelectable = false;
                        m_layer3DPoint.UpdateData();
                        m_sceneControl.Scene.Refresh();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #26
0
        private void btnCommit_Click(object sender, EventArgs e)
        {
            Recordset objRt = null;

            try
            {
                if (chkFlyRoute.CheckedItems.Count == 0)
                {
                    m_Application.MessageBox.Show("请选择要提交的路线!");
                    return;
                }
                objRt = (m_Application.Workspace.Datasources["CommonData"].Datasets["FlyRouteTable"] as DatasetVector).GetRecordset(false, CursorType.Dynamic);
                Recordset.BatchEditor editor = objRt.Batch;
                editor.MaxRecordCount = 10;
                editor.Begin();
                int index = 1;
                foreach (object obj in chkFlyRoute.CheckedItems)
                {
                    Label label = obj as Label;
                    Route route = label.Tag as Route;
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("RouteID", index++.ToString());
                    dic.Add("RouteName", route.Name);
                    dic.Add("Content", Encoding.Default.GetBytes(route.ToXML()));
                    objRt.AddNew(null, dic);
                }
                editor.Update();
                m_Application.MessageBox.Show("路线入库成功!");
            }
            catch (Exception ex)
            {
                Log.OutputBox(ex);
                m_Application.MessageBox.Show("路线入库失败!");
            }
            finally
            {
                if (objRt != null)
                {
                    objRt.Close();
                    objRt.Dispose();
                }
            }
        }
コード例 #27
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            if (textBoxX1.Text.Length == 0)
            {
                MessageBox.Show("查询信息不能为空");
                return;
            }
            Int32 layerCount = SampleRun.mapControl1.Map.Layers.Count;

            if (layerCount == 0)
            {
                MessageBox.Show("请先打开一个矢量数据集!");
                return;
            }
            string         fh             = comboBoxEx3.SelectedItem.ToString();
            string         tx             = textBoxX1.Text.ToString();
            string         sql            = tc + fh + tx;
            QueryParameter queryParameter = new QueryParameter();

            queryParameter.AttributeFilter = sql;
            queryParameter.CursorType      = CursorType.Static;

            Boolean       hasGeometry = false;
            DatasetVector dataset     = SampleRun.mapControl1.Map.Layers[nm].Dataset as DatasetVector;
            Recordset     recordset   = dataset.Query(queryParameter);

            if (recordset.RecordCount > 0)
            {
                hasGeometry = true;
            }
            Selection selection = SampleRun.mapControl1.Map.Layers[nm].Selection;

            selection.FromRecordset(recordset);
            recordset.Dispose();
            if (!hasGeometry)
            {
                MessageBox.Show("没有符合查询条件的结果或查询条件有误,请重新确认后查询!");
            }
            queryParameter.Dispose();
            SampleRun.mapControl1.Refresh();
            hasGeometry = false;
            this.Close();
        }
コード例 #28
0
        /// <summary>
        /// 按照各种算子进行查询
        /// Query with the specified parameters
        /// </summary>
        /// <param name="mode"></param>
        public void Query(SpatialQueryMode mode)
        {
            try
            {
                // 获取地图中的选择集,并转换为记录集
                // Get the dataset in the map, and convert it to recordset.
                Selection[] selections = m_mapControl.Map.FindSelection(true);
                Selection   selection  = selections[0];
                Recordset   recordset  = selection.ToRecordset();

                // 设置查询参数
                // Set the query parameter.
                QueryParameter parameter = new QueryParameter();
                parameter.SpatialQueryObject = recordset;
                parameter.SpatialQueryMode   = mode;

                // 对指定查询的图层进行查询
                // Query the specified layer.
                Layer         layer   = this.GetLayerByCaption(m_queriedLayerName);
                DatasetVector dataset = layer.Dataset as DatasetVector;

                Recordset recordset2 = dataset.Query(parameter);
                layer.Selection.FromRecordset(recordset2);

                layer.Selection.Style.LineColor = Color.Red;
                layer.Selection.Style.LineWidth = 0.6;
                layer.Selection.SetStyleOptions(StyleOptions.FillSymbolID, true);
                layer.Selection.Style.FillSymbolID    = 1;
                layer.Selection.IsDefaultStyleEnabled = false;

                recordset2.Dispose();

                // 刷新地图
                // Refresh the map.
                m_mapControl.Map.Refresh();

                recordset.Dispose();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }
コード例 #29
0
        /// <summary>
        /// 鼠标点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mSceneControl_MouseDown(object sender, MouseEventArgs e)
        {
            //右击
            if (e.Button == MouseButtons.Right)
            {
                switch (mIndex)
                {
                case 8:
                    mFlag  = 0;
                    mIndex = 0;
                    TempGeoLine.Clear();
                    mSceneControl.ObjectSelected -= new ObjectSelectedEventHandler(mSceneControlSelected);
                    mSceneControl.Action          = Action3D.Pan2;
                    break;

                case 9:
                    mFlag  = 0;
                    mIndex = 0;
                    TempGeoLine.Clear();
                    mSceneControl.ObjectSelected -= new ObjectSelectedEventHandler(mSceneControlSelected);
                    mSceneControl.Action          = Action3D.Pan2;
                    break;

                case 10:
                    mFlag     = 0;
                    mIndex    = 0;
                    mAltitude = 0;
                    TempGeoLine.Clear();
                    mSceneControl.ObjectSelected -= new ObjectSelectedEventHandler(mSceneControlSelected);
                    mSceneControl.Action          = Action3D.Pan2;
                    break;

                case 11:
                    mFlag  = 0;
                    mIndex = 0;
                    TempRecordset.Dispose();
                    TempGeoLine.Clear();
                    mSceneControl.ObjectSelected -= new ObjectSelectedEventHandler(mSceneControlSelected);
                    mSceneControl.Action          = Action3D.Pan2;
                    break;
                }
            }
        }
コード例 #30
0
 /// <summary>
 /// MapControl MouseDown事件
 /// MapControl MouseDown event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void m_mapControl_MouseDown(object sender, MouseEventArgs e)
 {
     try
     {
         if (e.Button == MouseButtons.Left)
         {
             Selection selection = m_layerPoint.Selection;
             if (selection == null || selection.Count == 0)
             {
                 selection = m_layerLine.Selection;
             }
             if (m_mapControl.Action == SuperMap.UI.Action.Select && e.Clicks == 1 &&
                 (m_selectMode == SelectMode.SELECTPOINT || m_selectMode == SelectMode.SELECTBARRIER ||
                  m_selectMode == SelectMode.SELECTEVENT))
             {
                 if (selection.Count <= 0)
                 {
                     if (SuperMap.Data.Environment.CurrentCulture != "zh-CN")
                     {
                         MessageBox.Show("The coordinates exceed the tolerance. Invalid!");
                     }
                     else
                     {
                         MessageBox.Show("坐标点超出选择容限,不能作为分析点");
                     }
                 }
                 else
                 {
                     //根据选择的不同,构造点对象
                     m_recordset = selection.ToRecordset();
                     Geometry geometry = m_recordset.GetGeometry();
                     AddPoint(geometry);
                     m_recordset.Dispose();
                 }
             }
         }
     }
     catch (System.Exception ex)
     {
         Trace.WriteLine(ex.Message);
     }
 }