ThinkGeo.com    |     Documentation    |     Premium Support

Get Coordinates from Dragged Point

Hello,


I want to modify coordinate of one street. And I want to use Dragged Point Style.


First, I add new InternalFeature to EditShapeLayer.


Dim ModifyFeature as Feature =OriginalLayer.QueryTools.GetFeatureByID(FeatureID, AllColumns)


....


 dragInteractiveOverlay.EditShapesLayer.InternalFeatures.Add("MultiLine", ModifyFeature )


After I drag some point...it may have some difference from original lineshape


Now, how can I get modified coordinates ?


Please give me some idea, Thanks.


 


 



  Actually, we have a project in the Code Community that does almost exactely what you are trying to acomplish. The project is Dragged Point Style with Label. It shows the label with the distance compared to a reference point. You can slightly modify the DrawCore method in the DragInteractiveOverlay class and have the label showing what you want.


code.thinkgeo.com/projects/s...stylelabel


 


You can replace that code in DrawCore and have the label showing the X and Y coordinate of the dragged point:


 


 



 //canvas.DrawTextWithScreenCoordinate(System.Convert.ToString(Dist) + " m", new GeoFont("Arial", 12, DrawingFontStyles.Bold), new GeoSolidBrush(GeoColor.StandardColors.Black),
                        //                                  ScreenPointF.X + 35, ScreenPointF.Y, DrawingLevel.LabelLevel);

                        canvas.DrawTextWithScreenCoordinate(System.Convert.ToString("X: " + pointShape.X + " Y: " + pointShape.Y) + " m", new GeoFont("Arial", 12, DrawingFontStyles.Bold), new GeoSolidBrush(GeoColor.StandardColors.Black),
                                                          ScreenPointF.X + 35, ScreenPointF.Y, DrawingLevel.LabelLevel);


Thanks for your help, Val 
 The sample seems get real-time draggedconrtrolPoint coordinates. 
 it is different from I want. 
 when i dragged each point and click button, i want to get all coordinates of controlPoints. (not just only draggedconrtrolPoint) 
  
 Please give some idea or sample, Thanks.

Carol,


I have reviewed the source code of the sample, I found when the overlay draw label there is a check to make only the dragged point show label, you just comment out the 51th line code of DragInteractiveOverlay and then all point will draw label.


//if (feature.ColumnValues["state"] != "selected")



Thanks


James



Thank you, James. 
 It works great! 


You are welcome. Do not hesitate to check out the Code Community. There are new projects posted almost daily. 
  
 code.thinkgeo.com/ 


Hello, 
 Like this issue, but I use TrackOverlay to draw a line shape. 
 if I click "ok" button, how do I get all coordinates value?  
 Could anyone give me any idea or sample? Thanks.

Hello,  
 I know how to do this. 
 Thanks a lot!

I am glad you  figured out on your own. Also, do not hesitate to share your new findings to the public by showing your code in the post. That is if you don’t mind having some of your code public, of course. :-)