English subtitles

← Circles - solution

Get Embed Code
4 Languages

Showing Revision 3 created 05/25/2016 by Udacity Robot.

  1. So as we saw earlier on, you specify
    the center point of the circle, and
  2. then its radius in meters.
  3. So here you can say I've set
    the .center of my circle.
  4. I just call map.addcircle
    a new circle options.
  5. And I set its center to be renton.
  6. And renton of course,
    is the latitude and
  7. longitude that we created earlier for
    the location of the rank and renton.
  8. I set a radius of 5,000,
  9. which means a 5 kilometer radius
    around the rank and renton.
  10. I've set the stroke color,
  11. which is the diameter of the circle will
    be drawn in this color, Color.GREEN.
  12. And then I've set using a fill color,
    using Color.argb.
  13. And you see I've set the A to be 64,
  14. which means it's going to
    be semi transparent.
  15. It's going to be slightly translucent.
  16. So, we can see the color, the 0, 255,
    0, which is going to be green, but
  17. it's a partially transparent green.
  18. Now when I run the app, I'll actually
    see the circle projected properly,
  19. including taking into account
    the tilt and zoom of the camera.
  20. And it will be drawn on
    the surface of the earth.
  21. Let's take a look at that.
  22. So here you can see it, I have my
    green circle, my semi translucent one.
  23. So as I zoom in,
    you'll see that my stroke is green.
  24. You'll see that my circle is
    five kilometer radius around
  25. the renton ice rink.
  26. Because I've colored
    it with translucency,
  27. we can actually see through
    to the map underneath.
  28. And also because my camera
    is tilted a little bit,
  29. we can see that it's
    slightly oval in shape.
  30. I'm not looking straight down at
    90 degrees to make it a circle.
  31. I'm tilted a little bit, because I'm
    looking somewhat up from the horizon
  32. direction, towards the Earth,
    and this part of Seattle.
  33. So there we can see it.
  34. The circle was added.
  35. Pretty straightforward.
  36. Pretty simple.
  37. Right?
  38. Of course if I rotate my map,
    the circle rotates with me.
  39. So it's all properly calculated for
    me and all properly drawn
  40. as a five kilometer radius circle
    around my home rank and renton.