POST
|
Hi Ed, I can duplicate your problem with the AutoZoomOnEmpty property when you specify a lyrx file uri to the LayerCreationParams. The assumption with this AutoZoomOnEmpty property is that there is only a single data source (and consequently only a single layer) being added to the map. Because you are specifying a lyrx file it is possible that there is more than one data source and layer being added . The code and AutoZoomOnEmpty property works as expected if the LayerCreationParams uri points to a single data source (such as a feature class or table in a geodatabase). Having said that, if you know that your lyrx file contains a single layer then the following is a possible workaround if you still wish to use a lyrx file. var layerdoc = new LayerDocument(path_to_lyrx_file);
var cimLayerDoc = layerdoc.GetCIMLayerDocument();
var layerDefs = cimLayerDoc.LayerDefinitions;
var layerDef = layerDefs[0];
var dataConnection = (layerDef as CIMFeatureLayer).FeatureTable.DataConnection;
LayerCreationParams lyrParams = new(dataConnection);
lyrParams.AutoZoomOnEmptyMap = false;
LayerFactory.Instance.CreateLayer<Layer>(lyrParams, map); I'll add an issue into our backlog to examine updating the code to take a lyrx file uri into account. Narelle
... View more
3 weeks ago
|
0
|
1
|
242
|
POST
|
Hi, Unfortunately we do not currently have any functionality to show custom help topics for MapTools. I will add an issue to our backlog to include this functionality. Regards Narelle
... View more
a month ago
|
4
|
0
|
129
|
POST
|
Hi Dave, One way of having a sketch tool allow multiple clicks without using the Line sketch is to use the Multipoint geometry type. You can then override the OnSketchModifiedAsync callback to force the sketch to finish after your required number of clicks (in this case 2). Here's a small snippet that sounds like what you're looking for. internal class LeaderLineTool : MapTool
{
public LeaderLineTool()
{
IsSketchTool = true;
SketchType = SketchGeometryType.Multipoint;
SketchOutputMode = SketchOutputMode.Map;
}
protected override Task OnToolActivateAsync(bool active)
{
return base.OnToolActivateAsync(active);
}
protected override async Task<bool> OnSketchModifiedAsync()
{
var sketchGeom = await GetCurrentSketchAsync();
if (sketchGeom is Multipoint multiPoint)
{
var ptCount = multiPoint.Points.Count;
// force the sketch to finish if there are more than 2 points
if (ptCount >= 2)
FinishSketchAsync();
}
return true;
}
protected override Task<bool> OnSketchCompleteAsync(Geometry geometry)
{
if (geometry is Multipoint multiPoint)
{
// check the point count
// user could have finished the sketch with less than the
// required 2 points
var ptCount = multiPoint.Points.Count;
if (ptCount < 2)
{
return Task.FromResult(true);
}
var firstPoint = multiPoint.Points[0];
var secondPoint = multiPoint.Points[1];
// first point for leader line location
// second point for callout location
}
return base.OnSketchCompleteAsync(geometry);
}
} Narelle
... View more
02-21-2024
04:10 PM
|
0
|
0
|
112
|
POST
|
Hi Tony, The error message is a little misleading. But essentially before you open a table pane you must have a mapView active. Unfortunately once a table pane has been opened it becomes the active view. So the first table pane opens successfully, but then your mapView is no longer active which is why the second (and subsequent) attempts to open a table pane fail. You should be able to open multiple table panes by code similar to the following var mv = MapView.Active;
if (mv == null)
return;
// get the active pane (the pane of the active mapView)
var pane = FrameworkApplication.Panes.ActivePane;
foreach (var layer in attributeTableLayers)
{
try
{
// open a table pane
FrameworkApplication.Panes.OpenTablePane(layer, TableViewMode.eAllRecords);
// reactivate the pane for the mapview
pane.Activate();
}
catch (Exception ex)
{
}
} Narelle
... View more
01-02-2024
09:00 PM
|
2
|
0
|
401
|
POST
|
Hello, The recent project list is a user setting. When you upgrade to a new version of ArcGIS Pro, you get a new collection of user settings. As far as I know they do not automatically transfer between versions That is your 3.1 user settings do not automatically become your 3.2 user settings when you upgrade to 3.2. The GetRecentProjects API should return all the projects in your 3.2 recent project list user setting. This is not restricted to projects that have been "created" in the 3.2 version, but projects that have been "opened" in 3.2. You can find your user settings for 3.2 at c:\users\(userID)\AppData\Roaming\Esri\ArcGISPro_StrongName_xxxx\3.2.0.0 where the xxxx in ArcGISPro_StrongName_xxxx is some collection of characters. Narelle
... View more
11-30-2023
06:23 PM
|
0
|
0
|
151
|
POST
|
Hi Hao, The 3.2 release of the Pro SDK (coming very very soon) has support for TIN. Some of the new objects that have been added to the API are TinLayer and TinDataset. You can access the nodes (TinNode), edges (TinEdge) or triangles (TinTriangle) of a TinDataset by searching or accessing the element by it's index. The TinDataset object also has many of the other methods that can be found on the ITinAdvanced2 interface. Please take a look at these APIs when 3.2 is released and let us know if there is additional functionality you require. Thanks Narelle
... View more
10-31-2023
08:54 PM
|
1
|
2
|
313
|
POST
|
Barbara, If the data source has been cleared, then you probably need to also set other properties on the CIMMapStereoProperties instance. Try something similar to the following protected override async void OnClick()
{
Map stereoMap = MapView.Active.Map;
await QueuedTask.Run(async () =>
{
CIMMap cimMap = stereoMap.GetDefinition();
var stereoProps = cimMap.StereoProperties;
string path = @"D:\Data\StartProject.gdb";
var fileGdbConnPath = new FileGeodatabaseConnectionPath(new Uri(path, UriKind.Absolute));
using (var gdb = new Geodatabase(fileGdbConnPath))
{
ArcGIS.Core.Data.Raster.MosaicDataset mDataset = gdb.OpenDataset<ArcGIS.Core.Data.Raster.MosaicDataset>("MyMoaid");
var mosaicDataConnection = mDataset.GetDataConnection();
var (leftImageID, rightImageID) = GetStereoImages(mDataset);
stereoProps.SourceType = StereoSourceType.StereoModelCollection;
stereoProps.StereoModelCollection = mosaicDataConnection;
stereoProps.LeftImageID = leftImageID;
stereoProps.RightImageID = rightImageID;
cimMap.StereoProperties = stereoProps;
stereoMap.SetDefinition(cimMap);
}
// MapView.Active.Redraw(true);
});
}
// Find the left and right image IDs from the mosaicDataset
// This is achieved by querying the stereo table and retrieving
// the ImageID1 and ImageID2 fields.
(long image1ID, long image2ID) GetStereoImages(ArcGIS.Core.Data.Raster.MosaicDataset mDataset)
{
var stereoTable = mDataset?.GetStereoTable();
var stereoTableDef = stereoTable?.GetDefinition();
if (stereoTableDef == null)
return (-1, -1);
var image1Fld = stereoTableDef.FindField("ImageID1");
var image2Fld = stereoTableDef.FindField("ImageID2");
if ((image1Fld == -1) || (image2Fld == -1))
return (-1, -1);
long image1 = -1;
long image2 = -1;
using (var cursor = stereoTable.Search(null))
{
if (cursor.MoveNext())
{
using (var row = cursor.Current)
{
var image = row[image1Fld];
if (image != null)
System.Int64.TryParse(image.ToString(), out image1);
image = row[image2Fld].ToString();
if (image != null)
System.Int64.TryParse(image.ToString(), out image2);
}
}
}
return (image1, image2);
} You may also need to set the LeftImageColorizer and RightImageColorizer properties, but I am not sure. Let me know if this still doesn't work for you. It worked for my test scenario, but I am not a raster expert. Narelle
... View more
09-14-2023
10:29 PM
|
0
|
1
|
472
|
POST
|
Hi Barbara, It looks like you have forgotten to save the updated CIM definition back to the map. Remember that a GetDefinition call also needs a SetDefinition call after any updates. Try adding a steroMap.SetDefinition call with your updated cimMap before you redraw. Narelle
... View more
09-13-2023
08:56 PM
|
1
|
0
|
489
|
POST
|
Go back to your first approach and try calling base.StartSketchAsync() after you've changed the SketchType. Internally the sketch is started on tool activation with the current SketchType. If you change the SketchType after this moment, you need to tell the tool to re-initialize the sketch. This is accomplished by the StartSketchAsync method. Narelle
... View more
08-06-2023
11:57 PM
|
1
|
0
|
439
|
POST
|
Hi, You can override the CanCommit function on EmbeddableControl to return false when your fields have not been filled in. And true when your control is correct. When a step cannot proceed, Tasks will show an error message at the bottom of the dockpane indicating that the step is not enabled or that there is an error. You cannot modify or configure this built in message, so you may consider adding a more specific message to your embeddable control that indicates what the error is. Narelle
... View more
07-18-2023
05:57 PM
|
0
|
0
|
267
|
POST
|
Hello, Thanks for your post. I am able to duplicate your issues at 3.1. I have logged an issue with the Layout team for this bug to be fixed. Here is a work around for this bug. If you are able to name your elements when creating them, you can call Layout.FindElement (https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic29299.html) using that name before you need to reference the element. Doing this, you will find that the object is populated correctly and no null reference exceptions should be thrown. For example, here is your code with the first mapFrame element correctly showing the parent after the second map frame has been created. var group1 = ElementFactory.Instance.CreateGroupElement(layout, new List<Element>(), "group1");
var test1 = ElementFactory.Instance.CreateMapFrameElement(group1, frameBounds, templateMap, "MF1");
var parent = test1.GetParent(); // > group1
test1.SetHeight(100.0); // > works
var test2 = ElementFactory.Instance.CreateMapFrameElement(group1, frameBounds, templateMap, "MF2");
parent = test1.GetParent(); // > null
parent = test2.GetParent(); // > group1
// re-get the element
test1 = layout.FindElement("MF1") as MapFrame;
parent = test1.GetParent(); // group1
test1.SetHeight(100.0); // > works Thanks Narelle
... View more
06-22-2023
08:28 PM
|
1
|
0
|
322
|
POST
|
Hi Brian, Try updating the editing module ("esri_editing_EditingModule") and the "esri_editing_data" menu (or "esri_editing_standalonetable_data_menu" for standalone tables) This sub menu is inserted into the "esri_mapping_layerContextMenu" Narelle
... View more
06-14-2023
02:24 PM
|
1
|
0
|
308
|
POST
|
Sorry. You also need to override an additional method in your implementation of the InspectorProvider. Add the override for the AttributesOrder. See the code snippet below. Also note that your add-in does not need to iterate through the attributes calling the IsVisible method after having loaded it. The internal Pro code of the inspector control code calls the InspectorProvider methods. All the add-in needs to do is create the inspector from your provider, create the embeddable control and then load the row. Narelle internal class CustomProvider : InspectorProvider
{
public override bool? IsVisible(Attribute attr)
{
if (attr.FieldName == "POP1990")
return false;
return true;
}
public override IEnumerable<Attribute> AttributesOrder(IEnumerable<Attribute> attrs)
{
return attrs;
}
}
... View more
05-21-2023
05:25 PM
|
1
|
0
|
669
|
POST
|
If you are using ArcGIS Pro 3.1 or higher there is also the InspectorProvider class that allows customization of field visibility, editability, display name, etc in the inspector when it is displayed as an embeddable control. These customizations are different from using the IDisplayTable to make the changes. https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic10294.html Here's an example that shows how to hide a field from the inspector grid. internal class CustomProvider : InspectorProvider
{
public override bool? IsVisible(Attribute attr)
{
if (attr.FieldName == "POP1990")
return false;
return true;
}
}
And now when creating the inspector grid use the following var provider = new CustomProvider();
_featureInspector = provider.Create();
// create a new instance for the inspector
// create an embeddable control from the inspector class to display on the pane
var icontrol = _featureInspector.CreateEmbeddableControl();
... We don't currently have any support for the second part of your question - being able to highlight the columns that have been modified. Narelle
... View more
05-19-2023
04:50 PM
|
2
|
2
|
708
|
POST
|
Hi, Can you change the definition of your OnSelectionChange function to the following and see if that helps with the method firing when a choice is made in the combobox. Protected Overrides Sub OnSelectionChange(layerName As ComboBoxItem) (so it is Overrides not Overridable Overloads) Narelle
... View more
02-22-2023
07:30 PM
|
0
|
0
|
492
|
Title | Kudos | Posted |
---|---|---|
1 | 02-12-2019 08:59 AM | |
4 | a month ago | |
2 | 01-02-2024 09:00 PM | |
1 | 10-31-2023 08:54 PM | |
1 | 09-13-2023 08:56 PM |
Online Status |
Offline
|
Date Last Visited |
2 weeks ago
|