1

Nutiteq マップに取り組んでいますが、場所が変わるとポリラインを描画できません。

私はこれまでに試しました:

@Override
public void onLocationChanged(Location location)
{
    MapPos lineLocation = mapView.getLayers().getBaseProjection().fromWgs84(location.getLongitude(), location.getLatitude());
    //arr_lat_long.add(new MapPos(lat, lng));
    arr_lat_long.add(lineLocation);
    Toast.makeText(getApplicationContext(), "Array list lat Lng" + arr_lat_long, 1000).show();
    if (arr_lat_long.size() > 2)
    {
        GeometryLayer geoLayer = new GeometryLayer(new EPSG4326());
        mapView.getLayers().addLayer(geoLayer);
        LineStyle lineStyle = LineStyle.builder().setLineJoinMode(LineStyle.ROUND_LINEJOIN).build();
        //Label label = new DefaultLabel("Line", "Here is a line");
        Line line = new Line(arr_lat_long, null, lineStyle, null);
        geoLayer.add(line);
    }
}
4

2 に答える 2

1

次のコードは私にとってはうまくいきます...

 @Override
            public void onLocationChanged(Location location)
            {
                Log.debug("GPS onLocationChanged " + location);
                if (locationCircle != null)
                {
                    MapPos lineLocation = mapView.getLayers().getBaseProjection().fromWgs84(location.getLongitude(), location.getLatitude());

                    //arr_lat_long.add(proj.fromWgs84(location.getLongitude(), location.getLatitude()));
                    //arr_lat_long.add(new MapPos(lat, lng));
                    arr_lat_long.add(lineLocation);


                    if (arr_lat_long.size() > 1)
                    {
                        Toast.makeText(getApplicationContext(), "Array list lat Lng" + arr_lat_long, 1000).show();

                        GeometryLayer geoLayer = new GeometryLayer(mapView.getComponents().layers.getBaseProjection());

                        mapView.getLayers().addLayer(geoLayer);
                        //LineStyle lineStyle = LineStyle.builder().setLineJoinMode(LineStyle.ROUND_LINEJOIN).build();  
                        StyleSet<LineStyle> lineStyleSet = new StyleSet<LineStyle>(LineStyle.builder().setWidth(0.05f).setColor(Color.BLUE).build());
                        Line line = new Line(arr_lat_long, null, lineStyleSet, null);
                        geoLayer.add(line);
                    }

                    }
于 2014-05-20T10:57:59.937 に答える