• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Android app drawing trace of agricultural machine

plam1986

Lurker
Hello,
I am making a Android application for agriculture and it is navigation off-road, for machines. I can draw a polygon where I have been, but I would like to make if I go into place, where have been before to draw a polygon of these points with different color. Example - I am drawing green trace and if I move into marked before place to be in red.
Thank you for your help.
 
I think you should place all visited coordinates in some array with some resolution (50 meters for example).
Then you compare new coordinates from GPS with all that in array[].
If the distance from your new coordinates to those in array is less than 50 meters, your color is new.
If array comparison is too slow, use binary search tree.
 
I think you should place all visited coordinates in some array with some resolution (50 meters for example).
Then you compare new coordinates from GPS with all that in array[].
If the distance from your new coordinates to those in array is less than 50 meters, your color is new.
If array comparison is too slow, use binary search tree.

Rather than use an array, which is a fixed size, use an ArrayList, or even a HashMap for efficient lookup, with the hash key being a combination of the coordinates, possibly.
 
Thank you about the responses to both of you, but still this confuse me - here is a photo of such program and there is a circle, that shows polygon in red - the place where is the second move at these coordinates. When I move from point A to point B there will be a polygon, because depends of the speed each time his size will differ. As I know, I can not get whole number of points and to add to ArrayList or HashMap. And there is the new proglem - if a part of the new polygon is in the previous how to make only it in different color.
redoneline.png
 
As I know, I can not get whole number of points and to add to ArrayList or HashMap. And there is the new proglem - if a part of the new polygon is in the previous how to make only it in different color.
1. If you can't put all points into HashMap, put every 10th point or every hundredth. I think it should be trade off between HashMap size and trace resolution.
2. You have an intersection of two shapes. It's standard geometry task, to find an intersection. Than make it different color.
 
Back
Top Bottom