ThinkGeo.com    |     Documentation    |     Premium Support

TrackShape first vertex is occasionally in wrong location

 


When using any of the TrackShapes, specifically, polygon, point and line, the user is able to click, and move the cursor and the beginning point of the trackshape is in a different location.  I have been able to reproduce this behavior fairly consistantly.  The mouse click is complete and the cursor moves and the point is in a different location.


I'm not really sure how to explain any better on how to reproduce the error.  It just seems the the trackstarted event is lagging behind.  I have included the x,y I am capturing, notice how far off the MouseDown x,y are from the MapMouseDown x,y  This data was captured at a scale of about 9,000,000, which is about full extent for texas.  Where I clicked and where the track started was almost a whole county difference.  The numbers below are generated from console.writeline in each method




winformsMap1_MouseDown mouse args x,y 598 250


winformsMap1_MouseUp mouse args x,y 598 250

TrackOverlay_MapMouseClick screen x,y - world x,y 627 245 - 890551.613968475 1281466.93415997

TrackOverlay_MapMouseDown screen x,y 627 245

TrackOverlay_TrackStarting starting vertex x,y 890551.613968475 1281466.93415997

TrackOverlay_TrackStarted started vertex x,y 890551.613968475 1281466.93415997

TrackOverlay_MapMouseUp screen x,y 627 245


Any ideas?


Thanks,


Ed



Ed,


Thanks for your post. I am wondering which version are your using now? You can get the version information by calling the StaticAPI WinformsMap.GetVersion().
 
Following is my test codes to recreate your problem:

   winformsMap1.MouseDown += new MouseEventHandler(winformsMap1_MouseDown);
            winformsMap1.MouseUp += new MouseEventHandler(winformsMap1_MouseUp);
 
            winformsMap1.TrackOverlay.MapMouseDoubleClick += new EventHandler<MapMouseDoubleClickInteractiveOverlayEventArgs>(TrackOverlay_MapMouseDoubleClick);
            winformsMap1.TrackOverlay.MapMouseDown += new EventHandler<MapMouseDownInteractiveOverlayEventArgs>(TrackOverlay_MapMouseDown);
            winformsMap1.TrackOverlay.MapMouseClick += new EventHandler<MapMouseClickInteractiveOverlayEventArgs>(TrackOverlay_MapMouseClick);
            winformsMap1.TrackOverlay.TrackStarting += new EventHandler<TrackStartingTrackInteractiveOverlayEventArgs>(TrackOverlay_TrackStarting);
            winformsMap1.TrackOverlay.TrackStarted += new EventHandler<TrackStartedTrackInteractiveOverlayEventArgs>(TrackOverlay_TrackStarted);
            winformsMap1.TrackOverlay.MapMouseUp += new EventHandler<MapMouseUpInteractiveOverlayEventArgs>(TrackOverlay_MapMouseUp);
 
            winformsMap1.TrackOverlay.TrackMode = TrackMode.Point;
 
void TrackOverlay_MapMouseClick(object sender, MapMouseClickInteractiveOverlayEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine(string.Format("TrackOverlay_MapMouseClick screen : X:{0} Y:{1}", e.InteractionArguments.ScreenX, e.InteractionArguments.ScreenY));
        }
 
        void TrackOverlay_MapMouseUp(object sender, MapMouseUpInteractiveOverlayEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine(string.Format("TrackOverlay_MapMouseUp screen : X:{0} Y:{1}", e.InteractionArguments.ScreenX, e.InteractionArguments.ScreenY));
        }
 
        void TrackOverlay_TrackStarted(object sender, TrackStartedTrackInteractiveOverlayEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine(string.Format("TrackOverlay_TrackStarted screen : X:{0} Y:{1}", e.StartedVertex.X, e.StartedVertex.Y));
        }
 
        void TrackOverlay_TrackStarting(object sender, TrackStartingTrackInteractiveOverlayEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine(string.Format("TrackOverlay_TrackStarting screen : X:{0} Y:{1}", e.StartingVertex.X, e.StartingVertex.Y));
        }
 
        void TrackOverlay_MapMouseDown(object sender, MapMouseDownInteractiveOverlayEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine(string.Format("TrackOverlay_MapMouseDown screen : X:{0} Y:{1}", e.InteractionArguments.ScreenX, e.InteractionArguments.ScreenY));
        }
 
        void TrackOverlay_MapMouseDoubleClick(object sender, MapMouseDoubleClickInteractiveOverlayEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine(string.Format("TrackOverlay_MapMouseDoubleClick screen : X:{0} Y:{1}", e.InteractionArguments.ScreenX, e.InteractionArguments.ScreenY));
        }
 
        void winformsMap1_MouseUp(object sender, MouseEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine(string.Format("winformsMap1_MouseUp : X:{0} Y:{1}", e.X, e.Y));
        }
 
        void winformsMap1_MouseDown(object sender, MouseEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine(string.Format("winformsMap1_MouseDown : X:{0} Y:{1}",e.X,e.Y));
        }

 
Following is the test result in DecimalDegrees:
winformsMap1_MouseDown : X:186 Y:46
winformsMap1_MouseUp : X:186 Y:46
TrackOverlay_MapMouseClick screen : X:186 Y:46
TrackOverlay_MapMouseDown screen : X:186 Y:46
TrackOverlay_TrackStarting screen : X:-74.507666015625 Y:34.986962890625
TrackOverlay_TrackStarted screen : X:-74.507666015625 Y:34.986962890625
TrackOverlay_MapMouseUp screen : X:186 Y:46
 
Following is the test result in Meter with projection set:
winformsMap1_MouseDown : X:369 Y:139
winformsMap1_MouseUp : X:369 Y:139
TrackOverlay_MapMouseClick screen : X:369 Y:139
TrackOverlay_MapMouseDown screen : X:369 Y:139
TrackOverlay_TrackStarting screen : X:-517482.314780576 Y:1602001.88003128
TrackOverlay_TrackStarted screen : X:-517482.314780576 Y:1602001.88003128
TrackOverlay_MapMouseUp screen : X:369 Y:139
 
Any more questions just feel free to let me know.
 
Thanks.
 
Yale

I am using the release version for winforms.  I agree that if you just click and dont move the mouse it works properly, but if you click then immediately move the mouse there will be a descripency in the screen coordinates as my numbers show.  In may take a few times but he have had instances where you can click and move the mouse like 1/2 second later and the points will register differently.  This behavior has been happening since we started using the product in april, but i didn’t start digging deeper on the issue until clients started complaining. 
  
 Let me know what else I can do to help. 
  
 Ed

 


Ed,
 
Sorry for the inconvenience.
 
I have extended our TrackInteractiveOverlay and make the new track overlay fit your requirement, it will fixed the first point which position is exactly the same as mouse down.
 
And my sample just contains track point, doesn’t contain track polygon and line, because I can not reproduce your issue from them. Can you check it? If polygon and line also has problem, can you tell me how to reproduce the problem? I will give your solution to fix the problem.
 
Thanks
James

1517-TrackFirstPointDemo.zip (12 KB)

James,


I implemented the code and I was still able to get it to fail with TrackMode.Point.  Here are the numbers:




winformsMap1_MouseDown mouse args x,y 704 248

winformsMap1_MouseUp mouse args x,y 704 248

TrackOverlay_MapMouseClick screen x,y - world x,y 727 248 - 979647.031430327 1263165.45204355

TrackOverlay_MapMouseDown screen x,y 727 248

TrackOverlay_TrackStarting starting vertex x,y 979647.031430327 1263165.45204355

TrackOverlay_TrackStarted started vertex x,y 979647.031430327 1263165.45204355

TrackOverlay_MapMouseUp screen x,y 727 248


We are able to reproduce this fairly consistantly, all we are doing is clicking the map and moving the mouse and eventually it will fail.  It seems easier to produce with the polygon, and it only happens on the first point where the track shape is being created, after that the points always match.  The behavior is the same with the line, when the first point of the line is created it can fail, but after that it works as expected.


Ed



James, 

I added some additional debugging in the trackoverlay that may give you some more information. It looks like that winforms map and trackoverlay are able to get out of sync. Notice the x is off by 4 pixels.  We are using version 

MapSuiteCore:3.1.299;DesktopEdition:3.1.299


winformsMap1_MouseDown mouse args x,y 646 247 

winformsMap1_MouseUp mouse args x,y 646 247 

MouseMoveCore screen x,y 647 247 

MouseMoveCore screen x,y 648 247 

MouseMoveCore screen x,y 650 247 

OnMapMouseClick screen x,y 650 247 

TrackOverlay_MapMouseClick screen x,y - world x,y 650 247 - 835513.460164621 1265037.31660544 

MouseClickCore screen x,y 650 247



Ed, 
  
 Have you ever seen the result, it definitely correct no matter the debug infromation is. 
 I doubt that you haven’t used my new TrackOverlay, because the original one will show that information from debug. But if using my extended one, it only show winformsMap1_MouseUp and winformsMap1_MouseDown. 
  
 Please attached your screen-shot both the sample form and Output window. 
  
 Thanks 
 James

James, 
 I implemented the code you sent, which was to send new interactionargs if the trackmode == point,  into my solution and the result was the same as I stated in my code at 10:33 this morning.   If you want I will use your solution tomorrow and send you the results. 
  
 In my post at 11 you should note that after the map_mouseup event fires, the trackoverlay mousemove code is executed before the track overlay onmapclick event occurs, this results in the behavior that i am describing.  The map mouse events are not directly wired the the trackoverlay mouse events.   
  
 I will use you solution tomorrow and send the results. 
  
 Ed


James,


I ran you demo as you can see from the screen shot.  There is no debug info in the code so there is nothing in the output window.  I am submitting this as a bug.


Thanks,


Ed



Ed, 
  
 Thanks for your post and sorry for the delay for some problem in the discussion forum in the past few days. 
  
 I think James’ idea is that when tracking point shape, the location of the point shape will be determined in MouseDown instead of MouseUp(by default), so the following events will not be fired any more. In this way, this is not a bug. 
  
 Any more questions just feel free to let me know. 
  
 Thanks. 
  
 Yale 


Yale,  
 I implemented his solution and it still failed.  I’m not sure where the communication is failing because the number I have supplied show that the map mouse click coordinates to not match the trackoverlay mouse click coordinates. 
  
 I am still waiting for a response to my support ticket. 
  
 Ed

Ed, 
  
 I just make sure one thing at first, the fail which you mentioned is that the times of map mouse click event raised and your mouse click times are not matched, is that right? And the problem is only this? 
  
 Our MapMouseClick event is not like Microsoft mouse click event which you unusually use. 
  
 It is just raised when your mouse down and mouse up exactly at the same screen coordinate within 500 milliseconds, So I am sure that if you want to test it, our MapMouseClick event raise times will be less than or equal to your think, because you usually click mouse and then will move a little which you can not sense it. But if you click your mouse very carefully, and you will find the times are equal. 
  
 Thanks 
  
 James 


James, 
  
 It is not about the times, the numbers i have been showing are the screen coordinates.  I was using the winformsmap.mouseclick x and y to show that they do not match the trackoverlay.mouseclick x and y.  Our users are trying to start drawing a polygon in a certain county, and when they move the mouse to continue the polygon, the click is registered at the current position of the cursor.  This means the trackshape is started in a completely different area than the user expected.   
  
 I sort of understand your explaination, but that does not resolve the issue.  It does not sense that a click event would have to wait until the mouse stops moving before firing for the track overlay.   
  
 If you review my debug info, you will see that the mouse up and mouse down on the map are the same coordinates, and the user is able to move the mouse and then the track overlaymapmouseclick event fires. 
  
 Ed


 James,  
 I have some additional information for you.  We changed the InteractiveClickInterval to 50.  Changing that value seemed to mitigate the points not lining up, but in turn the double click would not fire.  
  
 It appears that even though the InteractiveClickInterval is for the double click, it is affecting the click event as well.  Our theory is that once the interval has passed and determined that it is NOT a dbl click, it registers the current position of the cursor instead of the original click.  We are only able to recreate this behavior on the first click when creating a track shape.  It would appear that the original mouse coordinates that the user initiated should be rethrown, not where the cursur position is after the 500 ms delay. 
  
 Any thoughts? 
  
 Ed

Ed,


Thanks for your more information!


I want to clear your problem, so I have updated my sample code, and this time I added the debug information, but  it only show winformsMap1_MouseUp and winformsMap1_MouseDown like I said at 12-03-2009 09:46 PM. Overlaymapmouseclick event won't be raised.


I can see the first point is exactly match the coordinate of mouse down.


If you think the sample is not reflected your problem, can you update it and make it can easy reproduce what you said?


The InteractiveClickInterval will affect the double click, if you set to 50, that means your double click should within 50 ms, so if you can not click so quickly the event won't be raised.


Thanks


James



1547-TrackFirstPointDemo_WithDebugInfo.zip (12.5 KB)