本文整理汇总了C#中MapView类的典型用法代码示例。如果您正苦于以下问题:C# MapView类的具体用法?C# MapView怎么用?C# MapView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MapView类属于命名空间,在下文中一共展示了MapView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnClick
protected override async void OnClick()
{
activeMapView = ProSDKSampleModule.ActiveMapView;
Camera camera = await activeMapView.GetCameraAsync() ;
bool is2D = false ;
try {
is2D = activeMapView.ViewMode == ViewMode.Map;
}
catch(System.ApplicationException) {
return ;
}
if (is2D)
{
// in 2D we are changing the scale
double scaleStep = camera.Scale / _zoomSteps;
camera.Scale = camera.Scale + scaleStep;
}
else
{
// in 3D we are changing the Z-value and the pitch (for drama)
double heightZStep = camera.Z / _zoomSteps;
double pitchStep = 90.0 / _zoomSteps;
camera.Pitch = camera.Pitch + pitchStep;
camera.Z = camera.Z + heightZStep;
}
// the heading changes the same in 2D and 3D
camera.Heading = HollywoodZoomUtils.StepHeading(camera.Heading, -30);
// assign the changed camera back to the view
activeMapView.ZoomToAsync(camera);
}
示例2: BoundedImage
public BoundedImage(MapView map, Uri imageUri, BasicGeoposition northWest, BasicGeoposition southEast)
{
_map = map;
_northWest = northWest;
_southEast = southEast;
_img = new Image();
_img.Stretch = Stretch.Fill;
_img.Source = new BitmapImage(imageUri);
this.Children.Add(_img);
_map.ViewChanged += (center, zoom, heading) =>
{
UpdatePosition();
};
_map.SizeChanged += (s, a) =>
{
this.Width = _map.ActualWidth;
this.Height = _map.ActualHeight;
UpdatePosition();
};
UpdatePosition();
}
示例3: mapView1_Tap
// On tap, either get related records for the tapped well or find nearby wells if no well was tapped
private async void mapView1_Tap(object sender, MapViewInputEventArgs e)
{
// Show busy UI
BusyVisibility = Visibility.Visible;
// Get the map
if (m_mapView == null)
m_mapView = (MapView)sender;
// Create graphic and add to tap points
var g = new Graphic() { Geometry = e.Location };
TapPoints.Add(g);
// Buffer graphic by 100 meters, create graphic with buffer, add to buffers
var buffer = GeometryEngine.Buffer(g.Geometry, 100);
Buffers.Add(new Graphic() { Geometry = buffer });
// Find intersecting parcels and show them on the map
var result = await doQuery(buffer);
if (result != null && result.FeatureSet != null && result.FeatureSet.Features.Count > 0)
{
// Instead of adding parcels one-by-one, update the Parcels collection all at once to
// allow the map to render the new features in one rendering pass.
Parcels = new ObservableCollection<Graphic>(Parcels.Union(result.FeatureSet.Features));
}
// Hide busy UI
BusyVisibility = Visibility.Collapsed;
}
示例4: OnClick
protected override void OnClick()
{
activeMapView = ProSDKSampleModule.ActiveMapView;
Camera activeCamera = activeMapView.Camera;
if (activeMapView.Is2D)
{
// in 2D we are changing the scale
double scaleStep = activeCamera.Scale / _zoomSteps;
activeCamera.Scale = activeCamera.Scale - scaleStep;
}
else
{
// in 3D we are changing the Z-value and the pitch (for drama)
double heightZStep = activeCamera.EyeXYZ.Z / _zoomSteps;
double pitchStep = 90.0 / _zoomSteps;
activeCamera.Pitch = activeCamera.Pitch - pitchStep;
activeCamera.EyeXYZ.Z = activeCamera.EyeXYZ.Z - heightZStep;
}
// the heading changes the same in 2D and 3D
activeCamera.Heading = HollywoodZoomUtils.StepHeading(activeCamera.Heading, 30);
// assign the changed camera back to the view
activeMapView.Camera = activeCamera;
}
示例5: MainViewModel
/// <summary>
/// Initializes a new instance of the MainViewModel class.
/// </summary>
public MainViewModel()
{
if (IsInDesignMode)
{
// Code runs in Blend --> create design time data.
}
else
{
// Code runs "for real"
ConfigService config = new ConfigService();
this.myModel = config.LoadJSON();
Messenger.Default.Register<Esri.ArcGISRuntime.Controls.MapView>(this, (mapView) =>
{
this.mapView = mapView;
this.mapView.MaxScale = 500;
ArcGISLocalTiledLayer localTiledLayer = new ArcGISLocalTiledLayer(this.TilePackage);
localTiledLayer.ID = "SF Basemap";
localTiledLayer.InitializeAsync();
this.mapView.Map.Layers.Add(localTiledLayer);
this.CreateLocalServiceAndDynamicLayer();
this.CreateFeatureLayers();
});
}
}
示例6: SimplifierHandler
public SimplifierHandler(MapView mapView, Looper looper, IList<Point> points, IList<GeoPoint> data , int epsilon )
{
this.mapView = mapView;
_points = points;
_data = data;
_epsilon = epsilon;
}
示例7: OnCreate
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Register license
MapView.RegisterLicense(LICENSE, ApplicationContext);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
MapView = (MapView)FindViewById(Resource.Id.mapView);
// Add base map
CartoOnlineVectorTileLayer baseLayer = new CartoOnlineVectorTileLayer(CartoBaseMapStyle.CartoBasemapStyleDefault);
MapView.Layers.Add(baseLayer);
// Set projection
Projection projection = MapView.Options.BaseProjection;
// Set default position and zoom
// Change projection of map so coordinates would fit on a mercator map
MapPos berlin = MapView.Options.BaseProjection.FromWgs84(new MapPos(13.38933, 52.51704));
MapView.SetFocusPos(berlin, 0);
MapView.SetZoom(10, 0);
Marker marker = MapView.AddMarkerToPosition(berlin);
// Add simple event listener that changes size and/or color on map click
MapView.MapEventListener = new HelloMapEventListener(marker);
}
示例8: Tab
/// <summary>
///
/// </summary>
/// <param name="mapView">Must not be null</param>
/// <param name="tree"></param>
public Tab(MapView mapView, PersistentTree tree)
: base(mapView.Canvas)
{
Tree = tree;
MapView = mapView;
tree.DirtyChanged += Tree_DirtyChanged;
}
示例9: OnCreate
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
// Get a reference to the sensor manager
sensor_manager = (SensorManager) GetSystemService (Context.SensorService);
// Create our view
var map_view = new MapView (this, "MapViewCompassDemo_DummyAPIKey");
rotate_view = new RotateView (this);
rotate_view.AddView (map_view);
SetContentView (rotate_view);
// Create the location overlay
location_overlay = new MyLocationOverlay (this, map_view);
location_overlay.RunOnFirstFix (delegate {
map_view.Controller.AnimateTo (location_overlay.MyLocation);
});
map_view.Overlays.Add (location_overlay);
map_view.Controller.SetZoom(18);
map_view.Clickable = true;
map_view.Enabled = true;
}
示例10: CreateLayout
private void CreateLayout()
{
// Create a label for showing the load status for the public service
var label1ViewFrame = new CoreGraphics.CGRect(10, 30, View.Bounds.Width-10, 20);
_publicLayerLabel = new UILabel(label1ViewFrame);
_publicLayerLabel.TextColor = UIColor.Gray;
_publicLayerLabel.Font = _publicLayerLabel.Font.WithSize(12);
_publicLayerLabel.Text = PublicLayerName;
// Create a label to show the load status of the secured layer
var label2ViewFrame = new CoreGraphics.CGRect(10, 55, View.Bounds.Width-10, 20);
_secureLayerLabel = new UILabel(label2ViewFrame);
_secureLayerLabel.TextColor = UIColor.Gray;
_secureLayerLabel.Font = _secureLayerLabel.Font.WithSize(12);
_secureLayerLabel.Text = SecureLayerName;
// Setup the visual frame for the MapView
var mapViewRect = new CoreGraphics.CGRect(0, 80, View.Bounds.Width, View.Bounds.Height - 80);
// Create a map view with a basemap
_myMapView = new MapView();
_myMapView.Frame = mapViewRect;
// Add the map view and button to the page
View.AddSubviews(_publicLayerLabel, _secureLayerLabel, _myMapView);
}
示例11: AttachToMapView
internal void AttachToMapView(MapView mv)
{
if (m_mapView != null && m_mapView != mv)
throw new InvalidOperationException("RestoreAutoPanMode can only be assigned to one mapview");
m_mapView = mv;
m_mapView.PropertyChanged += m_mapView_PropertyChanged;
}
示例12: GetSearchCount_CountFeatures_NineFeatureFound
public async Task GetSearchCount_CountFeatures_NineFeatureFound()
{
// instantiate the locator so that our view model is created
locator = new ViewModelLocator();
// get the MainViewModel
MainViewModel mainViewModel = locator.MainViewModel;
// create a MapView
MapView mapView = new MapView();
// send the MapView to the MainViewModel
Messenger.Default.Send<MapView>(mapView);
// UNCOMMENT THE FOLLOWING LINES
//// Arrange
//// search string
//mainViewModel.SearchText = "Lancaster";
//// run the search async
//var task = mainViewModel.SearchRelayCommand.ExecuteAsync(4326);
//task.Wait(); // wait
//// Assert
//Assert.IsNotNull(mainViewModel, "Null mainViewModel");
//Assert.IsNotNull(mainViewModel.GridDataResults, "Null GridDataResults");
//Assert.AreEqual(9, mainViewModel.GridDataResults.Count);
}
示例13: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
_MapView = new MapView(new RectangleF(0, 0, View.Frame.Width, View.Frame.Height));
_MapView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
View.AddSubview(_MapView);
var home = new Place()
{
Name = "Home",
Description = "Boring Home Town",
Latitude = 32.725410,
Longitude = -97.320840,
};
var office = new Place()
{
Name = "Austin",
Description = "Super Awesome Town",
Latitude = 30.26710,
Longitude = -97.744546,
};
_MapView.ShowRouteFrom(office, home);
}
示例14: mapView1_Tap
// Perform identify when the map is tapped
private async void mapView1_Tap(object sender, MapViewInputEventArgs e)
{
if (m_mapView == null)
m_mapView = (MapView)sender;
// Clear any previously displayed results
clearResults();
// Get the point that was tapped and show it on the map
GraphicsLayer identifyPointLayer = m_mapView.Map.Layers["IdentifyPointLayer"] as GraphicsLayer;
identifyPointLayer.Graphics.Add(new Graphic() { Geometry = e.Location });
// Show activity
progress.Visibility = Visibility.Visible;
// Perform the identify operation
List<DataItem> results = await doIdentifyAsync(e.Location);
// Hide the activity indicator
progress.Visibility = Visibility.Collapsed;
// Show the results
ResultsListPicker.ItemsSource = results;
if (results.Count > 0)
{
ResultsListPicker.Visibility = Visibility.Visible;
ShowAttributesButton.Visibility = Visibility.Visible;
}
}
示例15: OnLaunched
// Invoked when the application is launched normally by the end user.
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
// Register CARTO license
bool registered = MapView.RegisterLicense(License);
if (registered)
{
Carto.Utils.Log.ShowDebug = true;
}
MapView = new MapView();
// Add base map
// TODO: Crashes here for some reason
CartoOnlineVectorTileLayer baseLayer = new CartoOnlineVectorTileLayer(CartoBaseMapStyle.CartoBasemapStyleDark);
MapView.Layers.Add(baseLayer);
// Set default location and zoom
Projection projection = MapView.Options.BaseProjection;
MapPos tallinn = projection.FromWgs84(new MapPos(24.646469, 59.426939));
MapView.AddMarkerToPosition(tallinn);
MapView.SetFocusPos(tallinn, 0);
MapView.SetZoom(3, 0);
Window.Current.Content = MapView;
Window.Current.Activate();
}