Ejemplo n.º 1
0
        internal static ServerModelNode AddServerToHomeView(DappleModel oModel, LayerBuilder oLayer)
        {
            const bool Enabled = true;
            const bool DontAddToHomeViewYet     = false;
            const bool DontSubmitToDappleSearch = false;

            ServerModelNode result = null;

            // --- Add the server to the model ---

            if (oLayer is ArcIMSQuadLayerBuilder)
            {
                ArcIMSQuadLayerBuilder castLayer = oLayer as ArcIMSQuadLayerBuilder;
                result = oModel.AddArcIMSServer(new ArcIMSServerUri(castLayer.ServerURL), Enabled, DontAddToHomeViewYet, DontSubmitToDappleSearch);
            }
            else if (oLayer is DAPQuadLayerBuilder)
            {
                DAPQuadLayerBuilder castLayer = oLayer as DAPQuadLayerBuilder;
                result = oModel.AddDAPServer(new DapServerUri(castLayer.ServerURL), Enabled, DontAddToHomeViewYet, DontSubmitToDappleSearch);
            }
            else if (oLayer is WMSQuadLayerBuilder)
            {
                WMSQuadLayerBuilder castLayer = oLayer as WMSQuadLayerBuilder;
                result = oModel.AddWMSServer(new WMSServerUri(castLayer.ServerURL), Enabled, DontAddToHomeViewYet, DontSubmitToDappleSearch);
            }
            else
            {
                throw new ApplicationException("Don't know how to get the server of type " + oLayer.GetType().ToString());
            }

            result.AddToHomeView();

            return(result);
        }