|
POST
|
if I am understanding your code snippet correctly, u are adding _two_ elements to your graphics layer (one with some text and another with a marker symbol)? Namely: symLayer.AddElement(polyTxtGra); symLayer.AddElement(symPtGraphic); Is that right? Therefore, can you not simply group the two elements together (into a group element) to achieve the same thing....or must this all be combined into a single symbol (as I was illustrating)? Creating a group element would look like this: var elem1 = symLayer.AddElement(polyTxtGra); var elem2 = symLayer.AddElement(symPtGraphic); symLayer.GroupElements(new List<Element>() { elem1, elem2 }); https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic29336.html
... View more
01-30-2023
12:38 PM
|
0
|
1
|
1783
|
|
POST
|
Sometimes to solve these kinds of things see if u can make the symbol first and then deconstruct it. Usually, if u cant make a symbol via the UI then the symbol probably can't be made via the api either (not always but in most cases). So in the Pro help we have Position and place marker symbol layers .which contains an "At Center" placement for markers in polys. A bit of fiddling with the symbology UI gives: The last bit is deconstructing the symbol which involves a bit of trial and error. There are three symbol layers - the marker, a stroke, and a fill. The marker has a placement set to position it "At Center". Note: I notice that Pro removes the stroke from the char marker to have it scale correctly when it is resized. internal class LayoutTool1 : LayoutTool {
private CIMPolygonSymbol _polygonSymbol = null;
public LayoutTool1() {
SketchType = SketchGeometryType.Polygon;
}
protected override Task OnToolActivateAsync(bool active) {
return base.OnToolActivateAsync(active);
}
protected override Task<bool> OnSketchCompleteAsync(Geometry geometry) {
return QueuedTask.Run(() => {
if (_polygonSymbol == null)
_polygonSymbol = MakePolySymbol();
ElementFactory.Instance.CreateGraphicElement(
this.ActiveElementContainer, geometry, _polygonSymbol);
return true;
});
}
private CIMPolygonSymbol MakePolySymbol() {
var char_index = 80;
var font = "ESRI Default Marker";
var char_marker = SymbolFactory.Instance.ConstructMarker(
char_index, font) as CIMCharacterMarker;
char_marker.Size = 16;
var grey = ColorFactory.Instance.CreateRGBColor(110, 110, 110);
var violet = ColorFactory.Instance.CreateRGBColor(236, 212, 252);
var purple = ColorFactory.Instance.CreateRGBColor(132, 0, 168);
//change the fill
//also, for some reason the stroke must be removed to have
//the symbol scaled correctly
foreach (var layer in char_marker.Symbol.SymbolLayers)
{
if (layer is CIMSolidFill)
{
((CIMSolidFill)layer).Color = purple;
}
else if (layer is CIMSolidStroke)
{
((CIMSolidStroke)layer).Width = 0.0;
}
}
//set the placement for the marker within the poly
var center_placement = new CIMMarkerPlacementPolygonCenter()
{
Method = PlacementPolygonCenterMethod.OnPolygon
};
//assign the marker placement
char_marker.MarkerPlacement = center_placement;
//make the poly outline and fill
var stroke = SymbolFactory.Instance.ConstructStroke(grey, 2.0);
var fill = SymbolFactory.Instance.ConstructSolidFill(violet);
//make the final symbol
return new CIMPolygonSymbol()
{
SymbolLayers = new List<CIMSymbolLayer>()
{
char_marker, stroke, fill
}.ToArray()
};
}
} Final symbol:
... View more
01-28-2023
10:57 AM
|
0
|
1
|
1802
|
|
POST
|
just specify the path to the project at the end of the command line (after the /config:xxxxxxx bit). If the path has spaces u will need to use quotes. refer to ProGuide Command line switches for ArcGISPro.exe for all the available command line switches fyi.
... View more
01-25-2023
09:45 PM
|
0
|
0
|
1719
|
|
POST
|
When running headless, Pro does not have a fully activated view so u cant rely on it for unit tests. To test functionality that requires a ("proper") active view u will need something like CUIT, coded UI test.
... View more
01-23-2023
07:40 AM
|
1
|
0
|
1208
|
|
POST
|
I think u have conflicting settings in your .csproj. Change the Copy to Output setting to "Do not copy". Leave the Build action as Content.
... View more
01-23-2023
07:30 AM
|
0
|
0
|
1442
|
|
POST
|
ArcGIS REST API search limit
01-18-2023
06:27 AM
|
0
|
0
|
356
|
|
POST
|
This looks suspect to me - the await on the Task.Delay. await QueuedTask.Run(async () =>
{
...
await Task.Delay(1000); I think if u change your code to: await QueuedTask.Run(() =>
{
Task.Delay(1000).Wait();//block You will get the effect u are after. Also, 1000 might be a little bit too quick. 2000+ may be better. Scratch that - u r in a loop, 1000 is fine. From memory I think there is an option on the ProgressDialog ctor - delayedShow. Default is true so u can set that to false to have the dialog immediately show. Last, I dont think the progress.Hide() is necessary.
... View more
01-16-2023
10:12 AM
|
0
|
0
|
3144
|
|
POST
|
Yes, things can get complicated quickly. If you need your combo to remain current "auto-magically" as the map TOC changes you will need to handle all events associated with changes to the TOC. Start with: ArcGIS.Desktop.Mapping.Events.LayersAddedEvent ArcGIS.Desktop.Mapping.Events.LayersRemovedEvent In each of these add or remove the relevant layer(s) to your list If the user can switch (active) maps, then you will need to handle this one also: ArcGIS.Desktop.Mapping.Events.ActiveMapViewChangedEvent. It will fire twice when a map pane switches - once when the (old) view is deactivated and once when the new view is activated. If a user selects a Layout/Chart/or other non-map pane then it fires just once (for the old view being deactivated). For "automatic" updating, as u call it, u would need an ObservableCollection and not a (generic) List. However, switching to an ObservableCollection will require u to handle the multi-threaded access (from the UI and, potentially, from the QueuedTask) which adds another level of complexity. (fyi This was covered at Dev Summit 2022 here: https://esri.github.io/arcgis-pro-sdk/techsessions/2022/PalmSprings/ImprovingYourDockpaneandProWindow.zip)
... View more
12-30-2022
02:10 PM
|
1
|
0
|
2289
|
|
POST
|
Thanks Gintautas, This looks like a bug in the Beta. We will fix it for final.
... View more
12-28-2022
02:49 PM
|
0
|
0
|
1916
|
|
POST
|
Mody, we can expose this property to allow for api change at 3.2 3.1 In the meanwhile, u can use something like this to change it programmatically if u must but I dont really recommend it. There are caveats when changing the User.Config programmatically like this: 1. The application can cache properties and their values and I dont know if this is the case with EnableUndo. 2. This code saves the User.Config on disk and this save is not synchronized with the Options dialog or other application code that may be saving the User.Config (which cld lead to a conflict if both try to save at the same time) internal class ToggleGP_EnableUndo : Button {
private static readonly string GP_EnableUndo = "EnableUndo";
protected override void OnClick() {
var enable_undo = GetGPEnableUndoSetting();
SetGPEnableUndoSetting(!enable_undo);
}
private bool GetGPEnableUndoSetting() {
var config = System.Configuration.ConfigurationManager.OpenExeConfiguration(
ConfigurationUserLevel.PerUserRoamingAndLocal);
var group = config.SectionGroups[@"userSettings"] as ConfigurationSectionGroup;
var gp_Section = group.Sections["ArcGIS.Desktop.Internal.GeoProcessing.Properties.Settings"] as ClientSettingsSection;
var enableUndoSetting = gp_Section?.Settings.Get(GP_EnableUndo);
var rawValue = enableUndoSetting?.Value?.ValueXml?.InnerText ?? "False";
return Boolean.Parse(rawValue);
}
private void SetGPEnableUndoSetting(bool enable_undo) {
var config = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
var group = config.SectionGroups[@"userSettings"] as ConfigurationSectionGroup;
var gp_Section = group.Sections["ArcGIS.Desktop.Internal.GeoProcessing.Properties.Settings"] as ClientSettingsSection;
var enableUndoSetting = gp_Section.Settings.Get(GP_EnableUndo);
//null check...
if (enableUndoSetting == null) {
//create a new value
var element = new SettingElement(GP_EnableUndo, SettingsSerializeAs.String);
var xElement = new XElement(XName.Get("value"));
XmlDocument doc = new XmlDocument();
XmlElement valueXml = doc.ReadNode(xElement.CreateReader()) as XmlElement;
valueXml.InnerText = enable_undo.ToString();
element.Value.ValueXml = valueXml;
gp_Section.Settings.Add(element);
}
else {
//change the value
XmlDocument doc = new XmlDocument();
var sr = new StringReader(enableUndoSetting.Value.ValueXml.OuterXml);
XmlElement valueXml = doc.ReadNode(XmlReader.Create(sr)) as XmlElement;
valueXml.InnerText = enable_undo.ToString();
enableUndoSetting.Value.ValueXml = valueXml;
}
config.Save();
}
}
... View more
12-27-2022
01:57 PM
|
0
|
2
|
2016
|
|
POST
|
There's nothing "built-in" but we have lots of examples of combos in panes, dockpanes, etc. that list the names of layers from the map, etc. in the samples. Here's one u can look at that should help get u started: https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Authoring/LayersPane - Specifically, look at the layers pane combobox implementation in https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/master/Map-Authoring/LayersPane/UI/LayersPane.xaml. It is bound to a property "AllMapLayers" in the view model. It is just showing feature layers but u can change that to be whichever layer types - as you need. There are probably others.
... View more
12-16-2022
05:02 PM
|
1
|
1
|
2369
|
|
POST
|
To change page orientation set the page height to the page width and the width to the height. You then have two choices: Set the changed page back on the layout and resize all page content to "fit" on the changed page orientation - or - (edit - this option is available at 3.1) Resize the page and leave page content "as is" - potentially page content may no longer fit on the page after a page resize but their dimensions and positions are unchanged (this option is available at 3.0 and 2.x) Here's a snippet u can fiddle with: private void SwitchPageOrientation() {
if (LayoutView.Active == null)
return;
var layout = LayoutView.Active.Layout;
QueuedTask.Run(() => {
var page = layout.GetPage();
//what is the orientation?
var orientation = page.Height > page.Width ? PageOrientation.Portrait :
PageOrientation.Landscape;
//TODO - use orientation as needed
//switch portrait->landscape or vice versa
var wd = page.Width;
var ht = page.Height;
page.Height = wd;
page.Width = ht;
//Available at 3.1
layout.SetPage(page, true);//resize the page elements
//Available at 3.0 and 2.x
//layout.SetPage(page);<-- use this flavor for no element resizing
//layout.SetPage(page, false);<-- or set the resize flag false
});
}
... View more
12-16-2022
04:44 PM
|
0
|
0
|
1567
|
|
POST
|
Hi Mody, I think it just depends on what your workflow requirements are. The EditCompletingEvent, imo, could be useful if you are tracking specific edit operations (typically that u initiate) and u are doing some broad-based validation or even auditing/logging. The ROW events are much more granular than the EditCompletingEvent event - they will fire any time an edit occurs against a dataset (for which u register for events). They also contain the row being edited which makes them useful for "final" validation of a specific feature or other business logic that wants to change an attribute value before the "Store" completes. The event to be the most judicious with will be the ROW event given how frequently it could fire during an edit (that spans multiple rows and multiple datasets - if u r registered against many datasets).
... View more
12-05-2022
09:39 AM
|
0
|
0
|
2129
|
|
POST
|
Hi Fridjof, your analysis sounds correct and I think Wolf's recommendation of a second edit operation is the way to go. The key is to "chain" the edit operations together that need to behave on the UNDO/REDO stack as if they are a single transaction (even tho' the chained operations actually span multiple edits). It is explained here (the "classic" use case being adding an attachment to a new feature - in that scenario, the feature must exist such that the relate to the row in the attachment table can be created...resulting in two edits). https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Editing#chaining-edit-operations Note: Just thought I would mention another possibility - it might be possible to use a RowToken - A RowToken acts as a placeholder for a new feature (if "feature" in your snippet example represents a new feature - sorry, I cant tell from the context). The basic pattern for use of a rowtoken is: var rowToken = editOp.Create(......);//call Create - returns a rowtoken or "placeholder" //Do surface Z query + generalization here dictOfAttributes["SHAPE"] = newShape; editOp.Modify(rowToken, dictOfAttributes);//Use the placeholder here to refer to the feature "TO BE" created. editOp.Execute(); //Now Create _and_ modify get executed together. RowToken is explained here: https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Editing#rowtokens
... View more
12-02-2022
08:31 AM
|
0
|
0
|
2551
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-19-2026 10:29 AM | |
| 1 | 04-29-2026 02:06 PM | |
| 1 | 01-08-2026 02:03 PM | |
| 1 | 01-08-2026 02:15 PM | |
| 3 | 12-17-2025 11:33 AM |
| Online Status |
Offline
|
| Date Last Visited |
a month ago
|