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


Java IconFactory类代码示例

本文整理汇总了Java中com.mapbox.mapboxsdk.annotations.IconFactory的典型用法代码示例。如果您正苦于以下问题:Java IconFactory类的具体用法?Java IconFactory怎么用?Java IconFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IconFactory类属于com.mapbox.mapboxsdk.annotations包,在下文中一共展示了IconFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ExtendedMarkerViewOptions

import com.mapbox.mapboxsdk.annotations.IconFactory; //导入依赖的package包/类
private ExtendedMarkerViewOptions(Parcel in) {
    marker = new ExtendedMarkerView(this, "", Constants.SPOT_TYPE_UNKNOWN);
    position((LatLng) in.readParcelable(LatLng.class.getClassLoader()));
    snippet(in.readString());
    title(in.readString());
    flat(in.readByte() != 0);
    anchor(in.readFloat(), in.readFloat());
    infoWindowAnchor(in.readFloat(), in.readFloat());
    rotation(in.readFloat());
    visible(in.readByte() != 0);
    alpha(in.readFloat());
    if (in.readByte() != 0) {
        // this means we have an icon
        String iconId = in.readString();
        Bitmap iconBitmap = in.readParcelable(Bitmap.class.getClassLoader());
        Icon icon = IconFactory.recreate(iconId, iconBitmap);

        icon(icon);
    }

    tag(in.readString());
    spotType(in.readInt());
}
 
开发者ID:Hitchwiki,项目名称:MyHitchhikingSpots-for-Android,代码行数:24,代码来源:ExtendedMarkerViewOptions.java

示例2: unselectMarker

import com.mapbox.mapboxsdk.annotations.IconFactory; //导入依赖的package包/类
public void unselectMarker() {
    if (markerSelected != null) {
        Bitmap bitmap = null;

        switch (markerSelected.getType()) {
            case POI:
                Poi poi = (Poi) markerSelected.getRelatedObject();
                bitmap = bitmapHandler.getMarkerBitmap(poi.getType(), Poi.computeState(false, false, poi.getUpdated()));
                break;

            case NOTE:
                bitmap = bitmapHandler.getNoteBitmap(Note.computeState((Note) markerSelected.getRelatedObject(), false, false));
                break;

            default:
                break;
        }
        if (bitmap != null) {
            markerSelected.setIcon(IconFactory.getInstance(getActivity()).fromBitmap(bitmap));
        }
        markerSelectedId = -1L;
        markerSelected = null;
    }
}
 
开发者ID:jawg,项目名称:osm-contributor,代码行数:25,代码来源:MapFragment.java

示例3: retrieveMapMarker

import com.mapbox.mapboxsdk.annotations.IconFactory; //导入依赖的package包/类
/**
 * Returns a map marker {@link Icon} based on the current theme setting.
 *
 * @param context to retrieve {@link SharedPreferences} and an instance of {@link IconFactory}
 * @return {@link Icon} map marker dark or light
 */
static Icon retrieveMapMarker(Context context) {
  SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
  boolean darkThemeEnabled = preferences.getBoolean(context.getString(R.string.dark_theme_enabled), false);
  IconFactory iconFactory = IconFactory.getInstance(context);
  return iconFactory.fromResource(darkThemeEnabled ? R.drawable.map_marker_dark : R.drawable.map_marker_light);
}
 
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:13,代码来源:ThemeSwitcher.java

示例4: drawableToIcon

import com.mapbox.mapboxsdk.annotations.IconFactory; //导入依赖的package包/类
/**
 * Demonstrates converting any Drawable to an Icon, for use as a marker icon.
 */
public static Icon drawableToIcon(@NonNull Context context, @DrawableRes int id) {
  Drawable vectorDrawable = ResourcesCompat.getDrawable(context.getResources(), id, context.getTheme());
  Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(),
    vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
  Canvas canvas = new Canvas(bitmap);
  vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
  vectorDrawable.draw(canvas);
  return IconFactory.getInstance(context).fromBitmap(bitmap);
}
 
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:13,代码来源:Utils.java

示例5: onBeforeClusterRendered

import com.mapbox.mapboxsdk.annotations.IconFactory; //导入依赖的package包/类
/**
 * Called before the marker for a Cluster is added to the map.
 * The default implementation draws a circle with a rough count of the number of items.
 */
protected void onBeforeClusterRendered(Cluster<T> cluster, MarkerOptions markerOptions) {
  int bucket = getBucket(cluster);
  Icon descriptor = mIcons.get(bucket);
  if (descriptor == null) {
    mColoredCircleBackground.getPaint().setColor(getColor(bucket));
    descriptor = IconFactory.getInstance(Mapbox.getApplicationContext())
      .fromBitmap(mIconGenerator.makeIcon(getClusterText(bucket)));
    mIcons.put(bucket, descriptor);
  }
  markerOptions.icon(descriptor);
}
 
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:16,代码来源:DefaultClusterRenderer.java

示例6: addMarker

import com.mapbox.mapboxsdk.annotations.IconFactory; //导入依赖的package包/类
private void addMarker(Acopio acopio, int pos) {
    MarkerViewOptions options = new MarkerViewOptions()
            .icon(IconFactory.getInstance(this).fromResource(R.mipmap.circle))
            .position(new LatLng(acopio.getGeopos().getLat(),
                    acopio.getGeopos().getLng()))
            .title(acopio.getNombre())
            .snippet(acopio.getDireccion()+"\n\n"+ getString(R.string.see_more));
    options.getMarker().setId(pos);
    this.mapboxMap.addMarker(options);
}
 
开发者ID:faviotorres,项目名称:AcopioMX,代码行数:11,代码来源:ActivityHome.java

示例7: drawableToIcon

import com.mapbox.mapboxsdk.annotations.IconFactory; //导入依赖的package包/类
public static Icon drawableToIcon(@NonNull Context context, @DrawableRes int id, int size) {
    Drawable vectorDrawable = AppCompatResources.getDrawable(context, id);
    if (vectorDrawable == null)
        return null;
    Bitmap bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
    vectorDrawable.draw(canvas);
    return IconFactory.getInstance(context).fromBitmap(bitmap);
}
 
开发者ID:Turistforeningen,项目名称:SjekkUT,代码行数:11,代码来源:Utils.java

示例8: getCameraIcon

import com.mapbox.mapboxsdk.annotations.IconFactory; //导入依赖的package包/类
public static final Icon getCameraIcon() {
    if( cameraIcon != null )
        return cameraIcon;
    IconFactory iconFactory = IconFactory.getInstance(mainContext);
    cameraIcon = iconFactory.fromResource(R.drawable.map_pin);
    return cameraIcon;
}
 
开发者ID:DaylightingSociety,项目名称:WhereAreTheEyes,代码行数:8,代码来源:Images.java

示例9: onViewCreated

import com.mapbox.mapboxsdk.annotations.IconFactory; //导入依赖的package包/类
@Override
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mMapView = (MapView) view.findViewById(R.id.mapview);


    mLocService = LocationServices.getLocationServices(getActivity());

    mMapView.onCreate(savedInstanceState);
    mMapView.getMapAsync(new OnMapReadyCallback() {
        @Override
        public void onMapReady(MapboxMap mapboxMap) {
            mMap = mapboxMap;
            mMap.setOnMyLocationChangeListener(FragMap.this);
            mMap.setMyLocationEnabled(true);
            if (mMap.getMyLocation() != null)
                onMyLocationChange(mMap.getMyLocation());
            mMap.addMarker(new MarkerOptions().position(mKaabePos).setIcon(IconFactory.getInstance(getActivity()).fromResource(R.drawable.ic_kaabe)));

            FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.myLocationButton);
            fab.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                    if (mMap.getMyLocation() != null) {
                        mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(mMap.getMyLocation().getLatitude(), mMap.getMyLocation().getLongitude()), 15));
                    }
                }
            });
        }
    });


}
 
开发者ID:metinkale38,项目名称:prayer-times-android,代码行数:35,代码来源:FragMap.java

示例10: drawableToIcon

import com.mapbox.mapboxsdk.annotations.IconFactory; //导入依赖的package包/类
/**
 * Demonstrates converting any Drawable to an Icon, for use as a marker icon.
 */
public static Icon drawableToIcon(@NonNull Context context, @DrawableRes int id, @ColorInt int colorRes, double width, double height) {
    Drawable vectorDrawable = ResourcesCompat.getDrawable(context.getResources(), id, context.getTheme());
    Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(),
            vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    vectorDrawable.setBounds(0, 0, (int) (canvas.getWidth() * width), (int) (canvas.getHeight() * height));
    if (colorRes != -1)
        DrawableCompat.setTint(vectorDrawable, colorRes);
    vectorDrawable.draw(canvas);
    return IconFactory.getInstance(context).fromBitmap(bitmap);
}
 
开发者ID:Hitchwiki,项目名称:MyHitchhikingSpots-for-Android,代码行数:15,代码来源:IconUtils.java

示例11: resetStillMarkers

import com.mapbox.mapboxsdk.annotations.IconFactory; //导入依赖的package包/类
private void resetStillMarkers()
{

    Log.i(TAG, "Resetting markers.");

    runOnUiThread(new Runnable() {
        @SuppressLint("PrivateResource")
        @Override
        public void run() {
            mapView.removeAllAnnotations();
            listOfMarkers.clear();
            msg.setText(R.string.no_event);
            msg.setTextColor(getResources().getColor(R.color.black));
            msgbox.setBackgroundColor(getResources().getColor(R.color.safe));
        }
    });
    
    IconFactory mIconFactory = IconFactory.getInstance(this);
    Drawable mIconDrawableDisabled = ContextCompat.getDrawable(this, R.drawable.map_grey);
    Icon disabled_icon = mIconFactory.fromDrawable(mIconDrawableDisabled);

    Drawable mIconDrawableActive = ContextCompat.getDrawable(this, R.drawable.map_green);
    Icon active_icon = mIconFactory.fromDrawable(mIconDrawableActive);

    for (int i = 0; i < sensors.size(); i++)
    {
        listOfMarkers.add(
            mapView.addMarker(new MarkerOptions()
                    .position(sensors.get(i).getLatLng())
                    .title(sensors.get(i).getName())
                    .icon(sensors.get(i).hasUid() ? active_icon : disabled_icon)
                    .snippet(sensors.get(i).getUid())));
    }

}
 
开发者ID:caribewave,项目名称:android-app,代码行数:36,代码来源:MainActivity.java

示例12: updateVectorials

import com.mapbox.mapboxsdk.annotations.IconFactory; //导入依赖的package包/类
public void updateVectorials(Set<Way> ways, TreeSet<Double> levels) {
    for (Way way : ways) {
        mapboxMap.addPolyline(way.getPolylineOptions());
        for (PoiNodeRef poiNodeRef : way.getPoiNodeRefs()) {
            WayMarkerOptions wayMarkerOptions = new WayMarkerOptions().position(poiNodeRef.getPosition())
                    .poiNodeRef(poiNodeRef)
                    .icon(IconFactory.getInstance(getActivity()).fromBitmap(bitmapHandler.getNodeRefBitmap(PoiNodeRef.State.NONE)));
            addWayMarker(wayMarkerOptions);
            markersNodeRef.put(poiNodeRef.getId(), wayMarkerOptions);
            polylinesWays.put(poiNodeRef.getId(), way.getPolylineOptions());
        }
    }
}
 
开发者ID:jawg,项目名称:osm-contributor,代码行数:14,代码来源:MapFragment.java

示例13: setIcon

import com.mapbox.mapboxsdk.annotations.IconFactory; //导入依赖的package包/类
private void setIcon(LocationMarkerViewOptions markerOptions, Object relatedObject, boolean selected) {
    Bitmap bitmap;
    if (relatedObject instanceof Poi) {
        Poi poi = (Poi) relatedObject;
        bitmap = mapFragment.getBitmapHandler().getMarkerBitmap(poi.getType(), Poi.computeState(selected, false, poi.getUpdated()));
    } else {
        Note note = (Note) relatedObject;
        bitmap = mapFragment.getBitmapHandler().getNoteBitmap(Note.computeState(note, selected, false));
    }

    if (bitmap != null) {
        markerOptions.icon(IconFactory.getInstance(mapFragment.getActivity()).fromBitmap(bitmap));
    }
}
 
开发者ID:jawg,项目名称:osm-contributor,代码行数:15,代码来源:MapFragmentPresenter.java

示例14: onPoiMarkerClick

import com.mapbox.mapboxsdk.annotations.IconFactory; //导入依赖的package包/类
/**
 * Click on POI
 * @param marker
 */
void onPoiMarkerClick(LocationMarkerView<Poi> marker) {
    Bitmap bitmap = mapFragment.getBitmapHandler().getMarkerBitmap(marker.getRelatedObject().getType(), Poi.computeState(true, false, false));
    if (bitmap != null) {
        marker.setIcon(IconFactory.getInstance(mapFragment.getActivity()).fromBitmap(bitmap));
    }
    mapFragment.switchMode(MapMode.DETAIL_POI);
    mapFragment.changeMapPositionSmooth(marker.getPosition());
    mapFragment.setMarkerSelectedId(-1L);
}
 
开发者ID:jawg,项目名称:osm-contributor,代码行数:14,代码来源:MapboxListener.java

示例15: onNoteMarkerClick

import com.mapbox.mapboxsdk.annotations.IconFactory; //导入依赖的package包/类
/**
 * Click on Note
 * @param marker
 */
private void onNoteMarkerClick(LocationMarkerView<Note> marker) {
    Bitmap bitmap = mapFragment.getBitmapHandler().getNoteBitmap(
            Note.computeState(marker.getRelatedObject(), true, false));
    if (bitmap != null) {
        marker.setIcon(IconFactory.getInstance(mapFragment.getActivity()).fromBitmap(bitmap));
    }

    mapFragment.switchMode(MapMode.DETAIL_NOTE);
    mapFragment.changeMapPositionSmooth(marker.getPosition());
    mapFragment.setMarkerSelectedId(-1L);
}
 
开发者ID:jawg,项目名称:osm-contributor,代码行数:16,代码来源:MapboxListener.java


注:本文中的com.mapbox.mapboxsdk.annotations.IconFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。