本文整理汇总了C#中Envelope.Expand方法的典型用法代码示例。如果您正苦于以下问题:C# Envelope.Expand方法的具体用法?C# Envelope.Expand怎么用?C# Envelope.Expand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Envelope
的用法示例。
在下文中一共展示了Envelope.Expand方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateFeatureLayersAsync
private async Task CreateFeatureLayersAsync()
{
try
{
var gdb = await Geodatabase.OpenAsync(GDB_PATH);
Envelope extent = new Envelope();
foreach (var table in gdb.FeatureTables)
{
var flayer = new FeatureLayer()
{
ID = table.Name,
DisplayName = table.Name,
FeatureTable = table
};
if (table.Extent != null)
{
if (extent == null)
extent = table.Extent;
else
extent = extent.Union(table.Extent);
}
mapView.Map.Layers.Add(flayer);
}
await mapView.SetViewAsync(extent.Expand(1.10));
}
catch (Exception ex)
{
MessageBox.Show("Error creating feature layer: " + ex.Message, "Samples");
}
}
开发者ID:KrisFoster44,项目名称:arcgis-runtime-samples-dotnet,代码行数:34,代码来源:FeatureLayerFromLocalGeodatabase.xaml.cs
示例2: mapView_ExtentChanged
/// <summary>Add feature tables from a local geodatabase as layers on the map</summary>
private async void mapView_ExtentChanged(object sender, EventArgs e)
{
mapView.ExtentChanged -= mapView_ExtentChanged;
try
{
var gdbFile = await ApplicationData.Current.LocalFolder.TryGetItemAsync(LOCAL_GDB_PATH);
if (gdbFile == null)
throw new Exception("Local geodatabase not found. Please download sample data from 'Sample Data Settings'");
var gdb = await Geodatabase.OpenAsync(gdbFile.Path);
Envelope extent = new Envelope();
foreach (var table in gdb.FeatureTables)
{
var flayer = new FeatureLayer()
{
ID = table.Name,
DisplayName = table.Name,
FeatureTable = table
};
if (table.Extent != null)
{
if (extent == null)
extent = table.Extent;
else
extent = extent.Union(table.Extent);
}
mapView.Map.Layers.Add(flayer);
}
if (!extent.IsEmpty)
await mapView.SetViewAsync(extent.Expand(1.10));
}
catch (Exception ex)
{
var _ = new MessageDialog(ex.Message, "Sample Error").ShowAsync();
}
}
开发者ID:KrisFoster44,项目名称:arcgis-runtime-samples-dotnet,代码行数:42,代码来源:FeatureLayerFromLocalGeodatabase.xaml.cs
示例3: watcher_PositionChanged
void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
_graphicLocation.Geometry = mercator.FromGeographic(new MapPoint(e.Position.Location.Longitude, e.Position.Location.Latitude));
// Use horizontal accuracy (returned in meters) to zoom to the location
if (initialLoad)
{
Envelope rect = new Envelope(
(_graphicLocation.Geometry as MapPoint).X - (e.Position.Location.HorizontalAccuracy / 2),
(_graphicLocation.Geometry as MapPoint).Y - (e.Position.Location.HorizontalAccuracy / 2),
(_graphicLocation.Geometry as MapPoint).X + (e.Position.Location.HorizontalAccuracy / 2),
(_graphicLocation.Geometry as MapPoint).Y + (e.Position.Location.HorizontalAccuracy / 2));
MyMap.ZoomTo(rect.Expand(20));
initialLoad = false;
}
else
{
MyMap.PanTo(_graphicLocation.Geometry);
}
}
示例4: ProcessExtent
private void ProcessExtent(Envelope extent) {
if (this.Map == null || this.Map.Extent == null) { return; }
//if (this.Map.Is) { return; }
Envelope env = extent.Expand(96d / DisplayInformation.GetForCurrentView().LogicalDpi); // DisplayProperties.LogicalDpi);
// Offset envelope (if necessary)
switch (ProximityMapEnvironment.Default.VerticalAlignment) {
case VerticalAlignment.Bottom:
env.YMin -= this.Map.Extent.Height;
env.YMax -= this.Map.Extent.Height;
break;
case VerticalAlignment.Top:
env.YMin += this.Map.Extent.Height;
env.YMax += this.Map.Extent.Height;
break;
}
switch (ProximityMapEnvironment.Default.HorizontalAlignment) {
case HorizontalAlignment.Left:
env.XMin -= this.Map.Extent.Width;
env.XMax -= this.Map.Extent.Width;
break;
case HorizontalAlignment.Right:
env.XMin += this.Map.Extent.Width;
env.XMax += this.Map.Extent.Width;
break;
}
// Zoom/pan to new extent
this.Map.ZoomTo(env, TimeSpan.Zero);
}
示例5: CreateFeatureLayersAsync
// Create feature layers from the given geodatabase file
private async Task CreateFeatureLayersAsync(string gdbPath)
{
try
{
var gdb = await Geodatabase.OpenAsync(gdbPath);
if (gdb.FeatureTables.Count() == 0)
throw new ApplicationException("Downloaded geodatabase has no feature tables.");
var groupLayer = mapView.Map.Layers["Local_Geodatabase"] as GroupLayer;
if (groupLayer != null)
mapView.Map.Layers.Remove(groupLayer);
groupLayer = new GroupLayer()
{
ID = "Local_Geodatabase",
DisplayName = string.Format("Local ({0})", gdbPath)
};
Envelope extent = new Envelope();
foreach (var table in gdb.FeatureTables)
{
var flayer = new FeatureLayer()
{
ID = table.Name,
DisplayName = string.Format("{0} ({1})", table.Name, table.RowCount),
FeatureTable = table
};
if (table.Extent != null)
{
if (extent == null)
extent = table.Extent;
else
extent = extent.Union(table.Extent);
}
groupLayer.ChildLayers.Add(flayer);
}
mapView.Map.Layers.Add(groupLayer);
await mapView.SetViewAsync(extent.Expand(1.10));
}
catch (Exception ex)
{
MessageBox.Show("Error creating feature layer: " + ex.Message, "Sample Error");
}
}
示例6: ZoomTo
void ZoomTo(Map map, Envelope extent)
{
if (map == null || extent == null)
return;
if (extent.Width > 0 && extent.Height > 0)
{
extent = extent.Expand(1.1);
}
else
{
double width = map.Extent.Width / 6;
double height = map.Extent.Height / 6;
extent = new Envelope(extent.XMin - width, extent.YMin - height, extent.XMin + width, extent.YMin + height);
//extent.SpatialReference = map.SpatialReference;
}
try
{
map.ZoomTo(extent);
}
catch (Exception exception)
{
ShowExceptionMessageBoxSR(exception, map, extent);
}
}
示例7: ShowResult
// Outputs result, zoom to route, fill directions
private void ShowResult(ISMDirections objDirections)
{
// Fill directions
m_dlgDirections.Init(objDirections);
m_btnShowDirections.Enabled = true;
try
{
// Zoom to extent
Envelope objEnv = null;
objEnv = new Envelope();
objEnv.PutCoords(objDirections.BoundBox.Left, objDirections.BoundBox.Bottom, objDirections.BoundBox.Right, objDirections.BoundBox.Top);
objEnv.Expand(1.1, 1.1, true);
// set spatial reference
IGeometry objGeo = objEnv as IGeometry;
objGeo.SpatialReference = m_objSpatialReference;
ZoomToExtent(objEnv);
// Create polyline
CreatePolyline(objDirections);
}
catch (Exception ex)
{
MessageBox.Show(this, "Cannot show result.", "Routing Sample", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
finally
{
// Refresh map
RefreshMap();
}
}