|
POST
|
Hi Lesley When you change the underlying datasource for a raster (or any feature layer for that matter), you will have also change the Colorizer (Change the renderer for a feature layer). This will update the Legend in the TOC. So it is a 2 step process: 1. Change the datasource using the ReplaceDataSource method. 2. Then apply the colorizer suitable for the new data. This is the code snippet I used: var rasterLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<RasterLayer>().FirstOrDefault();
QueuedTask.Run(async () => {
using (Geodatabase geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(@"\\Path-to-Data\raster.gdb"))))
{
using (Dataset dataset = geodatabase.OpenDataset<RasterDataset>("elevation"))
{
rasterLayer.ReplaceDataSource(dataset);
// Check if the Stretch colorizer can be applied to the raster layer.
if (rasterLayer.GetApplicableColorizers().Contains(RasterColorizerType.StretchColorizer))
{
// Create a new Stretch Colorizer Definition using the default constructor.
StretchColorizerDefinition stretchColorizerDef_default = new StretchColorizerDefinition();
// Create a new Stretch colorizer using the colorizer definition created above.
CIMRasterStretchColorizer newStretchColorizer_default =
await rasterLayer.CreateColorizerAsync(stretchColorizerDef_default) as CIMRasterStretchColorizer;
// Set the new colorizer on the raster layer.
rasterLayer.SetColorizer(newStretchColorizer_default);
}
}
}
});
... View more
03-16-2020
04:25 PM
|
1
|
1
|
754
|
|
POST
|
Hi Adam, This is a bug in the 2.5 version of Pro. This has been fixed in 2.6. Also, this has been identified as a fix to be included in the Pro 2.5 patch. Thank you for reporting this! Uma
... View more
03-13-2020
02:57 PM
|
0
|
1
|
728
|
|
POST
|
Hi, By default, any new UI elements you add get on to the "Add-in" tab. This is controlled by the "appearsOnAddintab" attribute in your DAML. The add-in template does this to provide you with a quick and convenient way to get your controls on to Pro's ribbon. So if you want to create a new tab to host your controls, do the following: 1. In your add-in's config.daml, set the apprearsOnAddIntab attribute to false in the group element that hosts your buttons. <group id="LayerDocConstructor_Group1" caption="Group 1" appearsOnAddInTab="false"> 2. Make a new Tab and host your group in that tab. <tabs>
<tab id="LayerDocConstructor_Tab1" caption="New Tab">
<group refID="LayerDocConstructor_Group1"/>
</tab>
</tabs> Thanks Uma
... View more
03-13-2020
01:31 PM
|
2
|
1
|
1469
|
|
POST
|
I can confirm that this has been fixed in version 2.6. Pro 2.6 will be released later this summer. You will be able to do something like this to get the correct label on the TOC that reflects the Number Format you use. CIMClassBreaksRenderer renderer = (CIMClassBreaksRenderer)featureLayer.CreateRenderer(gcDef);
renderer.NumberFormat = new CIMNumericFormat {
RoundingValue = 9,
RoundingOption = esriRoundingOptionEnum.esriRoundNumberOfDecimals,
ZeroPad = false
};
foreach (var br in renderer.Breaks) {
var specialChar = br.Label.Substring(0, 1);
var value = NumberFormat.ValueToString(numberFormat, br.UpperBound);
br.Label = $"{specialChar}{value}";
}
... View more
03-09-2020
01:37 PM
|
0
|
1
|
931
|
|
POST
|
Hi, I would suggest that you should use ActivePaneChangedEvent instead. The type of pane returned when the Active Pane changes will tell you if it is a Map Pane or a Table. It will be MapPaneViewModel for an Active Map or TablePaneViewModel for a Table. Code snippet: //Subscribe to event
ArcGIS.Desktop.Framework.Events.ActivePaneChangedEvent.Subscribe(OnActivePaneChanged);
private void OnActivePaneChanged(PaneEventArgs obj)
{
if (obj.IncomingPane != null)
{
System.Diagnostics.Debug.WriteLine($"Debug Message. GetTypeName: {obj.IncomingPane.GetType().Name}");
}
} A little background on the behavior you are seeing with ActiveMapViewChanged event - When you display the attribute table of a feature layer in the Active map, the IncomingView is first null (which is correct). The attribute table pane then becomes the active pane. But when the attribute table pane is active, the TOC that lists the layers needs to know the “context” of which map it needs to use. So the Attribute table pane that is currently active, “impersonates” the Map Pane. Hence the event gets triggered again and the Incoming View is now the “Map” associated with the attribute table. Thanks Uma
... View more
03-09-2020
01:19 PM
|
2
|
1
|
1921
|
|
POST
|
Hi We are investigating the level of effort involved and currently anticipate moving Pro over to the new .NET 6.0 after .NET 6 has been released. This will be a breaking change and require a Pro 3.0. Thanks Uma
... View more
03-06-2020
02:50 PM
|
1
|
5
|
2186
|
|
POST
|
Hi Most operations via the API are by design un-doable. Same as via the UI. Thanks Uma
... View more
03-06-2020
02:47 PM
|
0
|
0
|
1139
|
|
POST
|
Hi Brian This menu is not accessible via DAML. Thanks! Uma
... View more
03-06-2020
02:45 PM
|
2
|
0
|
562
|
|
POST
|
Hi Brian The Lyrx file you attached has a CIMSimpleRenderer. Just to confirm - when you get the renderer from your LayerDefinition, are you casting it to CIMSimpleRenderer? The code snippet above was using UniqueValueRenderer. Thanks Uma
... View more
03-03-2020
01:26 PM
|
0
|
0
|
2055
|
|
POST
|
Hi, Cast the definition retrieved into CIMFeatureLayer. Like this: var lyrDef = shp_layer.GetDefinition() as CIMFeatureLayer;
... View more
03-03-2020
09:44 AM
|
0
|
1
|
7197
|
|
POST
|
Hi Alan, Is your Add-in set to autoload? (Config.daml "Autoload" attribute set to true) Otherwise the add-in will only load when needed. Declaring Modules in DAML Modules are declared within the root ArcGIS element but must be further enclosed within a module's container element. The autoLoad attribute is used to control whether the module is loaded just-in-time (JIT)—the default—or automatically when the application starts. In almost all cases, autoLoad should be set to false. <modules> <insertModule id="acme_mainModule" caption="Acme" className="MainModule" autoLoad="false"> <!--Declare additional customizations here..--> </insertModule> </modules> If declaring a new module, all constituent plug-in declarations contained within the insertModule element are implicitly inserts, so the insert prefix on element names can be omitted (for example, insertButton becomes simply button).
... View more
02-28-2020
08:41 AM
|
0
|
3
|
2489
|
|
POST
|
Hi, The best way to get the bounding envelope of the graphic element is to: * Construct a polygon using the X, Y, Width and Height of the element. * Rotate the polygon with the element's rotation angle. * Use the "Extent" property on the polygon to get the "envelope" extent. Here is some code that does this - QueuedTask.Run( () => {
var layout = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault().GetLayout();
var element = layout.Elements.OfType<GraphicElement>().FirstOrDefault();
if (element == null) return;
//Get the element's X, Y, Width and height
var x = element.GetX();
var y = element.GetY();
var width = element.GetWidth();
var height = element.GetHeight();
//Create a polygon using the Graphic elements X, Y, Width and Height.
MapPoint pt1 = MapPointBuilder.CreateMapPoint(x, y); //Anchor pt - lower left
MapPoint pt2 = MapPointBuilder.CreateMapPoint(x + width, y); //lower right
MapPoint pt3 = MapPointBuilder.CreateMapPoint(x + width, y + height );//upper right
MapPoint pt4 = MapPointBuilder.CreateMapPoint(x, y + height);//upper left
List<MapPoint> list = new List<MapPoint>() { pt1, pt2, pt3, pt4 };
Polygon polygon = PolygonBuilder.CreatePolygon(list, null);
//Rotate the polygon by the same angle the graphic element is rotated by
var polygonRotate = GeometryEngine.Instance.Rotate(polygon, pt1, element.GetRotation() * (Math.PI / 180)) as Polygon; //Angle should be in radians.
//Use polygonRotate to get the bounds of the rotated text element
System.Diagnostics.Debug.WriteLine($"Width: {polygonRotate.Extent.Width}, Height: {polygonRotate.Extent.Height}");
//Create another graphic element that envelops the original element
Envelope env = polygonRotate.Extent;
CIMStroke lineStroke = SymbolFactory.Instance.ConstructStroke(ColorFactory.Instance.BlackRGB, 1, SimpleLineStyle.DashDotDot);
LayoutElementFactory.Instance.CreatePolygonGraphicElement(layout, env, SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.RedRGB, SimpleFillStyle.Null, lineStroke));
});
... View more
02-25-2020
05:45 AM
|
2
|
0
|
3165
|
|
POST
|
Hi, I see this issue too. I have contacted the development team to see what has changed at 2.4. Thanks Uma
... View more
02-21-2020
02:24 PM
|
0
|
1
|
686
|
|
POST
|
Hi Gintautas, You can install .NET Framework 4.8 for Visual Studio 2017 by downloading the framework from Microsoft directly. Here is the link I use to install .NET 4.8 when I need to use Visual Studio 2017. Download .NET Framework 4.8 Developer Pack Offline Installer Andrew Quee That was definitely a bad adventure. Just a few thoughts: * I will update the install instructions to give the option of directly installing the Pro SDK by simply double clicking the VSIX files downloaded from the SDK repo. This will be a good option to use so that you can circumvent the Visual Studio marketplace. Good idea! * One of the reasons we list that it is not a good idea to automatically "update" the Pro SDK is because you could get into a situation where you have Pro 2.4 and you get Pro SDK 2.5 automatically updated when you were not ready. But to clarify, the Pro SDK VSIX files do support the auto update mechanism offered by Visual studio. You just have to be careful that you don't get into a situation where you have an older Pro version with a newer SDK. If this happens, you will encounter errors when you attempt to create an ArcGIS Pro add-in using the SDK. Thanks! Uma
... View more
02-21-2020
10:39 AM
|
0
|
2
|
1816
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | Wednesday | |
| 1 | 09-18-2025 03:09 PM | |
| 1 | 11-04-2025 08:25 AM | |
| 1 | 09-23-2025 09:31 AM | |
| 1 | 11-20-2024 10:50 AM |
| Online Status |
Offline
|
| Date Last Visited |
yesterday
|