WPF数据模板
DataGrid 数据模板12345678910111213141516171819<DataGrid SelectedItem="{Binding SelectHexoPost}" AutoGenerateColumns="False" VerticalContentAlignment="Center" IsReadOnly="True" CanUserSortColumns="True" CanUserAddRows="False" ItemsSource="{Binding HexoPosts}"> <DataGrid.Columns> <DataGridTextColumn Binding="{Binding Id}" Width="0.3*" Header="ID"/&g ...
C#中Brush、Color、String相互转换
C#中Brush、Color、String相互转换1、String转换成Color
Color color = (Color)ColorConverter.ConvertFromString(string);
2、String转换成Brush
BrushConverter brushConverter = new BrushConverter(); Brush brush = (Brush)brushConverter.ConvertFromString(string);
3、Color转换成Brush
Brush brush = new SolidColorBrush(color));
4、Brush转换成Color有两种方法:
(1)先将Brush转成string,再转成Color。
Color color= (Color)ColorConverter.ConvertFromString(brush.ToString());
(2)将Brush转成SolidColo ...
ArcGIS Pro SDK 汇总
框架如何在停靠窗格可见或隐藏时订阅和取消订阅事件1234567891011121314151617181920private SubscriptionToken _eventToken = null;// Called when the visibility of the DockPane changes.protected override void OnShow(bool isVisible){ if (isVisible && _eventToken == null) //Subscribe to event when dockpane is visible { _eventToken = MapSelectionChangedEvent.Subscribe(OnMapSelectionChangedEvent); } if (!isVisible && _eventToken != null) //Unsubscribe as the dockpane closes. { MapSel ...
ArcGIS Pro SDK 工作流管理器
工作流管理器如何获取管理器对象12345// WorkflowModule.GetManager returns a manager of the type specified// keyword is currently just an empty stringvar wfCon = await WorkflowModule.ConnectAsync();var jobManager = wfCon.GetManager<JobsManager>();var configManager = wfCon.GetManager<ConfigurationManager>();
如何获取群组1234// GetAllGroups returns a list of Workflow Manager groupsvar wfCon = await WorkflowModule.ConnectAsync();var configManager = wfCon.GetManager<ConfigurationManager>();var allGroups ...
ArcGIS Pro SDK 任务
任务检索项目中的所有任务项12345IEnumerable<TaskProjectItem> taskItems = Project.Current.GetItems<TaskProjectItem>();foreach (var item in taskItems){ // do something}
打开任务文件 - .esriTasks 文件12345678910111213141516// Open a task filetry{ // TODO - substitute your own .esriTasks file to be opened string taskFile = @"c:\Tasks\Get Started.esriTasks"; //At 2.x - //System.Guid guid = await TaskAssistantModule.OpenTaskAsync(taskFile); var guid = await TaskAssistantFactory.I ...
ArcGIS Pro SDK 实时要素类
实时要素类从实时数据存储连接到实时要素类12345678910111213141516171819202122var url = "https://geoeventsample1.esri.com:6443/arcgis/rest/services/AirportTraffics/StreamServer"; await QueuedTask.Run(() =>{ var realtimeServiceConProp = new RealtimeServiceConnectionProperties( new Uri(url), RealtimeDatastoreType.StreamService ); using (var realtimeDatastore = new RealtimeDatastore(realtimeServiceCo ...
ArcGIS Pro SDK 订阅和搜索
订阅和搜索搜索和订阅流数据123456789101112131415161718192021222324252627282930313233343536373839404142434445464748await QueuedTask.Run(async () =>{ //query filter can be null to search and retrieve all rows //true means recycling cursor using (var rc = streamLayer.SearchAndSubscribe(qfilter, true)) { //waiting for new features to be streamed //default is no cancellation while (await rc.WaitForRowsAsync()) { while (rc.MoveNext()) { using (var row = rc.Cur ...
ArcGIS Pro SDK 渲染
渲染定义唯一值呈现器定义1234567891011var uvrDef = new UniqueValueRendererDefinition(){ ValueFields = new List<string> { "ACTYPE" }, SymbolTemplate = SymbolFactory.Instance.ConstructPointSymbol( ColorFactory.Instance.RedRGB, 10, SimpleMarkerStyle.Hexagon) .MakeSymbolReference(), ValuesLimit = 5};//Note: CreateRenderer can only create value classes based on//the current events it has receivedstreamLayer.SetRenderer(streamLayer.CreateRenderer(uvrDef));
为最新观测值设置唯一 ...
ArcGIS Pro SDK 流图层
流图层创建流图层使用 URI 创建流图层123456789101112//Must be on the QueuedTaskvar url = "https://geoeventsample1.esri.com:6443/arcgis/rest/services/AirportTraffics/StreamServer";var createParam = new FeatureLayerCreationParams(new Uri(url)){ IsVisible = false //turned off by default};var streamLayer = LayerFactory.Instance.CreateLayer<StreamLayer>(createParam, map);//or use "original" create layer (will be visible by default)Uri uri = new Uri(url);streamLayer = LayerFactory. ...
ArcGIS Pro SDK 场景图层
场景图层创建场景图层123456789101112131415161718192021var sceneLayerUrl = @"https://myportal.com/server/rest/services/Hosted/SceneLayerServiceName/SceneServer";//portal items also ok as long as the portal is the current active portal...//var sceneLayerUrl = @"https://myportal.com/home/item.html?id=123456789abcdef1234567890abcdef0";await QueuedTask.Run(() =>{ //Create with initial visibility set to false. Add to current scene var createparams = new LayerCreationParams(new Uri(s ...
ArcGIS Pro SDK 光栅
光栅在文件夹中打开栅格数据集123456// Create a FileSystemConnectionPath using the folder path.FileSystemConnectionPath connectionPath = new FileSystemConnectionPath(new System.Uri(@"C:\Temp"), FileSystemDatastoreType.Raster);// Create a new FileSystemDatastore using the FileSystemConnectionPath.FileSystemDatastore dataStore = new FileSystemDatastore(connectionPath);// Open the raster dataset.RasterDataset fileRasterDataset = dataStore.OpenDataset<RasterDataset>("Sample.tif");
在地理数据库中 ...
ArcGIS Pro SDK 宗地结构
宗地结构获取活动记录1234567891011121314151617181920string errorMessage = await QueuedTask.Run(() =>{ try { var myParcelFabricLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<ParcelLayer>().FirstOrDefault(); //if there is no fabric in the map then bail if (myParcelFabricLayer == null) return "There is no fabric in the map."; var theActiveRecord = myParcelFabricLayer.GetActiveRecord(); if (theActiveRecord == null) return "There is no A ...
ArcGIS Pro SDK 公共设施网络
公共设施网络获取公共设施网络从表中获取公共设施网络1234567891011121314151617181920212223public static UtilityNetwork GetUtilityNetworkFromTable(Table table){ UtilityNetwork utilityNetwork = null; if (table.IsControllerDatasetSupported()) { // Tables can belong to multiple controller datasets, but at most one of them will be a UtilityNetwork IReadOnlyList<Dataset> controllerDatasets = table.GetControllerDatasets(); foreach (Dataset controllerDataset in controllerDatasets) { if (con ...
ArcGIS Pro SDK 共享
共享ArcGIS 项目管理器:获取当前活动门户12var active_portal = ArcGISPortalManager.Current.GetActivePortal();string uri = active_portal.PortalUri.ToString();
ArcGIS 项目管理器:获取所有门户的列表123var portals = ArcGISPortalManager.Current.GetPortals();//Make a list of all the Urisvar portalUris = portals.Select(p => p.PortalUri.ToString()).ToList();
ArcGIS 项目管理器:将门户添加到门户列表12var portalUri = new Uri("http://myportal.esri.com/portal/", UriKind.Absolute);ArcGISPortalManager.Current.AddPortal(portalUri);
ArcGIS 项目管理 ...
ArcGIS Pro SDK 地图探索
地图探索地图视图测试视图是否为 3D 视图1234567891011public bool IsView3D(){ //Get the active map view. var mapView = MapView.Active; if (mapView == null) return false; //Return whether the viewing mode is SceneLocal or SceneGlobal return mapView.ViewingMode == ArcGIS.Core.CIM.MapViewingMode.SceneLocal || mapView.ViewingMode == ArcGIS.Core.CIM.MapViewingMode.SceneGlobal;}
设置查看模式1234567891011public void SetViewingModeToSceneLocal(){ //Get the active map view. var mapView = MapView. ...
ArcGIS Pro SDK 地图创作-体素图层
地图创作-体素图层创建体素图层检查是否可以创建体素图层1234567//Map must be a local scenebool canCreateVoxel = (MapView.Active.ViewingMode == MapViewingMode.SceneLocal);if (canCreateVoxel){ //TODO - use the voxel api methods}
创建体素图层1234567891011121314151617181920212223242526272829//Must be on the QueuedTask.Run()//Must be a .NetCDF file for voxelsvar url = @"C:\MyData\AirQuality_Redlands.nc";var cim_connection = new CIMVoxelDataConnection(){ URI = url};//Create a VoxelLayerCreationParam ...
ArcGIS Pro SDK 地图创作
地图创作地图获取活动地图1Map map = MapView.Active.Map;
使用默认底图图层创建新地图12345await QueuedTask.Run(() =>{ var map = MapFactory.Instance.CreateMap(mapName, basemap: Basemap.ProjectDefault); //TODO: use the map...});
在工程中查找地图并将其打开123456789101112131415161718192021public static async Task<Map> FindOpenExistingMapAsync(string mapName){ return await QueuedTask.Run(async () => { Map map = null; Project proj = Project.Current; //Finding the first project item with name matc ...
ArcGIS Pro SDK 布局-报告
布局-报告报告项目项获取当前项目中的所有报表12345var projectReports = Project.Current.GetItems<ReportProjectItem>();foreach (var reportItem in projectReports){ //Do Something with the report}
获取特定报告12ReportProjectItem reportProjItem = Project.Current.GetItems<ReportProjectItem>().FirstOrDefault(item => item.Name.Equals(reportName));Report report = reportProjItem?.GetReport();
在新视图中打开报表项目项1234567891011//Open a report project item in a new view.//A report project item may exist but it may no ...
ArcGIS Pro SDK 布局
布局布局项目项参考布局项目项及其关联布局1234567891011//Reference layout project items and their associated layout.//A layout project item is an item that appears in the Layouts//folder in the Catalog pane.//Reference all the layout project itemsIEnumerable<LayoutProjectItem> layouts = Project.Current.GetItems<LayoutProjectItem>();//Or reference a specific layout project item by nameLayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>() ...
ArcGIS Pro SDK 图形图层
图形图层常规创建图形图层123456789101112131415161718192021222324var map = MapView.Active.Map;if (map.MapType != MapType.Map) return;// not 2Dvar gl_param = new GraphicsLayerCreationParams { Name = "Graphics Layer" };QueuedTask.Run(() =>{ //By default will be added to the top of the TOC var graphicsLayer = LayerFactory.Instance.CreateLayer<ArcGIS.Desktop.Mapping.GraphicsLayer>(gl_param, map); //Add to the bottom of the TOC gl_param.MapMemberIndex = -1; //bottom LayerFac ...
ArcGIS Pro SDK 地理处理
地理处理常规如何执行模型工具123456789101112// get the model tool's parameter syntax from the model's helpstring input_roads = @"C:\data\Input.gdb\PlanA_Roads"; string buff_dist_field = "Distance"; // use values from a field string input_vegetation = @"C:\data\Input.gdb\vegetation"; string output_data = @"C:\data\Output.gdb\ClippedFC2"; // the model name is ExtractVegetation string tool_path = @"C:\data\MB\Models.tbx\ExtractVeget ...
ArcGIS Pro SDK 几何
几何空间参考构造空间参考 - 从已知 ID123456789101112131415// Use a builder convenience method or use a builder constructor.// Builder convenience methods don't need to run on the MCT.SpatialReference sr3857 = SpatialReferenceBuilder.CreateSpatialReference(3857);// Builder constructors need to run on the MCT.ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>{ using (SpatialReferenceBuilder srBuilder = new SpatialReferenceBuilder(3857)) { // do something with the builder sr385 ...