Beispiel #1
0
        private void LayoutRoot_Loaded(object sender, RoutedEventArgs e)
        {
            btnGenerateGridFile.IsEnabled = true;

            Map1.MapUnit       = GeographyUnit.Meter;
            Map1.ZoomLevelSet  = new ThinkGeoCloudMapsZoomLevelSet();
            Map1.CurrentExtent = new RectangleShape(-11204955.4870063, 4543351.66721459, -11200273.7233416, 4539757.60752901);

            //Load the well depth points and depth data from a text file into the dictionary
            //We cache this at the class level to prevent form loading it multiple times
            wellDepthPointData = GetWellDepthPointDataFromCSV(wellDepthPointDataFilePath);

            // 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");

            Map1.Overlays.Add(baseOverlay);

            //Add the grid layer, the grid cells, and the well points to the map
            LayerOverlay isoLineOverlay = new LayerOverlay();

            isoLineOverlay.Drawn   += new EventHandler <DrawnOverlayEventArgs>(isoLineOverlay_Drawn);
            isoLineOverlay.Drawing += new EventHandler <DrawingOverlayEventArgs>(isoLineOverlay_Drawing);

            Map1.Overlays.Add("isoLineOverlay", isoLineOverlay);

            isoLineOverlay.Layers.Add("IsoLineLayer", GetDynamicIsoLineLayer());
            isoLineOverlay.Layers.Add("GridCellsLayer", GetDynamicGridFeatureLayer());
            isoLineOverlay.Layers.Add("WellsLayer", GetWellDepthPointLayer());
            isoLineOverlay.DrawingQuality = DrawingQuality.HighQuality;

            Map1.Refresh();
        }
Beispiel #2
0
        private void btnPan_Click(object sender, EventArgs e)
        {
            // Grab the MapPrinterLayer and adjust the extent
            PrinterInteractiveOverlay printerOverlay = (PrinterInteractiveOverlay)Map1.InteractiveOverlays["PrintPreviewOverlay"];

            MapPrinterLayer mapPrinterLayer = ((MapPrinterLayer)(printerOverlay.PrinterLayers["MapLayer"]));

            if (sender == btnPanNorth)
            {
                mapPrinterLayer.MapExtent = MapUtil.Pan(mapPrinterLayer.MapExtent, PanDirection.Up, 30);
            }
            else if (sender == btnPanSouth)
            {
                mapPrinterLayer.MapExtent = MapUtil.Pan(mapPrinterLayer.MapExtent, PanDirection.Down, 30);
            }
            else if (sender == btnPanWest)
            {
                mapPrinterLayer.MapExtent = MapUtil.Pan(mapPrinterLayer.MapExtent, PanDirection.Left, 30);
            }
            else if (sender == btnPanEast)
            {
                mapPrinterLayer.MapExtent = MapUtil.Pan(mapPrinterLayer.MapExtent, PanDirection.Right, 30);
            }

            Map1.Refresh();
        }
Beispiel #3
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();
        }
Beispiel #4
0
        private void toolBoxItem_Click(object sender, RoutedEventArgs e)
        {
            PrinterInteractiveOverlay printerInteractiveOverlay = (PrinterInteractiveOverlay)Map1.InteractiveOverlays["PrintPreviewOverlay"];
            PrinterLayer printerLayer = null;

            if (sender == btnAddLabel)
            {
                printerLayer = new LabelPrinterLayer();
                printerLayer.SetPosition(2, 1, 0, 0, PrintingUnit.Inch);
            }
            else if (sender == btnAddImage)
            {
                printerLayer = new ImagePrinterLayer();
            }
            else if (sender == btnAddScaleLine)
            {
                MessageBox.Show("NotImplemented");
            }
            else if (sender == btnAddScaleBar)
            {
                MessageBox.Show("NotImplemented");
            }
            else if (sender == btnAddDataGrid)
            {
                printerLayer = new DataGridPrinterLayer();
                printerLayer.SetPosition(1, 1, 0, 0, PrintingUnit.Inch);
            }

            //if (ShowPrinterLayerProperties(printerLayer) == DialogResult.OK)
            if (ShowPrinterLayerProperties(printerLayer) == true)
            {
                printerInteractiveOverlay.PrinterLayers.Add(printerLayer);
                Map1.Refresh();
            }
        }
Beispiel #5
0
        private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit      = GeographyUnit.Meter;
            Map1.ZoomLevelSet = new ThinkGeoCloudMapsZoomLevelSet();

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

            Map1.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            PopupOverlay popupOverlay = new PopupOverlay();

            Map1.Overlays.Add(popupOverlay);

            ShapeFileFeatureLayer majorCitiesShapeLayer = new ShapeFileFeatureLayer(SampleHelper.Get("MajorCities_3857.shp"));

            majorCitiesShapeLayer.Open();
            Collection <Feature> features = majorCitiesShapeLayer.QueryTools.GetAllFeatures(ReturningColumnsType.AllColumns);

            foreach (Feature feature in features)
            {
                Popup popup = new Popup(feature.GetShape().GetCenterPoint());
                popup.Content = feature.ColumnValues["AREANAME"];
                popupOverlay.Popups.Add(popup);
            }
            majorCitiesShapeLayer.Close();

            Map1.CurrentExtent = popupOverlay.GetBoundingBox();
            Map1.Refresh();
        }
Beispiel #6
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ShapefileLayer pointLayer = Map1.FindLayer <ShapefileLayer>("cities-900913");

            SyncFontStyleSettings(pointLayer, true);
            Map1.Refresh("PointOverlay");
        }
Beispiel #7
0
        private void cbxPaperSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (IsLoaded)
            {
                // When the page size combobox is changed then we update the PagePrinterLayer to reflect the changes
                PrinterInteractiveOverlay printerInteractiveOverlay = (PrinterInteractiveOverlay)Map1.InteractiveOverlays["PrintPreviewOverlay"];
                PagePrinterLayer          pagePrinterLayer          = (PagePrinterLayer)printerInteractiveOverlay.PrinterLayers["PageLayer"];

                string selectText = ((ComboBoxItem)e.AddedItems[0]).Content.ToString();
                if (selectText.StartsWith("ANSI A"))
                {
                    pagePrinterLayer.PageSize = PrinterPageSize.AnsiA;
                }
                else if (selectText.StartsWith("ANSI B"))
                {
                    pagePrinterLayer.PageSize = PrinterPageSize.AnsiB;
                }
                else if (selectText.StartsWith("ANSI C"))
                {
                    pagePrinterLayer.PageSize = PrinterPageSize.AnsiC;
                }
                else if (selectText.StartsWith("ANSI D"))
                {
                    pagePrinterLayer.PageSize = PrinterPageSize.AnsiD;
                }
                else if (selectText.StartsWith("ANSI E"))
                {
                    pagePrinterLayer.PageSize = PrinterPageSize.AnsiE;
                }

                Map1.Refresh();
            }
        }
Beispiel #8
0
        private void Refresh()
        {
            ShapefileLayer areaLayer = Map1.FindLayer <ShapefileLayer>("countries-900913");

            if (areaLayer == null)
            {
                return;
            }
            if (values == null)
            {
                values = areaLayer.Source.GetUniqueFieldValues(columnName).Distinct().ToArray();
            }

            areaLayer.Styles.Clear();
            ValueStyle valueStyle = ValueStyle.Create(columnName, values, DimensionType.Area, colorFamily, new GeoColor(255, 108, 144, 150), 0.01f);

            areaLayer.Styles.Add(valueStyle);

            LegendTitleTextBlock.Text = $"Thematic by \"{columnName}\" column";
            LegendView.Update(valueStyle.ValueItems.OrderBy(i => i.Value).SelectMany(i =>
            {
                foreach (var style in i.Styles)
                {
                    style.Name = $"{columnName} = \"{i.Value}\"";
                }
                return(i.Styles);
            }));
            Map1.Refresh(RefreshType.Redraw);
        }
Beispiel #9
0
        private void Refresh()
        {
            ShapefileLayer areaLayer = Map1.FindLayer <ShapefileLayer>("countries-900913");

            if (areaLayer == null)
            {
                return;
            }
            areaLayer.Styles.Clear();
            ClassBreakStyle classBreakStyle = ClassBreakStyle.Create(columnName, 281396894, 5000000, 11, DimensionType.Area, colorFamily, new GeoColor(50, 100, 200, 150), 0.01f);

            classBreakStyle.ClassBreaks[0].Value = 0;
            areaLayer.Styles.Add(classBreakStyle);

            LegendTitleTextBlock.Text = "The population of countries";
            ClassBreak[] classBreaks = classBreakStyle.ClassBreaks.OrderBy(i => i.Value).ToArray();
            for (int i = 0; i < classBreaks.Length; i++)
            {
                ClassBreak fromClassBreak = classBreaks[i];
                ClassBreak toClassBreak   = i + 1 < classBreaks.Length ? classBreaks[i + 1] : null;
                foreach (var style in fromClassBreak.Styles)
                {
                    if (toClassBreak != null)
                    {
                        style.Name = $"{(fromClassBreak.Value / 1000000).ToString("N0")} ~ {(toClassBreak.Value / 1000000).ToString("N0")} million";
                    }
                    else
                    {
                        style.Name = $">= {(fromClassBreak.Value / 1000000).ToString("N0")} million";
                    }
                }
            }
            LegendView.Update(classBreaks.SelectMany(i => i.Styles));
            Map1.Refresh(RefreshType.Redraw);
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ShapefileLayer areaLayer = Map1.FindLayer <ShapefileLayer>("countries-900913");

            areaLayer.UseRandomStyle(120);
            Map1.Refresh("AreaOverlay");
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            FeatureLayer featureLayer = Map1.FindLayer <FeatureLayer>("countries-900913");

            featureLayer.UseRandomStyle();
            Map1.Refresh("Dynamic Overlay");
        }
Beispiel #12
0
        private async Task MoveLine(MemoryLayer highlightLayer, GeoLine baseline, double percentageRatio, int i, bool reverse = false)
        {
            GeoLine line = await Task.Run(() => (GeoLine)baseline.GetSegmentation((float)percentageRatio *i));

            highlightLayer.Features.Clear();

            if (line != null)
            {
                highlightLayer.Features.Add(new Feature(line));

                GeoCoordinate currentPoint = line.Coordinates.Last();
                highlightLayer.Features.Add(new Feature(new GeoPoint(currentPoint)));
                if (line.Coordinates.Count > 1)
                {
                    GeoCoordinate previousPoint = line.Coordinates.ElementAt(line.Coordinates.Count - 2);
                    double        angle         = Math.Atan2(currentPoint.Y - previousPoint.Y, currentPoint.X - previousPoint.X);
                    float         degree        = (float)(angle * 180 / Math.PI);
                    if (reverse)
                    {
                        degree = degree + 180;
                    }
                    highlightLayer.Styles.OfType <IconStyle>().First().Rotation = degree;
                }
            }
            Map1.Refresh("HighlightOverlay");

            await Task.Run(() => Thread.Sleep(50));
        }
Beispiel #13
0
        private void EditLayer_Click(object sender, RoutedEventArgs e)
        {
            PrinterInteractiveOverlay printerInteractiveOverlay = (PrinterInteractiveOverlay)Map1.InteractiveOverlays["PrintPreviewOverlay"];
            PrinterLayer printerLayer = (PrinterLayer)((MenuItem)sender).Tag;

            ShowPrinterLayerProperties(printerLayer);
            Map1.Refresh();
        }
        private void BtnClockwise_Click(object sender, RoutedEventArgs e)
        {
            int degreeStep = GetRotateArguments();

            Map1.RotatedAngle = Map1.RotatedAngle + degreeStep;

            Map1.Refresh();
        }
Beispiel #15
0
        private void RemoveLayer_Click(object sender, RoutedEventArgs e)
        {
            PrinterInteractiveOverlay printerInteractiveOverlay = (PrinterInteractiveOverlay)Map1.InteractiveOverlays["PrintPreviewOverlay"];
            PrinterLayer printerLayer = (PrinterLayer)((MenuItem)sender).Tag;

            printerInteractiveOverlay.PrinterLayers.Remove(printerLayer);

            Map1.Refresh();
        }
Beispiel #16
0
        private void CheckBox_Click(object sender, RoutedEventArgs e)
        {
            bool useDash = ((CheckBox)sender).IsChecked.Value;

            ShapefileLayer lineLayer = Map1.FindLayer <ShapefileLayer>("streets-900913");

            ((LineStyle)lineLayer.Styles[0]).Pen.DashPattern = useDash ? new[] { 4f, 4f } : null;
            Map1.Refresh("LineOverlay");
        }
Beispiel #17
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ShapefileLayer lineLayer = Map1.FindLayer <ShapefileLayer>("streets-900913");

            float[] dashPattern = ((LineStyle)lineLayer.Styles[0]).Pen.DashPattern;
            lineLayer.UseRandomStyle();
            ((LineStyle)lineLayer.Styles[0]).Pen.DashPattern = dashPattern;

            Map1.Refresh("LineOverlay");
        }
 private void StopAnglePanel_MouseUp(object sender, MouseButtonEventArgs e)
 {
     if (!isRotated)
     {
         Compass.RenderTransform = new RotateTransform(0, Compass.ActualWidth / 2 + 2, Compass.ActualHeight / 2);
         SetCanvasRotate(0);
         currentAngle = 0;
     }
     Map1.Refresh();
 }
 private void CancelEdit()
 {
     foreach (var feature in Map1.EditOverlay.EditShapesLayer.InternalFeatures)
     {
         Map1.TrackOverlay.TrackShapeLayer.InternalFeatures.Add(feature);
     }
     Map1.EditOverlay.EditShapesLayer.InternalFeatures.Clear();
     Map1.Refresh(new Overlay[] { Map1.EditOverlay, Map1.TrackOverlay });
     Map1.TrackOverlay.TrackMode = TrackMode.None;
 }
        private void MapTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            GoogleMapsLayer gooleMapsLayer = Map1.FindLayer <GoogleMapsLayer>("Google Maps");

            if (gooleMapsLayer != null)
            {
                gooleMapsLayer.MapsType = (GoogleMapsType)MapTypeComboBox.SelectedItem;
                Map1.Refresh(RefreshType.Redraw);
            }
        }
Beispiel #21
0
        private void SyncSymbolSettings(ShapefileLayer pointLayer)
        {
            SymbolStyle symbolStyle = (SymbolStyle)pointLayer.Styles[0];

            symbolStyle.SymbolType = (SymbolType)SymbolTypeComboBox.SelectedValue;
            symbolStyle.Size       = (float)SymbolSizeComboBox.SelectedValue;
            symbolStyle.Margin     = 40;

            Map1.Refresh("PointOverlay");
        }
Beispiel #22
0
        private void MapTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            StamenMapLayer stamenMapLayer = Map1.FindLayer <StamenMapLayer>("Stamen Map");

            if (stamenMapLayer != null)
            {
                stamenMapLayer.MapType = (StamenMapType)MapTypeComboBox.SelectedItem;
                Map1.Refresh(RefreshType.Redraw);
            }
        }
Beispiel #23
0
 private void cbxPercentage_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (this.IsLoaded)
     {
         String zoomString  = (String)cbxPercentage.SelectedItem;
         double currentZoom = Double.Parse(zoomString.Replace("%", ""));
         Map1.ZoomToScale(PrinterHelper.GetPointsPerGeographyUnit(Map1.MapUnit) / (currentZoom / 100));
         Map1.Refresh();
     }
 }
Beispiel #24
0
        private async Task MovePoint(MemoryLayer highlightLayer, GeoLine baseline, double percentageRatio, int i)
        {
            GeoPoint point = await Task.Run(() => baseline.GetPoint((float)percentageRatio *i));

            highlightLayer.Features.Clear();
            highlightLayer.Features.Add(new Feature(point));
            Map1.Refresh("HighlightOverlay");

            await Task.Run(() => Thread.Sleep(50));
        }
Beispiel #25
0
        private void MapTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            BingMapsLayer bingMapsLayer = Map1.FindLayer <BingMapsLayer>("Bing Maps");

            if (bingMapsLayer != null)
            {
                bingMapsLayer.MapsType = (BingMapsType)MapTypeComboBox.SelectedItem;
                Map1.Refresh(RefreshType.Redraw);
            }
        }
Beispiel #26
0
 // Reseter programmet som det var ved opstart
 private void ResetButton_Click(object sender, EventArgs e)
 {
     Runners.Clear();
     player.Second = 0;
     PlayTimer.Stop();
     Map1.Refresh();
     ResetButton.Hide();
     LoadButton.Show();
     player.ShutDown();
     RunnersCheckBox.Items.Clear();
 }
Beispiel #27
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            MemoryLayer resultLayer = Map1.FindLayer <MemoryLayer>("ResultLayer");

            if (resultLayer.Features.Count == 0)
            {
                Collection <GeoPoint> crossingPoints = highlightFeature.Geometry.GetCrossing(crossLineFeature.Geometry);
                resultLayer.Features.AddRange(crossingPoints.Select(p => new Feature(p)));
                Map1.Refresh("ResultOverlay");
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            MemoryLayer bufferResultLayer = Map1.FindLayer <MemoryLayer>("BufferResultLayer");

            if (bufferResultLayer.Features.Count == 0)
            {
                Feature bufferedFeature = new Feature(highlightFeature.Geometry.GetConvexHull());
                bufferResultLayer.Features.Add(bufferedFeature);
                Map1.Refresh("BufferedOverlay");
            }
        }
Beispiel #29
0
        private void UpdateStyle()
        {
            ShapefileLayer pointLayer = Map1.FindLayer <ShapefileLayer>("cities-900913");

            if (pointLayer == null)
            {
                return;
            }

            SyncFontStyleSettings(pointLayer);
            Map1.Refresh("PointOverlay");
        }
Beispiel #30
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            MemoryLayer resultLayer = Map1.FindLayer <MemoryLayer>("ResultLayer");

            if (resultLayer.Features.Count == 0)
            {
                Geometry intersection = feature1.Geometry.GetIntersection(feature2.Geometry);
                resultLayer.Features.Add(new Feature(intersection));

                Map1.Refresh("ResultOverlay");
            }
        }