本文整理汇总了C#中MapLayer类的典型用法代码示例。如果您正苦于以下问题:C# MapLayer类的具体用法?C# MapLayer怎么用?C# MapLayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MapLayer类属于命名空间,在下文中一共展示了MapLayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: showlocations
private void showlocations()
{
foreach (Place p in _vm.Places)
{
Grid MyGrid = new Grid();
MyGrid.RowDefinitions.Add(new RowDefinition());
MyGrid.RowDefinitions.Add(new RowDefinition());
MyGrid.Background = new SolidColorBrush(Colors.Transparent);
BitmapImage bmi = new BitmapImage(new Uri("/Assets/pushpinPhone.png", UriKind.Relative));
Image img = new Image();
img.Tag = (p);
img.Source = bmi;
MyGrid.Children.Add(img);
//Creating a MapOverlay and adding the Grid to it.
MapOverlay MyOverlay = new MapOverlay();
MyOverlay.Content = MyGrid;
MyOverlay.GeoCoordinate = new GeoCoordinate(p.Latitude, p.Longitude);
MyOverlay.PositionOrigin = new Point(0, 0.5);
//Creating a MapLayer and adding the MapOverlay to it
MapLayer MyLayer = new MapLayer();
MyLayer.Add(MyOverlay);
mapWithMyLocation.Layers.Add(MyLayer);
}
}
示例2: NewStore
public NewStore()
{
InitializeComponent();
markerLayer = new MapLayer();
map2.Layers.Add(markerLayer);
//geoQ = new GeocodeQuery();
//geoQ.QueryCompleted += geoQ_QueryCompleted;
//Debug.WriteLine("All construction done for GeoCoding");
System.Windows.Input.Touch.FrameReported += Touch_FrameReported;
map2.Tap += map2_Tap;
resultList.SelectionChanged += resultList_SelectionChanged;
watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default);
watcher.MovementThreshold = 20; // 20 meters
watcher.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs>(OnStatusChanged);
watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(OnPositionChanged);
newCenter();
watcher.Start();
}
示例3: MapView
public MapView()
{
InitializeComponent();
_layer = new MapLayer();
_map.Children.Add(_layer);
}
示例4: Generate
//an initial create-map method
public override void Generate(int seed, RDungeonFloor entry, List<FloorBorder> floorBorders, Dictionary<int, List<int>> borderLinks)
{
//TODO: make sure that this algorithm follows floorBorders and borderLinks constraints
this.seed = seed;
this.entry = entry;
FloorBorders = floorBorders;
BorderLinks = borderLinks;
BorderPoints = new Loc2D[1];
rand = new Random(seed);
MapArray = new Tile[10, 10];
MapLayer ground = new MapLayer(Width, Height);
GroundLayers.Add(ground);
for (int y = 0; y < Height; y++)
{
for (int x = 0; x < Width; x++)
{
MapArray[x, y] = new Tile(PMDToolkit.Enums.TileType.Walkable, 0, 0, 0);
GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(), 0);
}
}
BorderPoints[0] = new Loc2D(0, 0);
}
示例5: AddMapIcon
private void AddMapIcon(Map map, GeoCoordinate geoPosition)
{
// Create a small circle to mark the current location.
Ellipse myCircle = new Ellipse();
myCircle.Fill = new SolidColorBrush(Colors.Blue);
myCircle.Height = 20;
myCircle.Width = 20;
myCircle.Opacity = 50;
// Create a MapOverlay to contain the circle.
MapOverlay myLocationOverlay = new MapOverlay();
myLocationOverlay.Content = myCircle;
myLocationOverlay.PositionOrigin = new Point(0.5, 0.5);
myLocationOverlay.GeoCoordinate = geoPosition;
// Create a MapLayer to contain the MapOverlay.
MapLayer myLocationLayer = new MapLayer();
myLocationLayer.Add(myLocationOverlay);
// Add the MapLayer to the Map.
maploc.Layers.Add(myLocationLayer);
}
示例6: StartCurrentPosition
private void StartCurrentPosition()
{
_progressIndicator.IsIndeterminate = true;
_customLayer = new MapLayer();
MapControl.Layers.Add(_customLayer);
MapControl.Center = new GeoCoordinate(48.8607, 2.3504);
MapControl.ZoomLevel = 10;
Random rand = new Random();
foreach (var evt in model.ItemsByDate)
{
MapIcon posIcon = new MapIcon()
{
Width = 40,
Height = 40,
AnchorPoint = MapIconAnchorPoint.Center,
Coordinate = new GeoCoordinate(evt.loc[0], evt.loc[1]),
Source = new Uri("/PanoramaApp1;component/Images/MapObjects.png", UriKind.RelativeOrAbsolute),
Content = GetPushPinTemplate( evt.text + " - " + evt.nb_plus, evt)
};
_customLayer.Children.Add(posIcon);
}
_progressIndicator.IsIndeterminate = false;
}
示例7: ShowMyLocationOnTheMap
private async void ShowMyLocationOnTheMap()
{
// Get my current location.
Geolocator myGeolocator = new Geolocator();
Geoposition myGeoposition = await myGeolocator.GetGeopositionAsync();
Geocoordinate myGeocoordinate = myGeoposition.Coordinate;
GeoCoordinate myGeoCoordinate = CoordinateConverter.ConvertGeocoordinate(myGeocoordinate);
// Create a small circle to mark the current location.
Ellipse myCircle = new Ellipse();
myCircle.Fill = new SolidColorBrush(Colors.Blue);
myCircle.Height = 20;
myCircle.Width = 20;
myCircle.Opacity = 50;
// Create a MapOverlay to contain the circle.
MapOverlay myLocationOverlay = new MapOverlay();
myLocationOverlay.Content = myCircle;
myLocationOverlay.PositionOrigin = new Point(0.5, 0.5);
myLocationOverlay.GeoCoordinate = myGeoCoordinate;
// Create a MapLayer to contain the MapOverlay.
MapLayer myLocationLayer = new MapLayer();
myLocationLayer.Add(myLocationOverlay);
// Add the MapLayer to the Map.
Haritam.Layers.Add(myLocationLayer);
}
示例8: GeoButton_Click
private void GeoButton_Click(object sender, RoutedEventArgs e)
{
if (markerLayer != null)
{
map1.Layers.Remove(markerLayer);
markerLayer = null;
}
markerLayer = new MapLayer();
map1.Layers.Add(markerLayer);
if (geoQ.IsBusy == true){
geoQ.CancelAsync();
}
// Set the full address query
GeoCoordinate setMe = new GeoCoordinate(map1.Center.Latitude, map1.Center.Longitude);
setMe.HorizontalAccuracy = 1000000;
geoQ.GeoCoordinate = setMe;
geoQ.SearchTerm = geoBox.Text;
geoQ.MaxResultCount = 200;
geoQ.QueryAsync();
Debug.WriteLine("GeocodeAsync started for: " + geoBox.Text);
}
示例9: ItemContainerGenerator_ItemsChanged
private void ItemContainerGenerator_ItemsChanged(object sender, ItemsChangedEventArgs e)
{
if (e.Action == 1)
{
Position item = lstPositions.Items.Last() as Position;
layers = new MapLayer();
image = new BitmapImage();
image.UriSource = (new Uri(SelectedFriend.Picture, UriKind.Absolute));
grid = new Grid();
grid.DataContext = item;
grid.RightTapped += grid_RightTapped;
textBlock = new TextBlock();
textBlock.Text = item.Counter.ToString();
textBlock.VerticalAlignment = VerticalAlignment.Bottom;
textBlock.HorizontalAlignment = HorizontalAlignment.Center;
brush = new ImageBrush();
brush.ImageSource = image;
ellipse = new Ellipse();
ellipse.Height = 100;
ellipse.Width = 100;
ellipse.Fill = brush;
grid.Children.Add(ellipse);
grid.Children.Add(textBlock);
layers.Children.Add(grid);
MapLayer.SetPosition(grid, new Location(item.Latitude, item.Longitude));
myMap.Children.Add(layers);
}
}
示例10: ShowMyLocationOnTheMap
private async void ShowMyLocationOnTheMap()
{
// Get my current location.
Geolocator myGeolocator = new Geolocator();
Geoposition myGeoposition = await myGeolocator.GetGeopositionAsync();
Geocoordinate myGeocoordinate = myGeoposition.Coordinate;
GeoCoordinate myGeoCoordinate = CoordinateConverter.ConvertGeocoordinate(myGeocoordinate);
// Make my current location the center of the Map.
this.mapWithMyLocation.Center = myGeoCoordinate;
this.mapWithMyLocation.ZoomLevel = 13;
// Create a small circle to mark the current location.
Ellipse myCircle = new Ellipse();
myCircle.Fill = new SolidColorBrush(Colors.Red);
myCircle.Height = 20;
myCircle.Width = 20;
myCircle.Opacity = 50;
// Create a MapOverlay to contain the circle.
MapOverlay myLocationOverlay = new MapOverlay();
myLocationOverlay.Content = myCircle;
myLocationOverlay.PositionOrigin = new Point(0.5, 0.5);
myLocationOverlay.GeoCoordinate = myGeoCoordinate;
// Create a MapLayer to contain the MapOverlay.
MapLayer myLocationLayer = new MapLayer();
myLocationLayer.Add(myLocationOverlay);
// Add the MapLayer to the Map.
mapWithMyLocation.Layers.Add(myLocationLayer);
txTop.Text = ("My Location - Lat " + myGeoCoordinate.Latitude.ToString("0.0000") + " Lon " + myGeoCoordinate.Longitude.ToString("0.0000"));
}
示例11: lockLayer
void lockLayer(MapLayer mapLayer){
GameObject child;
for (int i = 0; i < mapLayer.gameObject.transform.childCount; i++){
child = mapLayer.gameObject.transform.GetChild(i).gameObject;
child.hideFlags = HideFlags.HideInHierarchy;
}
}
示例12: Seanslar_getCompleted
void Seanslar_getCompleted(seanslar sender)
{
loader.IsIndeterminate = false;
PanoramaRoot.Title = sender.SalonBilgisi.name;
pItem1.DataContext = sender.SalonBilgisi;
listFilmler.ItemsSource = sender.SalonBilgisi.movies;
if (sender.SalonBilgisi.latitude.ToString() != "false")
{
SalonCoordinate = new GeoCoordinate(double.Parse(sender.SalonBilgisi.latitude), double.Parse(sender.SalonBilgisi.longitude));
myMap.SetView(SalonCoordinate, 17);
pinpoint_salon newPin = new pinpoint_salon();
MapOverlay newOverlay = new MapOverlay();
newOverlay.Content = newPin;
newOverlay.GeoCoordinate = SalonCoordinate;
newOverlay.PositionOrigin = new Point(0, 0);
MapLayer MyLayer = new MapLayer();
MyLayer.Add(newOverlay);
myMap.Layers.Add(MyLayer);
}
else
{
myMap.Visibility = Visibility.Collapsed;
recMap.Visibility = System.Windows.Visibility.Collapsed;
}
}
示例13: OnNavigatedTo
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
string quakeQueryString = string.Empty;
if (NavigationContext.QueryString.TryGetValue("quake", out quakeQueryString))
{
quake = Earthquake.DeserializeFromQueryString(quakeQueryString);
}
else return;
ContentPanel.DataContext = quake;
QuakeMap.Center = quake.Location;
Pushpin pin = new Pushpin
{
GeoCoordinate = quake.Location,
Content = quake.FormattedMagnitude
};
if (quake.Magnitude >= appSettings.MinimumWarningMagnitudeSetting)
pin.Background = Application.Current.Resources["PhoneAccentBrush"] as SolidColorBrush;
MapOverlay overlay = new MapOverlay();
overlay.Content = pin;
overlay.GeoCoordinate = quake.Location;
overlay.PositionOrigin = new Point(0, 1);
MapLayer layer = new MapLayer();
layer.Add(overlay);
QuakeMap.Layers.Add(layer);
base.OnNavigatedTo(e);
}
示例14: AddPoint
private void AddPoint(Map controlMap, GeoCoordinate geo)
{
// With the new Map control:
// Map -> MapLayer -> MapOverlay -> UIElements
// - Add a MapLayer to the Map
// - Add an MapOverlay to that layer
// - We can add a single UIElement to that MapOverlay.Content
MapLayer ml = new MapLayer();
MapOverlay mo = new MapOverlay();
// Add an Ellipse UI
Ellipse r = new Ellipse();
r.Fill = new SolidColorBrush(Color.FromArgb(255, 240, 5, 5));
// the item is placed on the map at the top left corner so
// in order to center it, we change the margin to a negative
// margin equal to half the width and height
r.Width = r.Height = 12;
r.Margin = new Thickness(-6, -6, 0, 0);
// Add the Ellipse to the Content
mo.Content = r;
// Set the GeoCoordinate of that content
mo.GeoCoordinate = geo;
// Add the MapOverlay to the MapLayer
ml.Add(mo);
// Add the MapLayer to the Map
controlMap.Layers.Add(ml);
}
示例15: SelectDestination
public SelectDestination()
{
InitializeComponent();
street.Visibility = Visibility.Visible;
(ApplicationBar.Buttons[1] as ApplicationBarIconButton).IsEnabled = true;
GeoCoordinate geo = new GeoCoordinate();
geo = MainPage.bookingData.current_location;
googlemap.Center = geo;
googlemap.ZoomLevel = 16;
zzoom.IsEnabled = true;
positionLoaded = true;
Microsoft.Phone.Controls.Maps.Pushpin new_pushpin = new Microsoft.Phone.Controls.Maps.Pushpin();
new_pushpin.Location = geo;
pushPinCurrentLocation = new MapLayer();
new_pushpin.Content = "Current Location:\n ";
new_pushpin.Content += MainPage.bookingData.current_location_address;
new_pushpin.Visibility = Visibility.Visible;
googlemap.Children.Add(pushPinCurrentLocation);
pushPinCurrentLocation.AddChild(new_pushpin, geo, PositionOrigin.BottomLeft);
if (MainPage.bookingData.isDesSet == true)
{
AddressMapping();
}
}