当前位置: 首页>>代码示例>>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;未经允许,请勿转载。