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;
}
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;
}
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();
}
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);
}
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();
}
}
Aggregations