Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/222.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在android地图中对圆圈进行编码?_Android_Android Maps V2_Android Maps Utils - Fatal编程技术网

如何在android地图中对圆圈进行编码?

如何在android地图中对圆圈进行编码?,android,android-maps-v2,android-maps-utils,Android,Android Maps V2,Android Maps Utils,我知道我们可以在android中对多边形进行如下编码: encoded_string = polyutil.encode(polygon.getPoints()); 但是我们如何才能得到一个圆的编码字符串呢?我不知道什么是polyutil,或者它的encode方法做什么,但是一个圆的多边形点的等价物是圆心和半径。调用圆上的getCenter()和getRadius()并在其中包含该数据的字符串应该不会太难 您可以使用Java拓扑套件来完成这项工作。 不确定这是否是您想要的,但它会在圆的周

我知道我们可以在android中对多边形进行如下编码:

  encoded_string = polyutil.encode(polygon.getPoints());

但是我们如何才能得到一个圆的编码字符串呢?

我不知道什么是
polyutil
,或者它的
encode
方法做什么,但是一个圆的多边形点的等价物是圆心和半径。调用圆上的
getCenter()
getRadius()
并在其中包含该数据的字符串应该不会太难


您可以使用Java拓扑套件来完成这项工作。

不确定这是否是您想要的,但它会在圆的周长上为您提供一个坐标数组,因此可能值得一试

    Coordinate center = new Coordinate(entity.getLongitude(), entity.getLatitude());
    GeometricShapeFactory gsf = new GeometricShapeFactory();

    gsf.setCentre(center);
    gsf.setNumPoints(20);
    gsf.setSize(10.2);

    Polygon poly = gsf.createCircle();

    Coordinate[] coordArray = poly.getCoordinates();