Beispiel #1
0
        internal override LayerBuilder getBuilder(DappleModel oModel)
        {
            WMSServerModelNode oServer = oModel.AddWMSServer(m_oServer as WMSServerUri, true, false, false) as WMSServerModelNode;

            if (oServer.Enabled == false)
            {
                if (DialogResult.Yes == MessageBox.Show(String.Format(CultureInfo.InvariantCulture, "The WMS server {1} is in your server list, but is disabled.{2}'{0}' cannot be displayed unless the server is re-enabled.{2}{2}Do you wish to enable {1}?", getAttribute("layer"), m_oServer.ServerTreeDisplayName, Environment.NewLine),
                                                        "Server is Disabled", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1))
                {
                    oModel.ToggleServer(oServer, true);
                }
                else
                {
                    return(null);
                }
            }

            oServer.WaitForLoad();
            if (oServer.LoadState == LoadState.LoadFailed)
            {
                Program.ShowMessageBox(String.Format(CultureInfo.InvariantCulture, "'{0}' could not be added. Connection with the server at URL '{1}' failed. Refreshing the server from the Servers tab may resolve this problem.", getAttribute("layer"), m_oServer.ServerTreeDisplayName),
                                       "Dataset Could Not Be Added", MessageBoxButtons.OK, MessageBoxDefaultButton.Button1, MessageBoxIcon.Error);
                return(null);
            }

            WMSLayerModelNode oLayer = oServer.GetLayer(getAttribute("layer"));

            if (oLayer == null)
            {
                throw new ArgumentException("'" + getAttribute("layer") + "' was not found. This dataset may have been deleted or moved." + Environment.NewLine + Environment.NewLine + "Please check with the publisher of " + m_oServer.ServerTreeDisplayName + " for more information.");
            }
            WMSServerBuilder oDummyServer = new WMSServerBuilder(null, m_oServer as WMSServerUri, oServer.CapabilitiesFilename, true);

            return(new WMSQuadLayerBuilder(oLayer.LayerData, MainForm.WorldWindowSingleton, oDummyServer, null));
        }
        internal WMSQuadLayerBuilder(WMSLayer layer, WorldWindow worldWindow, WMSServerBuilder server, IBuilder parent)
            : base(layer.Title, worldWindow, parent)
        {
            m_Server = server;
            m_wmsLayer = layer;
            distAboveSurface = 0;

            m_hBoundary = new GeographicBoundingBox((double)layer.North, (double)layer.South, (double)layer.West, (double)layer.East);

            // Determine the needed levels (function of tile size and resolution, for which we just use ~5 meters because it is not available with WMS)
            double dRes = 5.0 / 100000.0;
            if (dRes > 0)
            {
                double dTileSize = LevelZeroTileSize;
                m_iLevels = 1;
                while (dTileSize / Convert.ToDouble(TextureSizePixels) > dRes / 4.0)
                {
                    m_iLevels++;
                    dTileSize /= 2;
                }
            }
        }
        internal WMSQuadLayerBuilder(WMSLayer layer, WorldWindow worldWindow, WMSServerBuilder server, IBuilder parent)
            : base(layer.Title, worldWindow, parent)
        {
            m_Server         = server;
            m_wmsLayer       = layer;
            distAboveSurface = 0;

            m_hBoundary = new GeographicBoundingBox((double)layer.North, (double)layer.South, (double)layer.West, (double)layer.East);

            // Determine the needed levels (function of tile size and resolution, for which we just use ~5 meters because it is not available with WMS)
            double dRes = 5.0 / 100000.0;

            if (dRes > 0)
            {
                double dTileSize = LevelZeroTileSize;
                m_iLevels = 1;
                while (dTileSize / Convert.ToDouble(TextureSizePixels) > dRes / 4.0)
                {
                    m_iLevels++;
                    dTileSize /= 2;
                }
            }
        }
Beispiel #4
0
        internal override LayerBuilder getBuilder(DappleModel oModel)
        {
            WMSServerModelNode oServer = oModel.AddWMSServer(m_oServer as WMSServerUri, true, false, false) as WMSServerModelNode;
            if (oServer.Enabled == false)
                if (DialogResult.Yes == MessageBox.Show(String.Format(CultureInfo.InvariantCulture, "The WMS server {1} is in your server list, but is disabled.{2}'{0}' cannot be displayed unless the server is re-enabled.{2}{2}Do you wish to enable {1}?", getAttribute("layer"), m_oServer.ServerTreeDisplayName, Environment.NewLine),
                    "Server is Disabled", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1))
                    oModel.ToggleServer(oServer, true);
                else
                    return null;

            oServer.WaitForLoad();
            if (oServer.LoadState == LoadState.LoadFailed)
            {
                Program.ShowMessageBox(String.Format(CultureInfo.InvariantCulture, "'{0}' could not be added. Connection with the server at URL '{1}' failed. Refreshing the server from the Servers tab may resolve this problem.", getAttribute("layer"), m_oServer.ServerTreeDisplayName),
                    "Dataset Could Not Be Added", MessageBoxButtons.OK, MessageBoxDefaultButton.Button1, MessageBoxIcon.Error);
                return null;
            }

            WMSLayerModelNode oLayer = oServer.GetLayer(getAttribute("layer"));
            if (oLayer == null) throw new ArgumentException("'" + getAttribute("layer") + "' was not found. This dataset may have been deleted or moved." + Environment.NewLine + Environment.NewLine + "Please check with the publisher of " + m_oServer.ServerTreeDisplayName + " for more information.");
            WMSServerBuilder oDummyServer = new WMSServerBuilder(null, m_oServer as WMSServerUri, oServer.CapabilitiesFilename, true);
            return new WMSQuadLayerBuilder(oLayer.LayerData, MainForm.WorldWindowSingleton, oDummyServer, null);
        }
Beispiel #5
0
 internal override LayerBuilder ConvertToLayerBuilder()
 {
     WMSServerModelNode oSMN = GetServer();
     WMSServerBuilder oServer = new WMSServerBuilder(null, oSMN.Uri as WMSServerUri, oSMN.CapabilitiesFilename, true);
     return new WMSQuadLayerBuilder(m_oData, Dapple.MainForm.WorldWindowSingleton, oServer, null);
 }