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
|
810
|
POST
|
Hi, I'm sorry; I'm not able to duplicate your problem with FeatureLayerCreationParams. I have a group layer containing 3 layers (pointing to a file geodatabase). Then I run the following code which inserts a hosted feature layer at index 2 in the group layer. The new layer is inserted at the correct location. Can you run this code and see if it works as you expect? Narelle protected override void OnClick()
{
var groupLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<GroupLayer>().FirstOrDefault();
if (groupLayer == null)
return;
// Airports_OPSNET45
string agolId = "8c1854a8580543b0a4848a0b5fbb0791";
int index = 2;
DoIt(agolId, "My layer", index, groupLayer);
}
internal Task DoIt(string AgolId, string name, int index, GroupLayer groupLayer)
{
return QueuedTask.Run(() =>
{
Item stagingLayer = ItemFactory.Instance.Create(AgolId, ItemFactory.ItemType.PortalItem);
if (LayerFactory.Instance.CanCreateLayerFrom(stagingLayer))
{
var featureCreateParams = new FeatureLayerCreationParams(stagingLayer)
{
IsVisible = true,
MapMemberIndex = index,
MapMemberPosition = MapMemberPosition.Index,
Name = name
};
Lactory.Instance.CreateLayer<FeatureLayer>(featureCreateParams, groupLayer);
}
});
}
... View more
02-17-2023
03:38 PM
|
0
|
0
|
650
|
POST
|
Hi, You seem to be missing setting the MapMemberPosition to MapMemberPosition.Index in the first code snippet (when you are using the FeatureLayerCreationParams). The default value for this property when it is not set is AutoArrange which means that the MapMemberIndex value is ignored. Thanks Narelle
... View more
02-16-2023
05:00 PM
|
0
|
2
|
664
|
POST
|
Hi, Seeing you're reading just a .txt file - I would recommend using standard .NET read/write classes/methods to open your file rather than the FileSystemConnectionPath object. https://learn.microsoft.com/en-us/dotnet/visual-basic/developing-apps/programming/drives-directories-files/how-to-read-text-from-files-with-a-streamreader This link has a code snippet which seems to suit your situation - opening a text file and reading lines. Thanks Narelle
... View more
02-09-2023
02:25 PM
|
1
|
2
|
863
|
POST
|
Hello, Currently there is no method in the API to access the set of favorite templates. Access to templates is currently only from a map member (layer or standalone table) using the GetTemplates method. I will add an issue to our backlog to address this in a future release. Narelle
... View more
01-30-2023
05:22 PM
|
1
|
1
|
651
|
POST
|
Hi Mody, This is by design. We do not receive a modified event for point geometry from the underlying architecture. Unfortunately there is no other event available for points. Narelle
... View more
12-13-2022
04:57 PM
|
0
|
0
|
226
|
POST
|
Hi Andy, Here's a short example of how to create a polygon. // current exent of mapView
var extent = MapView.Active.Extent;
var height = extent.Height;
var width = extent.Width;
var centerPt = extent.Center;
// new xmin, xmax, ymin, ymax values - a subset of the extent
var xmin = centerPt.X - width / 4;
var xmax = centerPt.X + width / 4;
var ymin = centerPt.Y - height / 4;
var ymax = centerPt.Y + height / 4;
// create 4 corners of the new polgyon
var pt1 = MapPointBuilderEx.CreateMapPoint(xmin, ymin, MapView.Active.Map.SpatialReference);
var pt2 = MapPointBuilderEx.CreateMapPoint(xmin, ymax, MapView.Active.Map.SpatialReference);
var pt3 = MapPointBuilderEx.CreateMapPoint(xmax, ymax, MapView.Active.Map.SpatialReference);
var pt4 = MapPointBuilderEx.CreateMapPoint(xmax, ymin, MapView.Active.Map.SpatialReference);
// then create a polygon from the set of points
var listPoints = new List<MapPoint>() { pt1, pt2, pt3, pt4 };
var polygon2 = PolygonBuilderEx.CreatePolygon(listPoints, MapView.Active.Map.SpatialReference); There's also the following documentation that can help you discover more about building geometries. - https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Geometry There are a lot of different code snippets here too. - https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Geometry Thanks Narelle
... View more
11-15-2022
12:39 AM
|
1
|
0
|
1054
|
POST
|
Hi Tom, Please see the information I posted here. https://community.esri.com/t5/arcgis-pro-sdk-questions/integration-and-configuration-of-custom-commands/m-p/1206677#M8659 let me know if there are additional questions. Narelle
... View more
09-04-2022
05:40 PM
|
1
|
0
|
292
|
POST
|
Dirk, Each type of customization that is part of the DAML file must be assigned a unique ID. We call this the damlID. So when you define a button in your add-in it has a damlID. In the example below the damlID is "acme_AddFromFileButton" <button id="acme_AddFromFileButton"
className=" AddFromFile"
caption="Add from file"
keytip="AF"
largeImage="Images\AddFromFile32.png"
smallImage="Images\AddFromFile16.pngg">
<tooltip heading="Add from file" image="Images\AddFromFile16.png">
Add spatial data files to the project
<disabledText>Requires an open project with a map</disabledText>
</tooltip>
</button> Similarly defining and registering a component in a category requires that the item have a unique damlID. In this definition the damlID is "esri_mapping_bookmarks". Internally we prefix our damlIds with "esri_(moduleName)" so this example belongs to the mapping module. So your daml entry for the emebeddable control category might look like the following <categories>
<updateCatgeory refID="esri_tasks_embeddableControls">
<insertComponent id="unity_editor_embeddedControlID" className="embeddedControlViewModel">
<content className="embeddedControlView" relatedCommand="unity_editor_CreateAssetsButton" autoRunOnly="true"/>
</insertComponent>
</updateCategory>
</categories> where embeeddedcontrolviewModel and embeddedControlView are the classes from step 2 that I explained above. And "unity_editor_CreateAssetsButton" is the damlID of the button that launches your dockPane defined in step 3. Regards Narelle
... View more
08-31-2022
06:38 PM
|
1
|
0
|
627
|
POST
|
Dirk, You will likely have to restructure some of your code to fully implement the ability of embedding your dockpane into the Tasks pane. The daml category that you found ("esri_tasks_embeddableControls") is the correct category to register your code in order for Tasks to recognize it as a component that can be embedded. But the view/viewModel that the daml entry references via the className attribute should be a class that inherits from ArcGIS.Desktop.Framework.Controls.EmbedableControl. You can create one of these using the Visual Studio template. Internally we typically follow the below steps for this pattern. 1. create an internal control and viewModel pair to hold the UI and code behind. 2. create an EmbeddableControl (a view and viewmodel pair) that hosts and instantiates the control and the control's view model from step1 3. create a DockPane (a view and viewmodel pair) that hosts and instantiate the control and the control's view model from step1. 4. The esri_tasks_embeddableControls daml entry reference the view/viewmodel from step 2. The "relatedCommand" attribute in that same daml entry references the buttonID that launches the dockpane from step 3. As you can see, this is an advanced extension pattern that has a certain amount of complexity involved. I hope this information helps to get you started. Let me know if you have additional questions. Narelle
... View more
08-29-2022
06:54 PM
|
0
|
2
|
642
|
POST
|
Hi David, Sorry for the late reply. I have been looking at your post and code and have a few comments. 1. I'm sure you've read the documentation we have about editing annotation and it's special considerations but am including a link here for reference. (https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Editing-Annotation) 2. The API currently doesn't expose the ability to show the yellow "grabhandle" that you see with the built in Move tool (that identifies the feature being moved). We have identified this as future functionality we would like to add but currently do not have a timeline identified. 3. The MapTool.AddOverlay function that you are using will create a graphic from the geometry and symbol parameters that are passed. This is why you see the line being displayed on the screen. The line is the baseline geometry of the annotation feature - the geometry that the annotation text lies on. To see the annotation text on the overlay, you should use the AddOverlay function that takes a CIMGraphic https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic27604.html. The CIMGraphic passed would the CIMTextGraphic of the annotation feature (found from AnnotationProperties.TextGraphic). 4. Because you're dealing with annotation and text, it is also important to use the second parameter of that AddOverlay method - the referenceScale. This can be retrieved from the AnnotationFeatureClassDefinition. await QueuedTask.Run(() =>
{
var annoFC = _layerAnno.GetFeatureClass() as AnnotationFeatureClass;
var annoFCDef = annoFC.GetDefinition() as AnnotationFeatureClassDefinition;
_annoRefScale = annoFCDef.GetReferenceScale();
var refScaleUnits = annoFCDef.GetReferenceScaleUnits();
}); So the AddOverlay routine would become _graphic = AddOverlay(_trackedTextGraphic, _annoRefScale); 5. Unfortunately there is no MapTool.UpdateOverlay method that supports the moving of text graphics in the manner used in your code. This is a gap in our API that was found as a result of looking at your post and it will be fixed in the next Pro release. Thanks for helping to identify this. 6. In the meantime a work around would be to dispose of the previous graphic and create a new one with the CIMTextGraphic at the moved geometry position. Unfortunately because this is in MouseMove, the performance may not be as smooth as the standard tool. Here's a sample of code that could replace your UpdateOverlay call Geometry movedGeometry = null;
if (_trackedSide == "up" || _trackedSide == "down")
{
movedGeometry = GeometryEngine.Instance.Move(_trackedGeometry, x, 0);
}
else
{
movedGeometry = GeometryEngine.Instance.Move(_trackedGeometry, 0, y);
}
lock (_lock)
{
if (_graphic != null)
_graphic.Dispose();
var newGraphic = _trackedTextGraphic.Clone();
newGraphic.Shape = movedGeometry;
_graphic = AddOverlay(newGraphic, _annoRefScale);
} I hope this provides some clarification and helps you make progress with your tool. Please let me know if you have any questions or comments about the above. Regards Narelle
... View more
08-17-2022
08:31 PM
|
1
|
0
|
550
|
POST
|
Hi Roxana, Unfortunately these trace options are not currently available in the public API. I will create an issue to add these in a future release. regards Narelle
... View more
08-03-2022
06:12 PM
|
1
|
1
|
414
|
POST
|
Hi Karen, If you have access to the tool code, can you see whether the following works for you as a possible workaround to the tool deactivating?
private bool ignoreToolDeactivation = false;
protected override async Task OnToolActivateAsync(bool active)
{
var map = MapView.Active.Map;
var wkid = map.SpatialReference.Wkid;
// wkid 102038 = world from space
if (wkid != 102038)
{
await QueuedTask.Run(() =>
{
ignoreToolDeactivation = true;
var sr = SpatialReferenceBuilder.CreateSpatialReference(102038);
map.SetSpatialReference(sr);
});
}
else
ignoreToolDeactivation = false;
await base.OnToolActivateAsync(active);
}
protected override Task OnToolDeactivateAsync(bool hasMapViewChanged)
{
if (ignoreToolDeactivation)
{
// dont let the tool deactivate
FrameworkApplication.SetCurrentToolAsync(this.ID);
}
return Task.CompletedTask;
} Thanks Narelle
... View more
07-17-2022
09:08 PM
|
1
|
1
|
797
|
POST
|
Hello, I don't believe we have anything in the public API that will currently support what you are trying to accomplish with regards to highlighted rows. We do have an issue in the backlog to add additional API functionality to the attributes pane so I will add this requirement to that list. We are hoping to address this issue for the next release. Thanks Narelle
... View more
07-13-2022
10:24 PM
|
0
|
1
|
419
|
POST
|
Hi Karen, I have taken a look at this, and can duplicate the behavior that you're seeing. Namely that modifying some map properties - either via some of the API calls or by modifying the CIMMap properties directly - can cause the sketch to be cancelled. In your scenario because you haven't yet started a sketch this will cause the tool to become deactivated. Unfortunately, I don't have a workaround at this time. But can I ask you to explain your workflow as to why you are changing the map's spatial reference in the tool activation. If I understand your workflow, perhaps I can make a suggestion which will avoid the problem. thanks Narelle
... View more
07-13-2022
10:21 PM
|
0
|
3
|
814
|
Title | Kudos | Posted |
---|---|---|
1 | 08-08-2024 09:44 PM | |
1 | 07-18-2024 04:46 PM | |
1 | 06-04-2024 07:18 PM | |
4 | 05-27-2024 09:22 PM | |
1 | 02-12-2019 08:59 AM |
Online Status |
Offline
|
Date Last Visited |
7 hours ago
|