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


Java Marker類代碼示例

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


Marker類屬於com.google.android.gms.maps.model包,在下文中一共展示了Marker類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showMarkers

import com.google.android.gms.maps.model.Marker; //導入依賴的package包/類
private void showMarkers() {
  googleMap.clear();
  Observable
      .fromIterable(currentDevices)
      .subscribe(device -> {
        Location center = GeoHash.fromString(device.getGeoHash()).getCenter();
        Marker marker = googleMap.addMarker(new MarkerOptions()
            .position(new LatLng(center.getLatitude(), center.getLongitude()))
            .icon(BitmapDescriptorFactory.fromResource(R.mipmap.ic_launcher))
            .flat(true)
            .title(device.getName())
            .snippet(device.getAddress())
        );
        Bitmap bitmap = Device.getBitmapImage(device.getImage(), getResources());
        Bitmap bmp = Bitmap.createScaledBitmap(bitmap, markerSize, markerSize, false);
        bitmap.recycle();
        marker.setIcon(BitmapDescriptorFactory.fromBitmap(bmp));
      });
}
 
開發者ID:drfonfon,項目名稱:ITagAntiLost,代碼行數:20,代碼來源:DevicesActivity.java

示例2: getInfoContents

import com.google.android.gms.maps.model.Marker; //導入依賴的package包/類
@Override
public View getInfoContents(Marker marker) {
    Gson gson = new Gson();
    Station station = gson.fromJson(marker.getTitle(), Station.class);
    titleTextView = (TextView) customView.findViewById(R.id.nameTextView);
    addressTextView = (TextView) customView.findViewById(R.id.streetTextView);

    totalTextView = (TextView) customView.findViewById(R.id.totalTextView);
    freeTextView = (TextView) customView.findViewById(R.id.freeTextView);
    engagedTextView = (TextView) customView.findViewById(R.id.engagedTextView);

    if (station != null) {
        titleTextView.setText(station.getNumberStation() + " " + station.getNombre());
        addressTextView.setText(station.getAddress());

        totalTextView.setText(activity.getString(R.string.bases) + "\n" + Integer.parseInt(station.getNumberBases()));
        freeTextView.setText(activity.getString(R.string.bases_free) + "\n" + Integer.parseInt(station.getBasesFree()));
        engagedTextView.setText(activity.getString(R.string.bases_engaged) + "\n" + Integer.parseInt(station.getBikeEngaged()));

        return customView;
    } else {
        return null;
    }
}
 
開發者ID:Mun0n,項目名稱:MADBike,代碼行數:25,代碼來源:BubbleAdapter.java

示例3: testIssueMarkerAdded

import com.google.android.gms.maps.model.Marker; //導入依賴的package包/類
@Test
public void testIssueMarkerAdded() throws MapNotLoadedException {
    Issue issueMock = getIssueMock();
    Marker markerMock = getMarkerMock();
    assertThat(mMap.isMapLoaded(), is(false));
    assertThat(mMap.getMarkers(), is(nullValue()));
    try {
        mMap.addIssueMarker(issueMock);
        fail("Trying to addItem issue when map is not present!");
    } catch (MapNotLoadedException ignore) {}
    mMap.onMapReady(mGoogleMap);
    when(mMap.isMapReady()).thenReturn(true);
    mMap.addIssueMarker(issueMock);
    assertThat(mMap.isMapLoaded(), is(true));
    assertThat(mMap.getMarkers(), is(not(nullValue())));
    IssueMarker marker = mMap.getMarkers().get(ISSUE_MOCK_ID.toUpperCase());
    marker.render(markerMock, mock(ClusterManager.class));
    assertThat(marker, is(instanceOf(IssueMarker.class)));
    assertThat(marker.getIssue(), is(sameInstance(issueMock)));
    assertThat(marker.getPosition(), is(markerMock.getPosition()));
    assertThat(marker.isRendered(), is(true));
    assertThat(markerMock.isVisible(), is(true));
}
 
開發者ID:ArnauBlanch,項目名稱:civify-app,代碼行數:24,代碼來源:CivifyMapTest.java

示例4: settaMarkersGiaPresenti

import com.google.android.gms.maps.model.Marker; //導入依賴的package包/類
/**
 * Imposta un marker per ogni parcheggio già presente in zona
 */
void settaMarkersGiaPresenti() {
    // rimuovi tutti i markers
    for(Marker m : mMarkerListPresenti)
        m.remove();
    mMarkerListPresenti.clear();

    // aggiungi un marker per ogni posizione
    for (Parcheggio p : ElencoParcheggi.getInstance().getListParcheggi()) {
        LatLng coordParcheggio = p.getCoordinate();

        Marker marker = mMappa.addMarker(new MarkerOptions()
                .position(coordParcheggio)
                .title(p.getIndirizzo())
                .icon(BitmapDescriptorFactory.defaultMarker(138)));

        // Associo al marker un tag che corrisponde al parcheggio in questo modo posso
        // poi eliminarlo direttamente
        marker.setTag(p);

        mMarkerListPresenti.add(marker);
    }
    mMainActivity.modificaTxtMarkerPresenti(ElencoParcheggi.getInstance().getListParcheggi().size());
}
 
開發者ID:IelloDevTeam,項目名稱:IelloAndroidAdminApp,代碼行數:27,代碼來源:MappaGoogle.java

示例5: removeSpawnPoint

import com.google.android.gms.maps.model.Marker; //導入依賴的package包/類
public static void removeSpawnPoint(final Context context, final Marker marker) {
    //Put up the Yes/No message box
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder
            .setTitle("Remove Pokemon spawn marker?")
            .setMessage("Are you sure?")
            .setIcon(android.R.drawable.ic_dialog_alert)
            .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    //Yes button clicked, do something
                    marker.remove();
                    mSpawnPoints.remove(marker);
                    removeSpawnPointFromDb(context, marker);

                }
            })
            .setNegativeButton("No", null)						//Do nothing on no
            .show();

}
 
開發者ID:kav0rka,項目名稱:VennTracker,代碼行數:21,代碼來源:SpawnLocation.java

示例6: getInfoContents

import com.google.android.gms.maps.model.Marker; //導入依賴的package包/類
/**
 * Método de Pop-up de cada marker
 * @param marker
 * @return markerView
 */
@Override
public View getInfoContents(Marker marker) {

    TextView tvLocality = (TextView) this.markerView.findViewById(R.id.tv_locality);
    TextView tvLat = (TextView) this.markerView.findViewById(R.id.tv_lat);
    TextView tvLng = (TextView) this.markerView.findViewById(R.id.tv_lng);
    TextView tvSnippet = (TextView) this.markerView.findViewById(R.id.tv_snippet);

    LatLng location = marker.getPosition();
    tvLocality.setText(marker.getTitle());
    tvLat.setText("Latitude: " + location.latitude);
    tvLng.setText("Longitude: " + location.longitude);
    tvSnippet.setText(marker.getTitle());

    return this.markerView;
}
 
開發者ID:gabriel-silva,項目名稱:MapaDeIgarassu,代碼行數:22,代碼來源:GoogleInfoWindowAdapter.java

示例7: onMarkerClick

import com.google.android.gms.maps.model.Marker; //導入依賴的package包/類
@Override
public boolean onMarkerClick(Marker marker) {
    Object markerTag = marker.getTag();
    if (markerTag instanceof Cluster) {
        //noinspection unchecked
        Cluster<T> cluster = (Cluster<T>) marker.getTag();
        //noinspection ConstantConditions
        List<T> clusterItems = cluster.getItems();

        if (mCallbacks != null) {
            if (clusterItems.size() > 1) {
                return mCallbacks.onClusterClick(cluster);
            } else {
                return mCallbacks.onClusterItemClick(clusterItems.get(0));
            }
        }
    }

    return false;
}
 
開發者ID:sharewire,項目名稱:google-maps-clustering,代碼行數:21,代碼來源:ClusterRenderer.java

示例8: drawNext

import com.google.android.gms.maps.model.Marker; //導入依賴的package包/類
public Marker drawNext() {

        MarkerOptions options = new MarkerOptions();

        if (isFirstPop) {

            options.position(path.getFirst().getStart());
            options.icon(firstNodeIcon);
            isFirstPop = false;
        } else {
            last = path.pop();
            options.position(last.getEnd());

            if (path.size() == 0) {
                options.icon(lastNodeIcon);
            } else {
                options.icon(middleNodeIcon);
            }
        }

        return map.addMarker(options);
    }
 
開發者ID:Augugrumi,項目名稱:SpaceRace,代碼行數:23,代碼來源:PathDrawer.java

示例9: onInfoWindowClick

import com.google.android.gms.maps.model.Marker; //導入依賴的package包/類
@Override
public void onInfoWindowClick(final Marker marker) {
    final Memory memory = mMemories.get(marker.getId());
    String[] actions  = {"Delete"};
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(memory.city+", "+memory.country)
            .setItems(actions, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    if (which == 0){
                        marker.remove();
                        mDataSource.deleteMemory(memory);
                    }
                }
            });

    builder.create().show();
}
 
開發者ID:PacktPublishing,項目名稱:Android-Wear-Projects,代碼行數:19,代碼來源:MapsActivity.java

示例10: getInfoContents

import com.google.android.gms.maps.model.Marker; //導入依賴的package包/類
@Override
    public View getInfoContents(Marker marker)
    {
        if (balloon == null)
            return null;
        
        if (balloonMarker == null || ! balloonMarker.equals(marker))
            return null;
        
//        final FrameLayout view = new FrameLayout(getActivity());
        final RMBTBalloonOverlayView bv = new RMBTBalloonOverlayView(getActivity());
        final View view = bv.setupView(getActivity(), null);
        bv.setBalloonData(balloon, null);
//        view.addView(bv);
        return view;
    }
 
開發者ID:rtr-nettest,項目名稱:open-rmbt,代碼行數:17,代碼來源:RMBTMapFragment.java

示例11: removeMarker

import com.google.android.gms.maps.model.Marker; //導入依賴的package包/類
/**
 * Removes the given marker from the map layout
 *
 * @param marker marker to remove
 * @return true if marker has been removed, false if it has not been found
 */
public boolean removeMarker(Marker marker) {
    synchronized (customMarkersMap) {
        if (customMarkersMap.containsValue(marker)){
            Iterator<com.ubudu.gmaps.model.Marker> iterator = customMarkersMap.keySet().iterator();
            while(iterator.hasNext()) {
                com.ubudu.gmaps.model.Marker m = iterator.next();
                Marker googleMarker = customMarkersMap.get(m);
                if(googleMarker.equals(marker)) {
                    googleMarker.remove();
                    iterator.remove();
                    return true;
                }
            }
        }
    }
    return false;
}
 
開發者ID:Ubudu,項目名稱:GoogleMapsLayout-Android,代碼行數:24,代碼來源:MapLayout.java

示例12: getMarkersWithTags

import com.google.android.gms.maps.model.Marker; //導入依賴的package包/類
/**
 *
 * @param tags tags to look for
 * @return markers matching the given tag
 */
private Map<com.ubudu.gmaps.model.Marker, Marker> getMarkersWithTags(List<String> tags){
    Map<com.ubudu.gmaps.model.Marker, Marker> result = new HashMap<>();
    synchronized (customMarkersMap) {
        for (com.ubudu.gmaps.model.Marker marker : customMarkersMap.keySet()) {
            boolean markerMatchesTags = true;
            for (String tag : tags) {
                if (!marker.getTags().contains(tag)) {
                    markerMatchesTags = false;
                    break;
                }
            }
            if (markerMatchesTags)
                result.put(marker, customMarkersMap.get(marker));
        }
    }
    return result;
}
 
開發者ID:Ubudu,項目名稱:GoogleMapsLayout-Android,代碼行數:23,代碼來源:MapLayout.java

示例13: setFloorElementsVisible

import com.google.android.gms.maps.model.Marker; //導入依賴的package包/類
/**
 * Change the visibility of all Markers and TileOverlays for a floor.
 */
private void setFloorElementsVisible(int floor, boolean visible) {
    // Overlays
    final TileOverlay overlay = mTileOverlays.get(floor);
    if (overlay != null) {
        overlay.setVisible(visible);
    }

    // Markers
    final ArrayList<Marker> markers = mMarkersFloor.get(floor);
    if (markers != null) {
        for (Marker m : markers) {
            m.setVisible(visible);
        }
    }
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:19,代碼來源:MapFragment.java

示例14: setMarker

import com.google.android.gms.maps.model.Marker; //導入依賴的package包/類
private Marker setMarker(User userData, LatLng currentUserLocation) {
    Marker marker;

    if (userData.getMapPhoto() != null) { // Set photo as icon if it's present
        Bitmap bitmap = PhotoFixer.makeCircle(userData.getMapPhoto());
        marker = googleMap.addMarker(new MarkerOptions()
                .position(currentUserLocation)
                .anchor(0.5f, 0.5f)
                .icon(BitmapDescriptorFactory.fromBitmap(bitmap)));
    } else { // Set default photo if it's not present
        marker = googleMap.addMarker(new MarkerOptions().position(currentUserLocation)
                .anchor(0.5f, 0.5f)
                .icon(BitmapDescriptorFactory.fromBitmap(Bitmap.createScaledBitmap(
                        BitmapFactory.decodeResource(getContext().getResources(),
                                R.mipmap.anonymous_user), 100, 100, false))));
    }
    return marker;
}
 
開發者ID:a-deda,項目名稱:share-location,代碼行數:19,代碼來源:MapFragment.java

示例15: onMapReady

import com.google.android.gms.maps.model.Marker; //導入依賴的package包/類
@Override
public void onMapReady(GoogleMap googleMap) {

    GoogleMapsModel.setMap(googleMap);

     /*Verificação de tipos de mapa*/
    if (Constants.MAP_TYPE_HYBRID == SharedPreferencesUtil.getTypeMaps(this)) {
        GoogleMapsModel.getMap().setMapType(Constants.MAP_TYPE_HYBRID);
    } else {
        GoogleMapsModel.getMap().setMapType(Constants.MAP_TYPE_NORMAL);
    }

    invokeAddMarkerMapOther.onAddMarkerFirebase(); //adicionando os marcados diretamente do firebase
    GoogleMapsModel.getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(Constants.CENTER_LOCATION, 16)); /*Centro do mapa*/
    /*Botões de Zoom*/
    GoogleMapsModel.getMap().getUiSettings().setZoomControlsEnabled(true);

    infoWindow();

     /*Listener de cada marker*/
    GoogleMapsModel.getMap().setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() {
        @Override
        public void onInfoWindowClick(Marker marker) {

            DataBaseUtil dataBaseUtil = new DataBaseUtil(context); /*Instância da base de dados local*/

            String name = marker.getTitle();
            LocationModel locationModel = dataBaseUtil.getLocation(name);

            if (name.equals(locationModel.getName())) {
                AlertDialogMessage alertDialogMessage = new AlertDialogMessage();
                alertDialogMessage.alertDialogMarker(context, locationModel.getId(),
                        locationModel.getName(), locationModel.getAddress(),
                        locationModel.getDescription(), locationModel.getLatitude(), locationModel.getLongitude());
            }
        }

    });

}
 
開發者ID:gabriel-silva,項目名稱:MapaDeIgarassuAdmin,代碼行數:41,代碼來源:HomeActivity.java


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