⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 printmapwebform.aspx.cs

📁 supermap开发的基站管理系统
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;

using SuperMap.IS.Utility;
using SuperMap.IS.Web;
using SuperMap.IS.WebControls;
using SuperMap.IS.ServiceInterface;

public partial class Gis_PrintMapWebForm : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Page_PreRender(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            InitMapControl();
           // InitMapBounds();
           // if (Session["CurMapScale"] == null)
                InitMapBounds();
            //else
            //{
            //    try
            //    {
            //        double scale = (double)Session["CurMapScale"];
            //        this.MapControl1.ViewScale = scale;
            //        this.MapControl1.Update();
            //    }
            //    catch
            //    {
            //        InitMapBounds();
            //    }
            //}
            InsertTZIntoMap();
            DrawLL();
            DrawFWJ();
            MapQueryByType();
        }
    }
   
    /// <summary>
    /// 初始化地图控件的尺寸(根据主页面地图控件的尺寸)
    /// </summary>
    private void InitMapControl()
    {
        if(Global.CurMapWidth.Contains(Request["pageTime"].ToString()))
        {
            MapControl1.Width = Convert.ToInt16(Global.CurMapWidth[Request["pageTime"].ToString()]) ;
        }
        if (Global.CurMapHeight.Contains(Request["pageTime"].ToString()))
        {
            MapControl1.Height = Convert.ToInt16(Global.CurMapHeight[Request["pageTime"].ToString()]);
        }
    }
    /// <summary>
    /// 
    /// </summary>
    private void InitMapBounds()
    {
        if (Global.CurMapRect.Contains(Request["pageTime"].ToString()))
            MapControl1.ViewByBounds((SuperMap.IS.Utility.MapRect)Global.CurMapRect[Request["pageTime"].ToString()]);
        if (Global.CurMapCurLayerConfig.Contains(Request["pageTime"].ToString())) //设置当前地图中图层的显示/隐藏,与主页中一致
        {
            DataTable dt = (DataTable)Global.CurMapCurLayerConfig[Request["pageTime"].ToString()];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (MapControl1.Layers.Length> i)
                {
                    MapControl1.Layers[i].Visible = Convert.ToBoolean(dt.Rows[i][0]);
                }
            }
            MapControl1.Update();
        }
    }
    /// <summary>
    /// 把在主页面中查询的台站信息画在地图上
    /// </summary>
    private void InsertTZIntoMap()
    {
        if (Global.CurTZList.Contains(Request["pageTime"].ToString()))  //在主页面中台站的查询结果
            InsertTZIntoMap((ArrayList)Global.CurTZList[Request["pageTime"].ToString()]);
    }
   
    /// <summary>
    /// 把台站信息画在地图上
    /// </summary>
    /// <param name="tzList"></param>
    private void InsertTZIntoMap(ArrayList tzList)
    {
        try
        {
            if (tzList == null || tzList.Count == 0)
            {
               // ShowDialog("没有满足条件的数据!");
                return;
            }
            int index = 0;
            tranStationInfo stationInfo;
            double x = 0, y = 0;
            foreach (object tz in tzList)
            {
                
                stationInfo = (tranStationInfo)tz;
                if (stationInfo.STAT_LG == "" || stationInfo.STAT_LA == "")
                    continue;
                if (MapControl1.ViewBounds.Contains(Convert.ToDouble(stationInfo.STAT_LG), Convert.ToDouble(stationInfo.STAT_LA)))
                {
                    index = MapControl1.CustomLayer.Marks.Count + 1;
                    string image = StaticClass.GetImageStrByType(stationInfo);
                    MapControl1.CustomLayer.Marks.Add(string.Format("image{0}", index), Convert.ToDouble(stationInfo.STAT_LG), Convert.ToDouble(stationInfo.STAT_LA), image);
                }
                MapControl1.CustomLayer.Visible = true;

            }
            MapControl1.Update();
          //  GetCoord(tzList);
        }
        catch (Exception e)
        {
          //  ShowDialog("台站信息有错误,请验证台站信息!");
        }

    }
    /// <summary>
    /// 把主页上的链路信息画到该页面上
    /// </summary>
    private void DrawLL()
    {
        if (Global.CurTZLLList.Contains(Request["pageTime"].ToString()))   //在主页面中链路信息
            DrawLL((ArrayList)Global.CurTZList[Request["pageTime"].ToString()]);
    }
    /// <summary>
    /// 画链路
    /// </summary>
    /// <param name="mapCoordsList"></param>
    private void DrawLL(ArrayList mapCoordsList)
    {
        MapCoord[] mapCoords;
        foreach (object item in mapCoordsList)
        {
            mapCoords = (MapCoord[])item;
            if (mapCoords.Length > 1)
                continue;
            this.MapControl1.CustomLayer.Lines.Add("line" + this.MapControl1.CustomLayer.Lines.Count.ToString(), mapCoords, "0.0001", "Red");
        }
        this.MapControl1.CustomLayer.Visible = true;
        this.MapControl1.Update();
    }
    /// <summary>
    /// 把主页上的方位角信息画到该页面上
    /// </summary>
    private void DrawFWJ()
    {
        if (Global.CurTZFWJList.Contains(Request["pageTime"].ToString()))   //在主页面中链路信息
            DrawFWJ((ArrayList)Global.CurTZFWJList[Request["pageTime"].ToString()]);
    }
    /// <summary>
    /// 画方位角
    /// </summary>
    /// <param name="fwjList"></param>
    private void DrawFWJ(ArrayList fwjList)
    {
        ArrayList fwj;
        MapCoord[] mapCoords;
        foreach (object item in fwjList)
        {
            fwj = (ArrayList)item;
            if (fwj.Count < 2)
                continue;
            mapCoords = (MapCoord[])fwj[0];
            this.MapControl1.CustomLayer.Lines.Add("line" + this.MapControl1.CustomLayer.Lines.Count.ToString(), mapCoords, "0.0001", "Red");
            this.MapControl1.CustomLayer.Marks.Add(this.MapControl1.CustomLayer.Marks.Count.ToString(), mapCoords[1].X,  mapCoords[1].Y, fwj[1].ToString ());
         
        }
        this.MapControl1.CustomLayer.Visible = true;
        this.MapControl1.Update();
        
        
    }
    /// <summary>
    /// 在地图上画出查询区域
    /// </summary>
    private void MapQueryByType()
    {
        try
        {
            if (Global.CurQueryMapType.Contains(Request["pageTime"].ToString()))
            {
                string type = Global.CurQueryMapType[Request["pageTime"].ToString()].ToString();
                if (type == null || type == "")
                    return;
                MapCoord[] coords = (MapCoord[])Global.CurQueryMapCoords[Request["pageTime"].ToString()];
                if (coords.Length < 2)
                    return;
                QueryParam param = new QueryParam();
                param.Highlight.HighlightQueryArea = true;
                param.Highlight.QueryAreaStyle = new SuperMap.IS.Utility.Style();
                param.Highlight.QueryAreaStyle.PenColor = Convertor.SystemColorToIntegerColor(Color.Blue);
                param.Highlight.QueryAreaStyle.BrushColor = Convertor.SystemColorToIntegerColor(Color.Blue);
                param.Highlight.QueryAreaStyle.BrushBackTransparent = true;
                param.Highlight.QueryAreaStyle.BrushStyle = 2;
                param.Layers = new QueryLayer[0];
                param.IsAllLayer = false;
                if (type == "CIRCLEQUERY")
                {
                    double distance = StaticClass.GetDistanceByTwoPoint(coords[0].X, coords[0].Y, coords[1].X, coords[1].Y);
                    this.MapControl1.QueryByDistance(coords[0], distance, param);
                }
                else
                {
                    MapRect rect = new MapRect();
                    rect.LeftBottom = new MapCoord(coords[0].X, coords[1].Y);
                    rect.RightTop = new MapCoord(coords[1].X, coords[0].Y);

                    this.MapControl1.QueryByRect(rect, param);
                }
            }
        }
        catch
        {
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -