1

I am using Visual Studio 2012, C#, .Net Framework 3.5, ArcMap 10.2.1, ArcFM 10.2.1b.

I am working on the requirement as follows: when user is in editing state in arcmap 'This Custom Tool' should be enabled. When user clicks the 'This Custom Tool' it will show a 'Custom Form' having Tab control with 2 tab pages. each tab pages will have Tree View and Previous|Next or Finish button to move UI forward/backward. The tab page1 is called Selected Features by default form loads with tab page 1 set to visible and focused. Then user will be able to draw a box on current focus map and retrieve all the point features which are from the editable feature layers and puts them on TreeView as Feature Layer->Feature Display Name (ArcFM ID8 List Item Display Name) on first tab page tree view. On First tab page TreeView user will be able to check or uncheck the individual features or feature layers to move them to next tab page tree view this is just a filter process to avoid showing unwanted features in second tab page tree view. When user clicks the Next button on tab page 1 it clones all the checked nodes and add it to second tab page tree view so that user can start editing the geometry for checked features. Depending on current focus tab page (1 or 2) 'This Custom Tool' will either allow user to draw a box to select features from map or on click it will move the selected feature from the 2nd tabl page tree view.

I am able to set the new geometry and move the selected feature to new location without any issue but user wants to see the rubberband effect while moving the mouse on the map if feature is participating in geometric network, similar to what ArcMap edit tool does when moving the feature participating in geometric network it shows all the connected features movement on mouse move.

Can anyone point me out what is that rubberband effect called and how do i implement it in 'This custom tool'.

I did googled it with several different relevant phrases but nothing popped out which will help me look into the API to implement this effect in custom tool.

1
  • I think I would call it shared geometry editing or maybe custom object editing.
    – PolyGeo
    Commented Feb 23, 2017 at 21:31

2 Answers 2

1

Below is the code snippet which resolved the issue.

//private variable declared in ITool class
private IDisplayFeedback feedback = null;
.
.
.
public override void OnMouseDown(int Button, int Shift, int X, int Y)
{
    IScreenDisplay currentScreenDisplay=...;//Get current ScreenDisplay from current ActiveView
    IFeature currentEditiableFeature=...;//Get current feature user chose to edit on the UI
    .
    .
    .
    if (currentEditiableFeature is IFeatureEdit2)
    {
        IFeatureEdit2 FE = currentEditiableFeature as IFeatureEdit2;
        if (FE != null)
        {
            ISet SET = new SetClass();//add connected features if user wants to move more than one feature at a time
            //in our case we just need to move a feature selected on UI which is single feature all the time
            feedback = FE.BeginMoveSet(SET, currentEditiableFeature.ShapeCopy as IPoint);
            if (feedback != null) feedback.Display = Utility.Utility.ScreenDisplay;
        }
    }
    .
    .
    .
    //Additional code to stop or abort feedback, move feature in start/stop operation and partial refresh the currentActiveView
}

public override void OnMouseMove(int Button, int Shift, int X, int Y)
{
    //Get point on map by using DisplayTransformation
    IPoint currentPt = currentActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
    if (currentPt != null && feedback != null)
    {
        feedback.MoveTo(currentPt);
    }
}
0

So you want to implement the functionality outlined here: Moving existing network features.

You'd probably need to use a couple of feedback classes, see: IDisplayFeedback Interface

1) Add all selected features to a MoveGeometryFeedbackClass instance.
2) Find all polylines that are network connected to any of the selected features, but not in the selection set.
3) Create a new feedback class instance for each polyline from 2). Not sure which would be best feedback class, maybe StretchLineFeedback ?

2
  • Thanks Chris I will give it a try and let you know if it works.
    – Jayant
    Commented Feb 24, 2017 at 16:41
  • I tried to have the way Chris explained but MoveGeometryFeedbackClass doesnt actually work as OOTB edit tool when you move the Network Feature. But the suggestion to look at the IDisplayFeedback was very helpful and finally i was able to achieve it using IFeatureEdit.BeginMoveSet() Refer my answer below for more details.
    – Jayant
    Commented Feb 27, 2017 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.