当前位置: 首页>>代码示例>>Java>>正文


Java PolylineOptions.startCap方法代码示例

本文整理汇总了Java中com.google.android.gms.maps.model.PolylineOptions.startCap方法的典型用法代码示例。如果您正苦于以下问题:Java PolylineOptions.startCap方法的具体用法?Java PolylineOptions.startCap怎么用?Java PolylineOptions.startCap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.maps.model.PolylineOptions的用法示例。


在下文中一共展示了PolylineOptions.startCap方法的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.startCap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。