• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Marker类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onOpen

import com.mapbox.mapboxsdk.overlay.Marker; //导入依赖的package包/类
@Override
public void onOpen(Marker overlayItem) {
    title = overlayItem.getTitle();
    ref = overlayItem.getDescription();

    // Check string's length and if longer then 25 characters, we shorten
    if(title.length() > 25){
        shortTitle = title.substring(0,24)+"...";
        ((TextView) mView.findViewById(R.id.title)).setText(shortTitle);
    }else ((TextView) mView.findViewById(R.id.title)).setText(title);

    if(ref.length() > 25){
        shortRef = ref.substring(0,24)+"...";
        ((TextView) mView.findViewById(R.id.ref)).setText(shortRef);
    } else ((TextView) mView.findViewById(R.id.ref)).setText(ref);



}
 
开发者ID:cammace,项目名称:iGuide,代码行数:20,代码来源:CampusIssueInfoWindow.java


示例2: createMiddleMarker

import com.mapbox.mapboxsdk.overlay.Marker; //导入依赖的package包/类
protected void createMiddleMarker(Vertex left, Vertex right) {
  if (left.equals(right) || left == null || right == null) {
    return;
  }

  LatLng middle = this.getMiddleLatLng(left.getPoint(), right.getPoint());
  Marker marker = this.createMarker(middle, this.vertexMiddleImage);

  Vertex vertex = new Vertex(left.getOwner(), marker);
  vertex.setGhost(true);

  this.vertices.add(vertex);

  left.setMiddleRight(vertex);
  right.setMiddleLeft(vertex);
}
 
开发者ID:affinitybridge,项目名称:cordova-mapbox-android-sdk,代码行数:17,代码来源:Builder.java


示例3: createMarker

import com.mapbox.mapboxsdk.overlay.Marker; //导入依赖的package包/类
final public Marker createMarker(LatLng latLng, Drawable image) {
  Marker marker = new Marker("", "", latLng);

  if (image != null) {
    marker.setHotspot(Marker.HotspotPlace.CENTER);
    marker.setAnchor(new PointF(0.5f, 0.5f));
    marker.setMarker(image);
  } else {
    marker.setIcon(new Icon(this.mapView.getContext(), Icon.Size.SMALL, "", "0000FF"));
  }

  this.markers.add(marker);

  this.markerOverlay.addItem(marker);
  marker.addTo(mapView);

  this.mapView.invalidate();

  return marker;
}
 
开发者ID:affinitybridge,项目名称:cordova-mapbox-android-sdk,代码行数:21,代码来源:Builder.java


示例4: selectMarker

import com.mapbox.mapboxsdk.overlay.Marker; //导入依赖的package包/类
/**
 * Select a marker, showing a tooltip if the marker has content that would appear within it.
 */
public void selectMarker(final Marker marker) {
    InfoWindow toolTip = marker.getToolTip(MapView.this);

    if (mMapViewListener != null) {
        mMapViewListener.onTapMarker(MapView.this, marker);
    }
    closeCurrentTooltip();
    if (toolTip != currentTooltip && marker.hasContent()) {
        if (mMapViewListener != null) {
            mMapViewListener.onShowMarker(MapView.this, marker);
        }
        currentTooltip = toolTip;
        marker.showBubble(currentTooltip, MapView.this, true);
    }
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:19,代码来源:MapView.java


示例5: onOpen

import com.mapbox.mapboxsdk.overlay.Marker; //导入依赖的package包/类
/**
 * Constructs the view that is displayed when the InfoWindow opens.
 * This retrieves data from overlayItem and shows it in the tooltip.
 *
 * @param overlayItem the tapped overlay item
 */
public void onOpen(Marker overlayItem) {
    String title = overlayItem.getTitle();
    ((TextView) mView.findViewById(mTitleId /*R.id.title*/)).setText(title);
    String snippet = overlayItem.getDescription();
    ((TextView) mView.findViewById(mDescriptionId /*R.id.description*/)).setText(snippet);

    //handle sub-description, hiding or showing the text view:
    TextView subDescText = (TextView) mView.findViewById(mSubDescriptionId);
    String subDesc = overlayItem.getSubDescription();
    if ("".equals(subDesc)) {
        subDescText.setVisibility(View.GONE);
    } else {
        subDescText.setText(subDesc);
        subDescText.setVisibility(View.VISIBLE);
    }
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:23,代码来源:InfoWindow.java


示例6: addMarker

import com.mapbox.mapboxsdk.overlay.Marker; //导入依赖的package包/类
/**
 * Adds a marker to the default marker overlay.
 *
 * @param marker the marker object to be added
 * @return the marker object
 */
public Marker addMarker(final Marker marker) {
    if (firstMarker) {
        defaultMarkerList.add(marker);
        setDefaultItemizedOverlay();
    } else {
        if (!getOverlays().contains(defaultMarkerOverlay)) {
            addItemizedOverlay(defaultMarkerOverlay);
        }
        defaultMarkerOverlay.addItem(marker);
    }
    marker.addTo(this);

    firstMarker = false;
    invalidate();
    return marker;
}
 
开发者ID:posm,项目名称:OpenMapKitAndroid,代码行数:23,代码来源:MapView.java


示例7: addOSMMarker

import com.mapbox.mapboxsdk.overlay.Marker; //导入依赖的package包/类
public Marker addOSMMarker(OSMOverlay osmOverlay, Marker marker) {
    if (firstMarker) {
        defaultMarkerList.add(marker);
        setDefaultOSMItemizedOverlay(osmOverlay);
    } else {
        if (!getOverlays().contains(defaultMarkerOverlay)) {
            addItemizedOverlay(defaultMarkerOverlay);
        }
        defaultMarkerOverlay.addItem(marker);
    }
    marker.addTo(this);

    firstMarker = false;
    invalidate();
    return marker;
}
 
开发者ID:posm,项目名称:OpenMapKitAndroid,代码行数:17,代码来源:MapView.java


示例8: selectMarker

import com.mapbox.mapboxsdk.overlay.Marker; //导入依赖的package包/类
/**
 * Select a marker, showing a tooltip if display_bubble is set to true and
 * the marker has content that would appear within it.
 */
public void selectMarker(final Marker marker, final boolean displayBubble) {
    InfoWindow toolTip = marker.getToolTip(MapView.this);

    if (mMapViewListener != null) {
        mMapViewListener.onTapMarker(MapView.this, marker);
    }
    closeCurrentTooltip();
    if (toolTip != currentTooltip && marker.hasContent()) {
        if (mMapViewListener != null) {
            mMapViewListener.onShowMarker(MapView.this, marker);
        }
        currentTooltip = toolTip;
        if (mShouldDisplayBubble && displayBubble) {
            marker.showBubble(currentTooltip, MapView.this, true);
        }
    }
}
 
开发者ID:posm,项目名称:OpenMapKitAndroid,代码行数:22,代码来源:MapView.java


示例9: setDefaultOSMItemizedOverlay

import com.mapbox.mapboxsdk.overlay.Marker; //导入依赖的package包/类
public void setDefaultOSMItemizedOverlay(OSMOverlay osmOverlay) {
    defaultMarkerOverlay = new OSMItemizedIconOverlay(osmOverlay, getContext(), defaultMarkerList,
            new ItemizedIconOverlay.OnItemGestureListener<Marker>() {
                public boolean onItemSingleTapUp(final int index, final Marker item) {
                    selectMarker(item);
                    return true;
                }

                public boolean onItemLongPress(final int index, final Marker item) {
                    if (mMapViewListener != null) {
                        mMapViewListener.onLongPressMarker(MapView.this, item);
                    }
                    return true;
                }
            }
    );
    addListener(defaultMarkerOverlay);
    defaultMarkerOverlay.setClusteringEnabled(mIsClusteringEnabled, mOnDrawClusterListener, mMinZoomForClustering);
    addItemizedOverlay(defaultMarkerOverlay);
}
 
开发者ID:posm,项目名称:OpenMapKitAndroid,代码行数:21,代码来源:MapView.java


示例10: onOpen

import com.mapbox.mapboxsdk.overlay.Marker; //导入依赖的package包/类
@Override
public void onOpen(Marker overlayItem) {
    title = overlayItem.getTitle();
    ref = overlayItem.getDescription();
    ((TextView) mView.findViewById(R.id.title)).setText(title);
    ((TextView) mView.findViewById(R.id.ref)).setText(ref);
}
 
开发者ID:cammace,项目名称:iGuide,代码行数:8,代码来源:CustomInfoWindow.java


示例11: select

import com.mapbox.mapboxsdk.overlay.Marker; //导入依赖的package包/类
protected void select(int index, Vertex vertex) {
  this.deselect();
  this.selected = index;

  GeometryInterface geometry = vertex.getOwner();

  Log.d("Builder", String.format("select() vertex.isGhost() ? %b.", vertex.isGhost()));
  // Promote middle vertex to real vertex.

  if (vertex.isGhost()) { // && geometry.insertLatLng(insertPos, vertex.getPoint())) {
    int insertPos = geometry.indexOfLatLng(vertex.getNext().getPoint());
    geometry.insertLatLng(insertPos, vertex.getPoint());
    vertex.setGhost(false);

    updatePrevNext(vertex.getPrev(), vertex);
    updatePrevNext(vertex, vertex.getNext());

    createMiddleMarker(vertex.getPrev(), vertex);
    createMiddleMarker(vertex, vertex.getNext());

    geometry.reset();
  }

  if (this.vertexSelectedImage != null) {
    vertex.getMarker().setHotspot(Marker.HotspotPlace.CENTER);
    vertex.getMarker().setMarker(this.vertexSelectedImage);
  } else {
    vertex.getMarker().setIcon(new Icon(this.mapView.getContext(), Icon.Size.SMALL, "", "FF0000"));
  }

  Log.d("Builder", String.format("select() this.selected: %d", this.selected));
}
 
开发者ID:affinitybridge,项目名称:cordova-mapbox-android-sdk,代码行数:33,代码来源:Builder.java


示例12: deselect

import com.mapbox.mapboxsdk.overlay.Marker; //导入依赖的package包/类
protected void deselect() {
  if (this.selected < 0) {
    return;
  }
  Vertex vertex = this.vertices.get(this.selected);

  if (this.vertexImage != null) {
    vertex.getMarker().setHotspot(Marker.HotspotPlace.CENTER);
    vertex.getMarker().setMarker(this.vertexImage);
  } else {
    vertex.getMarker().setIcon(new Icon(this.mapView.getContext(), Icon.Size.SMALL, "", "0000FF"));
  }

  this.selected = -1;
}
 
开发者ID:affinitybridge,项目名称:cordova-mapbox-android-sdk,代码行数:16,代码来源:Builder.java


示例13: initMarkers

import com.mapbox.mapboxsdk.overlay.Marker; //导入依赖的package包/类
protected void initMarkers(GeometryInterface geometry, ArrayList<LatLng> latLngs) {
  ArrayList<Vertex> newVertices = new ArrayList<Vertex>();

  if (this.startFeature(geometry)) {
    // Initialize markers for all vertices.
    for (LatLng latLng : latLngs) {
      if (geometry.addLatLng(latLng)) {
        Marker marker = this.createMarker(latLng, this.vertexImage);
        Vertex vertex = new Vertex(geometry, marker);
        newVertices.add(vertex);
      }
    }

    // Add all new vertices to main collection.
    this.vertices.addAll(newVertices);

    // Initialize middle markers.
    Vertex left, right;
    int length = latLngs.size();
    for (int i = 0, j = length - 1; i < length; j = i++) {
      left = newVertices.get(j);
      right = newVertices.get(i);
      this.createMiddleMarker(left, right);
      this.updatePrevNext(left, right);
    }
    this.stopFeature();
  }
}
 
开发者ID:affinitybridge,项目名称:cordova-mapbox-android-sdk,代码行数:29,代码来源:Builder.java


示例14: addLatLng

import com.mapbox.mapboxsdk.overlay.Marker; //导入依赖的package包/类
final public void addLatLng(GeometryInterface geometry, LatLng position) {
  if (geometry.addLatLng(position)) {
    Marker marker = this.createMarker(position, this.vertexImage);
    Vertex vertex = new Vertex(geometry, marker);
    this.vertices.add(vertex);

    if (geometry.size() > 1 && this.lastAdded != null) {
      this.createMiddleMarker(this.lastAdded, vertex);
      this.updatePrevNext(this.lastAdded, vertex);
    }

    this.lastAdded = vertex;
  }
}
 
开发者ID:affinitybridge,项目名称:cordova-mapbox-android-sdk,代码行数:15,代码来源:Builder.java


示例15: removePoint

import com.mapbox.mapboxsdk.overlay.Marker; //导入依赖的package包/类
final public void removePoint(int index) {
  if (index < 0) {
    return;
  }

  // Calling this.deselect() is necessary as removing the vertex and marker will shift
  // subsequent indices in this.vertices & this.markers.
  this.deselect();

  Vertex vertex = this.vertices.remove(index);
  Marker marker = this.markers.remove(index);

  updatePrevNext(vertex.getPrev(), vertex.getNext());
  createMiddleMarker(vertex.getPrev(), vertex.getNext());

  Vertex middleLeft = vertex.getMiddleLeft();
  Vertex middleRight = vertex.getMiddleRight();

  if (middleLeft != null) {
    this.markerOverlay.removeItem(middleLeft.getMarker());
  }
  if (middleRight != null) {
    this.markerOverlay.removeItem(middleRight.getMarker());
  }

  this.markerOverlay.removeItem(marker);

  GeometryInterface geometry = vertex.getOwner();
  geometry.remove(marker.getPoint());

  if (this.lastAdded == vertex) {
    this.lastAdded = vertex.getPrev();
  }

  marker.getDrawable().invalidateSelf();
  mapView.invalidate();
}
 
开发者ID:affinitybridge,项目名称:cordova-mapbox-android-sdk,代码行数:38,代码来源:Builder.java


示例16: addMarker

import com.mapbox.mapboxsdk.overlay.Marker; //导入依赖的package包/类
/**
 * Adds a marker to the default marker overlay.
 *
 * @param marker the marker object to be added
 * @return the marker object
 */
public Marker addMarker(final Marker marker) {
    if (firstMarker) {
        defaultMarkerList.add(marker);
        setDefaultItemizedOverlay();
    } else {
        defaultMarkerOverlay.addItem(marker);
    }
    marker.addTo(this);
    firstMarker = false;
    return marker;
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:18,代码来源:MapView.java


示例17: open

import com.mapbox.mapboxsdk.overlay.Marker; //导入依赖的package包/类
/**
 * open the window at the specified position.
 *
 * @param object the graphical object on which is hooked the view
 * @param position to place the window on the map
 * @param offsetX (&offsetY) the offset of the view to the position, in pixels.
 * This allows to offset the view from the object position.
 * @return this infowindow
 */
public InfoWindow open(Marker object, LatLng position, int offsetX, int offsetY) {
    onOpen(object);
    MapView.LayoutParams lp = new MapView.LayoutParams(MapView.LayoutParams.WRAP_CONTENT,
            MapView.LayoutParams.WRAP_CONTENT, position, MapView.LayoutParams.BOTTOM_CENTER,
            offsetX, offsetY);
    close(); //if it was already opened
    mMapView.addView(mView, lp);
    mIsVisible = true;
    return this;
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:20,代码来源:InfoWindow.java


示例18: addMarkers

import com.mapbox.mapboxsdk.overlay.Marker; //导入依赖的package包/类
public void addMarkers(final List<Marker> markers) {
    if (firstMarker) {
        defaultMarkerList.addAll(markers);
        setDefaultItemizedOverlay();
    } else {
        if (!getOverlays().contains(defaultMarkerOverlay)) {
            addItemizedOverlay(defaultMarkerOverlay);
        }
        defaultMarkerOverlay.addItems(markers);
    }
    for (Marker marker : markers) {
        marker.addTo(this);
    }
    firstMarker = false;
}
 
开发者ID:posm,项目名称:OpenMapKitAndroid,代码行数:16,代码来源:MapView.java


示例19: onTapMarker

import com.mapbox.mapboxsdk.overlay.Marker; //导入依赖的package包/类
/**
 * When the user selects a marker on the map, we want to pan
 * the map to where the marker is for selection.
 *
 * @param pMapView the map
 * @param pMarker  the marker
 */
@Override
public void onTapMarker(MapView pMapView, Marker pMarker) {
    LatLng latLng = pMarker.getPoint();
    pMapView.getController().animateTo(latLng);
    OSMNode node = ((OSMMarker)pMarker).getNode();
    OSMElement.deselectAll();
    node.select();
    if (OSMElement.hasSelectedElementsChanged() && selectionListener != null) {
        selectionListener.selectedElementsChanged(OSMElement.getSelectedElements());
    }
}
 
开发者ID:posm,项目名称:OpenMapKitAndroid,代码行数:19,代码来源:OSMMap.java


示例20: addNode

import com.mapbox.mapboxsdk.overlay.Marker; //导入依赖的package包/类
public OSMNode addNode(OSMNode node) {
    Marker marker = node.getMarker();
    if (marker != null) {
        marker.setVisibility(true);
    }
    jtsModel.addOSMStandaloneNode(node);
    mapView.invalidate();
    return node;
}
 
开发者ID:posm,项目名称:OpenMapKitAndroid,代码行数:10,代码来源:OSMMap.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DOMCache类代码示例发布时间:2022-05-23
下一篇:
Java GradleProject类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap