Beispiel #1
0
        public ActionResult Create([Bind(Include = "ID,Title,Description,Width,Height,CenterOnLat,CenterOnLong,ZoomLevel,DisplayZoomControl,DisplayMapTypeControl,DisplayScaleControl,DisplayStreetViewControl,DisplayPanControl,Tags,DateCreated,CreatedBy,DateModified,ModifiedBy")] Map map)
        {
            if (ModelState.IsValid)
            {
                // Stamp the Map with CreatedBy and DateCreated
                map.CreatedBy   = User.Identity.Name;
                map.DateCreated = DateTime.Now;

                // Add the map
                var thisID = db.Maps.Add(map);

                // Add the default styles for this map
                var thisMapStyle     = new MapStyle();
                var mapStyleDefaults = db.MapStyleDefaults.ToList();

                foreach (var defaultMapStyle in mapStyleDefaults)
                {
                    thisMapStyle.MapID         = thisID.ID;
                    thisMapStyle.FeatureTypeID = defaultMapStyle.FeatureTypeID;
                    thisMapStyle.Hue           = defaultMapStyle.Hue;
                    thisMapStyle.Saturation    = defaultMapStyle.Saturation;
                    thisMapStyle.Lightness     = defaultMapStyle.Lightness;
                    thisMapStyle.Gamma         = defaultMapStyle.Gamma;

                    db.MapStyles.Add(thisMapStyle);
                    db.SaveChanges();
                }


                db.SaveChanges();
                return(RedirectToAction("Edit", thisID));
            }

            return(View(map));
        }
Beispiel #2
0
        private void HandleStyleLoaded(MapStyle obj)
        {
            try
            {
                if (outter_points.Count >= 4)
                {
                    var polygon = new Polygon(points.Select(x => x.Select(y => new[] { y.Longitude, y.Latitude })));

                    var layer = new FillLayer("layer-id", "source-id")
                    {
                        FillColor = Color.FromHex("#FF0000")
                    };
                    var source = new GeoJsonSource("source-id", new Feature(polygon));

                    if (map.Functions.GetLayers().Count() > 0)
                    {
                        map.Functions.RemoveSource("source-id");
                        map.Functions.RemoveLayer("settlement-label");
                    }

                    map.Functions.AddSource(source);
                    map.Functions.AddLayerBelow(layer, "settlement-label");
                }
                else
                {
                    DisplayAlert(null, "You have less than 4 points", "OK");
                }
            }
            catch (Exception ex)
            {
            }
        }
        private void HandleStyleLoaded(MapStyle obj)
        {
            var bigLabel = Expression.CreateFormatEntry(
                Expression.Get("name_en"),
                FormatOption.FormatFontScale(1.5),
                FormatOption.FormatTextColor(Color.Blue),
                FormatOption.FormatTextFont(new [] { "Ubuntu Medium", "Arial Unicode MS Regular" })
                );

            var newLine = Expression.CreateFormatEntry(
                // Add "\n" in order to break the line and have the second label underneath
                "\n",
                FormatOption.FormatFontScale(0.5)
                );

            var smallLabel = Expression.CreateFormatEntry(
                Expression.Get("name"),
                FormatOption.FormatTextColor(Color.FromHex("#d6550a")),
                FormatOption.FormatTextFont(new [] { "Caveat Regular", "Arial Unicode MS Regular" })
                );

            var format = Expression.Format(bigLabel, newLine, smallLabel);

            // Retrieve the country label layers from the style and update them with the formatting expression
            foreach (var mapLabelLayer in map.Functions.GetLayers())
            {
                if (mapLabelLayer.Id.Contains("country-label") &&
                    mapLabelLayer is SymbolLayer symbolLayer)
                {
                    // Apply formatting expression
                    symbolLayer.TextField = format;
                    map.Functions.UpdateLayer(symbolLayer);
                }
            }
        }
Beispiel #4
0
        private void HandleStyleLoaded(MapStyle obj)
        {
            map.Functions.AddSource(new RasterSource(
                                        "SATELLITE_RASTER_SOURCE_ID",
                                        "mapbox://mapbox.satellite",
                                        512));

            // Create a new map layer for the satellite raster images and add the satellite layer to the map.
            // Use runtime styling to adjust the satellite layer's opacity based on the map camera's zoom level
            map.Functions.AddLayer(
                new RasterLayer(
                    "SATELLITE_RASTER_LAYER_ID",
                    "SATELLITE_RASTER_SOURCE_ID")
            {
                RasterOpacity = Expression.Interpolate(
                    Expression.Linear(),
                    Expression.Zoom(),
                    Expression.CreateStop(15, 0),
                    Expression.CreateStop(18, 1)
                    )
            });

            // Create a new camera position and animate the map camera to show the fade in/out UI of the satellite layer
            map.Functions.AnimateCamera(new CameraPosition(map.Center, 19, null, null), 9000);
        }
        private void HandleStyleLoaded(MapStyle obj)
        {
            map.Functions.AddSource(new VectorSource(
                                        "ethnicity-source",
                                        "http://api.mapbox.com/v4/examples.8fgz4egr.json?access_token=" + MapBoxService.AccessToken
                                        ));

            var circleLayer = new CircleLayer("population", "ethnicity-source")
            {
                SourceLayer  = "sf2010",
                CircleRadius =
                    Expression.Interpolate(
                        Expression.Exponential(1.75f),
                        Expression.Zoom(),
                        Expression.CreateStop(12f, 2f),
                        Expression.CreateStop(22f, 180f)
                        ),
                CircleColor =
                    Expression.Match(
                        Expression.Get("ethnicity"), Expression.Rgb(0f, 0f, 0f),
                        Expression.CreateStop("white", Expression.Rgb(251f, 176f, 59f)),
                        Expression.CreateStop("Black", Expression.Rgb(34f, 59f, 83f)),
                        Expression.CreateStop("Hispanic", Expression.Rgb(229f, 94f, 94f)),
                        Expression.CreateStop("Asian", Expression.Rgb(59f, 178f, 208f)),
                        Expression.CreateStop("Other", Expression.Rgb(204f, 204f, 204f)))
            };

            map.Functions.AddLayer(circleLayer);
        }
        protected override void OnElementChanged(ElementChangedEventArgs <CustomMapView> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null || Element == null)
            {
                return;
            }

            var formsElement = Element as CustomMapView;

            if (Control == null)
            {
                mapView          = new ExtendedMapView(this);
                mapView.MapStyle = MapStyle.FromJson(AppConstants.MAP_STYLE_GREY, null);

                mapView.Delegate = new CustomMapViewDelegate();
                SetNativeControl(mapView);
            }

            if (formsElement != null)
            {
                mapView.UpdateUserPosition(formsElement.UserLocation.Latitude, formsElement.UserLocation.Longitude);
                mapView.SetCamera(formsElement.UserLocation.Latitude, formsElement.UserLocation.Longitude, (float)formsElement.Zoom);
            }
        }
Beispiel #7
0
        private void HandleStyleLoaded(MapStyle obj)
        {
            var outerLineString       = new LineString(Config.POLYGON_COORDINATES);
            var innerLineString       = new LineString(Config.HOLE_COORDINATES[0]);
            var secondInnerLineString = new LineString(Config.HOLE_COORDINATES[1]);

            List <LineString> innerList = new List <LineString> {
                innerLineString,
                secondInnerLineString
            };

            map.Functions.AddSource(new GeoJsonSource("source-id",
                                                      new Feature(new Polygon(new[] { outerLineString, innerLineString, secondInnerLineString }))));

            var polygonFillLayer = new FillLayer("layer-id", "source-id")
            {
                FillColor = Config.BLUE_COLOR
            };

            if (map.Functions.GetLayers().Any(x => x.Id == "road-number-shield"))
            {
                map.Functions.AddLayerBelow(polygonFillLayer, "road-number-shield");
            }
            else
            {
                map.Functions.AddLayer(polygonFillLayer);
            }
        }
 public TileTask(MapStyle featureStyling, TileAddress address, Matrix4x4 transform, int generation)
 {
     this.data           = new List <FeatureMesh>();
     this.address        = address;
     this.Transform      = transform;
     this.generation     = generation;
     this.featureStyling = featureStyling;
 }
Beispiel #9
0
        public void ToStringTest()
        {
            var mapStyle = new MapStyle();

            var toString = mapStyle.ToString();

            Assert.IsNull(toString);
        }
        public void OnMapChanged(int p0)
        {
            switch (p0)
            {
            case MapView.DidFinishLoadingStyle:
                var mapStyle = Element.MapStyle;
                if (mapStyle == null ||
                    (!string.IsNullOrEmpty(_map.StyleUrl) && mapStyle.UrlString != _map.StyleUrl))
                {
                    mapStyle = new MapStyle(_map.StyleUrl);
                }
                if (Element.MapStyle.CustomSources != null)
                {
                    var notifiyCollection = Element.MapStyle.CustomSources as INotifyCollectionChanged;
                    if (notifiyCollection != null)
                    {
                        notifiyCollection.CollectionChanged += OnShapeSourcesCollectionChanged;
                    }

                    AddSources(Element.MapStyle.CustomSources.ToList());
                }
                if (Element.MapStyle.CustomLayers != null)
                {
                    if (Element.MapStyle.CustomLayers is INotifyCollectionChanged notifiyCollection)
                    {
                        notifiyCollection.CollectionChanged += OnLayersCollectionChanged;
                    }

                    AddLayers(Element.MapStyle.CustomLayers.ToList());
                }
                mapStyle.OriginalLayers = _map.Layers.Select((arg) =>
                                                             new Layer(arg.Id)
                                                             ).ToArray();
                Element.MapStyle = mapStyle;
                Element.DidFinishLoadingStyleCommand?.Execute(mapStyle);
                break;

            case MapView.DidFinishRenderingMap:
                Element.Center = new Position(_map.CameraPosition.Target.Latitude, _map.CameraPosition.Target.Longitude);
                Element.DidFinishRenderingCommand?.Execute(false);
                break;

            case MapView.DidFinishRenderingMapFullyRendered:
                Element.DidFinishRenderingCommand?.Execute(true);
                break;

            case MapView.RegionDidChange:
                Element.RegionDidChangeCommand?.Execute(false);
                break;

            case MapView.RegionDidChangeAnimated:
                Element.RegionDidChangeCommand?.Execute(true);
                break;

            default:
                break;
            }
        }
Beispiel #11
0
 public HomePage()
 {
     InitializeComponent();
     map.MapStyle = MapStyle.FromJson(jsonStyle);
     map.UiSettings.ZoomControlsEnabled = false;
     BindingContext       = viewModel = new HomePageViewModel();
     viewModel.Navigation = this.Navigation;
     LocationEnabled();
 }
Beispiel #12
0
            public static TileLayer CreateTileLayer(MapStyle mapStyle)
            {
                var mapId = mapStyle == null ? "mapbox.streets" : mapStyle.Name;
                var url   = $"https://api.mapbox.com/v4/{mapId}/{{z}}/{{x}}/{{y}}@2x.png?access_token=pk.eyJ1Ijoia2Vuc3lvdSIsImEiOiJjajJvZjR3cDEwMmZ2MzNxYmNpMnZrc3FmIn0.h_3HKpIB-jFdH0Efi-rgkw";

                return(new TileLayer(new HttpTileSource(new GlobalSphericalMercator(0, 18), url,
                                                        new[] { "a", "b", "c" }, name: "Mapbox",
                                                        attribution: MapboxAttribution)));
            }
 internal CopyrightRequestState(string _culture, MapStyle _style, LocationRect _boundingRectangle, double _zoomLevel, Credentials _credentials, Action <CopyrightResult> _copyrightCallback)
 {
     Culture           = _culture;
     Style             = _style;
     BoundingRectangle = _boundingRectangle;
     ZoomLevel         = _zoomLevel;
     Credentials       = _credentials;
     CopyrightCallback = _copyrightCallback;
 }
Beispiel #14
0
        private void HandleStyleLoaded(MapStyle obj)
        {
            var vectorSource = new VectorSource(
                "population",
                "http://api.mapbox.com/v4/mapbox.660ui7x6.json?access_token=" + MapBoxService.AccessToken
                );

            map.Functions.AddSource(vectorSource);

            var statePopulationLayer = new FillLayer("state-population", "population")
            {
                SourceLayer = "state_county_population_2014_cen",
                Filter      = Expression.Eq(Expression.Get("isState"), Expression.Literal(true)),
                FillColor   = Expression.Step(
                    Expression.Get("population"), Expression.Rgb(0, 0, 0),
                    Expression.CreateStop(0, Expression.Rgb(242, 241, 45)),
                    Expression.CreateStop(750000, Expression.Rgb(238, 211, 34)),
                    Expression.CreateStop(1000000, Expression.Rgb(218, 156, 32)),
                    Expression.CreateStop(2500000, Expression.Rgb(202, 131, 35)),
                    Expression.CreateStop(5000000, Expression.Rgb(184, 107, 37)),
                    Expression.CreateStop(7500000, Expression.Rgb(162, 86, 38)),
                    Expression.CreateStop(10000000, Expression.Rgb(139, 66, 37)),
                    Expression.CreateStop(25000000, Expression.Rgb(114, 49, 34))),
                FillOpacity = (0.75f)
            };

            map.Functions.AddLayerBelow(statePopulationLayer, "waterway-label");

            var countyPopulationLayer = new FillLayer("county-population", "population")
            {
                SourceLayer = ("state_county_population_2014_cen"),
                Filter      = Expression.Eq(Expression.Get("isCounty"), Expression.Literal(true)),
                FillColor   = Expression.Step(Expression.Get("population"), Expression.Rgb(0, 0, 0),
                                              Expression.CreateStop(0, Expression.Rgb(242, 241, 45)),
                                              Expression.CreateStop(100, Expression.Rgb(238, 211, 34)),
                                              Expression.CreateStop(1000, Expression.Rgb(230, 183, 30)),
                                              Expression.CreateStop(5000, Expression.Rgb(218, 156, 32)),
                                              Expression.CreateStop(10000, Expression.Rgb(202, 131, 35)),
                                              Expression.CreateStop(50000, Expression.Rgb(184, 107, 37)),
                                              Expression.CreateStop(100000, Expression.Rgb(162, 86, 38)),
                                              Expression.CreateStop(500000, Expression.Rgb(139, 66, 37)),
                                              Expression.CreateStop(1000000, Expression.Rgb(114, 49, 34))),
                FillOpacity = 0.75f,
                Visibility  = Expression.Visibility(false)
            };

            map.Functions.AddLayerBelow(countyPopulationLayer, "waterway-label");

            var updateLayer = new FillLayer("county-population", "population");

            map.CameraMovedCommand = new Command <CameraPosition>((cameraPosition) =>
            {
                var visible            = cameraPosition.Zoom > ZOOM_THRESHOLD;
                updateLayer.Visibility = Expression.Visibility(visible);
                map.Functions.UpdateLayer(updateLayer);
            });
        }
        private void HandleStyleLoaded(MapStyle obj)
        {
            map.Center = new LatLng(double.Parse((this.BindingContext as CalculateViewModel).Lat),
                                    double.Parse((this.BindingContext as CalculateViewModel).Lon));

            iconImageSource   = (ImageSource)"RE.png";
            markerImageSource = (ImageSource)"Marker.png";

            map.Functions.AddStyleImage(iconImageSource);
            map.Functions.AddStyleImage(markerImageSource);

            featureCollection = new FeatureCollection(symbolLayerIconFeatureList);
            markerCollection  = new FeatureCollection(markerLayerIconFeatureList);

            source = new GeoJsonSource
            {
                Id   = "feature.memory.src",
                Data = featureCollection
            };

            markerSource = new GeoJsonSource
            {
                Id   = "feature.marker.src",
                Data = markerCollection
            };

            map.Functions.AddSource(source);
            map.Functions.AddSource(markerSource);

            symbolLayer = new SymbolLayer("feature.symbol.layer", source.Id)
            {
                IconAllowOverlap = Expression.Literal(true),
                IconImage        = Expression.Literal(iconImageSource.Id),
                IconOffset       = Expression.Literal(new[] { -5, -5 }),
                IconSize         = Expression.Literal(0.7)
            };

            markerLayer = new SymbolLayer("feature.marker.layer", markerSource.Id)
            {
                IconAllowOverlap = Expression.Literal(true),
                IconImage        = Expression.Literal(markerImageSource.Id),
                IconOffset       = Expression.Literal(new[] { -5, -5 }),
                IconSize         = Expression.Literal(0.2)
            };

            map.Functions.AddLayer(symbolLayer);
            map.Functions.AddLayer(markerLayer);

            var feature = new Feature(new GeoJSON.Net.Geometry.Point(new Position(
                                                                         (this.BindingContext as CalculateViewModel).Lat,
                                                                         (this.BindingContext as CalculateViewModel).Lon)));

            symbolLayerIconFeatureList.Add(feature);
            featureCollection = new FeatureCollection(symbolLayerIconFeatureList);

            map.Functions.UpdateSource(source.Id, featureCollection);
        }
Beispiel #16
0
        private void HandleStyleLoaded(MapStyle obj)
        {
            map.Functions.ShowBuilding(new BuildingInfo()
            {
                MinZoomLevel = 15,
                IsVisible    = true
            });

            map.Functions.AnimateCamera(new CameraPosition(map.Center, map.ZoomLevel, map.Pitch, map.RotatedDegree), 1000);
        }
Beispiel #17
0
 private void HandleStyleLoaded(MapStyle obj)
 {
     try
     {
         map.Annotations = symbolAnnotations.ToArray();
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #18
0
 private void HandleStyleLoaded(MapStyle obj)
 {
     AddClusteredGeoJsonSource();
     map.Functions.AddStyleImage(new IconImageSource
     {
         Id         = "cross-icon-id",
         Source     = (ImageSource)"ic_cross.png",
         IsTemplate = true
     });
 }
        private void HandleStyleLoaded(MapStyle obj)
        {
            map.Functions.AddSource(
                // Point to GeoJSON data. This example visualizes all M1.0+ earthquakes from
                // 12/22/15 to 1/21/16 as logged by USGS' Earthquake hazards program.
                new GeoJsonSource("earthquakes",
                                  "https://www.mapbox.com/mapbox-gl-js/assets/earthquakes.geojson")
            {
                Options = new GeoJsonOptions()
                {
                    Cluster        = (true),
                    ClusterMaxZoom = (15),    // Max zoom to cluster points on
                    ClusterRadius  = (20),    // Use small cluster radius for the hotspots look
                }
            }
                );

            // Use the earthquakes source to create four layers:
            // three for each cluster category, and one for unclustered points

            // Each point range gets a different fill color.
            var layers = new KeyValuePair <int, Color>[] {
                new KeyValuePair <int, Color> (150, Color.FromHex("#E55E5E")),
                new KeyValuePair <int, Color>(20, Color.FromHex("#F9886C")),
                new KeyValuePair <int, Color>(0, Color.FromHex("#FBB03B"))
            };

            CircleLayer unclustered = new CircleLayer("unclustered-points", "earthquakes")
            {
                CircleColor  = Color.FromHex("#FBB03B"),
                CircleRadius = 20f,
                CircleBlur   = 1f,
                Filter       = Expression.Neq(Expression.Get("cluster"), Expression.Literal(true))
            };

            map.Functions.AddLayerBelow(unclustered, "building");

            for (int i = 0; i < layers.Length; i++)
            {
                var pointCount = Expression.ToNumber(Expression.Get("point_count"));
                var circles    = new CircleLayer("cluster-" + i, "earthquakes")
                {
                    CircleColor  = layers[i].Value,
                    CircleRadius = 70f,
                    CircleBlur   = 1f,
                    Filter       = i == 0
                    ? Expression.Gte(pointCount, Expression.Literal(layers[i].Key))
                    : Expression.All(
                        Expression.Gte(pointCount, Expression.Literal(layers[i].Key)),
                        Expression.Lt(pointCount, Expression.Literal(layers[i - 1].Key))
                        )
                };
                map.Functions.AddLayerBelow(circles, "building");
            }
        }
Beispiel #20
0
        public override bool ShowObject(string settingsXml)
        {
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(settingsXml);
            bool          urlOverride   = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "Url", false);
            string        mapPreset     = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "MapPreset", "Default");
            MapStyle      mapStyle      = (MapStyle)Enum.Parse(typeof(MapStyle), XmlHelper.GetElementValue(xmlDocument.DocumentElement, "MapStyle", MapStyle.Aerial.ToString()));
            MapNavigation mapNavigation = (MapNavigation)Enum.Parse(typeof(MapNavigation), XmlHelper.GetElementValue(xmlDocument.DocumentElement, "MapNavigation", MapNavigation.Normal.ToString()));
            double        latitude      = (double)XmlHelper.GetElementValue(xmlDocument.DocumentElement, "Latitude", 47.05m);
            double        longitude     = (double)XmlHelper.GetElementValue(xmlDocument.DocumentElement, "Longitude", 8.3m);
            int           zoom          = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "Zoom", 8);

            IMap map = (IMap)LoadControl("~/UserControls/GoogleMap.ascx");

            if (urlOverride)
            {
                map.MapLayout = MapLayout.MapOnly;
                if (!string.IsNullOrEmpty(Request.QueryString["OID"]))
                {
                    map.ObjectId = Request.QueryString["OID"].ToGuid();
                }
                else
                {
                    QuickParameters quickParameters = new QuickParameters();
                    quickParameters.Udc             = UserDataContext.GetUserDataContext();
                    quickParameters.QuerySourceType = QuerySourceType.Page;
                    quickParameters.OnlyGeoTagged   = true;
                    quickParameters.FromNameValueCollection(Request.QueryString);
                    quickParameters.Amount          = 1000;
                    quickParameters.DisablePaging   = true;
                    quickParameters.ShowState       = ObjectShowState.Published;
                    quickParameters.QuerySourceType = QuerySourceType.Page;
                    map.QuickParameters             = quickParameters;
                }
            }
            else
            {
                var mapSettings = MapSection.CachedInstance.Maps[mapPreset];
                map.MapLayout          = mapSettings.MapLayout;
                map.ObjectTypesAndTags = mapSettings.ObjectTypes.LINQEnumarable.ToList();
            }
            map.Zoom         = zoom;
            map.Latitude     = latitude;
            map.Longitude    = longitude;
            map.MapNaviation = mapNavigation;
            map.MapStyle     = mapStyle;
            int width = map.MapLayout == MapLayout.MapOnly ? WidgetHost.ColumnWidth - WidgetHost.ContentPadding : WidgetHost.ColumnWidth - WidgetHost.ContentPadding - 200;

            map.Width  = width;
            map.Height = (int)Math.Round(width * 0.75);
            Ph.Controls.Add((UserControl)map);

            return(map.HasContent);
        }
Beispiel #21
0
        private void HandleStyleLoaded(MapStyle obj)
        {
            map.Functions.RemoveLayer("water-label");
            map.Functions.AddSource(new GeoJsonSource(GEOJSON_SOURCE_ID, "asset://bathymetry-data.geojson")
            {
                IsLocal = true
            });

            SetUpDepthFillLayers();
            SetUpDepthNumberSymbolLayer();
        }
Beispiel #22
0
        private void HandleStyleLoaded(MapStyle obj)
        {
            var waterLayer         = new FillLayer("water", "built-in");
            var buildingLayer      = new FillLayer("building", "built-in");
            var selectedLayerIndex = 0;

            picker.ItemsSource           = new[] { "Water", "Building" };
            picker.SelectedIndexChanged += (sender, e) => {
                if (selectedLayerIndex == picker.SelectedIndex)
                {
                    return;
                }

                selectedLayerIndex = picker.SelectedIndex;
                var expression = Expression.Rgb((int)red.Value, (int)green.Value, (int)blue.Value);
                switch (selectedLayerIndex)
                {
                case 0:
                    waterLayer.FillColor = expression;
                    map.Functions.UpdateLayer(waterLayer);
                    break;

                case 1:
                    buildingLayer.FillColor = expression;
                    map.Functions.UpdateLayer(buildingLayer);
                    break;
                }
            };
            picker.SelectedIndex = 0;

            red.ValueChanged   += SliderValueChanged;
            green.ValueChanged += SliderValueChanged;
            blue.ValueChanged  += SliderValueChanged;


            void SliderValueChanged(object sender, ValueChangedEventArgs e)
            {
                var expression = Expression.Rgb((int)red.Value, (int)green.Value, (int)blue.Value);

                switch (selectedLayerIndex)
                {
                case 0:
                    waterLayer.FillColor = expression;
                    map.Functions.UpdateLayer(waterLayer);
                    break;

                case 1:
                    buildingLayer.FillColor = expression;
                    map.Functions.UpdateLayer(buildingLayer);
                    break;
                }
            };
        }
Beispiel #23
0
        private void HandleStyleLoaded(MapStyle obj)
        {
            var symbol = new SymbolAnnotation {
                Coordinates = new LatLng(60.169091, 24.939876),
                IconImage   = MAKI_ICON_HARBOR,
                IconSize    = 2.0f,
                IsDraggable = true,
                Id          = Guid.NewGuid().ToString()
            };

            map.Annotations = new[] { symbol };
        }
        private void HandleStyleLoaded(MapStyle obj)
        {
            var polygon = new Polygon(
                POINTS.Select(x => x.Select(y => new[] { y.Longitude, y.Latitude }))
                );

            map.Functions.AddSource(new GeoJsonSource("source-id", polygon));
            map.Functions.AddLayerBelow(new FillLayer("layer-id", "source-id")
            {
                FillColor = Color.FromHex("#3bb2d0")
            }, "settlement-label");
        }
        public ActionResult DeleteConfirmed(int id)
        {
            MapStyle mapStyle = db.MapStyles.Find(id);
            var      mapId    = mapStyle.MapID;

            db.MapStyles.Remove(mapStyle);
            db.SaveChanges();

            var redirectURL = "../../Maps/Edit/" + mapId + "#appearance";

            return(Redirect(redirectURL));
        }
        public void GetMap(UIView _mapView)
        {
            CameraPosition camera = CameraPosition.FromCamera(37.797865, -122.402526, 6);

            mapView = MapView.FromCamera(CGRect.Empty, camera);
            mapView.MyLocationEnabled = true;


            mapView.MapStyle = MapStyle.FromJson(ReadFile(), null);
            mapView.Frame    = _mapView.Bounds;
            _mapView.AddSubview(mapView);
        }
        private void HandleStyleLoaded(MapStyle obj)
        {
            map.Functions.ShowBuilding(new BuildingInfo()
            {
                Color        = Color.LightGray,
                Opacity      = 0.6f,
                MinZoomLevel = 15,
                IsVisible    = true
            });

            map.Functions.AnimateCamera(new CameraPosition(map.Center, map.ZoomLevel, map.Pitch, 0), 1000);
        }
Beispiel #28
0
        private void ApplyMapTheme()
        {
            var    assembly = typeof(MapPage).GetTypeInfo().Assembly;
            var    stream   = assembly.GetManifestResourceStream($"BCTApp.MapResources.MapTheme.json");
            string themeFile;

            using (var reader = new StreamReader(stream))
            {
                themeFile       = reader.ReadToEnd();
                beeMap.MapStyle = MapStyle.FromJson(themeFile);
            }
        }
Beispiel #29
0
        private void HandleStyleLoaded(MapStyle obj)
        {
            map.Functions.AddSource(new GeoJsonSource(HEATMAP_SOURCE_ID, "asset://la_heatmap_styling_points.geojson")
            {
                IsLocal = true
            });

            InitHeatmapColors();
            InitHeatmapRadiusStops();
            InitHeatmapIntensityStops();
            AddHeatmapLayer();
        }
Beispiel #30
0
        private void customMap()               //caricare la mappa da map wizard
        {
            var    assembly = typeof(MainPage).GetTypeInfo().Assembly;
            Stream stream   = assembly.GetManifestResourceStream("RentHouse.com.GoogleMap.json");
            string Json     = "";

            using (var reader = new StreamReader(stream))
            {
                Json = reader.ReadToEnd();
            }
            map.MapStyle = MapStyle.FromJson(Json);
        }
Beispiel #31
0
 public void MapSetStyle(MapStyle style, Map mapJsObj)
 {
     switch (style)
     {
         case MapStyle.HYBRID:
             HtmlPage.Window.Eval(mapJsObj.Id + ".setMapType(G_HYBRID_MAP);");
             break;
         case MapStyle.STREET:
             HtmlPage.Window.Eval(mapJsObj.Id + ".setMapType(G_NORMAL_MAP);");
             break;
         case MapStyle.SATELLITE:
             HtmlPage.Window.Eval(mapJsObj.Id + ".setMapType(G_SATELLITE_MAP);");
             break;
         default:
             break;
     }
 }
Beispiel #32
0
 /// <summary>
 ///     Map style type. All available styles are defined by Map view server of the Map Image API.
 /// </summary>
 /// <param name="mapStyle"></param>
 /// <returns></returns>
 public IMapImageBuilder Style(MapStyle mapStyle)
 {
     _mapImage.style = mapStyle.GetDescription();
     return this;
 }
Beispiel #33
0
 public ViewComboBox()
 {
     ItemsSource = new MapStyle[] { MapStyle.Satalite, MapStyle.Roads, MapStyle.Both };
 }
Beispiel #34
0
        private string GetRelativePath(string quadkey, MapStyle style)
        {
            string path = "";
            for (int i = 0; i < quadkey.Length; i += this.CombineFactor) {
                var fragment = quadkey.Substring(i, Math.Min(this.CombineFactor, quadkey.Length - i));
                path = Path.Combine(path, fragment);
            }
            path += "_";

            switch (style) {
                case MapStyle.Road:
                    path += "r.png_";
                    break;
                case MapStyle.Hybrid:
                    path += "h.jpeg_";
                    break;
            }

            return path;
        }
Beispiel #35
0
 public bool PreparePath(string quadkey, MapStyle style)
 {
     var abspath = this.GetAbsolutePath(quadkey, style);
     var dir = Path.GetDirectoryName(abspath);
     Directory.CreateDirectory(dir);
     return true;
 }
Beispiel #36
0
 public string GetAbsolutePath(string quadkey, MapStyle style)
 {
     var relpath = this.GetRelativePath(quadkey, style);
     return Path.Combine(this.TileDirectory, relpath);
 }
Beispiel #37
0
 public bool Exist(string quadkey, MapStyle style)
 {
     var abspath = this.GetAbsolutePath(quadkey, style);
     return File.Exists(abspath);
 }