Esempio n. 1
0
 private void DisplayColorAdjustmentParameters(WmsSource wms)
 {
     tbrBrightness.SetValue(wms.Brightness * 20.0f);
     tbrConstrast.SetValue(wms.Contrast * 20.0f);
     tbrSaturation.SetValue(wms.Saturation * 20.0f);
     tbrHue.SetValue(wms.Hue);
     tbrGamma.SetValue(wms.Gamma * 20.0f);
     tbrTransparency.Value          = wms.Opacity;
     chkUseTransparentColor.Checked = wms.UseTransparentColor;
     clpTransparent.Color           = wms.TransparentColor;
 }
Esempio n. 2
0
        private void DisplayRequestParameters(WmsSource wms)
        {
            cboVersion.SetValue(wms.Version);

            cboFormat.Items.Add(wms.Format);
            cboFormat.SelectedIndex = 0;

            cboLayers.Items.Add(wms.Layers);
            cboLayers.SelectedIndex = 0;

            cboSize.Items.Add("256 × 256");
            cboSize.SelectedIndex = 0;

            cboStyles.Items.Add("<empty>");
            cboStyles.SelectedIndex = 0;

            cboCrs.Items.Add(wms.Epsg > 0 ? "EPSG:" + wms.Epsg : "<not defined>");
            cboCrs.SelectedIndex = 0;
        }
Esempio n. 3
0
        private bool AddWmsLayer(LayerIdentity identity)
        {
            if (identity.IdentityType == LayerIdentityType.Wms)
            {
                var wms = new WmsSource("")
                {
                    BaseUrl = identity.Connection, Layers = identity.Query
                };

                // TODO: we don't notify plugin about it, perhaps we should
                int layerHandle = _context.Map.Layers.Add(wms);
                if (layerHandle != -1)
                {
                    _lastLayerHandle = layerHandle;
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 4
0
        /// <summary>
        /// Creates MapWinGIS WMS provider based GetCapabilities definition and layers selected by user.
        /// </summary>
        public static WmsSource CreateWmsLayer(this WmsCapabilities capabilities, IEnumerable <Layer> layers, string serverUrl, ISpatialReference mapProjection)
        {
            var layersArray = layers as Layer[] ?? layers.ToArray();
            var layer       = layersArray.FirstOrDefault();

            if (layer == null)
            {
                return(null);
            }

            // First try the layer, as a fallback, use the bounding box defined in the capabilities
            var box = layer.ChooseBoundingBox(mapProjection) ?? capabilities.Capability.Layer.ChooseBoundingBox(mapProjection);

            if (box == null)
            {
                MessageService.Current.Info("Failed to determine bounds of the layer.");
                return(null);
            }

            var epsg = -1;

            if (!ParseEpsg(box.CRS, ref epsg))
            {
                MessageService.Current.Info("Failed to determine coordinate system for the layer.");
                return(null);
            }

            var provider = new WmsSource("WMS provider")
            {
                Layers      = GetLayers(layersArray),
                Epsg        = epsg,
                BoundingBox = new Envelope(box.MinX, box.MaxX, box.MinY, box.MaxY),
                BaseUrl     = serverUrl,
                Format      = capabilities.GetFormat()
            };

            return(provider);
        }
Esempio n. 5
0
 public static WmsLayer GetInternal(this WmsSource provider)
 {
     return(provider.InternalObject as WmsLayer);
 }