|
POST
|
Hi Chris, Just to confirm, does this line of code not return 3 Group layers when you nest them in the structure you mention (Group A > Group B > Group C) MapView.Active.Map.GetLayersAsFlattenedList().OfType<GroupLayer>() A test add-in with this logic worked for me, so wanted to confirm with you. Thanks Uma
... View more
10-08-2018
04:05 PM
|
0
|
1
|
2705
|
|
POST
|
Hi Brad I was able to see the same issue. I have passed this on to the development team to take a look at this issue. Thanks for reporting this one Thanks Uma
... View more
10-04-2018
09:32 AM
|
1
|
3
|
1307
|
|
POST
|
Hi Roman You can get the button's ID directly like this: internal class Button1 : Button
{
protected override void OnClick()
{
var buttonID = this.ID;
}
} Thanks Uma
... View more
10-04-2018
08:27 AM
|
1
|
1
|
1275
|
|
POST
|
Hi Joshua Here is a code snippet you can use to zoom the map frame in layout view to a specific layer: LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals("MyLayout"));
QueuedTask.Run( () => {
//Get the layout from the layout project item
Layout layout = layoutItem.GetLayout();
//Get the map frame in the layout
MapFrame mapFrame = layout.FindElement("New Map Frame") as MapFrame;
//Get map
var mapFrameMap = mapFrame.Map;
//Get the specific layer you want from the map
var lyrOfInterest = mapFrameMap.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
//Get the Layer's extent
var lyrExtent = lyrOfInterest.QueryExtent();
//Zoom to this extent in the MapFrame
//Note: This method will be deprecated at 2.3.
//But you can use mapFrame.SetCamera(lyrOfInterest) instead. (This will be a new overload available in 2.3)
mapFrame.ZoomTo(lyrExtent);
}); Thanks Uma
... View more
09-21-2018
02:17 PM
|
0
|
6
|
3980
|
|
POST
|
Hi Richard You are correct, there is no enum for the 3D Styles currently. Thanks Uma
... View more
09-18-2018
04:58 PM
|
0
|
0
|
1321
|
|
POST
|
Hi Rich Prior to the 2.0 release there were problems with using AddOverlay method in a Scene. With 2.2 release, you should be able to use the AddOverlay method in a Scene. We will update the documentation with the 2.3 release. To create and work with 3D Markers, you can use the following snippets: 1. If you have a 3D model file, you can create a Marker from it using the ConstructMarkerFromFile method. You can then assign the marker to a point symbol. Here is a snippet for this: How to construct a point symbol from a file on disk 2. If you just want to use one of the 3D Symbols available with Pro, this snippet might be useful: How to apply a point symbol from a style to a feature layer Thanks Uma
... View more
09-18-2018
02:25 PM
|
0
|
2
|
1321
|
|
POST
|
Hi Mark, This issue has been fixed in Pro 2.3 that will be released in the early part of 2019. Thanks! Uma
... View more
09-13-2018
09:22 AM
|
0
|
0
|
853
|
|
POST
|
Hi Dominic The marker used to create the point symbol is stored inside the point symbol as a symbol layer. You could get it like this: var pointSymbol = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.GreenRGB, 10.0, SimpleMarkerStyle.Diamond);
var marker = pointSymbol.SymbolLayers[0] as CIMVectorMarker; Thanks Uma
... View more
08-31-2018
12:54 PM
|
0
|
0
|
1095
|
|
POST
|
Hi Dominic Check out the ConstructMarker method - It has a few overloads that might be what you are looking for. This one gives you a marker directly by passing in SimpleMarkerStyle: public CIMMarker ConstructMarker(
CIMColor color,
double size,
SimpleMarkerStyle markerStyle
) Thanks Uma
... View more
08-30-2018
08:50 AM
|
0
|
2
|
1095
|
|
POST
|
Hi Fayu, Here is a code snippet add a feature class from a file gdb. I got this from a previous answer posted by Wolf. // Add this in your OnClick code-behind for the button
if (MapView.Active?.Map == null) return;
ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
{
// using the community sample dataset
using (Geodatabase geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(@"C:\Data\FeatureTest\FeatureTest.gdb"))))
{
using (FeatureClass addFeatureClass = geodatabase.OpenDataset<FeatureClass>("TestLines"))
{
LayerFactory.Instance.CreateFeatureLayer(addFeatureClass, MapView.Active.Map, 0, "New FC");
}
}
}); Thanks Uma
... View more
08-24-2018
08:56 AM
|
0
|
1
|
3710
|
|
POST
|
Hi Sreehari The only filters you can use are the predefined ItemFilers collection available in the Pro API. You can find the available collection here: http://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic8983.html Currently there is no filter that will allow you to save to shapefiles or feature class. Thanks Uma Harano
... View more
08-23-2018
03:18 PM
|
0
|
3
|
1170
|
|
POST
|
Hi Joshua Here is a code snippet that can change the map frame's background. Thanks! Uma protected override void OnClick()
{
QueuedTask.Run(() =>
{
//Get the layout
var layout = Project.Current.GetItems<LayoutProjectItem>()?.First().GetLayout();
if (layout == null) return;
//Get the map frame in the layout
MapFrame mapFrame = layout.FindElement("New Map Frame") as MapFrame;
if (mapFrame == null)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Map frame not found", "WARNING");
return;
}
//Get the map frame's definition in order to modify the background.
var mapFrameDefn = mapFrame.GetDefinition() as CIMMapFrame;
//Construct the polygon symbol to use to create a background
var polySymbol = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.BlueRGB, SimpleFillStyle.Solid);
//Set the background
mapFrameDefn.GraphicFrame.BackgroundSymbol = polySymbol.MakeSymbolReference();
//Set the map frame defintion
mapFrame.SetDefinition(mapFrameDefn);
});
}
... View more
08-16-2018
08:53 AM
|
1
|
4
|
5172
|
|
POST
|
Hi You can get your feature layer like this: //Gets the first layer in the active map
var lyr = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().First();
//Or
//Gets layer with a specific name
var lyr = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(l => l.Name == "U.S. States (Generalized)").First(); ; To give you an idea how you could use these code snippets, given below is the entire workflow. If you have a button, you can do the following in your button's OnClick method: protected override async void OnClick()
{
//Gets your feature layer
var lyr = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().First();
await SimpleRendererPolygon(lyr); //calls the method below to apply the simple renderer
}
internal static Task SimpleRendererPolygon(FeatureLayer featureLayer)
{
return QueuedTask.Run(() =>
{
//Creating a polygon with a red fill and blue outline.
CIMStroke outline = SymbolFactory.Instance.ConstructStroke(
ColorFactory.Instance.BlueRGB, 2.0, SimpleLineStyle.Solid);
CIMPolygonSymbol fillWithOutline = SymbolFactory.Instance.ConstructPolygonSymbol(
ColorFactory.Instance.CreateRGBColor(255, 190, 190), SimpleFillStyle.Solid, outline);
//Get the layer's current renderer
CIMSimpleRenderer renderer = featureLayer.GetRenderer() as CIMSimpleRenderer;
//Update the symbol of the current simple renderer
renderer.Symbol = fillWithOutline.MakeSymbolReference();
//Update the feature layer renderer
featureLayer.SetRenderer(renderer);
});
}
... View more
08-14-2018
10:07 AM
|
1
|
1
|
1354
|
|
POST
|
Hi Joshua Here is the code for a Simple renderer that could help: Simple Renderer for a Polygon feature layer. internal static Task SimpleRendererPolygon(FeatureLayer featureLayer)
{
return QueuedTask.Run(() =>
{
//Creating a polygon with a red fill and blue outline.
CIMStroke outline = SymbolFactory.Instance.ConstructStroke(
ColorFactory.Instance.BlueRGB, 2.0, SimpleLineStyle.Solid);
CIMPolygonSymbol fillWithOutline = SymbolFactory.Instance.ConstructPolygonSymbol(
ColorFactory.Instance.CreateRGBColor(255, 190, 190), SimpleFillStyle.Solid, outline);
//Get the layer's current renderer
CIMSimpleRenderer renderer = featureLayer.GetRenderer() as CIMSimpleRenderer;
//Update the symbol of the current simple renderer
renderer.Symbol = fillWithOutline.MakeSymbolReference();
//Update the feature layer renderer
featureLayer.SetRenderer(renderer);
});
} Using this code snippet above, here is how the polygon feature will get renderered -
... View more
08-13-2018
01:05 PM
|
0
|
4
|
1354
|
| Title | Kudos | Posted |
|---|---|---|
| 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 | |
| 1 | 04-28-2025 03:06 PM |
| Online Status |
Offline
|
| Date Last Visited |
2 weeks ago
|