|
POST
|
I am wondering if it is possible to add an Overlay to a geometry, but either keep that underlying Geometry's label, or add a label to the overlay. Since I am adding an overlay based on a unique attribute of a layer, I need to show the ID of that underlying layer. I use this code to add an overlay, but I really need to either retain the underlying label, or better yet, add a label overlay too. Any Ideas? Geometry MergedMATGeometries = FeatureServiceManagement.MergeSearchedGeometry("LayerName", "AttributeName", "AttributeValue");
CIMStroke solid = SymbolFactory.Instance.ConstructStroke(CIMColor.CreateRGBColor(255, 0, 0, 50.0), 1.0, SimpleLineStyle.Solid);
CIMColor RandomColor = GetRandomColor();
IDisposable disp = mapView.AddOverlay(MergedMATGeometries,
SymbolFactory.Instance.ConstructPolygonSymbol(RandomColor, SimpleFillStyle.Solid,
solid).MakeSymbolReference());
//I need to add a label to the above AddOverlay,
... View more
06-13-2018
01:52 PM
|
0
|
1
|
730
|
|
POST
|
I am now able to determine when a user does use the Rotate/Scale/Move tools, but I need to prevent or rollback the user changes from these tools. These would be devastating to my feature service and my values that hook into other systems.
... View more
05-21-2018
01:38 PM
|
0
|
0
|
837
|
|
POST
|
In order to get that the shape changed from either vertices/delete/reshape you can use the arg on Module to get the difference in the shape. In order to do this in the OnRowChange Event you need to get both the OriginalGeometry and the NewGeometry first. You can compare them using .equals to get that change. In order to detect a move/rotate/scale, you will need to use the above methods to find out if IsSketchModified, IsMove, IsRotate, or IsScale is true. If these conditions are false, then you can assume that the change came from the OOB Attribute Editor.
... View more
05-21-2018
01:36 PM
|
0
|
0
|
1072
|
|
POST
|
I need to prevent my users from Reshaping my polygons if that polygon has been approved/verified by the field managers. So I need to catch and rollback(canceledit()) those shape changes in the RowChangeEvent of the Module. This works for catching vertices changes and the following is able to rollback that change if (pmi.HasShapeChanged && !canChange) //Locked Area Rollback
{
// CANCEL the Change to the currently selected
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Changes Not Allowed to Area Verified Field!", "Area Verified", MessageBoxButton.OK, MessageBoxImage.Exclamation);
//CANCEL the Change works for edit vertices
args.CancelEdit(() => Task.FromResult(false));
} The problem now, is that I discovered that when the Rotate/Scale/Move modify tools are used, args.CancelEdit doesn't roll back/cancel the change like it does for the edit vertices. I am using a feature service and need to continue to roll back any shape changes on my verified geometries. Is this a bug in that the arg when created with the Rotate/Scale/Move doesn't have the original geometry to rollback to like it does for edit vertices?
... View more
05-18-2018
08:11 AM
|
0
|
2
|
907
|
|
POST
|
that is the type of thing I want. But i also want Move/Rotate/Scale values. I cant seem to get the binding flags right, it keeps turning up null? var activeTool = FrameworkApplication.ActiveTool;
var currentTool = FrameworkApplication.CurrentTool;
var isMoveProp = activeTool.GetType().BaseType.GetProperty("IsMove", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetProperty);
... View more
05-18-2018
07:26 AM
|
0
|
1
|
1072
|
|
POST
|
Is there a way to see this data in code for the FrameworkApplication.ActiveTool? I think if I can cast the ActiveTool to ModifyFeatureTool, I could get what I want from the IsSketchModified field. But I can't find a way to get this. I have been debugging, and I am finding that the IsSketchModified is true for any shape changes, and false for attribute only. This would do it for me, but can't find a way to get from ActiveTool to ModifyFeatureTool.
... View more
05-17-2018
12:39 PM
|
0
|
3
|
1072
|
|
POST
|
I am unable to determine a geometry if a geometry is updated when that Change comes from the Modify tools of Scale/Move/Rotate. What is happening is that in my module I subscribe to the RowChangedEvent. In this event, i catch when a user modifies vertices or clips an item, that way i can update that object accordingly. i do this by getting the original pre change geometry like this. This is currently working //GET THE PRE EDIT SHAPE
Inspector inspr = await GetInspectorForRow(args, false);
//This is the Value before the vertices change
pmi.OriginalGeometry = inspr.Shape; Then I get the actual change in shape which I get from the arg using the following //GET THE POST EDIT SHAPE
int shapeIndex = args.Row.GetTable().GetDefinition().FindField("Shape");
Geometry geomNew = args.Row[shapeIndex] as Geometry;
if (geomNew != null)
{
pmi.NewShape = geomNew.Clone();
} I then use the above before and after geometries to determine if the shape had changed, if so make some calculations and do work, if not, then rollback or do something else. But in comparing these two geometries, it works when it comes from edit vertices or clipping, etc. //CHECK IF THERE WAS A SHAPE CHANGE
bool shapeChanged = !pmi.OriginalGeometry.IsEqual(pmi.NewShape); But when using Scale/Move/Rotate it sees them as the same geometry always. All of my attempts to use the following have also proven to not work. //THESE DON'T YIELD THE EXPECTED RESULTS
Args.HasValueChanged //Always True
Inspector.GeometryAttribute.OriginalValue
Inspector.GeometryAttribute.CurrentValue
bool shapeChangedCorrect = !OriginalGeometry.IsEqual(NewGeometry); //Always Equal
Any Suggestions on what I need to do to compare the original and new value when using the modify tools? I need this as a change to an area might need to be filled in by another type of area. The original value allowed a user to roll back. But now that the above doesn't work for the modified tools, the following cancel option doesn't work for these tools either. //ROLL BACK FAILS WHEN USING ROTATE/SCALE/MOVE
//Roll Back or undo changes from the edit
args.CancelEdit(() => Task.FromResult(false));
... View more
05-17-2018
11:25 AM
|
0
|
0
|
670
|
|
POST
|
Is there a way for my onRowChangeEvent(RowChangedEventArgs args) to determine if a change came from the ArcGIS Pro attribute editor specifically? I want to allow users to change the shape, scale, and location of objects, but not alter the attributes using the out of the box editor. I have come up with a number of work arounds, but wondering if I am missing something that says the change came from map/attribute editor/etc...
... View more
05-17-2018
06:18 AM
|
0
|
6
|
1157
|
|
POST
|
Is this the release that is not scheduled until August? In the meantime, could a solution be to use the offset line geometry engine tool and create a line left/right/both, then somehow create a polygon by filling in the distance between the two lines
... View more
05-09-2018
07:47 AM
|
0
|
1
|
711
|
|
POST
|
I am wondering if there is an equivalent to IBufferConstruction in the PRO SDK. It is necessary that for a given line for one of my tools, that the user be allowed to buffer left/right/full and to have round/flat endpoints. I am essentially getting drawing line from user and then prompting them with how they want it buffered? Does this exist in PRO like in ArcObjects Below? //Setup the Buffer Constructor and its Properties
IBufferConstruction BufferConstructor = new BufferConstruction();
try
{
//Buffer Properties
IBufferConstructionProperties bcProps = BufferConstructor as IBufferConstructionProperties2;
bcProps.EndOption = esriBufferConstructionEndEnum.esriBufferRound;
bcProps.SideOption = esriBufferConstructionSideEnum.esriBufferFull;
if (string.Equals(endType, "Square", StringComparison.OrdinalIgnoreCase))
{
bcProps.EndOption = esriBufferConstructionEndEnum.esriBufferFlat;
}
if (string.Equals(sideType, "1-Sided", StringComparison.OrdinalIgnoreCase))
{
bcProps.SideOption = esriBufferConstructionSideEnum.esriBufferRight;
if (string.Equals(directionType, "Left", StringComparison.OrdinalIgnoreCase))
{
bcProps.SideOption = esriBufferConstructionSideEnum.esriBufferLeft;
}
}
//Type factoryType = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment");
//System.Object obj = Activator.CreateInstance(factoryType);
//ISpatialReferenceFactory3 spatialReferenceFactory = obj as ISpatialReferenceFactory3;
//IUnit meterUnit = spatialReferenceFactory.CreateUnit((int)esriSRUnitType.esriSRUnit_Meter);
//bcProps.Unit = meterUnit;
}
... View more
05-07-2018
01:20 PM
|
0
|
3
|
775
|
|
POST
|
I think I just simply turn on the Tracing like below, it appears to be much more simple in Pro. If this is the best way to handle this, or if a better way exists to use ICommand, then please let me know. protected async override Task OnToolActivateAsync(bool hasMapViewChanged)
{
if (_lineSymbol == null)
{
_lineSymbol = await CreateLineSymbolAsync();
}
SketchSymbol = _lineSymbol.MakeSymbolReference();
//General Snapping
Snapping.IsEnabled = true;
Snapping.SetSnapMode(SnapMode.Edge, true);
Snapping.SetSnapMode(SnapMode.End, true);
Snapping.SetSnapMode(SnapMode.Intersection, true);
//Set the command to Rotate
ICommand _trace = FrameworkApplication.GetPlugInWrapper("esri_editing_TraceConstructor") as ICommand;
_trace.Execute(null);
}
... View more
05-07-2018
11:46 AM
|
0
|
1
|
862
|
|
POST
|
I would like my drawing tool to default to Snapping to Vertices and to Enable Tracing mode on Activate. I have easily figure out how to enable Snapping, but i am not able to enable Tracing mode. In arcobjects I was able to do this with the TraceConstructor/ShapeConstructor. How can i do this in the new version so that the tool defaults to the trace mode. Here is what I want to do so far. I create a polylie that snaps, but i also want it to trace using the standard trace option. protected async override Task OnToolActivateAsync(bool hasMapViewChanged)
{
if (_lineSymbol == null)
{
_lineSymbol = await CreateLineSymbolAsync();
}
SketchSymbol = _lineSymbol.MakeSymbolReference();
//General Snapping
Snapping.IsEnabled = true;
Snapping.SetSnapMode(SnapMode.Edge, true);
Snapping.SetSnapMode(SnapMode.End, true);
Snapping.SetSnapMode(SnapMode.Intersection, true);
//TURN ON TRACING TOOL
//TURN ON TRACING TOOL
}
... View more
05-07-2018
11:37 AM
|
0
|
2
|
976
|
|
POST
|
I am trying to do this at the end of my OnSketchCompleteAsync at the end but it seems to make my Map unusable and doesn't change the tool. Do I need to deactivate my tool and trigger the other tool or something? ArcGIS.Desktop.Framework.FrameworkApplication.SetCurrentToolAsync("esri_editing_EditVerticesRotate"); I first create a Polyline from a point where a user clicks, then i want the user to rotate that line as they desire. protected async override Task<bool> OnSketchCompleteAsync(Geometry geometry)
{
await QueuedTask.Run(async () =>
{
//Get the Geometry of the map and project to Local for better distance
Geometry thisGeometry = geometry;
thisGeometry = GeometryEngine.Instance.Project(geometry, MapView.Active.Map.SpatialReference);
double extendLength = 125;
Coordinate2D ClickPoint = new Coordinate2D(geometry as MapPoint);
//Get the Row Direction Line to Display
MapPointBuilder TopPoint = new MapPointBuilder();
MapPointBuilder MidPoint = new MapPointBuilder();
MapPointBuilder BottomPoint = new MapPointBuilder();
MapPointBuilder RowDirectionPoint = new MapPointBuilder();
//Get Top Point
TopPoint.X = ClickPoint.X;
TopPoint.Y = ClickPoint.Y;
//Get Bottom Point
BottomPoint.X = ClickPoint.X;
BottomPoint.Y = ClickPoint.Y - (extendLength * 2);
//Get Mid Point
MidPoint.X = ClickPoint.X;
MidPoint.Y = ClickPoint.Y - extendLength;
//Get Row Direction Point
RowDirectionPoint.X = MidPoint.X + (extendLength / 2);
RowDirectionPoint.Y = MidPoint.Y;
//Creating the Line though the vertex for the direction
IList<MapPoint> segmentDirection = new List<MapPoint>
{
MapPointBuilder.CreateMapPoint(TopPoint.X, TopPoint.Y, thisGeometry.SpatialReference),
MapPointBuilder.CreateMapPoint(BottomPoint.X, BottomPoint.Y, thisGeometry.SpatialReference),
MapPointBuilder.CreateMapPoint(MidPoint.X, MidPoint.Y, thisGeometry.SpatialReference),
MapPointBuilder.CreateMapPoint(RowDirectionPoint.X, RowDirectionPoint.Y, thisGeometry.SpatialReference)
};
Polyline directionThroughVertex = PolylineBuilder.CreatePolyline(segmentDirection, thisGeometry.SpatialReference);
//Create and Row Direction Feature from the new line
string intersectingFeatureName = "Row Direction Line";
FeatureLayer RowDirectionFeatureLayer =
FeatureServiceManagement.GetFeatureLayer(intersectingFeatureName);
EditOperation RowDirectionCreateOperation = new EditOperation()
{
Name = string.Format("Create point in '{0}'", intersectingFeatureName),
ProgressMessage = "Working...",
CancelMessage = "Operation canceled.",
ErrorMessage = "Error creating point",
SelectModifiedFeatures = true,
SelectNewFeatures = true,
ShowProgressor = true
};
//Create the Feature and get its OID, then we can load it with defaults for the Tool
long newFeatureOID = -1;
RowDirectionCreateOperation.Create(RowDirectionFeatureLayer,
directionThroughVertex, oid => newFeatureOID = oid);
bool result = await RowDirectionCreateOperation.ExecuteAsync();
});
//I WANT TO GET THE ROTATE TOOL TO WORK HERE (It deadlocks now or something)
ArcGIS.Desktop.Framework.FrameworkApplication.SetCurrentToolAsync("esri_editing_EditVerticesRotate");
return true;
}
... View more
05-01-2018
01:04 PM
|
0
|
1
|
670
|
|
POST
|
I have a tool that runs and creates a feature where the user clicks. It creates a polygon of a certain shape that the user must move and rotate. How do i initiate either the Move or Rotate modify feature function from code. i can't seem to get the setcurrenttoolasync to do this?
... View more
04-30-2018
11:49 AM
|
0
|
2
|
763
|
|
POST
|
My Code doesn't seem to wait for the sketch from the user? I call the SetCurrentToolAsync function and i can see that it initiates the tool. But It just blows right by this line of code after i call it. I think I am missing something to get the drawing. My code cannot proceed until I get the drawing from the user. await FrameworkApplication.SetCurrentToolAsync("XYX_RowTool");
... View more
04-20-2018
01:08 PM
|
0
|
0
|
1160
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-23-2018 06:49 AM | |
| 1 | 08-02-2023 08:28 AM | |
| 1 | 01-03-2020 10:54 AM | |
| 1 | 11-30-2017 06:41 AM | |
| 1 | 08-20-2018 01:10 PM |
| Online Status |
Offline
|
| Date Last Visited |
10-22-2025
04:33 AM
|