本文整理汇总了C#中GraphicsOverlay类的典型用法代码示例。如果您正苦于以下问题:C# GraphicsOverlay类的具体用法?C# GraphicsOverlay怎么用?C# GraphicsOverlay使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GraphicsOverlay类属于命名空间,在下文中一共展示了GraphicsOverlay类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreatePolylines
public CreatePolylines()
{
InitializeComponent();
_graphicsOverlay = MyMapView.GraphicsOverlays["graphicsOverlay"];
MyMapView.SpatialReferenceChanged += MyMapView_SpatialReferenceChanged;
}
示例2: AddModelMarkerSymbol
private async Task AddModelMarkerSymbol()
{
// Instantiate a new ModelMarkerSymbol
ModelMarkerSymbol modelMarkerSymbol = new ModelMarkerSymbol();
// Set the SourceUri property
modelMarkerSymbol.SourceUri = Path.Combine(AssemblyDirectory, @"Samples\Scene\PT-Boat-Model\PTBoat.obj");
// Increase the scale to achieve the desired visual size
modelMarkerSymbol.Scale = 50;
// Create a new MapPoint for the location
MapPoint mapPoint = new MapPoint(-155, 19, -100);
// Create a new Graphic to display the model symbol
Graphic graphic = new Graphic(mapPoint);
// Set the Graphic Symbol property
graphic.Symbol = modelMarkerSymbol;
// Create a GraphicsOverlay to contain the symbolized Graphic
GraphicsOverlay graphicsoverlay = new GraphicsOverlay()
{
RenderingMode = GraphicsRenderingMode.Dynamic,
SceneProperties = new LayerSceneProperties() { SurfacePlacement = SurfacePlacement.Relative }
};
// Add the Graphic to the GraphicsOverlay
graphicsoverlay.Graphics.Add(graphic);
// Add the GraphicsOverlay to the MapView's GraphicsOverlays collection
MySceneView.GraphicsOverlays.Add(graphicsoverlay);
// Set the Viewpoint
await MySceneView.SetViewAsync(new Camera(mapPoint.Y - 0.5, mapPoint.X + 0.5, 25000, 315, 70));
}
示例3: LineFillSymbols
/// <summary>Construct Line and Fill Symbols sample control</summary>
public LineFillSymbols()
{
InitializeComponent();
_graphicsOverlay = MyMapView.GraphicsOverlays["graphicsOverlay"];
MyMapView.SpatialReferenceChanged += MyMapView_SpatialReferenceChanged;
}
示例4: LoadLocation
private async void LoadLocation()
{
Windows.Devices.Geolocation.Geoposition l = null;
try
{
var loc = new Windows.Devices.Geolocation.Geolocator();
l = position = await loc.GetGeopositionAsync();
}
catch { return; }
foreach (var coll in new GraphicsOverlayCollection[] {
sceneView.GraphicsOverlays , mapView.GraphicsOverlays
})
{
GraphicsOverlay overlay = new GraphicsOverlay();
coll.Add(overlay);
Graphic g = new Graphic()
{
Symbol = new SimpleMarkerSymbol()
{
Color = Color.FromArgb(255, 0, 122, 194),
Size = 20,
Outline = new SimpleLineSymbol()
{
Width = 2,
Color = Colors.White
}
},
};
g.Geometry = new MapPoint(l.Coordinate.Point.Position.Longitude, l.Coordinate.Point.Position.Latitude, SpatialReferences.Wgs84);
overlay.Graphics.Add(g);
break;
}
}
示例5: CreatePictureMarkerSymbolFromResources
private async Task CreatePictureMarkerSymbolFromResources(GraphicsOverlay overlay)
{
Assembly currentAssembly = null;
#if WINDOWS_UWP
// Get current assembly that contains the image
currentAssembly = GetType().GetTypeInfo().Assembly;
#else
// Get current assembly that contains the image
currentAssembly = Assembly.GetExecutingAssembly();
#endif
// Get image as a stream from the resources
// Picture is defined as EmbeddedResource and DoNotCopy
var resourceStream = currentAssembly.GetManifestResourceStream(
"ArcGISRuntimeXamarin.Resources.PictureMarkerSymbols.pin_star_blue.png");
// Create new symbol using asynchronous factory method from stream
PictureMarkerSymbol pinSymbol = await PictureMarkerSymbol.CreateAsync(resourceStream);
// Create location for the pint
MapPoint pinPoint = new MapPoint(-226773, 6550477, SpatialReferences.WebMercator);
// Create graphic with the location and symbol
Graphic pinGraphic = new Graphic(pinPoint, pinSymbol);
// Add graphic to the graphics overlay
overlay.Graphics.Add(pinGraphic);
}
示例6: MyMapView_Loaded
private async void MyMapView_Loaded(object sender, RoutedEventArgs e)
{
// ArcGIS Online への参照を取得
var portal = await ArcGISPortal.CreateAsync(new Uri(PORTAL_URL));
// ID を基にアイテムを取得
var item = await ArcGISPortalItem.CreateAsync(portal, "Web マップ ID");
// アイテムを Web マップとして取得
var webmap = await WebMap.FromPortalItemAsync(item);
// Web マップを格納するために WebMapViewModel を作成
var vm = await WebMapViewModel.LoadAsync(webmap, portal);
// MapView コントロールの Map プロパティに、WebMap を割り当て
MyMapView.Map = vm.Map;
// グラフィックス オーバーレイが存在しない場合は、新規に追加
if (MyMapView.GraphicsOverlays.Count == 0)
{
geocodeResultGraphicsOverlay = new GraphicsOverlay()
{
Renderer = createGeocoordingSymbol(),
};
MyMapView.GraphicsOverlays.Add(geocodeResultGraphicsOverlay);
}
isMapReady = true;
}
示例7: LineFillSymbols
/// <summary>Construct Line and Fill Symbols sample control</summary>
public LineFillSymbols()
{
InitializeComponent();
_graphicsOverlay = MyMapView.GraphicsOverlays["graphicsOverlay"];
MyMapView.ExtentChanged += MyMapView_ExtentChanged;
}
示例8: GeodesicBuffer
/// <summary>Construct Geodesic Buffer sample control</summary>
public GeodesicBuffer()
{
InitializeComponent();
_graphicsOverlay = MyMapView.GraphicsOverlays["graphicsOverlay"];
SetupSymbols();
}
示例9: ProjectCoordinate
/// <summary>Construct Project sample control</summary>
public ProjectCoordinate()
{
InitializeComponent();
_graphicsOverlay = MyMapView.GraphicsOverlays["graphicsOverlay"];
MyMapView.SpatialReferenceChanged += MyMapView_SpatialReferenceChanged;
}
示例10: OfflineGeocoding
/// <summary>Construct Offline Geocoding sample control</summary>
public OfflineGeocoding()
{
InitializeComponent();
_graphicsOverlay = MyMapView.GraphicsOverlays["graphicsOverlay"];
SetupRendererSymbols();
}
示例11: CreateOverlay
private void CreateOverlay()
{
// Create polygon builder and add polygon corners into it
PolygonBuilder builder = new PolygonBuilder(SpatialReferences.WebMercator);
builder.AddPoint(new MapPoint(-20e5, 20e5));
builder.AddPoint(new MapPoint(20e5, 20e5));
builder.AddPoint(new MapPoint(20e5, -20e5));
builder.AddPoint(new MapPoint(-20e5, -20e5));
// Get geometry from the builder
Polygon polygonGeometry = builder.ToGeometry();
// Create symbol for the polygon
SimpleFillSymbol polygonSymbol = new SimpleFillSymbol(
SimpleFillSymbolStyle.Solid,
System.Drawing.Color.Yellow,
null);
// Create new graphic
Graphic polygonGraphic = new Graphic(polygonGeometry, polygonSymbol);
// Create overlay to where graphics are shown
_polygonOverlay = new GraphicsOverlay();
_polygonOverlay.Graphics.Add(polygonGraphic);
// Add created overlay to the MapView
_myMapView.GraphicsOverlays.Add(_polygonOverlay);
}
示例12: AreaSample
public AreaSample()
{
InitializeComponent();
_graphicsOverlay = MyMapView.GraphicsOverlays["AreaOverlay"];
MyMapView.SpatialReferenceChanged += MyMapView_SpatialReferenceChanged;
}
示例13: AttributeQuery
public AttributeQuery()
{
this.InitializeComponent();
_graphicsOverlay = MyMapView.GraphicsOverlays["graphicsOverlay"];
InitializeComboBox();
}
示例14: CreatePolylines
/// <summary>Construct Create Polylines sample control</summary>
public CreatePolylines()
{
InitializeComponent();
_graphicsOverlay = MyMapView.GraphicsOverlays["graphicsOverlay"];
MyMapView.NavigationCompleted += MyMapView_NavigationCompleted;
}
示例15: Initialize
private void Initialize()
{
// Create new Map with basemap
Map myMap = new Map(Basemap.CreateImagery());
// Create initial map location and reuse the location for graphic
MapPoint centralLocation = new MapPoint(-226773, 6550477, SpatialReferences.WebMercator);
Viewpoint initialViewpoint = new Viewpoint(centralLocation, 7500);
// Set initial viewpoint
myMap.InitialViewpoint = initialViewpoint;
// Provide used Map to the MapView
_myMapView.Map = myMap;
// Create overlay to where graphics are shown
GraphicsOverlay overlay = new GraphicsOverlay();
// Add created overlay to the MapView
_myMapView.GraphicsOverlays.Add(overlay);
// Create a simple marker symbol
SimpleMarkerSymbol simpleSymbol = new SimpleMarkerSymbol()
{
Color = Color.Red,
Size = 10,
Style = SimpleMarkerSymbolStyle.Circle
};
// Add a new graphic with a central point that was created earlier
Graphic graphicWithSymbol = new Graphic(centralLocation, simpleSymbol);
overlay.Graphics.Add(graphicWithSymbol);
}