Example #1
0
        public FrmHistory()
        {
            InitializeComponent();

            this.Tag = this.MainPanel;

            com_StartHour.SelectedIndex   = 0;
            com_StartMinute.SelectedIndex = 0;
            com_EndHour.SelectedIndex     = com_EndHour.Items.Count - 1;
            com_EndMinute.SelectedIndex   = com_EndMinute.Items.Count - 1;
            com_PlaySpeed.SelectedIndex   = 1;

            //初始化部门列表
            com_SelectDepartment.Items.Add("所有部门");
            for (int j = 0; j < DB_Service.MainDataSet.Tables["DepartmentTable"].Rows.Count; j++)
            {
                com_SelectDepartment.Items.Add(DB_Service.MainDataSet.Tables["DepartmentTable"].Rows[j]["DepartmentName"].ToString());
            }
            //加载地图图层
            DataRow[] rows = DB_Service.MainDataSet.Tables["LayerTable"].Select("DataSourceType = 2");
            for (int i = 0; i < rows.Length; i++)
            {
                CommonFun.AddLayer(rows[i]["TableOrShapeFile"].ToString(), this.mapImage, 5, -13);
            }

            //加载基站图层
            DataRow[] tempRows = DB_Service.MainDataSet.Tables["LayerTable"].Select("TableOrShapeFile = 'StationTable'");
            if (tempRows.Length > 0)
            {
                CommonFun.AddLayer(tempRows[0]["TableOrShapeFile"].ToString(), this.mapImage, 5, -13);
            }

            //初始化mapImage
            if (this.mapImage.Map.Layers.Count > 0)
            {
                try
                {
                    this.mapImage.Map.ZoomToExtents();
                }
                catch
                { }
                if (mapImage.Map.Zoom == 0.0)
                {
                    mapImage.Map.Zoom = 1.0;
                }
                this.mapImage.Map.MinimumZoom = Global.MapImageMinView;
                this.mapImage.Map.MaximumZoom = mapImage.Map.Zoom * 2;
                this.mapImage.ActiveTool      = SharpMap.Forms.MapImage.Tools.Pan;
                btn_Brows_Click(null, null);
            }
        }
Example #2
0
 /// <summary>
 /// 刷新地图设置
 /// </summary>
 private void RefreshMapSet()
 {
     this.mapImage.Map.Layers.Clear();
     listView_Layr.Items.Clear();
     com_MainMap.Items.Clear();
     MapLayerRow = null;
     //加载地图图层
     DataRow[] rows = DB_Service.MainDataSet.Tables["LayerTable"].Select("DataSourceType = 2");
     for (int i = 0; i < rows.Length; i++)
     {
         listView_Layr.Items.Add(new ListViewItem(new string[] { rows[i]["ViewOrder"].ToString(), rows[i]["LayerName"].ToString(), rows[i]["TableOrShapeFile"].ToString() }));
         com_MainMap.Items.Add(rows[i]["TableOrShapeFile"].ToString());
         CommonFun.AddLayer(rows[i]["TableOrShapeFile"].ToString(), this.mapImage, 5, -13);
     }
     //刷新Com_MainMap的Index
     RefreshComMainMapIndex();
     //清空详细显示
     tex_LayerName.Text         = "";
     tex_MapFile.Text           = "";
     tex_MinLabelZoom.Text      = "";
     tex_MaxLabelZoom.Text      = "";
     tex_ShowOrder.Text         = "";
     tex_LabelLayerColName.Text = "";
     //初始化mapImage
     this.mapImage.ActiveTool = SharpMap.Forms.MapImage.Tools.Pan;
     if (this.mapImage.Map.Layers.Count > 0)
     {
         try
         {
             this.mapImage.Map.ZoomToExtents();
         }
         catch
         { }
         if (mapImage.Map.Zoom == 0.0)
         {
             mapImage.Map.Zoom = 1.0;
         }
         this.mapImage.Map.MinimumZoom = Global.MapImageMinView;
         this.mapImage.Map.MaximumZoom = mapImage.Map.Zoom * 2;
         this.mapImage.Refresh();
         label_ZoomRuler.Text = "比例尺 1:" + Convert.ToString(Math.Round(mapImage.Map.Zoom, 0));
     }
     btn_MapSave.Visible  = false;
     btn_MapAbort.Visible = false;
 }
        private void com_Map_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.mapImage.Map.Layers.Clear();

            //加载地图图层
            DataRow[] rows = DB_Service.MainDataSet.Tables["LayerTable"].Select("DataSourceType = 2");
            for (int i = 0; i < rows.Length; i++)
            {
                CommonFun.AddLayer(rows[i]["TableOrShapeFile"].ToString(), this.mapImage, 5, -13);
            }

            //加载基站图层
            DataRow[] tempRows = DB_Service.MainDataSet.Tables["LayerTable"].Select("TableOrShapeFile = 'StationTable'");
            if (tempRows.Length > 0)
            {
                CommonFun.AddLayer(tempRows[0]["TableOrShapeFile"].ToString(), this.mapImage, 5, -13);
            }

            //初始化mapImage
            if (this.mapImage.Map.Layers.Count > 0)
            {
                try
                {
                    this.mapImage.Map.ZoomToExtents();
                }
                catch
                { }
                if (mapImage.Map.Zoom == 0.0)
                {
                    mapImage.Map.Zoom = 1.0;
                }
                this.mapImage.Map.MinimumZoom = Global.MapImageMinView;
                this.mapImage.Map.MaximumZoom = mapImage.Map.Zoom * 2;
                this.mapImage.ActiveTool      = SharpMap.Forms.MapImage.Tools.Pan;
                btn_Brows_Click(sender, e);
            }
        }