6 package com.google.appinventor.components.runtime;
10 import org.locationtech.jts.geom.Geometry;
11 import org.osmdroid.util.GeoPoint;
45 @DesignerComponent(version = YaVersion.CIRCLE_COMPONENT_VERSION,
46 category = ComponentCategory.MAPS,
47 description =
"Circle")
53 private GeoPoint center =
new GeoPoint(0.0, 0.0);
58 private double latitude;
63 private double longitude;
68 private double radius;
72 public Double visit(
MapMarker marker, Object... arguments) {
73 if ((Boolean) arguments[1]) {
81 public Double visit(
MapLineString lineString, Object... arguments) {
82 if ((Boolean) arguments[1]) {
90 public Double visit(
MapPolygon polygon, Object... arguments) {
91 if ((Boolean) arguments[1]) {
99 public Double visit(
MapCircle circle, Object... arguments) {
100 if ((Boolean) arguments[1]) {
108 public Double visit(
MapRectangle rectangle, Object... arguments) {
109 if ((Boolean) arguments[1]) {
123 @
SimpleProperty(description =
"Returns the type of the feature. For Circles, "
124 +
"this returns the text \"Circle\".")
134 this.radius = radius;
144 description =
"The radius of the circle in meters.")
154 if (isValidLatitude(latitude)) {
155 this.latitude = latitude;
156 this.center.setLatitude(latitude);
172 description =
"The latitude of the center of the circle.")
182 if (isValidLongitude(longitude)) {
183 this.longitude = longitude;
184 this.center.setLongitude(longitude);
200 description =
"The longitude of the center of the circle.")
214 if (!isValidLatitude(latitude)) {
217 }
else if (!isValidLongitude(longitude)) {
221 this.latitude = latitude;
222 this.longitude = longitude;
223 this.center.setLatitude(latitude);
224 this.center.setLongitude(longitude);
232 return visitor.
visit(
this, arguments);
242 this.latitude = latitude;
243 this.longitude = longitude;