POST
|
Hi, To convert a vertex to a control point, you have to simply change the ID of the vertex from 0 to 1. Control points have a vertex of 1. So you can iterate through the vertices to find the 4th and 7th vertices. In the following code snippet, I am changing two vertices in a selected polyline feature to be Control points. I iterate through the points in the selected line. Each point is converted into a MapPoint and gets added to a list. Points 6 and 7 are added as Control points. Notice the if statement on 20. These points are made "ID.Aware" and the IDs are set to be 1. Check out this page for more info: https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic27355.html I create a new polyline using the point collection. Then I use an edit operation to modify the selected line with the new line I just made. var lineLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
if (lineLayer == null)
return;
var changeVertexIDOperation = new EditOperation();
QueuedTask.Run( () =>
{
var lineLayerCursor = lineLayer.GetSelection().Search();
var lineVertices = new List<MapPoint>();
long oid = -1;
while (lineLayerCursor.MoveNext())
{
var lineFeature = lineLayerCursor.Current as Feature;
var line = lineFeature.GetShape() as Polyline;
int vertexIndex = 1;
oid = lineFeature.GetObjectID();
foreach ( var point in line.Points )
{
MapPointBuilderEx mapPointBuilderEx = new MapPointBuilderEx(point);
//I am changing the vertex 6 and 7 to control points
if (vertexIndex == 6 || vertexIndex == 7)
{
mapPointBuilderEx.HasID = true;
mapPointBuilderEx.ID = 1;
}
lineVertices.Add(mapPointBuilderEx.ToGeometry() as MapPoint);
vertexIndex++;
}
}
var newLine = PolylineBuilderEx.CreatePolyline(lineVertices);
changeVertexIDOperation.Modify(lineLayer, oid, newLine);
changeVertexIDOperation.Execute();
});
... View more
3 weeks ago
|
2
|
1
|
104
|
POST
|
Hi, Here is a code snippet that sets a FeatureLayer to be uneditable. QueuedTask.Run(() =>
{
var cimFeatureLayer = layer.GetDefinition() as CIMFeatureLayer;
var featureTable = cimFeatureLayer.FeatureTable;
featureTable.Editable = false;
cimFeatureLayer.FeatureTable = featureTable;
layer.SetDefinition(cimFeatureLayer);
});
... View more
3 weeks ago
|
1
|
1
|
53
|
POST
|
Hi, Are you looking to add a new class break to a Unique Value renderer? If so, here is a code snippet: var layer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
if (layer == null)
return;
QueuedTask.Run( () => {
var uvr = layer.GetRenderer() as CIMUniqueValueRenderer;
if (uvr == null)
return;
var cimUniqueValueGroup = uvr.Groups[0] as CIMUniqueValueGroup;
var classes = cimUniqueValueGroup.Classes;
var cimUniqueValueClass = new CIMUniqueValueClass();
cimUniqueValueClass.Label = "New Value";
var lineSymbol = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.RedRGB, 2.0, SimpleLineStyle.Solid) ;
lineSymbol.UseRealWorldSymbolSizes = false;
cimUniqueValueClass.Symbol = lineSymbol.MakeSymbolReference();
#region New value to the class
var cimUniqueValues = new List<CIMUniqueValue>();
var cimUniqueValue = new CIMUniqueValue() { FieldValues = new string[] { "New Value" } };
cimUniqueValues.Add(cimUniqueValue);
#endregion
cimUniqueValueClass.Values = cimUniqueValues.ToArray();
cimUniqueValueClass.Visible = true;
var classesList = classes.ToList();
classesList.Add(cimUniqueValueClass);
cimUniqueValueGroup.Classes = classesList.ToArray();
uvr.Groups[0] = cimUniqueValueGroup;
layer.SetRenderer(uvr);
}); Regarding your second question, if you are looking to add a new Symbol layer to an existing symbol, this is the code snippet: var layer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault( s => s.ShapeType == esriGeometryType.esriGeometryPolyline);
QueuedTask.Run( () => {
var simpleRenderer = layer.GetRenderer() as CIMSimpleRenderer;
var lineSymbol = simpleRenderer.Symbol.Symbol as CIMLineSymbol;
if (lineSymbol == null)
return;
var layers = lineSymbol.SymbolLayers;
var solidStroke = SymbolFactory.Instance.ConstructStroke(ColorFactory.Instance.RedRGB, 2.0, SimpleLineStyle.Solid);
var offSetEffect = new CIMGeometricEffectOffset()
{
Method = GeometricEffectOffsetMethod.Rounded,
Offset = 3,
Option = GeometricEffectOffsetOption.Fast
};
solidStroke.Effects = new CIMGeometricEffect[] { offSetEffect };
var layersList = layers.ToList();
layersList.Add(solidStroke);
lineSymbol.SymbolLayers = layersList.ToArray();
simpleRenderer.Symbol = lineSymbol.MakeSymbolReference();
layer.SetRenderer(simpleRenderer);
});
... View more
3 weeks ago
|
1
|
0
|
84
|
POST
|
Hi Tim, This is now fixed in ArcGIS Pro 3.3. Thanks for reporting this one. Uma
... View more
3 weeks ago
|
1
|
0
|
26
|
POST
|
I see this issue also. Thanks for reporting this. I will post an update when this gets addressed. Thanks! Uma
... View more
01-23-2024
09:44 AM
|
0
|
0
|
97
|
POST
|
Hi, If you pick the On the Ground option, the CIM definition of the layer looks like this: <LayerElevation xsi:type="typens:CIMLayerElevationSurface">
<OffsetZ>0</OffsetZ>
<ElevationSurfaceLayerURI>CIMPATH=Map/dc9328b7a8a849d78652499f3fa0ca9e.json</ElevationSurfaceLayerURI>
<IsRelativeToScene>false</IsRelativeToScene>
</LayerElevation> In code, you can set these CIM values like this: var layer = MapView.Active?.Map?.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
var surface = MapView.Active.Map.GetGroundElevationSurfaceLayer();
if (layer == null || surface == null)
return;
await QueuedTask.Run(() =>
{
//Get the layer's CIM Definition
var layerDefn = layer.GetDefinition() as CIMFeatureLayer;
//Set the LayerElevation properties
layerDefn.LayerElevation.ElevationSurfaceLayerURI = surface.URI;
layerDefn.LayerElevation.OffsetZ = 0;
layerDefn.LayerElevation.IsRelativeToScene = false;
//This is important - set the FeatureElevationExpression to an empty string
layerDefn.FeatureElevationExpression = string.Empty;
layer.SetDefinition(layerDefn);
}); If you pick the Relative to the Ground option, there is an additional attribute on the CIM that specifies the attribute to use for feature elevation. <FeatureElevationExpression>Shape.Z</FeatureElevationExpression> In code, you set this CIM value like this - (in addition to setting the LayerElevation mentioned above). layerDefn.FeatureElevationExpression = "Shape.Z";
... View more
11-08-2023
10:15 AM
|
0
|
0
|
179
|
POST
|
Attached is an addin that creates a Polygon construction tool. This tool implements "ToolOptions". In the Options UI, I added a text box for Tolerance. Then on the Tool activate callback, I used the tolerance provided in the options UI and to set the map's snapping environment's XY Tolerance like this: var snapOptions = Snapping.GetOptions(ActiveMapView.Map);
snapOptions.XYTolerance = ToleranceToolOption;
Snapping.SetOptions(ActiveMapView.Map, snapOptions);
... View more
11-02-2023
11:48 AM
|
1
|
0
|
237
|
POST
|
Hi Dave, Is this the info you are looking for? //Set snapping options via get/set options
var snapOptions = Snapping.GetOptions(myMap);
snapOptions.IsSnapToSketchEnabled = true;
snapOptions.XYTolerance = 100;
snapOptions.IsZToleranceEnabled = true;
snapOptions.ZTolerance = 0.6;
Snapping.SetOptions(myMap,snapOptions); https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Editing#snapping
... View more
11-01-2023
11:23 AM
|
0
|
0
|
259
|
POST
|
Hi Dave In majority of the cases, the MapMemberPropertiesChangedEvent is fired per layer. So, MapMembers in the MapMembers list is always the same layer in the majority of the cases. I am investigating to see if there are any edge cases where this is not true. Regarding the event hint in the changing of the layer name via the Properties page or the Contents pane - that does look like an inconsistency. Thanks for reporting this one!
... View more
11-01-2023
11:05 AM
|
1
|
0
|
180
|
POST
|
You can create a Dynamic Text element to write out the Map Frame's scale. var layout = LayoutView.Active.Layout;
if (layout == null)
return;
//Construct the dynamic text string.
//You can create the dynamic text in the UI to get a hint as to how to compose the string in code.
String title = @"Scale: <dyn type=""mapFrame"" name=""Map Frame"" property=""scale"" preStr=""1:""/>";
Coordinate2D llTitle = new Coordinate2D(6, 2.5);
await QueuedTask.Run( () => {
TextElement titleGraphics = ElementFactory.Instance.CreateTextGraphicElement(
layout, TextType.RectangleParagraph, llTitle.ToMapPoint(), null, title) as TextElement;
});
... View more
10-25-2023
01:25 PM
|
0
|
0
|
194
|
POST
|
I see this behavior also. I will post back if I have any updates on this. Just curious about the workflow you are trying to achieve with the custom tool - How will you zoom, pan, identify, select? Will your tool handle all the actions?
... View more
07-19-2023
01:30 PM
|
0
|
1
|
223
|
POST
|
Hi Here is the method: SetFrozenFieldsAsync Method (TableView) Sets the specified fields to be frozen in the table view. Frozen fields are promoted to be the first visible fields in the table view and stay visible as the table view is scrolled horizontally. A divider bar is placed between the frozen fields and the remaining fields in the table. The specified list of fields are added to any existing fields that are already frozen.
... View more
05-24-2023
12:51 PM
|
2
|
0
|
242
|
POST
|
You can use the EditOperation.Merge method to merge features programmatically. If you are looking to re-create the "Merge Construction Tool" available with Pro, you can create your own construction tool using the Pro SDK that is similar to what Pro does like this: * Create a Custom Construction tool with options. Here is a wiki with sample code that walks you through this: https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Construction-Tools-with-Options This ProGuide demonstrates how to create a construction tool with options which allows users to input parameter values to the tool at run-time. So in this UI you can add logic to pick your features to merge, etc.
... View more
05-15-2023
09:23 AM
|
1
|
0
|
224
|
POST
|
Button controls have a Pro Style. Can you try adding this style to you button element? Style="{DynamicResource Esri_Button}"
... View more
04-28-2023
07:25 AM
|
0
|
1
|
355
|
Title | Kudos | Posted |
---|---|---|
2 | 3 weeks ago | |
1 | 3 weeks ago | |
1 | 3 weeks ago | |
1 | 3 weeks ago | |
1 | 08-13-2020 09:37 AM |
Online Status |
Offline
|
Date Last Visited |
2 weeks ago
|