Esempio n. 1
0
        private void cmbRestrictionStyle_SelectedIndexChanged(object sender, SelectionChangedEventArgs e)
        {
            if (mapView.Overlays.Count > 0)
            {
                LayerOverlay     dynamicOverlay          = (LayerOverlay)mapView.Overlays[1];
                RestrictionLayer currentRestrictionLayer = (RestrictionLayer)dynamicOverlay.Layers["RestrictionLayer"];
                if (currentRestrictionLayer.CustomStyles.Count > 0)
                {
                    currentRestrictionLayer.CustomStyles.Clear();
                }

                switch (cmbRestrictionStyle.SelectedItem.ToString().Split(':')[1].Trim())
                {
                case "HatchPattern":
                    currentRestrictionLayer.RestrictionStyle = RestrictionStyle.HatchPattern;
                    break;

                case "CircleWithSlashImage":
                    currentRestrictionLayer.RestrictionStyle = RestrictionStyle.CircleWithSlashImage;
                    break;

                case "UseCustomStyles":
                    currentRestrictionLayer.RestrictionStyle = RestrictionStyle.UseCustomStyles;
                    AreaStyle customStyle = new AreaStyle(new GeoSolidBrush(new GeoColor(150, GeoColors.Gray)));
                    currentRestrictionLayer.CustomStyles.Add(customStyle);
                    break;

                default:
                    break;
                }

                mapView.Overlays["RestrictionOverlay"].Refresh();
            }
        }
Esempio n. 2
0
        public void SetRestrictionStyle(Map map, GeoCollection <object> args)
        {
            LayerOverlay     staticOverlay           = (LayerOverlay)map.CustomOverlays["StaticOverlay"];
            RestrictionLayer currentRestrictionLayer = (RestrictionLayer)staticOverlay.Layers["RestrictionLayer"];

            if (currentRestrictionLayer.CustomStyles.Count > 0)
            {
                currentRestrictionLayer.CustomStyles.Clear();
            }

            string selectItem = args[0].ToString();

            switch (selectItem)
            {
            case "HatchPattern":
                currentRestrictionLayer.RestrictionStyle = RestrictionStyle.HatchPattern;
                break;

            case "CircleWithSlashImage":
                currentRestrictionLayer.RestrictionStyle = RestrictionStyle.CircleWithSlashImage;
                break;

            case "UseCustomStyles":
                currentRestrictionLayer.RestrictionStyle = RestrictionStyle.UseCustomStyles;
                Style customStyle = new AreaStyle(new GeoSolidBrush(new GeoColor(150, GeoColor.StandardColors.Gray)));
                currentRestrictionLayer.CustomStyles.Add(customStyle);
                break;

            default:
                break;
            }
        }
Esempio n. 3
0
        public string HideZones(Map map, GeoCollection <object> args)
        {
            LayerOverlay     staticOverlay           = (LayerOverlay)map.CustomOverlays["StaticOverlay"];
            RestrictionLayer currentRestrictionLayer = (RestrictionLayer)staticOverlay.Layers["RestrictionLayer"];

            currentRestrictionLayer.RestrictionMode = RestrictionMode.HideZones;
            return("You can not see Africa because we have added a RestrictionLayer and its mode is HideZones.");
        }
Esempio n. 4
0
 private void rbtnHideMode_Click(object sender, RoutedEventArgs e)
 {
     if (mapView.Overlays.Count > 0)
     {
         LayerOverlay     dynamicOverlay          = (LayerOverlay)mapView.Overlays[1];
         RestrictionLayer currentRestrictionLayer = (RestrictionLayer)dynamicOverlay.Layers["RestrictionLayer"];
         currentRestrictionLayer.RestrictionMode = RestrictionMode.HideZones;
         mapView.Overlays["RestrictionOverlay"].Refresh();
     }
 }
Esempio n. 5
0
        private void rbtnHideMode_Click(object sender, EventArgs e)
        {
            LayerOverlay     dynamicOverlay          = (LayerOverlay)winformsMap1.Overlays[1];
            RestrictionLayer currentRestrictionLayer = (RestrictionLayer)dynamicOverlay.Layers["RestrictionLayer"];

            currentRestrictionLayer.RestrictionMode = RestrictionMode.HideZones;
            tbxModeInstruction.Text = "You can not see Africa because we have added a RestrictionLayer and its mode is HideZones.";

            winformsMap1.Refresh(winformsMap1.Overlays["RestrictionOverlay"]);
        }
Esempio n. 6
0
        private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit       = GeographyUnit.Meter;
            mapView.ZoomLevelSet  = new ThinkGeoCloudMapsZoomLevelSet();
            mapView.CurrentExtent = new RectangleShape(-4904363, 6313059, 9575868, -5401887);

            ThinkGeoCloudRasterMapsOverlay worldMapKitDesktopOverlay = new ThinkGeoCloudRasterMapsOverlay(SampleHelper.ThinkGeoCloudId, SampleHelper.ThinkGeoCloudSecret);

            mapView.Overlays.Add("WorldOverlay", worldMapKitDesktopOverlay);

            RestrictionLayer restrictionLayer = new RestrictionLayer();

            restrictionLayer.Zones.Add(new RectangleShape(-1967015, 4440501, 6681396, -4120479));
            restrictionLayer.RestrictionMode = RestrictionMode.ShowZones;
            restrictionLayer.UpperScale      = 250000000;
            restrictionLayer.LowerScale      = double.MinValue;

            LayerOverlay restrictionOverlay = new LayerOverlay();

            restrictionOverlay.Layers.Add("RestrictionLayer", restrictionLayer);
            mapView.Overlays.Add("RestrictionOverlay", restrictionOverlay);

            mapView.Refresh();
        }
Esempio n. 7
0
        private void CreateARestrictionLayer_Load(object sender, EventArgs e)
        {
            winformsMap1.MapUnit       = GeographyUnit.DecimalDegree;
            winformsMap1.CurrentExtent = new RectangleShape(-44.056640625, 49.224609375, 86.021484375, -43.587890625);
            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);

            RestrictionLayer restrictionLayer = new RestrictionLayer();

            restrictionLayer.Zones.Add(new RectangleShape(-17.67, 37.01, 60.02, -34.68));
            restrictionLayer.RestrictionMode = RestrictionMode.ShowZones;
            restrictionLayer.UpperScale      = 250000000;
            restrictionLayer.LowerScale      = double.MinValue;

            WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new WorldMapKitWmsDesktopOverlay();

            winformsMap1.Overlays.Add("WorldOverlay", worldMapKitDesktopOverlay);

            LayerOverlay restrictionOverlay = new LayerOverlay();

            restrictionOverlay.Layers.Add("RestrictionLayer", restrictionLayer);
            winformsMap1.Overlays.Add("RestrictionOverlay", restrictionOverlay);

            winformsMap1.Refresh();
        }
        private void WpfMap_Loaded(object sender, RoutedEventArgs e)
        {
            wpfMap1.MapUnit = GeographyUnit.DecimalDegree;
            wpfMap1.CurrentExtent = new RectangleShape(-44.056640625, 49.224609375, 86.021484375, -43.587890625);

            WorldMapKitWmsWpfOverlay worldMapKitDesktopOverlay = new WorldMapKitWmsWpfOverlay();
            wpfMap1.Overlays.Add("WorldOverlay", worldMapKitDesktopOverlay);

            RestrictionLayer restrictionLayer = new RestrictionLayer();
            restrictionLayer.Zones.Add(new RectangleShape(-17.67, 37.01, 60.02, -34.68));
            restrictionLayer.RestrictionMode = RestrictionMode.ShowZones;
            restrictionLayer.UpperScale = 250000000;
            restrictionLayer.LowerScale = double.MinValue;

            LayerOverlay restrictionOverlay = new LayerOverlay();
            restrictionOverlay.Layers.Add("RestrictionLayer", restrictionLayer);
            wpfMap1.Overlays.Add("RestrictionOverlay", restrictionOverlay);

            wpfMap1.Refresh();
        }