예제 #1
0
        private void addWMS()
        {
            string selVal = searchResultsList.Text;
            List <ESRI.ArcGIS.GISClient.IWMSLayerDescription> lyrDescripts;
            string             lyrDlgName; string lyrName; string wmsUrl;
            layerSelectionForm lyrDlg;

            bool hasWms = metaList.geturl(selVal, "OGC:WMS", out wmsUrl, out lyrName);

            if (hasWms)
            {
                wmsUrl = wmsUrl.Split('?')[0] + "?";

                if (geopuntHelper.websiteExists(wmsUrl, true) == false)
                {
                    MessageBox.Show("Kan geen connectie maken met de Service.", "Connection timed out");
                    return;
                }

                try
                {
                    lyrDescripts = geopuntHelper.listWMSlayers(wmsUrl);
                    if (lyrDescripts.Count <= 2)
                    {
                        geopuntHelper.addWMS2map(ArcMap.Document.FocusMap, wmsUrl);
                        return;
                    }

                    lyrDlg = new layerSelectionForm(lyrDescripts, lyrName);
                    lyrDlg.ShowDialog(this);

                    lyrDlgName = lyrDlg.selectedLayerName;

                    if (lyrDlgName != null)
                    {
                        ILayer lyr = geopuntHelper.getWMSLayerByName(wmsUrl, lyrDlgName);
                        if (lyr != null)
                        {
                            ArcMap.Document.FocusMap.AddLayer(lyr);
                        }
                        else
                        {
                            geopuntHelper.addWMS2map(ArcMap.Document.FocusMap, wmsUrl);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + " : " + ex.StackTrace, "Error");
                }
            }
        }
예제 #2
0
        private void addWMS()
        {
            string selVal = searchResultsList.Text;
            List<ESRI.ArcGIS.GISClient.IWMSLayerDescription> lyrDescripts;
            string lyrDlgName; string lyrName; string wmsUrl;
            layerSelectionForm lyrDlg;

            bool hasWms = metaList.geturl(selVal, "OGC:WMS", out wmsUrl, out lyrName);
            if (hasWms)
            {
                wmsUrl = wmsUrl.Split('?')[0] + "?";

                if (geopuntHelper.websiteExists(wmsUrl, true) == false)
                {
                    MessageBox.Show("Kan geen connectie maken met de Service.", "Connection timed out");
                    return;
                }

                try
                {
                    lyrDescripts = geopuntHelper.listWMSlayers(wmsUrl);
                    if (lyrDescripts.Count <= 2)
                    {
                        geopuntHelper.addWMS2map(ArcMap.Document.FocusMap, wmsUrl);
                        return;
                    }

                    lyrDlg = new layerSelectionForm(lyrDescripts, lyrName);
                    lyrDlg.ShowDialog(this);

                    lyrDlgName = lyrDlg.selectedLayerName;

                    if (lyrDlgName != null)
                    {
                        ILayer lyr = geopuntHelper.getWMSLayerByName(wmsUrl, lyrDlgName);
                        if (lyr != null)
                        {
                            ArcMap.Document.FocusMap.AddLayer(lyr);
                        }
                        else
                        {
                            geopuntHelper.addWMS2map(ArcMap.Document.FocusMap, wmsUrl);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + " : " + ex.StackTrace, "Error");
                }
            }
        }