Page.xaml.cs :  » GIS » DeepEarth » ExampleControl » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » GIS » DeepEarth 
DeepEarth » ExampleControl » Page.xaml.cs
// Deep Earth is a community project available under the Microsoft Public License (Ms-PL)
// Code is provided as is and with no warrenty  Use at your own risk
// View the project and the latest code at http://codeplex.com/deepearth/

using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Media;
using DeepEarth.Client.MapControl.Geometry;
using DeepEarth.Client.Services.Bing;
using DeepEarth.Client.Services.OSM;


namespace ExampleControl{

    public partial class Page
    {


        public Page()
        {
            InitializeComponent();

            //Choose your startup provider
            //map.BaseLayer.Source = new VeTileSource(VeMapModes.VeHybrid);
            map.BaseLayer.Source = new OsmTileSource(OsmMapModes.Mapnik);
            //map.BaseLayer.Source = new OamTileSource(OamMapModes.OAM);

            GeometryLayerTest();

            GeometryAnchorTest();




        }

        private void GeometryLayerTest()
        {


            //Bermuda Triangle is drawn on a GeometryLayer with TransformUpdate
            GeometryLayer transformLayer = new GeometryLayer(map) { UpdateMode = GeometryLayer.UpdateModes.TransformUpdate };
            transformLayer.Opacity = 0.5;
            map.Layers.Add(transformLayer);
            Polygon polygon = new Polygon();
            transformLayer.Add(polygon);
            polygon.Points = new ObservableCollection<Point> { new Point(-80.195, 25.775), new Point(-64.75, 32.303), new Point(-66.073, 18.44) };

            RadialGradientBrush fillBrush = new RadialGradientBrush();
            fillBrush.GradientStops.Add(new GradientStop { Color = Colors.Red, Offset = 0 });
            fillBrush.GradientStops.Add(new GradientStop { Color = Colors.Purple, Offset = 1 });
            polygon.Fill = fillBrush;
            Color.FromArgb(0x7F, 0xFF, 0x00, 0x00);
            System.Windows.Controls.ToolTipService.SetToolTip(polygon, "Bermuda Triangle");


            //Equator is drawn on a PanOnly GeometryLayer
            GeometryLayer panOnlyLayer = new GeometryLayer(map) { UpdateMode = GeometryLayer.UpdateModes.PanOnlyUpdate };
            panOnlyLayer.Opacity = 0.5;
            map.Layers.Add(panOnlyLayer);
            LineString line = new LineString();
            panOnlyLayer.Add(line);
            line.Points.Add(new Point(-180, 0));
            line.Points.Add(new Point(180, 0));
            line.LineThickness = 4;
            line.LineColor = Colors.White;
            System.Windows.Controls.ToolTipService.SetToolTip(line, "Equator");


            //Equator endpoints are drawn on an ElementUpdate Geometry Layer to test synching of layers
            GeometryLayer elementUpdateLayer = new GeometryLayer(map) { UpdateMode = GeometryLayer.UpdateModes.ElementUpdate };
            elementUpdateLayer.Opacity = 0.5;
            map.Layers.Add(elementUpdateLayer);
            elementUpdateLayer.Add(new PointBase { Point = new Point(-180, 0) });
            elementUpdateLayer.Add(new PointBase { X = 180, Y = 0 }); // Alternative syntax for setting a PointBase

        }

        private GeometryLayer anchorTestLayer;
        private Style styleArrow;
        private void GeometryAnchorTest()
        {
            var point = new Point(0, 0);

            if(anchorTestLayer == null)
            {
                anchorTestLayer = new GeometryLayer(map) { ID = "RESULTSLAYER", UpdateMode = GeometryLayer.UpdateModes.ElementUpdate };
                styleArrow = (Application.Current.Resources["PushPinArrowStyle"]) as Style;
                map.Layers.Add(anchorTestLayer);
            }

            //Add an arrow pin whose another point is an anchor of 0.5, 1.0;
            PointBase arrowPin = new PointBase { Point = point, Style = styleArrow };
            anchorTestLayer.Add(arrowPin);

            //Add a another point with the default style which has an anchor of 0.5, 0.5;
            //PointBase defaultPin = new PointBase { Point = point };
            //anchorTestLayer.Add(defaultPin);

        }

        private void ToggleSidePanel_Click(object sender, RoutedEventArgs e)
        {
            sidePanelControl.ToggleSidePanel();
        }

    }
}
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.