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

📄 printmainwebform.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_PrintMainWebForm : System.Web.UI.Page
{
    #region 属性 
    /// <summary>
    /// 当前台站查询结果
    /// </summary>
    private DataSet TZResult
    {
        set
        {
            Session["MainTZResult"] = value;
        }
        get
        {
            if (Session["MainTZResult"] == null)
                return null;
            return (DataSet)Session["MainTZResult"];
        }
    }
    /// <summary>
    /// 当前画在地图上的台站集合
    /// </summary>
    private ArrayList CurTZList
    {
        set
        {
            Session["MainCurTZList"] = value;
        }
        get
        {
            if (Session["MainCurTZList"] == null)
                return null;
            return (ArrayList)Session["MainCurTZList"];
        }
    }
    /// <summary>
    /// 记录当前地图上画链路的台站集合(主要用在地图打印)
    /// </summary>
    private ArrayList CurLLMapCoordList
    {
        set
        {
            Session["MainCurLLMapCoordList"] = value;
        }
        get
        {
            if (Session["MainCurLLMapCoordList"] == null)
                return new ArrayList();
            return (ArrayList)Session["MainCurLLMapCoordList"];
        }
    }
    /// <summary>
    /// 记录当前地图方位角信息(包括方位角的两个台站和之间的关系)(主要用在地图打印)
    /// </summary>
    private ArrayList CurFWJList
    {
        set
        {
            Session["MainCurFWJList"] = value;
        }
        get
        {
            if (Session["MainCurFWJList"] == null)
                return new ArrayList();
            return (ArrayList)Session["MainCurFWJList"];
        }
    }
    /// <summary>
    /// 把当前地图按照一定比例进行放大
    /// </summary>
    private float CurScale
    {
        set
        {
            Session["MainCurScale"] = value;
        }
        get
        {
            if (Session["MainCurScale"] == null)
                return 0;
            return (float)Session["MainCurScale"];
        }
    }
    /// <summary>
    /// 地图 当前显示的矩形
    /// </summary>
    private MapRect MapCurRect
    {
        set
        {
            Session["MainMapCurRect"] = value;
        }
        get
        {
            if (Session["MainMapCurRect"] == null)
                return null;
            return (MapRect)Session["MainMapCurRect"];
        }
    }
    /// <summary>
    /// 地图查询的类型
    /// </summary>
    private string QueryMapType
    {
        set
        {
            Session["MainQueryMapType"] = value;
        }
    }
    /// <summary>
    /// 地图查询的两点坐标
    /// </summary>
    private MapCoord[] MapQueryMapCoords
    {
        set
        {
            Session["MainMapQueryMapCoords"] = value;
        }
    }
    #endregion
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void img02_Click(object sender, ImageClickEventArgs e)
    {
        this.MapControl1.Zoom(2);
    }
    protected void img03_Click(object sender, ImageClickEventArgs e)
    {
        this.MapControl1.Zoom(0.5);
    }
    protected void Page_PreRender(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            InitMapControl();
            InitMapBounds();
    
            InsertTZIntoMap();
            DrawLL();
            DrawFWJ();
            MapQueryByType();
        }
    }

    /// <summary>
    /// 初始化地图控件的尺寸(根据主页面地图控件的尺寸)
    /// </summary>
    private void InitMapControl()
    {
        if (Session["MapControlWidth"] != null)
        {
            MapControl1.Width = Convert.ToInt16(Session["MapControlWidth"]);
        }
        if (Session["MapControlHeight"] != null)
        {
            MapControl1.Height = Convert.ToInt16(Session["MapControlHeight"]);
        }
    }
    /// <summary>
    /// 
    /// </summary>
    private void InitMapBounds()
    {
        if (Session["MapCurRect"] != null)
            MapControl1.ViewByBounds((SuperMap.IS.Utility.MapRect)Session["MapCurRect"]);
        if (Session["CurMapLayerConfigTable"] != null)  //设置当前地图中图层的显示/隐藏,与主页中一致
        {
            DataTable dt = (DataTable)Session["CurMapLayerConfigTable"];
            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();
            MapControl1.ViewScale = MapControl1.ViewScale + 0.000000842784749034736;
            MapControl1.Update();
        }
    }
    /// <summary>
    /// 把在主页面中查询的台站信息画在地图上
    /// </summary>
    private void InsertTZIntoMap()
    {
        if (Session["CurTZList"] != null)   //在主页面中台站的查询结果
            InsertTZIntoMap((ArrayList)Session["CurTZList"]);
    }

    /// <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 (Session["CurLLMapCoordList"] != null)   //在主页面中链路信息
            DrawLL((ArrayList)Session["CurLLMapCoordList"]);
    }
    /// <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 (Session["CurFWJList"] != null)   //在主页面中链路信息
            DrawFWJ((ArrayList)Session["CurFWJList"]);
    }
    /// <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
        {
            string type = Session["QueryMapType"].ToString();
            if (type == null || type == "")
                return;
            MapCoord[] coords = (MapCoord[])Session["MapQueryMapCoords"];
            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
        {
        }
    }
    protected void MapControl1_ViewBoundsChanged(object sender, SuperMap.IS.WebControls.EventArguments.ViewBoundsChangedEventArgs e)
    {
        this.MapCurRect = MapControl1.ViewBounds;
    }
}

⌨️ 快捷键说明

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