POST
|
This works for me ... protected override async void OnClick()
{
await Test();
//If you run this in the DEBUGGER you will NOT see the dialog
//var ps = new ProgressorSource("Doing my thing...");
//ps.Max = 5;
//await ProgressDialogModule.RunProgress(ps, 5);
}
private static async Task Test()
{
using (var progDialog = new ArcGIS.Desktop.Framework.Threading.Tasks.
ProgressDialog("Showing Test Progress", "Canceled", 100, false))
{
CancelableProgressorSource cps = new CancelableProgressorSource(progDialog)
{
Max = 100
};
progDialog.Show();
for (int idx = 0; idx < 10; idx++)
{
await Task.Delay(1000);
cps.Progressor.Value += 10;
cps.Progressor.Status = (cps.Progressor.Value * 100 / cps.Progressor.Max) + @" % Completed";
cps.Progressor.Message = "Message " + cps.Progressor.Value;
}
progDialog.Hide();
}
}
... View more
12-22-2021
01:29 PM
|
0
|
1
|
911
|
POST
|
Are you running in debug mode? Progress Dialog boxes are disabled when debugging in Visual Studio.
... View more
12-22-2021
11:30 AM
|
0
|
3
|
926
|
POST
|
There's also the ISpatialReferenceFactory.ExportESRISpatialReferenceToPRJFile Method
... View more
12-17-2021
08:48 AM
|
0
|
0
|
1152
|
POST
|
You might try changing your MS Access VBA to write to files in a directory that an ArcGIS Pro addin watches using the FileSystemWatcher. When a file appears, the addin would open it, and perform whatever action is defined in the file. That's assuming messages just go one way. The "Get " messages makes me think the communication needs to be two way though.
... View more
12-17-2021
08:41 AM
|
1
|
0
|
576
|
POST
|
I don't see a way to rubbersheet in Pro without using layers present in a map. Perhaps horizontal grid shift geotransformation could achieve the same results as rubbersheeting. A grid shift file facilitates the conversion from one coordinate system to another. A grid shift file is often used for defining a transformation over a large area when the distortion in one of the coordinate systems inhibits the use of an exact set of transformation parameters. One of the first grid shift files used in Canada is the National Transformation version 2 (NTv2) which performs coordinate transformations from NAD27 (high distortion) to NAD83. Since NTv2 was developed, other grid shift files have been created using the same format. NSCRS Technical Support 0009 Grid Shift Files 3Feb2016.pdf The hard part is creating the gsb file. The file format isn't well documented. Proj.org says: Details about all three formats can be found in the GDAL documentation and/or driver source code. GDAL reads and writes all three formats. Using GDAL for construction of new grids is recommended. I don't see anything relevant to gsb in the GDAL docs search results though. Esri's ntv2_file program might be better. Esri support has a document describing how to install the gsb file for Desktop. It doesn't mention Pro, but I suspect it's just a matter of copying it here: C:\Program Files\ArcGIS\Pro\Resources\pedata\ntv2 Or ... it might just be easier to learn to live with link layers in your map.
... View more
12-15-2021
09:17 AM
|
0
|
1
|
424
|
POST
|
Actually ... none of the OnPane overrides for Module are being called for me when I switch active panes - Init and OnUpdate are being called though. Using 2.9.0
... View more
12-13-2021
03:00 PM
|
0
|
0
|
481
|
POST
|
For the sample, I made copies by copy/pasting the images in their respective folders ... Then added BitmapImage elements to the respective resource files: Then added an Image with a Dynamic resource to the pane: Ran it and saw this: Changed to dark theme, saw this:
... View more
12-13-2021
01:29 PM
|
0
|
0
|
570
|
POST
|
I don't see scale but to get the extent, this works: protected override async void OnClick()
{
//Saving the project is needed to assure the
// map definitions are in sync with the view extents
await Project.Current.SaveAsync();
await QueuedTask.Run(() =>
{
foreach (var mapdef in Project.Current.Items
.OfType<MapProjectItem>()
.Select(itm => itm.GetMap().GetDefinition()))
{
Trace.WriteLine(mapdef.DefaultExtent.ToJson());
}
});
}
... View more
12-13-2021
12:42 PM
|
1
|
1
|
344
|
POST
|
I'm guessing since PopupContent uses html, and since html can't display tiff images, there's no easy way. There might be a hard way though: Modify the CustomPopup sample's template.html so that it uses tiff.js which allegedly converts tiff's to png.
... View more
12-13-2021
11:17 AM
|
0
|
0
|
540
|
POST
|
Add a custom condition for "canaddlayers_condition", with a "canaddlayers_state". Add a button wired to the canaddlayers_condition. Delete Esri's addData button, and insert your own adddata button. Wire your button to use the Browse snippet when it's clicked. Override the Initialize in your module to subscribe to active map view change event. protected override bool Initialize()
{
ActiveMapViewChangedEvent.Subscribe((ea) =>
{
string stateID = "canaddlayers_state";
if (ea.IncomingView?.Map.Name == "Map1")
FrameworkApplication.State.Activate(stateID);
else
FrameworkApplication.State.Deactivate(stateID);
Trace.WriteLine("changed");
});
return base.Initialize();
} When I activate/deactivate Map1, the button gets activated/deactivated.
... View more
12-13-2021
11:02 AM
|
1
|
0
|
622
|
POST
|
Getting back to the original question: Is the only way to retrieve the data source is by iteration through layer(s) using the ArcGIS Pro SDK? You don't need to iterate through all layers - you can just loop through layers that belong to the currently selected datasource on the datasource tab. This can be done with a command that retrieves the currently selected DataSourceMember from the tab (via MapView's GetSelectedDataSource member) , then loops through DataSourceMember.GetMapMembers , which should be all the layers that use that datasource. You can arbitrarily pick the first member of the GetMapMembers to determine what datasource is selected in the UI. To add the command to this context menu: Use DAML like this:
... View more
12-09-2021
07:56 AM
|
0
|
0
|
423
|
POST
|
With 2.9 SDK running 2.9 desktop I added a new Addin Module, added an override for Initialize in Module1.cs Changed autoLoad=true in the Config.daml set a breakpoint in the Intialize() override Run Pro from VS in debug mode When pro started it hit my break point. If you do these steps (with a new module) and get different results, I suspect it might have something to do with running 2.9 SDK with 2.8 desktop. (I've always wondered how compatible this is).
... View more
12-07-2021
09:35 AM
|
0
|
0
|
509
|
POST
|
The original question has <Image Source="Images/trekk.jpg" /> But the follow-up post has Esri's default when creating a splash via New>Project .... Pro Managed Configuration results in a project with a UI and Images folders. Notice how the Source path in the xaml in the UI folder has a relative path to the images in the Images folder: So, if your xaml is in a (UI) folder that is a sibling to the Images folder, perhaps try using a ".." for the relative path in the Source.
... View more
12-07-2021
09:10 AM
|
0
|
0
|
919
|
POST
|
Something like this might work. Right click on project and Add>New Item then choose Pro Map Tool. In the daml, change the condition: Change the OnSketchCompleteAsync override: using ArcGIS.Core.CIM;
using ArcGIS.Core.Data;
using ArcGIS.Core.Geometry;
using ArcGIS.Desktop.Editing;
using ArcGIS.Desktop.Framework.Threading.Tasks;
using ArcGIS.Desktop.Mapping;
using System;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
namespace ToolTester
{
internal class MapTool1 : MapTool
{
public MapTool1()
{
IsSketchTool = true;
SketchType = SketchGeometryType.Point;
SketchOutputMode = SketchOutputMode.Map;
}
protected override Task OnToolActivateAsync(bool active)
{
return base.OnToolActivateAsync(active);
}
protected override Task<bool> OnSketchCompleteAsync(Geometry geometry)
{
return QueuedTask.Run(() =>
{
var fLayer = this.ActiveMapView.GetSelectedLayers().FirstOrDefault() as FeatureLayer;
//condition="esri_mapping_featureLayerSelectedCondition" in the daml should prevent this ...
if (fLayer == null)
return true;
//use whatever field is been set as Display Field in the layer properties ...
var fldName = ((CIMFeatureLayer)fLayer.GetDefinition()).FeatureTable.DisplayField;
string fileName = GetFirstRow(fLayer, fldName, geometry);
if (!string.IsNullOrWhiteSpace(fileName))
{
Uri myUri = new Uri($@"C:\Temp\{fileName}.lyrx");
Debug.Print(fileName);
//todo: verify file exists, layer not already added, etc.
//Layer newlayer = LayerFactory.Instance.CreateFeatureLayer(myUri, this.ActiveMapView.Map, LayerPosition.AddToTop);
}
return true;
});
}
private string GetFirstRow(FeatureLayer fLayer, string fldName, Geometry geom)
{
string s = "";
GeometryEngine.Instance.Project(geom, fLayer.GetSpatialReference());
using (var cursor = fLayer.Search(new SpatialQueryFilter()
{
FilterGeometry = GeometryEngine.Instance.Project(geom, fLayer.GetSpatialReference()),
SpatialRelationship = SpatialRelationship.Intersects,
SubFields = fldName
}))
{
if (cursor.MoveNext())
s = cursor.Current[fldName].ToString();
};
return s;
}
}
}
... View more
12-07-2021
07:34 AM
|
1
|
1
|
1598
|
POST
|
This works for me with 2.9 (see Extent at end) private static void Test()
{
//from here: https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/#topic20909.html
using (GeometryBagBuilder builder = new GeometryBagBuilder(SpatialReferences.WGS84))
{
GeometryBag emptyBag = builder.ToGeometry();
// emptyBag.IsEmpty = true
MapPoint point = MapPointBuilder.CreateMapPoint(1, 2, SpatialReferences.WebMercator);
builder.AddGeometry(point);
// builder.CountGeometries = 1
GeometryBag geometryBag = builder.ToGeometry();
// geometryBag.PartCount = 1
// geometryBag.PointCount = 1
// geometryBag.IsEmpty = false
IReadOnlyList<Geometry> geometries = geometryBag.Geometries;
// geometries.Count = 1
// geometries[0] is MapPoint with a sr of WGS84
bool isEqual = geometryBag.IsEqual(emptyBag); // isEqual = false
List<Coordinate2D> coords2D = new List<Coordinate2D>()
{
new Coordinate2D(0, 0),
new Coordinate2D(0, 1),
new Coordinate2D(1, 1),
new Coordinate2D(1, 0)
};
Multipoint multipoint = MultipointBuilder.CreateMultipoint(coords2D, SpatialReferences.WGS84);
builder.InsertGeometry(0, multipoint);
geometryBag = builder.ToGeometry();
// geometryBag.PartCount = 2
geometries = geometryBag.Geometries;
// geometries.Count = 2
// geometries[0] is Multipoint
// geometries[1] is MapPoint
Polyline polyline = PolylineBuilder.CreatePolyline(coords2D, SpatialReferences.WebMercator);
builder.AddGeometry(polyline);
//builder.RemoveGeometry(1);
geometryBag = builder.ToGeometry();
// geometryBag.PartCount = 2
geometries = geometryBag.Geometries;
// geometries.Count = 2
// geometries[0] is Multipoint
// geometries[1] is Polyline
var ext = geometryBag.Extent;
Console.WriteLine(ext.ToJson());
}
}
... View more
12-06-2021
11:55 AM
|
1
|
1
|
612
|
Title | Kudos | Posted |
---|---|---|
1 | 03-04-2021 06:59 AM | |
1 | 08-05-2022 07:29 AM | |
2 | 12-17-2020 02:24 PM | |
3 | 02-08-2022 09:14 AM | |
1 | 12-17-2021 08:41 AM |
Online Status |
Offline
|
Date Last Visited |
12-29-2023
02:58 PM
|