當前位置: 首頁>>代碼示例>>Java>>正文


Java PolylineOptions.endCap方法代碼示例

本文整理匯總了Java中com.google.android.gms.maps.model.PolylineOptions.endCap方法的典型用法代碼示例。如果您正苦於以下問題:Java PolylineOptions.endCap方法的具體用法?Java PolylineOptions.endCap怎麽用?Java PolylineOptions.endCap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.android.gms.maps.model.PolylineOptions的用法示例。


在下文中一共展示了PolylineOptions.endCap方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: drawPolyline

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
void drawPolyline(final List<Route> routes) {

        ArrayList<LatLng> points = null;
        PolylineOptions lineOptions = new PolylineOptions();

        mCoordinatorlayout.postDelayed(new Runnable() {
            @Override
            public void run() {
                mOriginEditText.clearFocus();
                mDestinationEditText.clearFocus();
                setUpTimeAndDistanceText(routes.get(0).distance.text, routes.get(0).duration.text);
                setUpOriginDestinationText();
                mCoordinatorlayout.requestLayout();
            }
        }, 1000);

        for (int i = 0; i < routes.size(); i++) {
            this.mListLatLng.addAll(routes.get(i).points);
        }

        lineOptions.width(10);
        if (mPrimaryPolyLineColor == 0) {
            lineOptions.color(Color.BLACK);
        } else {
            lineOptions.color(ContextCompat.getColor(getContext(), mPrimaryPolyLineColor));
        }
        lineOptions.startCap(new SquareCap());
        lineOptions.endCap(new SquareCap());
        lineOptions.jointType(ROUND);
        mPrimaryPolyLine = mMap.addPolyline(lineOptions);

        PolylineOptions greyOptions = new PolylineOptions();
        greyOptions.width(10);
        if (mSecondaryPolyLineColor == 0) {
            greyOptions.color(Color.GRAY);
        } else {
            lineOptions.color(ContextCompat.getColor(getContext(), mSecondaryPolyLineColor));
        }
        greyOptions.startCap(new SquareCap());
        greyOptions.endCap(new SquareCap());
        greyOptions.jointType(ROUND);
        mSecondaryPolyLine = mMap.addPolyline(greyOptions);

        animatePolyLine();
    }
 
開發者ID:aliumujib,項目名稱:Nibo,代碼行數:46,代碼來源:NiboOriginDestinationPickerFragment.java

示例2: onMapReady

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
/**
 * Manipulates the map once available.
 * This callback is triggered when the map is ready to be used.
 * If Google Play services is not installed on the device, the user will be prompted to install
 * it inside the SupportMapFragment. This method will only be triggered once the user has
 * installed Google Play services and returned to the app.
 */
@Override
public void onMapReady(GoogleMap googleMap) {
    map = googleMap;
    if (map == null) return;
    map.setMapStyle(MapStyleOptions.loadRawResourceStyle(getContext(), R.raw.map_style));
    map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(22.3964, 114.1095), 10));
    GoogleMapOptions options = new GoogleMapOptions();
    options.mapToolbarEnabled(false);
    options.compassEnabled(true);
    options.rotateGesturesEnabled(true);
    options.scrollGesturesEnabled(false);
    options.tiltGesturesEnabled(true);
    options.zoomControlsEnabled(false);
    options.zoomGesturesEnabled(true);
    map.setBuildingsEnabled(false);
    map.setIndoorEnabled(false);
    map.setTrafficEnabled(false);
    map.setOnMarkerClickListener(this);
    if (ActivityCompat.checkSelfPermission(getContext(),
            Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED ||
            ActivityCompat.checkSelfPermission(getContext(),
                    Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
        map.setMyLocationEnabled(true);
    }
    if (busRouteStops != null && busRouteStops.size() > 0) {
        PolylineOptions line = new PolylineOptions().width(20).zIndex(1)
                .color(ContextCompat.getColor(getContext(), R.color.colorAccent));
        for (BusRouteStop stop: busRouteStops) {
            LatLng latLng = new LatLng(Double.parseDouble(stop.latitude), Double.parseDouble(stop.longitude));
            line.add(latLng);
            IconGenerator iconFactory = new IconGenerator(getContext());
            Bitmap bmp = iconFactory.makeIcon(stop.sequence + ": " + stop.name);
            map.addMarker(new MarkerOptions().position(latLng)
                    .icon(BitmapDescriptorFactory.fromBitmap(bmp))).setTag(stop);
        }
        line.startCap(new RoundCap());
        line.endCap(new RoundCap());
        map.addPolyline(line);
        if (busRouteStops.size() < goToStopPos) {
            goToStopPos = 0;
        }
        map.moveCamera(CameraUpdateFactory.newLatLngZoom(
                new LatLng(Double.parseDouble(busRouteStops.get(goToStopPos).latitude),
                        Double.parseDouble(busRouteStops.get(goToStopPos).longitude)), 16));
    }
}
 
開發者ID:alvinhkh,項目名稱:buseta,代碼行數:54,代碼來源:LwbStopListFragment.java


注:本文中的com.google.android.gms.maps.model.PolylineOptions.endCap方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。