Ejemplo n.º 1
0
        /// <summary>
        /// Set up the map with the ThinkGeo Cloud Maps overlay
        /// </summary>
        protected override void OnAppearing()
        {
            base.OnAppearing();
            // Create the background world maps using vector tiles requested from the ThinkGeo Cloud Service.
            ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light);

            thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector");
            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            // Set the map's unit of measurement to meters (Spherical Mercator)
            mapView.MapUnit = GeographyUnit.Meter;

            // Create a marker overlay to display the geocoded locations that will be generated, and add it to the map
            SimpleMarkerOverlay geocodedLocationsOverlay = new SimpleMarkerOverlay();

            mapView.Overlays.Add("Geocoded Locations Overlay", geocodedLocationsOverlay);

            // Set the map extent to Frisco, TX
            mapView.CurrentExtent = new RectangleShape(-10798419.605087, 3934270.12359632, -10759021.6785336, 3896039.57306867);

            // Initialize the GeocodingCloudClient using our ThinkGeo Cloud credentials
            geocodingCloudClient = new GeocodingCloudClient("FSDgWMuqGhZCmZnbnxh-Yl1HOaDQcQ6mMaZZ1VkQNYw~", "IoOZkBJie0K9pz10jTRmrUclX6UYssZBeed401oAfbxb9ufF1WVUvg~~");

            cboSearchType.SelectedIndex   = 0;
            cboLocationType.SelectedIndex = 0;

            mapView.Refresh();
        }
        private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit       = GeographyUnit.Meter;
            mapView.ZoomLevelSet  = new ThinkGeoCloudMapsZoomLevelSet();
            mapView.CurrentExtent = new RectangleShape(-17336118, 20037508, 11623981, -16888303);

            // Create background world map with vector tile requested from ThinkGeo Cloud Service.
            ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay(SampleHelper.ThinkGeoCloudId, SampleHelper.ThinkGeoCloudSecret, ThinkGeoCloudVectorMapsMapType.Light);

            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            SimpleMarkerOverlay markerOverlay = new SimpleMarkerOverlay();

            markerOverlay.DragMode = MarkerDragMode.CopyWithShiftKey;
            mapView.Overlays.Add("MarkerOverlay", markerOverlay);

            Marker marker = new Marker(-10606588, 4715285);

            marker.ImageSource = new BitmapImage(new Uri("/Resources/AQUA.png", UriKind.RelativeOrAbsolute));
            marker.Width       = 20;
            marker.Height      = 34;
            marker.YOffset     = -17;
            markerOverlay.Markers.Add(marker);

            mapView.Refresh();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Perform the spatial query and draw the shapes on the map
        /// </summary>
        private void GetFeaturesContaining(PointShape point)
        {
            // Find the layers we will be modifying in the MapView
            SimpleMarkerOverlay   queryFeatureMarkerOverlay = (SimpleMarkerOverlay)mapView.Overlays["Query Feature Marker Overlay"];
            ShapeFileFeatureLayer zoningLayer = (ShapeFileFeatureLayer)mapView.FindFeatureLayer("Frisco Zoning");

            // Clear the query point marker overlay and add a marker on the newly drawn point
            queryFeatureMarkerOverlay.Markers.Clear();

            // Create a marker with a static marker image and add it to the map
            var marker = new Marker(point)
            {
                ImageSource = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Resources/AQUA.png"),
                YOffset     = -17
            };;

            queryFeatureMarkerOverlay.Markers.Add(marker);
            queryFeatureMarkerOverlay.Refresh();

            // Perform the spatial query using the drawn point and highlight features that were found
            var queriedFeatures = PerformSpatialQuery(point, zoningLayer);

            HighlightQueriedFeatures(queriedFeatures);

            // Clear the drawn point
            mapView.TrackOverlay.TrackShapeLayer.InternalFeatures.Clear();
        }
        private void lvcChart_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
        {
            SimpleMarkerOverlay markerOverlay = (SimpleMarkerOverlay)wpfMap1.Overlays["MarkerOverlay"];

            markerOverlay.Markers[0].Position = new Point(-179.0, -89.0);
            markerOverlay.Refresh();
        }
        private void UpdateElementsRotation(double angle)
        {
            LayerOverlay          layerOverlay = (LayerOverlay)Map1.Overlays["LayerOverlay"];
            ShapeFileFeatureLayer worldLayer   = (ShapeFileFeatureLayer)layerOverlay.Layers["SampleLayer"];

            worldLayer.Open();

            SimpleMarkerOverlay markerOverlay = (SimpleMarkerOverlay)Map1.Overlays["MarkerOverlay"];

            foreach (var marker in markerOverlay.Markers)
            {
                marker.RenderTransform = new RotateTransform(-angle, marker.ActualWidth / 2, marker.ActualHeight);
            }

            PopupOverlay popupOverlay = (PopupOverlay)Map1.Overlays["PopupOverlay"];

            foreach (var popup in popupOverlay.Popups)
            {
                popup.RenderTransform = new RotateTransform(-angle, popup.ActualWidth, popup.ActualHeight);
            }

            if (worldLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle != null)
            {
                worldLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.RotationAngle = angle;
            }
        }
        private void Form_Load(object sender, EventArgs e)
        {
            winformsMap1.MapUnit       = GeographyUnit.DecimalDegree;
            winformsMap1.CurrentExtent = new RectangleShape(-155.733, 95.60, 104.42, -81.9);

            WorldMapKitWmsDesktopOverlay worldMapKitOverlay = new WorldMapKitWmsDesktopOverlay();

            winformsMap1.Overlays.Add(worldMapKitOverlay);

            SimpleMarkerOverlay markerOverlay = new SimpleMarkerOverlay();

            markerOverlay.MapControl = winformsMap1;
            markerOverlay.DragMode   = MarkerDragMode.CopyWithShiftKey;
            winformsMap1.Overlays.Add("MarkerOverlay", markerOverlay);

            Marker marker = new Marker(-95.2806, 38.9554);

            marker.Image   = Properties.Resources.AQUA;
            marker.Width   = 20;
            marker.Height  = 34;
            marker.YOffset = -17;
            markerOverlay.Markers.Add(marker);

            winformsMap1.Refresh();
        }
        private void DisplayMap_Load(object sender, EventArgs e)
        {
            winformsMap1.MapUnit       = GeographyUnit.DecimalDegree;
            winformsMap1.CurrentExtent = new RectangleShape(-155.733, 95.60, 104.42, -81.9);

            WorldMapKitWmsDesktopOverlay worldMapKitOverlay = new WorldMapKitWmsDesktopOverlay();

            winformsMap1.Overlays.Add(worldMapKitOverlay);

            SimpleMarkerOverlay markerOverlay = new SimpleMarkerOverlay();

            markerOverlay.MapControl = winformsMap1;
            markerOverlay.DragMode   = MarkerDragMode.CopyWithShiftKey;
            winformsMap1.Overlays.Add("MarkerOverlay", markerOverlay);

            Marker marker = new Marker(-95.2806, 38.9554);

            marker.Image           = new Bitmap(@"..\..\SampleData\Data\United States.png");
            marker.Width           = 32;
            marker.Height          = 32;
            marker.YOffsetInScreen = -17;
            markerOverlay.Markers.Add(marker);

            winformsMap1.Refresh();
        }
        public void SetupMap(List <ShapeFileFeatureLayer> modelLayers, SimpleMarkerOverlay markersOverlay, SimpleMarkerOverlay cumulativeFactorsOverlay,
                             LayerOverlay pathAndPOILayerOverlay)
        {
            _modelLayers = modelLayers;
            foreach (ShapeFileFeatureLayer shapeFileFeatureLayer in _modelLayers)
            {
                _layerOverlay.Layers.Add(shapeFileFeatureLayer);
            }

            foreach (ThinkGeoMarker marker in markersOverlay.Markers)
            {
                _markersOverlay.Markers.Add(MapHelper.CopyMarker(marker));
            }

            foreach (ThinkGeoMarker marker in cumulativeFactorsOverlay.Markers)
            {
                _cumulativeFactorsOverlay.Markers.Add(MapHelper.CopyMarker(marker));
            }

            foreach (Layer layer in pathAndPOILayerOverlay.Layers)
            {
                _pathAndPOILayerOverlay.Layers.Add(layer);
            }

            SetCurrentExtent();

            winformsMap1.Refresh();
        }
        private void Initialization()
        {
            // Set markders
            SimpleMarkerOverlay markOverlay = new SimpleMarkerOverlay();

            wpfMap1.Overlays.Add("markOverlay", markOverlay);

            startMarker = new Marker(new PointShape(-117.1486, 36.1977))
            {
                YOffset     = -24,
                ImageSource = new BitmapImage(new Uri("/Images/start.png", UriKind.RelativeOrAbsolute))
            };
            markOverlay.Markers.Add(startMarker);
            endMarker = new Marker(new PointShape(-117.1305, 36.1764))
            {
                ImageSource = new BitmapImage(new Uri("/Images/end.png", UriKind.RelativeOrAbsolute)),
                YOffset     = -24
            };
            markOverlay.Markers.Add(endMarker);

            // Add example line points
            gradeLine.Vertices.Add(new Vertex(-117.1486, 36.1977));
            gradeLine.Vertices.Add(new Vertex(-117.0461, 36.1512));
            gradeLine.Vertices.Add(new Vertex(-117.0394, 36.1871));
            gradeLine.Vertices.Add(new Vertex(-117.0952, 36.1708));
            gradeLine.Vertices.Add(new Vertex(-117.1305, 36.1764));
        }
Ejemplo n.º 10
0
        private void LayoutRoot_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeographyUnit.Meter;

            // Load roads overlay
            LayerOverlay roadsOverlay = new LayerOverlay();

            Map1.Overlays.Add(roadOverlayName, roadsOverlay);

            // Load road data from a shape file.
            ShapeFileFeatureLayer roadsFeatureLayer = new ShapeFileFeatureLayer(@"..\..\Data\Roads.shp");

            roadsFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = new LineStyle(GeoPens.Gray);
            roadsFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle    = TextStyles.CreateSimpleTextStyle("ROAD_NAME", "Arial", 8, DrawingFontStyles.Regular, GeoColors.Black);
            roadsFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            roadsOverlay.Layers.Add(roadsFeatureLayer);

            // Add highlight overlay
            LayerOverlay highlightOverlay = new LayerOverlay();

            Map1.Overlays.Add(roadHighlightOverlayName, highlightOverlay);
            InMemoryFeatureLayer highlightLayer = new InMemoryFeatureLayer();

            highlightLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = new LineStyle(new GeoPen(new GeoColor(123, GeoColors.Green), 5.0f));
            highlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            highlightOverlay.Layers.Add(highlightLayer);

            // Add marker overlay
            SimpleMarkerOverlay markerOverlay = new SimpleMarkerOverlay();

            Map1.Overlays.Add(markerOverlayName, markerOverlay);
            // Set the map extent
            Map1.CurrentExtent = new RectangleShape(2478794.65996324, 7106797.82702127, 2482540.06498076, 7104117.76042073);
            Map1.Refresh();
        }
Ejemplo n.º 11
0
        public static SimpleMarkerOverlay GetMarkersOverlay(WinformsMap map)
        {
            SimpleMarkerOverlay markerOverlay = new SimpleMarkerOverlay {
                MapControl = map, Name = "markers"
            };

            return(markerOverlay);
        }
        private void lvcChart_DataHover(object sender, ChartPoint chartPoint)
        {
            ChartInformation    instance      = (ChartInformation)chartPoint.Instance;
            SimpleMarkerOverlay markerOverlay = (SimpleMarkerOverlay)wpfMap1.Overlays["MarkerOverlay"];

            markerOverlay.Markers[0].Position = new Point(instance.Longitude, instance.Latitude);
            markerOverlay.Refresh();
        }
Ejemplo n.º 13
0
        public static SimpleMarkerOverlay GetCumulativeFactorsOverlay(WinformsMap map)
        {
            SimpleMarkerOverlay cumulativeFactorsOverlay = new SimpleMarkerOverlay {
                MapControl = map, Name = "cumulativeFactors"
            };

            return(cumulativeFactorsOverlay);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Set up the map with the ThinkGeo Cloud Maps overlay and a feature layer containing Frisco zoning data
        /// </summary>
        protected override void OnAppearing()
        {
            base.OnAppearing();
            // Create the background world maps using vector tiles requested from the ThinkGeo Cloud Service.
            ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light);

            thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector");

            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            // Set the Map Unit to meters (used in Spherical Mercator)
            mapView.MapUnit = GeographyUnit.Meter;

            // Create a feature layer to hold the Frisco zoning data
            ShapeFileFeatureLayer zoningLayer = new ShapeFileFeatureLayer(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Data/Shapefile/Zoning.shp"));

            // Convert the Frisco shapefile from its native projection to Spherical Mercator, to match the map
            ProjectionConverter projectionConverter = new ProjectionConverter(2276, 3857);

            zoningLayer.FeatureSource.ProjectionConverter = projectionConverter;

            // Add a style to use to draw the Frisco zoning polygons
            zoningLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            zoningLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(50, GeoColors.MediumPurple), GeoColors.MediumPurple, 2);

            // Create a layer to hold features found by the spatial query
            InMemoryFeatureLayer highlightedFeaturesLayer = new InMemoryFeatureLayer();

            highlightedFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(90, GeoColors.MidnightBlue), GeoColors.MidnightBlue);
            highlightedFeaturesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Add each feature layer to it's own overlay
            // We do this so we can control and refresh/redraw each layer individually
            LayerOverlay layerOverlay = new LayerOverlay();

            layerOverlay.Layers.Add("Frisco Zoning", zoningLayer);
            layerOverlay.Layers.Add("Highlighted Features", highlightedFeaturesLayer);


            // Add a MarkerOverlay to the map to display the selected point for the query
            SimpleMarkerOverlay queryFeatureMarkerOverlay = new SimpleMarkerOverlay();

            mapView.Overlays.Add("Query Feature Marker Overlay", queryFeatureMarkerOverlay);

            mapView.Overlays.Add("Layer Overlay", layerOverlay);

            // Add a sample point to the map for the initial query
            PointShape sampleShape = new PointShape(-10779425.2690712, 3914970.73561765);

            GetFeaturesWithinDistance(sampleShape);

            // Set the map extent to the initial area
            mapView.CurrentExtent = new RectangleShape(-10781338.5834248, 3916678.62545891, -10777511.9547176, 3913262.84577639);

            mapView.Refresh();
        }
Ejemplo n.º 15
0
        private void mapView_MapClick(object sender, MapClickMapViewEventArgs e)
        {
            SimpleMarkerOverlay markerOverlay = (SimpleMarkerOverlay)mapView.Overlays["MarkerOverlay"];
            Marker marker = new Marker(e.WorldLocation);

            marker.ImageSource = new BitmapImage(new Uri("/Resources/AQUA.png", UriKind.RelativeOrAbsolute));
            marker.Width       = 20;
            marker.Height      = 34;
            marker.YOffset     = -17;

            markerOverlay.Markers.Add(marker);
            markerOverlay.Refresh();
        }
        private void AddMarkerToMap(PointShape location)
        {
            SimpleMarkerOverlay markerOverlay = (SimpleMarkerOverlay)Map1.Overlays["MarkerOverlay"];
            Marker marker = new Marker(location);

            marker.ImageSource     = new BitmapImage(new Uri("/Resources/AQUA.png", UriKind.RelativeOrAbsolute));
            marker.Width           = 20;
            marker.Height          = 34;
            marker.YOffset         = -17;
            marker.RenderTransform = new RotateTransform(-currentAngle, marker.Width / 2, marker.Height);
            markerOverlay.Markers.Add(marker);
            markerOverlay.Refresh();
        }
        private void WpfMap_Loaded(object sender, RoutedEventArgs e)
        {
            wpfMap1.MapUnit = GeographyUnit.DecimalDegree;
            wpfMap1.CurrentExtent = new RectangleShape(-155.733, 95.60, 104.42, -81.9);

            WorldMapKitWmsWpfOverlay worldMapKitOverlay = new WorldMapKitWmsWpfOverlay();
            wpfMap1.Overlays.Add(worldMapKitOverlay);

            SimpleMarkerOverlay markerOverlay = new SimpleMarkerOverlay();
            wpfMap1.Overlays.Add("MarkerOverlay", markerOverlay);

            wpfMap1.Refresh();
        }
        private void winformsMap1_MapClick(object sender, MapClickWinformsMapEventArgs e)
        {
            SimpleMarkerOverlay markerOverlay = (SimpleMarkerOverlay)winformsMap1.Overlays["MarkerOverlay"];

            Marker marker = new Marker(e.WorldLocation);

            marker.Image   = Properties.Resources.AQUA;
            marker.Width   = 20;
            marker.Height  = 34;
            marker.YOffset = -17;

            markerOverlay.Markers.Add(marker);

            winformsMap1.Refresh();
        }
Ejemplo n.º 19
0
        private void Form_Load(object sender, EventArgs e)
        {
            winformsMap1.MapClick += new EventHandler<MapClickWinformsMapEventArgs>(winformsMap1_MapClick);
            winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
            winformsMap1.CurrentExtent = new RectangleShape(-155.733, 95.60, 104.42, -81.9);

            WorldMapKitWmsDesktopOverlay worldMapKitOverlay = new WorldMapKitWmsDesktopOverlay();
            winformsMap1.Overlays.Add(worldMapKitOverlay);

            SimpleMarkerOverlay markerOverlay = new SimpleMarkerOverlay();
            markerOverlay.MapControl = winformsMap1;
            winformsMap1.Overlays.Add("MarkerOverlay", markerOverlay);

            winformsMap1.Refresh();
        }
Ejemplo n.º 20
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            wpfMap.MapUnit      = GeographyUnit.Meter;
            wpfMap.ZoomLevelSet = new ThinkGeoCloudMapsZoomLevelSet();

            // Add background map.
            // Please input your ThinkGeo Cloud Client ID / Client Secret to enable the background map.
            ThinkGeoCloudRasterMapsOverlay baseOverlay = new ThinkGeoCloudRasterMapsOverlay("ThinkGeo Cloud Client ID", "ThinkGeo Cloud Client Secret");

            wpfMap.Overlays.Add(baseOverlay);

            // Add marker overlay for showing the best matching place.
            bestmatchingMarkerOverlay = new SimpleMarkerOverlay();
            wpfMap.Overlays.Add("BestMatchingMarkerOverlay", bestmatchingMarkerOverlay);

            // Add marker overlay for showing result.
            nearbysMarkerOverlay = new SimpleMarkerOverlay();
            wpfMap.Overlays.Add("NearbysMarkerOverlay", nearbysMarkerOverlay);

            // Add layer for searchRadius.
            seachRadiusFeatureLayer = new InMemoryFeatureLayer();
            seachRadiusFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = new AreaStyle(new GeoPen(new GeoColor(100, GeoColors.Blue)), new GeoSolidBrush(new GeoColor(10, GeoColors.Blue)));
            seachRadiusFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Add layer for showing geometry in result.
            resultGeometryFeatureLayer = new InMemoryFeatureLayer();
            resultGeometryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = new AreaStyle(GeoPens.Blue, new GeoSolidBrush(new GeoColor(10, GeoColors.Blue)));
            resultGeometryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay searchResultOverlay = new LayerOverlay()
            {
                DrawingQuality = DrawingQuality.HighQuality
            };

            searchResultOverlay.Layers.Add("ResultGeometryFeatureLayer", resultGeometryFeatureLayer);
            searchResultOverlay.Layers.Add("SerachRadiusFeatureLayer", seachRadiusFeatureLayer);
            wpfMap.Overlays.Add("SearchResult", searchResultOverlay);

            wpfMap.CurrentExtent = new RectangleShape(-10789506, 3924697, -10767934, 3905588);
            wpfMap.Refresh();

            // Bind search categories to comboxList.
            nearbySearchCategory.ItemsSource = new List <string>()
            {
                "None", "Common", "All", "Customized"
            };
            nearbySearchCategory.SelectedIndex = 2;
        }
        private static void RemoveMarker()
        {
            if (GisEditor.LayerListManager.SelectedLayerListItem == null)
            {
                return;
            }
            Marker marker = GisEditor.LayerListManager.SelectedLayerListItem.ConcreteObject as Marker;

            if (marker != null)
            {
                SimpleMarkerOverlay markerOverlay = GetMarkerOverlayByMarker(GisEditor.ActiveMap, marker);
                markerOverlay.Markers.Remove(marker);
                GisEditor.ActiveMap.Refresh(markerOverlay);
                GisEditor.UIManager.InvokeRefreshPlugins(new RefreshArgs(markerOverlay.Markers, RefreshArgsDescriptions.RemoveMarkerDescription));
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Adds a marker to the simpleMarkerOverlay where the map tap event occurred.
        /// </summary>
        private void MapView_OnMapTouch(object sender, TouchMapViewEventArgs e)
        {
            SimpleMarkerOverlay simpleMarkerOverlay = (SimpleMarkerOverlay)mapView.Overlays["simpleMarkerOverlay"];

            // Create a marker at the position the mouse was tapped
            var marker = new Marker()
            {
                Position    = e.PointInWorldCoordinate,
                ImageSource = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Resources/AQUA.png"),
                YOffset     = -17
            };

            // Add the marker to the simpleMarkerOverlay and refresh the map
            simpleMarkerOverlay.Markers.Add(marker);
            simpleMarkerOverlay.Refresh();
        }
Ejemplo n.º 23
0
        private void ConfigureMap()
        {
            winformsMap1.Overlays.Clear();
            _layerOverlay = new LayerOverlay {
                Name = "main", IsBase = true
            };
            _markersOverlay         = MapHelper.GetMarkersOverlay(winformsMap1);
            _pathAndPOILayerOverlay = new LayerOverlay {
                Name = "pathandpoi"
            };
            _cumulativeFactorsOverlay = MapHelper.GetCumulativeFactorsOverlay(winformsMap1);

            winformsMap1.Overlays.Add(_layerOverlay);
            winformsMap1.Overlays.Add(_markersOverlay);
            winformsMap1.Overlays.Add(_cumulativeFactorsOverlay);
            winformsMap1.Overlays.Add(_pathAndPOILayerOverlay);
        }
Ejemplo n.º 24
0
        private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit       = GeographyUnit.Meter;
            mapView.ZoomLevelSet  = new ThinkGeoCloudMapsZoomLevelSet();
            mapView.CurrentExtent = new RectangleShape(-17336118, 20037508, 11623981, -16888303);

            // Create background world map with vector tile requested from ThinkGeo Cloud Service.
            ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay(SampleHelper.ThinkGeoCloudId, SampleHelper.ThinkGeoCloudSecret, ThinkGeoCloudVectorMapsMapType.Light);

            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            SimpleMarkerOverlay markerOverlay = new SimpleMarkerOverlay();

            mapView.Overlays.Add("MarkerOverlay", markerOverlay);

            mapView.Refresh();
        }
Ejemplo n.º 25
0
        public static void PlotPoint(PointShape plottedPoint)
        {
            Marker plottedMarker = new Marker(plottedPoint);

            plottedMarker.Cursor                       = System.Windows.Input.Cursors.Hand;
            plottedMarker.ImageSource                  = new BitmapImage(new Uri("/GisEditorPluginCore;component/Images/pin_icon_red.png", UriKind.Relative), new RequestCachePolicy(RequestCacheLevel.CacheIfAvailable));
            plottedMarker.YOffset                      = -8.5;
            plottedMarker.ToolTip                      = GetWorkingContent(plottedPoint);
            plottedMarker.PositionChanged             += MarkerPositionChanged;
            plottedMarker.MarkerMouseClick            += MarkerMouseClick;
            plottedMarker.PreviewMouseRightButtonDown += PlottedMarker_PreviewMouseRightButtonDown;
            plottedMarker.ContextMenu                  = GetContextMenuForPlottedMarker(plottedMarker);

            SimpleMarkerOverlay simpleMarkerOverlay = CurrentOverlays.PlottedMarkerOverlay;

            simpleMarkerOverlay.Markers.Add(plottedMarker);
            GisEditor.ActiveMap.Refresh(simpleMarkerOverlay);
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Update the UI based on the results of a Cloud Geocoding Query
        /// </summary>
        private void UpdateSearchResultsOnUI(CloudGeocodingResult searchResult)
        {
            // Clear the locations list and existing location markers on the map
            SimpleMarkerOverlay geocodedLocationOverlay = (SimpleMarkerOverlay)mapView.Overlays["Geocoded Locations Overlay"];

            geocodedLocationOverlay.Markers.Clear();
            lsbLocations.ItemsSource = null;
            geocodedLocationOverlay.Refresh();

            // Update the UI with the number of results found and the list of locations found
            txtSearchResultsDescription.Text = $"Found {searchResult.Locations.Count} matching locations.";
            lsbLocations.ItemsSource         = searchResult.Locations;
            if (searchResult.Locations.Count > 0)
            {
                lsbLocations.IsVisible    = true;
                lsbLocations.SelectedItem = searchResult.Locations[0];
            }
        }
        private void Map1_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit       = GeographyUnit.Meter;
            Map1.CurrentExtent = new RectangleShape(-16965308.8699768, 10390517.8895596, 15908646.0310775, -8922930.61480984);

            LayerOverlay layerOverlay = new LayerOverlay();

            layerOverlay.TileType   = TileType.MultipleTile;
            layerOverlay.TileBuffer = 2;

            BackgroundLayer backgroundLayer = new BackgroundLayer(new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean));

            layerOverlay.Layers.Add(backgroundLayer);

            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\Countries02.shp");

            worldLayer.DrawingMarginInPixel = 200;
            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle      = WorldStreetsAreaStyles.Common();
            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle      = WorldStreetsTextStyles.GeneralPurpose("CNTRY_NAME", 12);
            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.Font = new GeoFont("Arial", 16, DrawingFontStyles.Bold);
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel   = ApplyUntilZoomLevel.Level20;
            layerOverlay.Layers.Add("SampleLayer", worldLayer);
            Map1.Overlays.Add("LayerOverlay", layerOverlay);

            SimpleMarkerOverlay markerOverlay = new SimpleMarkerOverlay();

            Map1.Overlays.Add("MarkerOverlay", markerOverlay);

            PopupOverlay popupOverlay = new PopupOverlay();

            Map1.Overlays.Add("PopupOverlay", popupOverlay);
            Popup popup = new Popup(new PointShape(-10777662.2854073, 3912165.79621789));

            popup.Content = new TextBlock()
            {
                Text = "ThinkGeo", FontSize = 20
            };
            popupOverlay.Popups.Add(popup);

            Map1.TrackOverlay.DrawingMarginPercentage = 80;
            Map1.EditOverlay.DrawingMarginPercentage  = 80;

            Map1.Refresh();
        }
Ejemplo n.º 28
0
        private void winformsMap1_MapClick(object sender, MapClickWinformsMapEventArgs e)
        {
            SimpleMarkerOverlay markerOverlay = (SimpleMarkerOverlay)winformsMap1.Overlays["MarkerOverlay"];
            Marker marker = new Marker(e.WorldLocation);

            Label content = new Label();
            content.Image = Properties.Resources.AQUABLANK;
            content.Width = 20;
            content.Height = 34;
            content.Text = (index++).ToString();
            content.Font = new Font("Arial", 14, FontStyle.Bold);
            content.ForeColor = Color.White;
            content.Margin = new Padding(0, -10, 0, 0);
            marker.Controls.Add(content);

            markerOverlay.Markers.Add(marker);

            winformsMap1.Refresh();
        }
Ejemplo n.º 29
0
        private static ContextMenu GetContextMenuForPlottedMarker(Marker marker)
        {
            ContextMenu ctx = new ContextMenu();

            MenuItem menuItem = new MenuItem();

            menuItem.Header      = "Remove";
            menuItem.DataContext = marker;
            menuItem.Icon        = new Image()
            {
                Width  = 16,
                Height = 16,
                Source = new BitmapImage(new Uri("pack://application:,,,/GisEditorPluginCore;component/Images/Delete.png", UriKind.RelativeOrAbsolute))
            };

            menuItem.Click += (s, e) =>
            {
                MenuItem self          = (MenuItem)s;
                Marker   relatedMarker = self.DataContext as Marker;

                if (relatedMarker != null)
                {
                    Popup relatedPopup = relatedMarker.Tag as Popup;

                    SimpleMarkerOverlay currentMarkerOverlay = CurrentOverlays.PlottedMarkerOverlay;
                    if (currentMarkerOverlay.Markers.Contains(relatedMarker))
                    {
                        currentMarkerOverlay.Markers.Remove(relatedMarker);
                        GisEditor.ActiveMap.Refresh(currentMarkerOverlay);
                    }

                    PopupOverlay currentPopupOverlay = CurrentOverlays.PopupOverlay;
                    if (currentPopupOverlay.Popups.Contains(relatedPopup))
                    {
                        currentPopupOverlay.Popups.Remove(relatedPopup);
                        GisEditor.ActiveMap.Refresh(currentPopupOverlay);
                    }
                }
            };

            ctx.Items.Add(menuItem);
            return(ctx);
        }
Ejemplo n.º 30
0
        private void GetFeaturesWithinDistance(PointShape point)
        {
            // Find the layers we will be modifying in the MapView
            SimpleMarkerOverlay   queryFeatureMarkerOverlay = (SimpleMarkerOverlay)mapView.Overlays["Query Feature Marker Overlay"];
            ShapeFileFeatureLayer zoningLayer = (ShapeFileFeatureLayer)mapView.FindFeatureLayer("Frisco Zoning");

            // Clear the query point marker overlaylayer and add a marker on the newly drawn point
            queryFeatureMarkerOverlay.Markers.Clear();
            queryFeatureMarkerOverlay.Markers.Add(CreateNewMarker(point));
            queryFeatureMarkerOverlay.Refresh();

            // Perform the spatial query using the drawn point and highlight features that were found
            var queriedFeatures = PerformSpatialQuery(point, zoningLayer);

            HighlightQueriedFeatures(queriedFeatures);

            // Disable map drawing and clear the drawn point
            mapView.TrackOverlay.TrackMode = TrackMode.None;
            mapView.TrackOverlay.TrackShapeLayer.InternalFeatures.Clear();
        }
Ejemplo n.º 31
0
        private void UpdateMap(Feature currentFeature)
        {
            // We need to first find our vehicle overlay
            SimpleMarkerOverlay vehicleOverlay = (SimpleMarkerOverlay)mapView.Overlays["Vehicle Overlay"];

            // Update the markers position
            vehicleOverlay.Markers["vehicle"].Position = (PointShape)currentFeature.GetShape();

            // If we have the center on vehicle check box checked then we center the map on the new location
            if (centerOnVehicle.IsChecked)
            {
                mapView.CenterAt(currentFeature);
                mapView.Overlays["Background Maps"].Refresh();
            }
            else
            {
                // Refresh the vehicle overlay
                mapView.Overlays["Vehicle Overlay"].Refresh();
            }
        }
        private void WpfMap_Loaded(object sender, RoutedEventArgs e)
        {
            wpfMap1.MapUnit = GeographyUnit.DecimalDegree;
            wpfMap1.CurrentExtent = new RectangleShape(-155.733, 95.60, 104.42, -81.9);

            WorldMapKitWmsWpfOverlay worldMapKitOverlay = new WorldMapKitWmsWpfOverlay();
            wpfMap1.Overlays.Add(worldMapKitOverlay);

            SimpleMarkerOverlay markerOverlay = new SimpleMarkerOverlay();
            markerOverlay.DragMode = MarkerDragMode.CopyWithShiftKey;
            wpfMap1.Overlays.Add("MarkerOverlay", markerOverlay);

            Marker marker = new Marker(-95.2806, 38.9554);
            marker.ImageSource = new BitmapImage(new Uri("/Resources/AQUA.png", UriKind.RelativeOrAbsolute));
            marker.Width = 20;
            marker.Height = 34;
            marker.YOffset = -17;
            markerOverlay.Markers.Add(marker);

            wpfMap1.Refresh();
        }
        public static SimpleMarkerOverlay CreateSimpleMarkerOverlay()
        {
            const string simpleMarkerOverlayName = "Simple Marker Overlay";

            SimpleMarkerOverlay simpleMarkerOverlay = new SimpleMarkerOverlay();
            simpleMarkerOverlay.Name = simpleMarkerOverlayName;

            //  Create Marker and set the image for marker.
            Marker marker = new Marker(new PointShape(-10778193.6066375, 3912148.55));
            Uri resourceUri = new Uri(string.Format(uriTemplate, "drawpoint.png"), UriKind.RelativeOrAbsolute);
            marker.ImageSource = new BitmapImage(resourceUri);

            //  Set centerY of the marker
            marker.YOffset = -marker.ImageSource.Height * 0.5;
            simpleMarkerOverlay.Markers.Add(marker);

            return simpleMarkerOverlay;
        }