Search in sources :

Example 6 with PolylineOptions

use of com.google.android.gms.maps.model.PolylineOptions in project android-maps-utils by googlemaps.

the class KmlStyle method createPolylineOptions.

/**
     * Creates a new PolylineOption from given properties of an existing PolylineOption
     * @param originalPolylineOption An existing PolylineOption instance
     * @return A new PolylineOption
     */
private static PolylineOptions createPolylineOptions(PolylineOptions originalPolylineOption) {
    PolylineOptions polylineOptions = new PolylineOptions();
    polylineOptions.color(originalPolylineOption.getColor());
    polylineOptions.width(originalPolylineOption.getWidth());
    return polylineOptions;
}
Also used : PolylineOptions(com.google.android.gms.maps.model.PolylineOptions)

Example 7 with PolylineOptions

use of com.google.android.gms.maps.model.PolylineOptions in project android-maps-utils by googlemaps.

the class GeoJsonLineStringStyle method toPolylineOptions.

/**
     * Gets a new PolylineOptions object containing styles for the GeoJsonLineString
     *
     * @return new PolylineOptions object
     */
public PolylineOptions toPolylineOptions() {
    PolylineOptions polylineOptions = new PolylineOptions();
    polylineOptions.color(mPolylineOptions.getColor());
    polylineOptions.clickable(mPolylineOptions.isClickable());
    polylineOptions.geodesic(mPolylineOptions.isGeodesic());
    polylineOptions.visible(mPolylineOptions.isVisible());
    polylineOptions.width(mPolylineOptions.getWidth());
    polylineOptions.zIndex(mPolylineOptions.getZIndex());
    return polylineOptions;
}
Also used : PolylineOptions(com.google.android.gms.maps.model.PolylineOptions)

Example 8 with PolylineOptions

use of com.google.android.gms.maps.model.PolylineOptions in project android-maps-utils by googlemaps.

the class DistanceDemoActivity method startDemo.

@Override
protected void startDemo() {
    mTextView = (TextView) findViewById(R.id.textView);
    getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(-33.8256, 151.2395), 10));
    getMap().setOnMarkerDragListener(this);
    mMarkerA = getMap().addMarker(new MarkerOptions().position(new LatLng(-33.9046, 151.155)).draggable(true));
    mMarkerB = getMap().addMarker(new MarkerOptions().position(new LatLng(-33.8291, 151.248)).draggable(true));
    mPolyline = getMap().addPolyline(new PolylineOptions().geodesic(true));
    Toast.makeText(this, "Drag the markers!", Toast.LENGTH_LONG).show();
    showDistance();
}
Also used : MarkerOptions(com.google.android.gms.maps.model.MarkerOptions) LatLng(com.google.android.gms.maps.model.LatLng) PolylineOptions(com.google.android.gms.maps.model.PolylineOptions)

Example 9 with PolylineOptions

use of com.google.android.gms.maps.model.PolylineOptions in project Android-GoogleDirectionAndPlaceLibrary by akexorcist.

the class DirectionActivity2 method onCreate.

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_direction_2);
    mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
    mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(start, 15));
    gd = new GoogleDirection(this);
    gd.setOnDirectionResponseListener(new OnDirectionResponseListener() {

        public void onResponse(String status, Document doc, GoogleDirection gd) {
            Toast.makeText(getApplicationContext(), status, Toast.LENGTH_SHORT).show();
            gd.animateDirection(mMap, gd.getDirection(doc), GoogleDirection.SPEED_NORMAL, true, true, true, false, null, false, true, new PolylineOptions().width(3));
        }
    });
    gd.request(start, end, GoogleDirection.MODE_DRIVING);
}
Also used : GoogleDirection(app.akexorcist.gdaplibrary.GoogleDirection) OnDirectionResponseListener(app.akexorcist.gdaplibrary.GoogleDirection.OnDirectionResponseListener) Document(org.w3c.dom.Document) PolylineOptions(com.google.android.gms.maps.model.PolylineOptions)

Example 10 with PolylineOptions

use of com.google.android.gms.maps.model.PolylineOptions in project Android-GoogleDirectionAndPlaceLibrary by akexorcist.

the class GoogleDirection method animateDirection.

public void animateDirection(GoogleMap gm, ArrayList<LatLng> direction, int speed, boolean cameraLock, boolean isCameraTilt, boolean isCameraZoom, boolean drawMarker, MarkerOptions mo, boolean flatMarker, boolean drawLine, PolylineOptions po) {
    if (direction.size() > 1) {
        isAnimated = true;
        animatePositionList = direction;
        animateSpeed = speed;
        this.drawMarker = drawMarker;
        this.drawLine = drawLine;
        this.flatMarker = flatMarker;
        this.isCameraTilt = isCameraTilt;
        this.isCameraZoom = isCameraZoom;
        step = 0;
        this.cameraLock = cameraLock;
        this.gm = gm;
        setCameraUpdateSpeed(speed);
        beginPosition = animatePositionList.get(step);
        endPosition = animatePositionList.get(step + 1);
        animateMarkerPosition = beginPosition;
        if (mAnimateListener != null)
            mAnimateListener.onProgress(step, animatePositionList.size());
        if (cameraLock) {
            float bearing = getBearing(beginPosition, endPosition);
            CameraPosition.Builder cameraBuilder = new CameraPosition.Builder().target(animateMarkerPosition).bearing(bearing);
            if (isCameraTilt)
                cameraBuilder.tilt(90);
            else
                cameraBuilder.tilt(gm.getCameraPosition().tilt);
            if (isCameraZoom)
                cameraBuilder.zoom(zoom);
            else
                cameraBuilder.zoom(gm.getCameraPosition().zoom);
            CameraPosition cameraPosition = cameraBuilder.build();
            gm.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
        }
        if (drawMarker) {
            if (mo != null)
                animateMarker = gm.addMarker(mo.position(beginPosition));
            else
                animateMarker = gm.addMarker(new MarkerOptions().position(beginPosition));
            if (flatMarker) {
                animateMarker.setFlat(true);
                float rotation = getBearing(animateMarkerPosition, endPosition) + 180;
                animateMarker.setRotation(rotation);
            }
        }
        if (drawLine) {
            if (po != null)
                animateLine = gm.addPolyline(po.add(beginPosition).add(beginPosition).add(endPosition).width(dpToPx((int) po.getWidth())));
            else
                animateLine = gm.addPolyline(new PolylineOptions().width(dpToPx(5)));
        }
        new Handler().postDelayed(r, speed);
        if (mAnimateListener != null)
            mAnimateListener.onStart();
    }
}
Also used : CameraPosition(com.google.android.gms.maps.model.CameraPosition) MarkerOptions(com.google.android.gms.maps.model.MarkerOptions) DocumentBuilder(javax.xml.parsers.DocumentBuilder) Handler(android.os.Handler) PolylineOptions(com.google.android.gms.maps.model.PolylineOptions)

Aggregations

PolylineOptions (com.google.android.gms.maps.model.PolylineOptions)10 LatLng (com.google.android.gms.maps.model.LatLng)5 MarkerOptions (com.google.android.gms.maps.model.MarkerOptions)3 PolygonOptions (com.google.android.gms.maps.model.PolygonOptions)3 SuppressLint (android.annotation.SuppressLint)1 Handler (android.os.Handler)1 GoogleDirection (app.akexorcist.gdaplibrary.GoogleDirection)1 OnDirectionResponseListener (app.akexorcist.gdaplibrary.GoogleDirection.OnDirectionResponseListener)1 Response (com.android.volley.Response)1 VolleyError (com.android.volley.VolleyError)1 JsonArrayRequest (com.android.volley.toolbox.JsonArrayRequest)1 CameraUpdate (com.google.android.gms.maps.CameraUpdate)1 GoogleMap (com.google.android.gms.maps.GoogleMap)1 CameraPosition (com.google.android.gms.maps.model.CameraPosition)1 Marker (com.google.android.gms.maps.model.Marker)1 Polygon (com.google.android.gms.maps.model.Polygon)1 Polyline (com.google.android.gms.maps.model.Polyline)1 GeoJsonLineString (com.google.maps.android.data.geojson.GeoJsonLineString)1 GeoJsonMultiLineString (com.google.maps.android.data.geojson.GeoJsonMultiLineString)1 GeoJsonMultiPolygon (com.google.maps.android.data.geojson.GeoJsonMultiPolygon)1