-
Title:
Circles - solution
-
Description:
-
So as we saw earlier on, you specify
the center point of the circle, and
-
then its radius in meters.
-
So here you can say I've set
the .center of my circle.
-
I just call map.addcircle
a new circle options.
-
And I set its center to be renton.
-
And renton of course,
is the latitude and
-
longitude that we created earlier for
the location of the rank and renton.
-
I set a radius of 5,000,
-
which means a 5 kilometer radius
around the rank and renton.
-
I've set the stroke color,
-
which is the diameter of the circle will
be drawn in this color, Color.GREEN.
-
And then I've set using a fill color,
using Color.argb.
-
And you see I've set the A to be 64,
-
which means it's going to
be semi transparent.
-
It's going to be slightly translucent.
-
So, we can see the color, the 0, 255,
0, which is going to be green, but
-
it's a partially transparent green.
-
Now when I run the app, I'll actually
see the circle projected properly,
-
including taking into account
the tilt and zoom of the camera.
-
And it will be drawn on
the surface of the earth.
-
Let's take a look at that.
-
So here you can see it, I have my
green circle, my semi translucent one.
-
So as I zoom in,
you'll see that my stroke is green.
-
You'll see that my circle is
five kilometer radius around
-
the renton ice rink.
-
Because I've colored
it with translucency,
-
we can actually see through
to the map underneath.
-
And also because my camera
is tilted a little bit,
-
we can see that it's
slightly oval in shape.
-
I'm not looking straight down at
90 degrees to make it a circle.
-
I'm tilted a little bit, because I'm
looking somewhat up from the horizon
-
direction, towards the Earth,
and this part of Seattle.
-
So there we can see it.
-
The circle was added.
-
Pretty straightforward.
-
Pretty simple.
-
Right?
-
Of course if I rotate my map,
the circle rotates with me.
-
So it's all properly calculated for
me and all properly drawn
-
as a five kilometer radius circle
around my home rank and renton.