Exemple #1
0
        private void InitializeLayout()
        {
            try
            {
                LayoutElements elements = mapLayoutControl1.MapLayout.Elements;
                // 构造GeoMap
                // Create the GeoMap object.
                GeoMap geoMap = new GeoMap();

                geoMap.MapName = "地籍图";


                // 设置GeoMap对象的外切矩形
                // Set the exterior rectangle.
                Rectangle2D rect = new Rectangle2D(new Point2D(850, 1300), new Size2D(
                                                       1500, 1500));
                GeoRectangle geoRect = new GeoRectangle(rect, 0);
                geoMap.Shape = geoRect;
                elements.AddNew(geoMap);
                m_mapID = elements.GetID();

                // 构造指北针
                // Initialize the GeoNorthArrow
                GeoNorthArrow northArrow = new GeoNorthArrow(
                    NorthArrowStyleType.EightDirection,
                    new Rectangle2D(new Point2D(1400, 2250), new Size2D(350, 350)),
                    0);

                northArrow.BindingGeoMapID = m_mapID;

                elements.AddNew(northArrow);

                // 构造比例尺
                // Initialize the scale
                GeoMapScale scale = new GeoMapScale(m_mapID, new Point2D(125, 400), 50, 50);
                scale.LeftDivisionCount = 2;
                scale.ScaleUnit         = Unit.Kilometer;
                scale.SegmentCount      = 4;

                elements.AddNew(scale);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #2
0
        public gk065()
        {
            InitializeComponent();


            workspace1 = new SuperMap.Data.Workspace();

            /* WorkspaceConnectionInfo workspaceConnectionInfo = new WorkspaceConnectionInfo();
             * workspaceConnectionInfo.Type = WorkspaceType.Oracle;
             * workspaceConnectionInfo.Server = "ORCL";
             * workspaceConnectionInfo.Database = "";
             * workspaceConnectionInfo.Name = "workspace";
             * workspaceConnectionInfo.User = "******";
             * workspaceConnectionInfo.Password = "******";
             * workspace1.Open(workspaceConnectionInfo);*/
            workspace1.Open(gkfqd.Common.Tool.GetConnectionInfo());
            mapLayoutControl1.MapLayout.Workspace = workspace1;

            mapLayoutControl1.IsHorizontalScrollbarVisible = true;
            mapLayoutControl1.IsVerticalScrollbarVisible   = true;

            try
            {
                LayoutElements elements = mapLayoutControl1.MapLayout.Elements;
                //构造GeoMap
                GeoMap geoMap = new GeoMap();
                geoMap.MapName = "temp";

                //设置GeoMap对象的外切矩形
                Rectangle2D rect = new Rectangle2D(new Point2D(850, 1300), new Size2D(
                                                       1500, 1500));
                GeoRectangle geoRect = new GeoRectangle(rect, 0);
                geoMap.Shape = geoRect;
                elements.AddNew(geoMap);
                m_mapID = elements.GetID();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
            mapLayoutControl1.TrackMode = TrackMode.Edit;
            mapLayoutControl1.MapLayout.Zoom(4);
        }
Exemple #3
0
        private void AddMap(string mapName)
        {
            try
            {
                LayoutElements elements = mapLayoutControl1.MapLayout.Elements;
                //构造GeoMap
                GeoMap geoMapUse = new GeoMap();
                geoMapUse.MapName = mapName;


                // geoMapUse. = m_mapControl.Map;
                //设置GeoMap对象的外切矩形
                Rectangle2D rect = new Rectangle2D(new Point2D(850, 1300), new Size2D(
                                                       1500, 1500));
                GeoRectangle geoRect = new GeoRectangle(rect, 0);
                geoMapUse.Shape = geoRect;
                elements.AddNew(geoMapUse);
                m_mapID = elements.GetID();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }
Exemple #4
0
        public void InitializeLayout(string mapName)
        {
            try
            {
                LayoutElements elements = m_mapLayoutControl.MapLayout.Elements;
                // 构造GeoMap
                GeoMap geoMap = new GeoMap();

                //设置地图名称,在工作空间内的地图
                geoMap.MapName = mapName;

                // 设置GeoMap对象的外切矩形
                Rectangle2D  rect    = new Rectangle2D(new Point2D(1000, 1300), new Size2D(1500, 1500));
                GeoRectangle geoRect = new GeoRectangle(rect, 0);
                geoMap.Shape = geoRect;

                elements.AddNew(geoMap);
                m_mapID = elements.GetID();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }