Ejemplo n.º 1
0
        protected Layer doCreateFromCapabilities(OGCCapabilities caps, AVList parameters)
        {
            string serviceName = caps.getServiceInformation().getServiceName();

            if (serviceName == null || !(serviceName.equalsIgnoreCase(OGCConstants.WMS_SERVICE_NAME) ||
                                         serviceName.Contains("WMS")))
            {
                string message = Logging.getMessage("WMS.NotWMSService", serviceName != null ? serviceName : "null");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            if (parameters == null)
            {
                parameters = new AVListImpl();
            }

            if (parameters.getStringValue(AVKey.LAYER_NAMES) == null)
            {
                // Use the first named layer since no other guidance given
                List <WMSLayerCapabilities> namedLayers = ((WMSCapabilities)caps).getNamedLayers();

                if (namedLayers == null || namedLayers.Count == 0 || namedLayers[0] == null)
                {
                    String message = Logging.getMessage("WMS.NoLayersFound");
                    Logging.logger().severe(message);
                    throw new IllegalStateException(message);
                }

                parameters.setValue(AVKey.LAYER_NAMES, namedLayers[0].getName());
            }

            return(new WMSTiledImageLayer((WMSCapabilities)caps, parameters));
        }
Ejemplo n.º 2
0
 /**
  * Implemented by subclasses to perform the actual object creation. This default implementation always returns
  * null.
  *
  * @param caps   the capabilities document.
  * @param parameters a list of configuration properties. These properties override any specified in the capabilities
  *               document. The list should contain the {@link AVKey#LAYER_NAMES} property for services that define
  *               layers, indicating which named layers described in the capabilities document to create. If this
  *               argumet is null or contains no layers, the first named layer is used.
  *
  * @return the requested object.
  */
 protected object doCreateFromCapabilities(OGCCapabilities caps, AVList parameters)
 {
     return(null);
 }