I'm trying to figure out a way to programmatically get the visual color (not the picking color) of the point where a user clicks on a WorldWind AnalyticSurface.
Looking at AnalyticSurface and PickedObjectList I'm not sure of what API calls I need to string together to do this or if its even possible.
Here is a possible solution. Just try.
When clicked, (i assume you have made some MouseListener
object with a mouseClicked()
method in it), just get the current mouse pointer location on the whole computer screen as co-rdinate.
import java.awt.MouseInfo;
import java.awt.PointerInfo;
import java.awt.Point;
PointerInfo pi=MouseInfo.getPointerInfo();
Point p=pi.getLocation();
Now we got the position of point clicked on screen.
Using Robot class you can get the pixel at the location.
import.java.awt.Robot;
import.java.awt.Color;
Robot robot=new Robot();
Color color=robot.getPixelColor(p.x,p.y) ;
// you got the color at the clicked point.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With