pssingh43 / stardroid

Automatically exported from code.google.com/p/stardroid
0 stars 0 forks source link

Missing possibility to listen to onClick events #4

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Basically i am missing any helper functions that will map a touch event's 
coordinates to an actual object.
Or am i just missing something?

The best place to go for it should be DynamicStarMapActivity.onTouchEvent(...) 
to get the click coordinates and then find which object maps to the touch event 
coordinates in the skyView GLSurfaceView. But i'm just unable to find any 
functions that might help here.

Any ideas?

Greets

Original issue reported on code.google.com by goddc...@googlemail.com on 23 Jan 2012 at 10:03

GoogleCodeExporter commented 8 years ago
We never did implement a feature that would identify objects from a click. I do 
have a test build somewhere that did something like that, though. I'll see if I 
can find it.

Original comment by kevin.se...@gmail.com on 23 Jan 2012 at 3:36

GoogleCodeExporter commented 8 years ago
that would be really really great.
i'm really lost right now. I can catch the MotionEvent without a problem, also 
getting the AstronomerModel and the Pointing (which includes the line of sight) 
is not a problem.

But from here i'm lost. How to convert the screen coordinates of the 
MotionEvent to GeocentricCoordinates? And when i have those, how to find the 
object that is at that location?

Greets

Original comment by goddc...@googlemail.com on 23 Jan 2012 at 3:44

GoogleCodeExporter commented 8 years ago
I must have deleted the code because I couldn't find it.

For converting screen coordinates, I think I basically did linear 
interpolation. If you know the coordinates of the four corners of the screen, 
you can interpolate the location of the event. Note that this breaks down at 
the corners. It is also a pretty bad assumption if you are zoomed way out. It 
should be good enough for experiments, though.

For the search, I think you can do a linear search. We should have all of the 
coordinates of objects in memory. I would simply compare the coordinates of the 
event with the coordinates of each object and return the closest one. If you 
follow the logic for searches, you should find the right data structures. I 
realize that its inefficient, but again, it should be good enough for now.

Its been a while since I looked at that code, so I can't give you any concrete 
references. I'll try to poke around in the code over the next couple of days 
and send more concrete suggestions.

Original comment by kevin.se...@gmail.com on 24 Jan 2012 at 12:27

GoogleCodeExporter commented 8 years ago
You may also want to pop up a list of nearby objects if the area is crowded.  
That's what I do in LunarMap for Android and AstroInfo for Palm.  

Original comment by arpruss on 24 Jan 2012 at 1:24

GoogleCodeExporter commented 8 years ago
The approach with the linear interpolation using the edges of the "visibly sky" 
is a great idea.
But how do i get those four edges? Are there any helper functions present for 
that?

Original comment by goddc...@googlemail.com on 24 Jan 2012 at 2:05

GoogleCodeExporter commented 8 years ago
Kevin if you do happen to find that code or know of any good resources to get 
other started on re-inventing it that would be appreciated.

As I mentioned elsewhere I'm trying to get something going to take advantage of 
Starmap and Skywatcher's Panorama app both being open source, being able to 
click on an object on screen to select the object for further action (such as 
slewing a telescope to it) would be a very hand addition.

Bob

Original comment by BobSteph...@gmail.com on 22 Apr 2012 at 9:07

GoogleCodeExporter commented 8 years ago
Realised that I'd not done enough with google prior to that last question. 
Sorry about that. I'll do some more homework and may then need to ask some more 
questions.

Bob

Original comment by BobSteph...@gmail.com on 22 Apr 2012 at 11:24

GoogleCodeExporter commented 8 years ago
There's been any develop on this? I'm trying to do the same, but I'm completely 
lost...

Original comment by oscenso...@gmail.com on 2 Dec 2014 at 10:30

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Ok, so here's what I've done.

I captured the labels Geocentric Positions and stored all of them in the 
ApplicationConstants class. You can get them in the 
ProtobufAstronomicalSource.getLabels(), except for the planets, wich you can 
get on PlanetSource.initialize().

Then, when the user clicks, the method onSingleTapConfirmed is called in the 
class com.google.android.stardroid.touch.GestureInterpreter. Inside this method 
I get all the labels, convert the Geocentric Postions into screen position, 
using this code attached.

I hope this helps.
Marcio Granzotto Rodrigues

Original comment by oscenso...@gmail.com on 6 Jan 2015 at 8:14

Attachments: