Beispiel #1
0
        protected override void toolBar_ButtonClick(object sender, ToolBarButtonClickEventArgs e)
        {
            if (e.Button.Equals(tbUpdateData))
            {
                if (currentLayer == null)
                {
                    currentLayer = new MapServerLayer(msServer.Text,
                                                      MapServerService.WMS, MapServerVersion.v1_1_1);
                }
                else
                {
                    currentLayer.GetData();
                }
                fillDialogWithData(currentLayer);
                return;
            }
            else if (e.Button.Equals(tbOkButton))
            {
                if (currentLayer == null)
                {
                    currentLayer = new MapServerLayer(msServer.Text,
                                                      MapServerService.WMS, MapServerVersion.v1_1_1);
                }

                saveData();
            }
            else if (e.Button.Equals(tbCancelButton))
            {
                base.toolBar_ButtonClick(sender, e);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 获取ArcGISServer服务图层
        /// </summary>
        /// <param name="serverUrl"></param>服务器地址
        /// <param name="mapservername"></param>地图服务名称
        /// <param name="isLan"></param>地图服务是局域网内还是互联网上的
        /// <returns></returns>
        public ILayer GetARGServerLyr(String serverUrl, String mapservername, bool isLan)
        {
            ILayer lyr = null;

            //获得服务对象名称
            try
            {
                IAGSServerObjectName pServerObjectName = GetAGSMapServer(serverUrl, mapservername, isLan);//获取地图
                IName pName = (IName)pServerObjectName;
                //访问地图服务
                IAGSServerObject pServerObject = (IAGSServerObject)pName.Open();
                IMapServer       pMapServer    = (IMapServer)pServerObject;
                mapserver = pMapServer;//获取地图服务对象

                IMapServerLayer pMapServerLayer = new MapServerLayer() as IMapServerLayer;
                //连接地图服务
                pMapServerLayer.ServerConnect(pServerObjectName, pMapServer.DefaultMapName);
                //添加数据图层
                lyr = pMapServerLayer as ILayer;
            }
            catch (Exception ex)
            {
                MessageBox.Show("服务器配置信息错误,请到“系统管理-系统配置”设置", "连接失败");
            }

            return(lyr);
        }
Beispiel #3
0
        public DialogResult ShowDialog(MapServerLayer layer)
        {
            this.currentLayer = layer;

            if (layer == null)
            {
                layerTabControl.SelectedIndex = 1;
            }
            else
            {
                layerTabControl.SelectedIndex = 0;
                fillDialogWithData(layer);
            }

            return(base.ShowDialog());
        }
Beispiel #4
0
 /// <summary>
 /// Sets AGS layer visibility
 /// </summary>
 /// <param name="pMSLayer"></param>
 /// <param name="strSecretName"></param>
 private void setAGSLayerVisiblity(MapServerLayer pMSLayer, string strSecretName)
 {
     //make them all non-visible
     if (pMSLayer is ICompositeLayer)
     {
         ICompositeLayer ipCompLayer = (ICompositeLayer)pMSLayer;
         for (int idx = 0; idx < ipCompLayer.Count; idx++)
         {
             if (ipCompLayer.get_Layer(idx).Name == strSecretName)
             {
                 ipCompLayer.get_Layer(idx).Visible = true;
             }
             else
             {
                 ipCompLayer.get_Layer(idx).Visible = false;
             }
         }
     }
 }
Beispiel #5
0
        private void fillDialogWithData(MapServerLayer layer)
        {
            if (layer.IsUptodate)
            {
                this.layerTabControl.Controls.Add(this.layerTab);
                this.layerTabControl.Controls.Add(this.infoTab);

                this.bListViewClicked = false;
                availLayersView.Clear();
                this.availLayersView.Columns.Add("Name", 120, HorizontalAlignment.Left);
                msLm = layer.ConcreteLayer.LayerManager;
                for (int i = 0; i < msLm.LayerCount; i++)
                {
                    MSLayer      concreteLayer = msLm.getLayer(i);
                    ListViewItem lItem         = new ListViewItem(concreteLayer.Title);
                    availLayersView.Items.Add(lItem);
                    availLayersView.Items[i].Checked = concreteLayer.Visible;
                }
                this.bListViewClicked = true;

                layerNameTextBox.Text    = currentLayer.LayerName;
                layerCommentTextBox.Text = currentLayer.Comment;
                msServer.Text            = currentLayer.MapserverURL;

                // build tree

                this.infoTree.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
                    new TreeNode("Server"),
                    new TreeNode("Dienste"),
                    new TreeNode("Layer")
                });

                infoTree.Nodes[0].Nodes.Add("Name: " + currentLayer.ConcreteLayer.Name);
                infoTree.Nodes[0].Nodes.Add("Title: " + currentLayer.ConcreteLayer.Title);
                infoTree.Nodes[0].Nodes.Add("Abstract: " + currentLayer.ConcreteLayer.AbstractDesc);
                infoTree.Nodes[0].Nodes.Add("Kontakt: " + currentLayer.ConcreteLayer.ContactInfo);

                infoTree.Nodes[1].Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
                    new TreeNode("Anfragen"),
                    new TreeNode("Ausnahmen"),
                    new TreeNode("Benutzermöglichkeiten")
                });

                if (currentLayer.ConcreteLayer.Capabilities.GetCapabilitiesEnabled)
                {
                    infoTree.Nodes[1].Nodes[0].Nodes.Add("GetCapabilities");
                }
                if (currentLayer.ConcreteLayer.Capabilities.GetMapEnabled)
                {
                    infoTree.Nodes[1].Nodes[0].Nodes.Add("GetMap");
                }
                if (currentLayer.ConcreteLayer.Capabilities.GetFeatureInfoEnabled)
                {
                    infoTree.Nodes[1].Nodes[0].Nodes.Add("GetFeatureInfo");
                }
                if (currentLayer.ConcreteLayer.Capabilities.DescribeLayerEnabled)
                {
                    infoTree.Nodes[1].Nodes[0].Nodes.Add("DescribeLayer");
                }
                if (currentLayer.ConcreteLayer.Capabilities.GetLegendGraphicEnabled)
                {
                    infoTree.Nodes[1].Nodes[0].Nodes.Add("GetLegendGraphic");
                }
                if (currentLayer.ConcreteLayer.Capabilities.GetStylesEnabled)
                {
                    infoTree.Nodes[1].Nodes[0].Nodes.Add("GetStyles");
                }
            }
        }
Beispiel #6
0
        private void fillDialogWithData(MapServerLayer layer)
        {
            if (layer.IsUptodate)
            {
                this.layerTabControl.Controls.Add(this.layerTab);
                this.layerTabControl.Controls.Add(this.infoTab);

                this.bListViewClicked = false;
                availLayersView.Clear();
                this.availLayersView.Columns.Add("Name", 120, HorizontalAlignment.Left);
                msLm = layer.ConcreteLayer.LayerManager;
                for (int i = 0; i < msLm.LayerCount; i++)
                {
                    MSLayer concreteLayer = msLm.getLayer(i);
                    ListViewItem lItem = new ListViewItem(concreteLayer.Title);
                    availLayersView.Items.Add(lItem);
                    availLayersView.Items[i].Checked = concreteLayer.Visible;
                }
                this.bListViewClicked = true;

                layerNameTextBox.Text = currentLayer.LayerName;
                layerCommentTextBox.Text = currentLayer.Comment;
                msServer.Text = currentLayer.MapserverURL;

                // build tree

                this.infoTree.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
            new TreeNode("Server"),
            new TreeNode("Dienste"),
            new TreeNode("Layer")});

                infoTree.Nodes[0].Nodes.Add("Name: " + currentLayer.ConcreteLayer.Name);
                infoTree.Nodes[0].Nodes.Add("Title: " + currentLayer.ConcreteLayer.Title);
                infoTree.Nodes[0].Nodes.Add("Abstract: " + currentLayer.ConcreteLayer.AbstractDesc);
                infoTree.Nodes[0].Nodes.Add("Kontakt: " + currentLayer.ConcreteLayer.ContactInfo);

                infoTree.Nodes[1].Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
            new TreeNode("Anfragen"),
            new TreeNode("Ausnahmen"),
            new TreeNode("Benutzermöglichkeiten")});

                if (currentLayer.ConcreteLayer.Capabilities.GetCapabilitiesEnabled)
                    infoTree.Nodes[1].Nodes[0].Nodes.Add("GetCapabilities");
                if (currentLayer.ConcreteLayer.Capabilities.GetMapEnabled)
                    infoTree.Nodes[1].Nodes[0].Nodes.Add("GetMap");
                if (currentLayer.ConcreteLayer.Capabilities.GetFeatureInfoEnabled)
                    infoTree.Nodes[1].Nodes[0].Nodes.Add("GetFeatureInfo");
                if (currentLayer.ConcreteLayer.Capabilities.DescribeLayerEnabled)
                    infoTree.Nodes[1].Nodes[0].Nodes.Add("DescribeLayer");
                if (currentLayer.ConcreteLayer.Capabilities.GetLegendGraphicEnabled)
                    infoTree.Nodes[1].Nodes[0].Nodes.Add("GetLegendGraphic");
                if (currentLayer.ConcreteLayer.Capabilities.GetStylesEnabled)
                    infoTree.Nodes[1].Nodes[0].Nodes.Add("GetStyles");
            }
        }
Beispiel #7
0
        protected override void toolBar_ButtonClick(object sender, ToolBarButtonClickEventArgs e)
        {
            if (e.Button.Equals(tbUpdateData))
            {
                if (currentLayer == null)
                    currentLayer = new MapServerLayer(msServer.Text,
                        MapServerService.WMS, MapServerVersion.v1_1_1);
                else
                    currentLayer.GetData();
                fillDialogWithData(currentLayer);
                return;
            }
            else if (e.Button.Equals(tbOkButton))
            {
                if (currentLayer == null)
                    currentLayer = new MapServerLayer(msServer.Text,
                        MapServerService.WMS, MapServerVersion.v1_1_1);

                saveData();
            }
            else if (e.Button.Equals(tbCancelButton))

            base.toolBar_ButtonClick(sender, e);
        }
Beispiel #8
0
        public DialogResult ShowDialog(MapServerLayer layer)
        {
            this.currentLayer = layer;

            if (layer == null)
                layerTabControl.SelectedIndex = 1;
            else
            {
                layerTabControl.SelectedIndex = 0;
                fillDialogWithData(layer);
            }

            return base.ShowDialog();
        }
Beispiel #9
0
        public void addMapserverLayer(MapServerLayer mapserverLayer)
        {
            layerListViewMappingList.Add(LayerCount, LayerCount);
            layerArray.Add(mapserverLayer);

            if (LayerCount == 1)
                this.scale = this.firstScale = mainControler.MapPanel.calculateZoomFactor(mapserverLayer.Width, mapserverLayer.Height);

            if (LayerCount == 1) {
                mainControler.createNewCanvas(
                    mapserverLayer.BoundingBox.Left * firstScale,
                    mapserverLayer.BoundingBox.Top * firstScale, scale);
                mainControler.MapPanel.onLayerZoom(0);
            }

            addLayerPostProcessing(mapserverLayer);
        }
Beispiel #10
0
 /// <summary>
 /// Sets AGS layer visibility
 /// </summary>
 /// <param name="pMSLayer"></param>
 /// <param name="strSecretName"></param>
 private void setAGSLayerVisiblity(MapServerLayer pMSLayer, string strSecretName)
 {
     //make them all non-visible
     if (pMSLayer is ICompositeLayer)
     {
         ICompositeLayer ipCompLayer = (ICompositeLayer)pMSLayer;
         for (int idx = 0; idx < ipCompLayer.Count; idx++)
         {
             if (ipCompLayer.get_Layer(idx).Name == strSecretName)
             {
                 ipCompLayer.get_Layer(idx).Visible = true;
             }
             else
                 ipCompLayer.get_Layer(idx).Visible = false;
         }
     }
 }