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


Java Icon类代码示例

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


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

示例1: updateSurroundingMarkers

import com.mapbox.mapboxsdk.annotations.Icon; //导入依赖的package包/类
private void updateSurroundingMarkers() {
    if (mMap != null && mSurroundingPlaces != null && !mSurroundingPlaces.isEmpty() && mSurroundingMarkers == null) {
        mLastIconSize = getResources().getDimensionPixelSize(R.dimen.marker_iconsize_normal);
        Icon circle = Utils.drawableToIcon(getActivity(), R.drawable.ic_marker, mLastIconSize);
        List<MarkerOptions> markers = new ArrayList<>();
        for (Place place : mSurroundingPlaces) {
            if (place.hasLocation()) {
                markers.add(new MarkerOptions()
                        .position(new LatLng(place.getLocation().getLatitude(), place.getLocation().getLongitude()))
                        .icon(circle)
                        .title(place.getName()));
            }
        }
        mSurroundingMarkers = mMap.addMarkers(markers);
        for (int i = 0; i < mSurroundingMarkers.size() && mSurroundingMarkers.size() == mSurroundingPlaces.size(); ++i) {
            mMarkerIdToPlaceId.put(mSurroundingMarkers.get(i).getId(), mSurroundingPlaces.get(i).getId());
        }
    }
}
 
开发者ID:Turistforeningen,项目名称:SjekkUT,代码行数:20,代码来源:MapFragment.java

示例2: ExtendedMarkerViewOptions

import com.mapbox.mapboxsdk.annotations.Icon; //导入依赖的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

示例3: writeToParcel

import com.mapbox.mapboxsdk.annotations.Icon; //导入依赖的package包/类
@Override
public void writeToParcel(Parcel out, int flags) {
    out.writeParcelable(getPosition(), flags);
    out.writeString(getSnippet());
    out.writeString(getTitle());
    out.writeByte((byte) (isFlat() ? 1 : 0));
    out.writeFloat(getAnchorU());
    out.writeFloat(getAnchorV());
    out.writeFloat(getInfoWindowAnchorU());
    out.writeFloat(getInfoWindowAnchorV());
    out.writeFloat(getRotation());
    out.writeByte((byte) (isVisible() ? 1 : 0));
    out.writeFloat(alpha);
    Icon icon = getIcon();
    out.writeByte((byte) (icon != null ? 1 : 0));
    if (icon != null) {
        out.writeString(getIcon().getId());
        out.writeParcelable(getIcon().getBitmap(), flags);
    }
    out.writeString(tag);
    out.writeInt(spotType);
}
 
开发者ID:Hitchwiki,项目名称:MyHitchhikingSpots-for-Android,代码行数:23,代码来源:ExtendedMarkerViewOptions.java

示例4: retrieveMapMarker

import com.mapbox.mapboxsdk.annotations.Icon; //导入依赖的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

示例5: drawableToIcon

import com.mapbox.mapboxsdk.annotations.Icon; //导入依赖的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

示例6: onBeforeClusterRendered

import com.mapbox.mapboxsdk.annotations.Icon; //导入依赖的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

示例7: resizeSurroundingMarkers

import com.mapbox.mapboxsdk.annotations.Icon; //导入依赖的package包/类
private void resizeSurroundingMarkers() {
    if (isAdded() && mMap != null && mSurroundingMarkers != null && mSurroundingMarkers.size() > 0) {
        int iconSize = calculateMarkerIconSize();
        if (iconSize != mLastIconSize) {
            Icon circle = Utils.drawableToIcon(getActivity(), R.drawable.ic_marker, iconSize);
            for (Marker marker : mSurroundingMarkers) {
                marker.setIcon(circle);
            }
            mLastIconSize = iconSize;
        }
    }
}
 
开发者ID:Turistforeningen,项目名称:SjekkUT,代码行数:13,代码来源:MapFragment.java

示例8: drawableToIcon

import com.mapbox.mapboxsdk.annotations.Icon; //导入依赖的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

示例9: getCameraIcon

import com.mapbox.mapboxsdk.annotations.Icon; //导入依赖的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

示例10: getGotARideIconForRoute

import com.mapbox.mapboxsdk.annotations.Icon; //导入依赖的package包/类
private Icon getGotARideIconForRoute(int routeIndex) {
    Icon i = ic_typeunknown_spot;

    if (routeIndex > -1) {
        int value = routeIndex;
        if (value < 5)
            value += 5;

        switch (value % 5) {
            case 0:
                i = ic_got_a_ride_spot0;
                break;
            case 1:
                i = ic_got_a_ride_spot1;
                break;
            case 2:
                i = ic_got_a_ride_spot2;
                break;
            case 3:
                i = ic_got_a_ride_spot3;
                break;
            case 4:
                i = ic_got_a_ride_spot4;
                break;
        }
    }

    return i;
}
 
开发者ID:Hitchwiki,项目名称:MyHitchhikingSpots-for-Android,代码行数:30,代码来源:MyMapsActivity.java

示例11: drawableToIcon

import com.mapbox.mapboxsdk.annotations.Icon; //导入依赖的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

示例12: resetStillMarkers

import com.mapbox.mapboxsdk.annotations.Icon; //导入依赖的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

示例13: dialogClose

import com.mapbox.mapboxsdk.annotations.Icon; //导入依赖的package包/类
public void dialogClose() {
  IconFactory mIconFactory = IconFactory.getInstance(this);
  Drawable mboundry = ContextCompat.getDrawable(this, R.drawable.boundary);
  final Icon Iboundry = mIconFactory.fromDrawable(mboundry);
  Drawable mboat = ContextCompat.getDrawable(this, R.drawable.pointarrow);
  Icon Iboat = mIconFactory.fromDrawable(mboat);

  //if (getBoatType() == true)
  {

    networkThread = new NetworkAsync().execute(); //launch networking asnyc task

  }
  //        else if (getBoatType() == false) {
  //            log.append("Simulated Boat");
  //            ipAddressBox.setText("Simulated Phone");
  //            simulatedBoat();
  //        } else {
  //            log.append("fail");
  //        }

  try {
    //boat2 = new Marker(currentBoat.getIpAddress().toString(), "Boat", new LatLng(pHollowStartingPoint.getLatitude(), pHollowStartingPoint.getLongitude()));


  } catch (Exception e) {

  }
}
 
开发者ID:platypusllc,项目名称:tablet,代码行数:30,代码来源:TeleOpPanel.java

示例14: addMarkers

import com.mapbox.mapboxsdk.annotations.Icon; //导入依赖的package包/类
private void addMarkers() {
  Icon lightningBoltIcon = IconFactory.getInstance(DirectionsMatrixApiActivity.this)
    .fromResource(R.drawable.lightning_bolt);
  for (Feature feature : featureCollection.getFeatures()) {
    mapboxMap.addMarker(new MarkerOptions()
      .position(new LatLng(feature.getProperty("Latitude").getAsDouble(),
        feature.getProperty("Longitude").getAsDouble()))
      .snippet(feature.getStringProperty("Station_Name"))
      .icon(lightningBoltIcon));
  }
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:12,代码来源:DirectionsMatrixApiActivity.java

示例15: onCreate

import com.mapbox.mapboxsdk.annotations.Icon; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  // Mapbox access token is configured here. This needs to be called either in your application
  // object or in the same activity which contains the mapview.
  Mapbox.getInstance(this, getString(R.string.access_token));

  // This contains the MapView in XML and needs to be called after the access token is configured.
  setContentView(R.layout.activity_annotation_custom_marker);

  mapView = (MapView) findViewById(R.id.mapView);
  mapView.onCreate(savedInstanceState);
  mapView.getMapAsync(new OnMapReadyCallback() {
    @Override
    public void onMapReady(MapboxMap mapboxMap) {

      // Create an Icon object for the marker to use
      Icon icon = IconFactory.getInstance(DrawCustomMarkerActivity.this).fromResource(R.drawable.purple_marker);

      // Add the custom icon marker to the map
      mapboxMap.addMarker(new MarkerOptions()
        .position(new LatLng(-33.8500000, 18.4158234))
        .title(getString(R.string.draw_custom_marker_options_title))
        .snippet(getString(R.string.draw_custom_marker_options_snippet))
        .icon(icon));
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:30,代码来源:DrawCustomMarkerActivity.java


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