当前位置: 首页>>代码示例>>C#>>正文


C# MapControl类代码示例

本文整理汇总了C#中MapControl的典型用法代码示例。如果您正苦于以下问题:C# MapControl类的具体用法?C# MapControl怎么用?C# MapControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MapControl类属于命名空间,在下文中一共展示了MapControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LineStringEditorCreationWithoutMapControlTest

        public void LineStringEditorCreationWithoutMapControlTest()
        {
            var mapControl = new MapControl();
            mapControl.Map.ZoomToFit(new Envelope(new Coordinate(0, 0), new Coordinate(1000, 1000)));
        
            var lineStringEditor = new LineStringInteractor(null, sampleFeature, GetStyle(), null);
            Assert.AreEqual(null, lineStringEditor.TargetFeature);
            Assert.AreNotEqual(null, lineStringEditor.SourceFeature);
            
            // There are no default focused trackers
            var trackers = lineStringEditor.Trackers.Where(t => t.Selected);
            Assert.AreEqual(0, trackers.Count());

            TrackerFeature tracker = lineStringEditor.Trackers[2];
            Assert.AreNotEqual(null, tracker);
            Assert.AreEqual(20.0, tracker.Geometry.Coordinates[0].X);
            Assert.AreEqual(0.0, tracker.Geometry.Coordinates[0].Y);

            lineStringEditor.Start();
            lineStringEditor.SetTrackerSelection(tracker, true);

            trackers = lineStringEditor.Trackers.Where(t => t.Selected);
            Assert.AreEqual(1, trackers.Count());
            Assert.AreNotEqual(null, lineStringEditor.TargetFeature);
            Assert.AreNotEqual(lineStringEditor.SourceFeature, lineStringEditor.TargetFeature);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:26,代码来源:LineStringInteractorTest.cs

示例2: addPinsToMap

        public void addPinsToMap(MapControl mapControl, Action<MapPin> tappedCallback = null)
        {
            removePinsFromMap(mapControl);
            m_mapPins = new List<MapPin>();

            int i = 1;
            DB_station prevStation = null;
            foreach (List<DB_station> route in m_routes)
            {
                foreach(DB_station station in route)
                {
                    if (station == prevStation || (station.latitude == 0f && station.longitude == 0f))
                        continue;

                    // Title for station.
                    string title = "Przystanek " + (i++) + "\n" + station.post_id + " " + station.post_name + "\n" + station.street;

                    // Add pin into map.
                    var location = new Geopoint(new BasicGeoposition()
                    {
                        Latitude = station.latitude,
                        Longitude = station.longitude
                    });
                    MapPin pin = new MapPin(title, station, MapPin.PinType.RegularPin, MapPin.PinSize.Small, tappedCallback);
                    pin.addToMap(mapControl, location);
                    m_mapPins.Add(pin);
                    prevStation = station;
                }
            }
        }
开发者ID:Lichwa,项目名称:JakDojadeXamarin,代码行数:30,代码来源:MapRoute.cs

示例3: LayersWindow

        public LayersWindow(MapControl mapControl)
        {
            InitializeComponent();
            _mapControl = mapControl;
            _model = new ObservableCollection<LayerViewModel>();
            if (mapControl.mapBox.Map.Layers != null && mapControl.mapBox.Map.Layers.Count > 0) {
                foreach (ILayer layer in mapControl.mapBox.Map.Layers) {
                    if (layer is VectorLayer) {
                        _model.Insert(0, new VectorLayerViewModel(layer as VectorLayer));
                    } else if (layer is MyGdalRasterLayer) {
                        _model.Insert(0, new RasterLayerViewModel(layer as MyGdalRasterLayer));
                    }
                }
            }

            lstLayers.ItemsSource = _model;

            if (_model.Count > 0) {
                lstLayers.SelectedIndex = 0;
            }

            MapBackColor = mapControl.mapBox.BackColor;

            backgroundColorPicker.DataContext = this;
        }
开发者ID:kehh,项目名称:biolink,代码行数:25,代码来源:LayersWindow.xaml.cs

示例4: PointMutatorCreationWithoutMapControlTest

        public void PointMutatorCreationWithoutMapControlTest()
        {
            MapControl mapControl = new MapControl();
            mapControl.Map.ZoomToBox(new Envelope(new Coordinate(0, 0), new Coordinate(1000, 1000)));
            ICoordinateConverter coordinateConverter = new CoordinateConverter(mapControl);
            LineStringEditor lineStringMutator = new LineStringEditor(coordinateConverter, null, sampleFeature, GetStyle());
            Assert.AreEqual(null, lineStringMutator.TargetFeature);
            Assert.AreNotEqual(null, lineStringMutator.SourceFeature);
            // There are no default focused trackers
            IList<ITrackerFeature> trackers = lineStringMutator.GetFocusedTrackers();
            Assert.AreEqual(0, trackers.Count);

            ITrackerFeature tracker = lineStringMutator.GetTrackerByIndex(2);
            Assert.AreNotEqual(null, tracker);
            Assert.AreEqual(20.0, tracker.Geometry.Coordinates[0].X);
            Assert.AreEqual(0.0, tracker.Geometry.Coordinates[0].Y);

            lineStringMutator.Start();
            lineStringMutator.Select(tracker, true);

            trackers = lineStringMutator.GetFocusedTrackers();
            Assert.AreEqual(1, trackers.Count);
            Assert.AreNotEqual(null, lineStringMutator.TargetFeature);
            Assert.AreNotEqual(lineStringMutator.SourceFeature, lineStringMutator.TargetFeature);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:25,代码来源:LineStringMutatorTest.cs

示例5: Start

    void Start()
    {
        GameObject mapControlObj = GameObject.Find("MapControl");
        mapControl = mapControlObj.GetComponent<MapControl>();

        Transform textBox = transform.Find("UpperLeft/TextBox");
        mapControl.SetTextBox(textBox.GetComponent<MapTextBox>());

        upperLeft = transform.Find("UpperLeft");
        Camera.main.transform.GetComponent<UIManager>().lockToEdge(upperLeft);

        upperRight = transform.Find("UpperRight");
        Camera.main.transform.GetComponent<UIManager>().lockToEdge(upperRight);
        upperRight.gameObject.AddComponent<InputRepeater>().SetTarget(mapControl.transform);

        lowerLeft = transform.Find("LowerLeft");
        Camera.main.transform.GetComponent<UIManager>().lockToEdge(lowerLeft);
        Transform playerName = lowerLeft.Find("PlayerName");
        Transform playerScore = lowerLeft.Find("PlayerScore");

        lowerRight = transform.Find("LowerRight");
        Camera.main.transform.GetComponent<UIManager>().lockToEdge(lowerRight);
        Transform enemyName = lowerRight.Find("EnemyName");
        Transform enemyScore = lowerRight.Find("EnemyScore");

        mapControl.InitScoreboard(playerName, playerScore, enemyName, enemyScore);
    }
开发者ID:Diggery,项目名称:SuperSneak,代码行数:27,代码来源:MapUI.cs

示例6: SettingsManager

        public SettingsManager(ref MapControl MapMain)
        {
            // Check is the instance doesnt already exist.
            if (Current != null)
            {
                //if there is an instance in the app already present then simply throw an error.
                throw new Exception("Only one settings manager can exist in a App.");
            }

            // Setting the instance to the static instance field.
            Current = this;

            this.MapMain = MapMain;

            ApplicationData.Current.DataChanged += new TypedEventHandler<ApplicationData, object>(DataChangeHandler);

            // Roaming Settings
            RoamingSettings = ApplicationData.Current.RoamingSettings;

            RoamingSettings.CreateContainer("Map", ApplicationDataCreateDisposition.Always);
            RoamingSettings.CreateContainer("Appearance", ApplicationDataCreateDisposition.Always);
            

            // Local Settings
            LocalSettings = ApplicationData.Current.LocalSettings;

            LocalSettings.CreateContainer("Location", ApplicationDataCreateDisposition.Always);
        }
开发者ID:LdwgWffnschmdt,项目名称:CykeMaps,代码行数:28,代码来源:SettingsManager.cs

示例7: TilesLayer

 /// <summary>
 /// Creates a new feature layer for visualizing a map based of tiles.
 /// </summary>
 /// <param name="Id">The unique identification of the layer.</param>
 /// <param name="MapControl">The MapControl of the layer.</param>
 /// <param name="ZIndex">The Z-Index of the layer.</param>
 public TilesLayer(String Id,
                   MapControl  MapControl,
                   Int32       ZIndex)
     : this(Id, ZIndex, MapControl)
 {
     TilesRefreshTimer  = new Timer(TilesAutoRefresh, null, TimeSpan.Zero, TimeSpan.FromMilliseconds(100));
 }
开发者ID:Vanaheimr,项目名称:Aegir,代码行数:13,代码来源:TilesLayer.cs

示例8: MapControl_OnMapTapped

        private void MapControl_OnMapTapped(MapControl sender, MapInputEventArgs args)
        {
            if (PushPins.Count > 0)
            {
                MyMapControl.MapElements.Remove(PushPin.Icon);
                PushPins.Clear();
            }

            Geopoint location = args.Location; // Download the complete position of tapped point

            //DownloadedLocation = location;

            CheckBorders.Check(location);

            if (CheckBorders.Check(location) == true)
            {

                PushPin.SetPosition(MyMapControl, location.Position.Latitude, location.Position.Longitude);

                PushPins.Add(PushPin);
            }
            else
            {
                MessageBox.ShowMessage("Obszar poza zasięgiem!");
            }

            
        }
开发者ID:Wizjonersky,项目名称:TaxiCalculator,代码行数:28,代码来源:MainPage.xaml.cs

示例9: MapsViewModel

        public MapsViewModel(MapControl mapControl)
        {
            _mapControl = mapControl;
            StopStreetViewCommand = new DelegateCommand(StopStreetView, () => IsStreetView);
            StartStreetViewCommand = new DelegateCommand(StartStreetViewAsync, () => !IsStreetView);

            if (!DesignMode.DesignModeEnabled)
            {
                _dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
            }

            _locator.StatusChanged += async (s, e) =>
            {
                await _dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                                PositionStatus = e.Status
                );
            };

            // intialize defaults at startup
            CurrentPosition = new Geopoint(new BasicGeoposition { Latitude = 48.2, Longitude = 16.3 });
            // { Latitude = 47.604, Longitude = -122.329 });
            CurrentMapStyle = MapStyle.Road;
            DesiredPitch = 0;
            ZoomLevel = 12;
        }
开发者ID:ProfessionalCSharp,项目名称:ProfessionalCSharp6,代码行数:25,代码来源:MapsViewModel.cs

示例10: ClearSelectionOnParentGroupLayerRemove

        public void ClearSelectionOnParentGroupLayerRemove()
        {
            var featureProvider = new DataTableFeatureProvider();
            featureProvider.Add(new WKTReader().Read("POINT(0 0)"));
            var layer = new VectorLayer { DataSource = featureProvider };
            var groupLayer = new GroupLayer { Layers = { layer } };

            using (var mapControl = new MapControl { Map = { Layers = { groupLayer } }, AllowDrop = false })
            {
                var selectTool = mapControl.SelectTool;

                selectTool.Select(featureProvider.Features.Cast<IFeature>());

                WindowsFormsTestHelper.Show(mapControl);

                mapControl.Map.Layers.Remove(groupLayer);

                mapControl.WaitUntilAllEventsAreProcessed();

                selectTool.Selection
                    .Should("selection is cleared on layer remove").Be.Empty();
            }

            WindowsFormsTestHelper.CloseAll();
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:25,代码来源:SelectToolTest.cs

示例11: myMap_MapTapped_1

 private void myMap_MapTapped_1(MapControl sender, MapInputEventArgs args)
 {
     Debug.WriteLine(args.Location);
     messageShown = false;
     pinOnMap = true;
     Controller.PinPosition = args.Location;
 }
开发者ID:wowinter13,项目名称:maPanic,代码行数:7,代码来源:MainPage.xaml.cs

示例12: MyMap_MapTapped

 private void MyMap_MapTapped(MapControl sender, MapInputEventArgs args)
 {
     var tappedGeoPosition = args.Location.Position;
     var status = "MapTapped at \nLatitude:" + tappedGeoPosition.Latitude + "\nLongitude: " +
                  tappedGeoPosition.Longitude;
     //rootPage.NotifyUser(status, NotifyType.StatusMessage);
 }
开发者ID:wowinter13,项目名称:maPanic,代码行数:7,代码来源:GeoMapView.xaml.cs

示例13: GridProfileTool

        public GridProfileTool(MapControl mapControl)
            : base(mapControl)
        {

            GridProfiles = new List<IFeature>();

            VectorLayer profileLayer = new VectorLayer("Profile Layer")
                                           {
                                               DataSource = new FeatureCollection(GridProfiles, typeof(GridProfile)),
                                               Enabled = true,
                                               Style = new VectorStyle
                                                           {
                                                               Fill = new SolidBrush (Color.Tomato),
                                                               Symbol = null,
                                                               Line = new Pen(Color.SteelBlue, 1),
                                                               Outline = new Pen(Color.FromArgb(50, Color.LightGray), 3)
                                                           },
                                               Map = mapControl.Map,
                                               ShowInTreeView = true
                                           };
            Layer = profileLayer;

            newLineTool = new NewLineTool(profileLayer)
                              {
                                  MapControl = mapControl,
                                  Name = "ProfileLine",
                                  AutoCurve = false,
                                  MinDistance = 0,
                                  IsActive = false
                              };
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:31,代码来源:GridProfileTool.cs

示例14: MapLayer

 public MapLayer(MapControl control)
 {
     _control = control;
     _viewModel = _control.ViewModel;
     _settings = control.ViewModel.Settings;
     _renderBackground = control.ViewModel.Settings.RenderBackground;
 }
开发者ID:lltcggie,项目名称:StageMapEditor,代码行数:7,代码来源:MapLayer.cs

示例15: CanAddPointToPolygon

        public void CanAddPointToPolygon()
        {
            var mapControl = new MapControl();

            var vectorLayer = new VectorLayer();
            var layerData = new FeatureCollection();
            vectorLayer.DataSource = layerData;
            layerData.FeatureType = typeof(CloneableFeature);

            layerData.Add(new Polygon(new LinearRing(
                                           new[]
                                               {
                                                   new Coordinate(0, 0),
                                                   new Coordinate(100, 0),
                                                   new Coordinate(100, 100),
                                                   new Coordinate(0, 100),
                                                   new Coordinate(0, 0),
                                               })));

            mapControl.Map.Layers.Add(vectorLayer);

            var firstFeature = (IFeature)layerData.Features[0];
            mapControl.SelectTool.Select(firstFeature);

            var curveTool = mapControl.GetToolByType<CurvePointTool>();

            curveTool.IsActive = true;
            var args = new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0);
            curveTool.OnMouseMove(new Coordinate(50, 0), new MouseEventArgs(MouseButtons.None, 1, 0, 0, 0));
            curveTool.OnMouseDown(new Coordinate(50, 0), args);
            curveTool.OnMouseUp(new Coordinate(50, 0), args);

            Assert.AreEqual(6, firstFeature.Geometry.Coordinates.Length);
            Assert.AreEqual(50.0, firstFeature.Geometry.Coordinates[1].X);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:35,代码来源:CurvePointToolTest.cs


注:本文中的MapControl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。