WmsLayer.withUriAndLayerNames constructor

WmsLayer.withUriAndLayerNames({
  1. required Uri uri,
  2. required List<String> layerNames,
})

Creates a WmsLayer with the specified URL and layer names.

To specify a preferred WMS version, set the 'VERSION' parameter in the 'GetCapabilities' URL for the service.

Parameters:

  • uri — The URL of a WMS service.
  • layerNames — A List of the visible WMS layer names.

Implementation

factory WmsLayer.withUriAndLayerNames({
  required Uri uri,
  required List<String> layerNames,
}) {
  _initializeArcGISEnvironmentIfNeeded();
  final coreURI = _CString(uri.toString());
  final coreLayerNames = layerNames.toMutableArray(
    valueType: _ElementType.string,
  );
  final handle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_WMSLayer_createWithURLAndLayerNames(
      coreURI.bytes,
      coreLayerNames._handle,
      errorHandler,
    );
  });
  final WmsLayer object = Layer._instanceCache.instanceWith(handle);
  object._layerNames.value.setCache(layerNames);
  return object;
}