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


Java MarkerOptions.position方法代码示例

本文整理汇总了Java中com.google.android.gms.maps.model.MarkerOptions.position方法的典型用法代码示例。如果您正苦于以下问题:Java MarkerOptions.position方法的具体用法?Java MarkerOptions.position怎么用?Java MarkerOptions.position使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.maps.model.MarkerOptions的用法示例。


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

示例1: addGateway

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
public void addGateway(Packet packet) {
    for (Gateway gateway : packet.getGateways()) {
        double gwLat = gateway.getLatitude();
        double gwLon = gateway.getLongitude();

        if (gwLat != 0 && gwLon != 0) {
            String gatewayId = gateway.getGatewayID();

            if (gatewaysWithMarkers.contains(gatewayId)) {
                //already has a marker for this gateway
            } else {
                MarkerOptions gwoptions = new MarkerOptions();
                gwoptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.gateway_dot));
                gwoptions.position(new LatLng(gwLat, gwLon));
                gwoptions.title(gatewayId);
                //gwoptions.snippet(gatewayId);
                gwoptions.anchor((float) 0.5, (float) 0.5);
                mMap.addMarker(gwoptions);

                gatewaysWithMarkers.add(gatewayId);
            }
        }
    }
}
 
开发者ID:jpmeijers,项目名称:ttnmapper_android_v2,代码行数:25,代码来源:MapsActivity.java

示例2: drawNext

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的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

示例3: ShowNearbyPlaces

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
private void ShowNearbyPlaces(List<HashMap<String, String>> nearbyPlacesList) {
    for (int i = 0; i < nearbyPlacesList.size(); i++) {
        Log.d("onPostExecute","Entered into showing locations");
        MarkerOptions markerOptions = new MarkerOptions();
        HashMap<String, String> googlePlace = nearbyPlacesList.get(i);
        double lat = Double.parseDouble(googlePlace.get("lat"));
        double lng = Double.parseDouble(googlePlace.get("lng"));
        String placeName = googlePlace.get("place_name");
        String vicinity = googlePlace.get("vicinity");
        LatLng latLng = new LatLng(lat, lng);
        markerOptions.position(latLng);
        markerOptions.title(placeName + " : " + vicinity);
        mMap.addMarker(markerOptions);
        markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED));
        //move map camera
        mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
        mMap.animateCamera(CameraUpdateFactory.zoomTo(11));
    }
}
 
开发者ID:LewisVo,项目名称:Overkill,代码行数:20,代码来源:GetNearbyPlacesData.java

示例4: onPostExecute

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
protected void onPostExecute(List<HashMap<String, String>> list) {
    googleMap.clear();

        for (int i = 0; i < list.size(); i++) {
            MarkerOptions markerOptions = new MarkerOptions();
            HashMap<String, String> googlePlace = list.get(i);
            double lat = Double.parseDouble(googlePlace.get("lat"));
            double lng = Double.parseDouble(googlePlace.get("lng"));
            String placeName = googlePlace.get("place_name");
            //String vicinity = googlePlace.get("vicinity");
            LatLng latLng = new LatLng(lat, lng);
            markerOptions.position(latLng);
            markerOptions.title(placeName);
            markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.custom_marker));
            googleMap.addMarker(markerOptions);
        }
    }
 
开发者ID:webianks,项目名称:Crimson,代码行数:19,代码来源:PlacesDisplayTask.java

示例5: PlacePinAndPositionCamera

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
public void PlacePinAndPositionCamera(LatLng addressPosition) {

        MarkerOptions markerOptions = new MarkerOptions();
        markerOptions.position(addressPosition);
        mMap.addMarker(markerOptions
                .title("Crisis Location").icon(BitmapDescriptorFactory
                        .defaultMarker(BitmapDescriptorFactory.HUE_RED)));
        mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(addressPosition, 12));
        LatLngBounds.Builder builder = new LatLngBounds.Builder();

        builder.include(addressPosition);

        LatLngBounds bounds = builder.build();

        int padding = 150; // offset from edges of the map in pixels
        CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, padding);

        mMap.animateCamera(cu);
    }
 
开发者ID:panzerama,项目名称:Dispatch,代码行数:20,代码来源:MainActivity.java

示例6: onLocationChanged

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onLocationChanged(Location location) {

  //place marker at current position
  //mGoogleMap.clear();
  if (currLocationMarker != null) {
    currLocationMarker.remove();
  }
  latLng = new LatLng(location.getLatitude(), location.getLongitude());
  MarkerOptions markerOptions = new MarkerOptions();
  markerOptions.position(latLng);
  markerOptions.title(getString(R.string.current_position));
  markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
  currLocationMarker = mGoogleMap.addMarker(markerOptions);

  //zoom to current position:
  CameraPosition cameraPosition = new CameraPosition.Builder()
    .target(latLng).zoom(14).build();

  mGoogleMap.animateCamera(CameraUpdateFactory
    .newCameraPosition(cameraPosition));

  mMocketClient.pushLatLngToServer(latLng);
}
 
开发者ID:Nishant-Pathak,项目名称:mocket_android_demo,代码行数:25,代码来源:MapsActivity.java

示例7: onMapReady

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
    //Inicializo el mapa
    MapsInitializer.initialize(getContext());
    mMap = googleMap;

    //Si tengo proyectos los muestro en el mapa
    if (proyecto.getCoordenadas().compareTo("") != 0) {
        String[] coordenadas = proyecto.getCoordenadas().split(",");
        double lat = Double.parseDouble(coordenadas[0]);
        double lon = Double.parseDouble(coordenadas[1]);
        posicionProyecto = new LatLng(lat, lon);
        MarkerOptions markerOptions = new MarkerOptions();
        markerOptions.title(proyecto.getNombre());
        //Pongo la descripción en el infowindow solo con 10 caracteres
        if (proyecto.getDescripcion().length() > 50)
            markerOptions.snippet(proyecto.getDescripcion().substring(0, 50));
        else
            markerOptions.snippet(proyecto.getDescripcion());
        markerOptions.position(posicionProyecto);
        mMap.addMarker(markerOptions);
    }

    // Movemos la camara a la posicion del usuario
    if (miPosicion != null)
        mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(miPosicion, 3));

}
 
开发者ID:nen155,项目名称:TFG-SmartU-La-red-social,代码行数:29,代码来源:FragmentMapaProyecto.java

示例8: onToggleAction

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
protected void onToggleAction() {
    if (shouldShow()) {
        for (final LatLng latLng : this.boatSpawns) {
            final MarkerOptions markerOptions = createMarkerOptions();
            markerOptions.position(latLng);
            this.boatMarkers.add(this.mapController.addMarker(markerOptions));
        }
    } else {
        for (final Marker marker : this.boatMarkers) {
            marker.remove();
        }
        this.boatMarkers.clear();
    }
}
 
开发者ID:ZafraniTechLLC,项目名称:Companion-For-PUBG-Android,代码行数:16,代码来源:BoatAction.java

示例9: addMarker

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
/**
 * Helper function.
 *
 * @param latLng position on {@link GoogleMap} to create a marker.
 * @return marker on map.
 */
@NonNull
private Marker addMarker(@NonNull final LatLng latLng) {
    final MarkerOptions options = createMarkerOptions();
    options.position(latLng);
    return this.mapController.addMarker(options);
}
 
开发者ID:ZafraniTechLLC,项目名称:Companion-For-PUBG-Android,代码行数:13,代码来源:DistanceAction.java

示例10: addMeasurementMarker

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
public void addMeasurementMarker(Packet packet) {
    createMarkerBitmaps(); //create markers if they do not exist

    MarkerOptions options = new MarkerOptions();
    double rssi = packet.getMaxRssi();
    if (rssi == 0) {
        options.icon(circleBlack);
    } else if (rssi < -120) {
        options.icon(circleBlue);
    } else if (rssi < -115) {
        options.icon(circleCyan);
    } else if (rssi < -110) {
        options.icon(circleGreen);
    } else if (rssi < -105) {
        options.icon(circleYellow);
    } else if (rssi < -100) {
        options.icon(circleOrange);
    } else {
        options.icon(circleRed);
    }
    options.position(new LatLng(packet.getLatitude(), packet.getLongitude()));
    options.anchor((float) 0.5, (float) 0.5);
    options.title("RSSI: " + packet.getMaxRssi() + "dBm\n" +
            "SNR: " + packet.getMaxSnr() + "dB\n" +
            "Gateways: " + packet.gateways.size());

    mMap.addMarker(options);
    markersOnMap.add(options); //save a list of markers used for auto zooming
}
 
开发者ID:jpmeijers,项目名称:ttnmapper_android_v2,代码行数:30,代码来源:MapsActivity.java

示例11: replaceMarker

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
/**
 * Adds a marker to the current position.
 */
private void replaceMarker(LatLng latLng) {
    // Remove the previous marker
    if (currentLocationMarker != null) {
        currentLocationMarker.remove();
    }
    MarkerOptions markerOptions = new MarkerOptions();
    markerOptions.position(latLng);
    // Add a marker indicating the user's current position to the Google Map
    currentLocationMarker = googleMap.addMarker(markerOptions);
}
 
开发者ID:thandomy,项目名称:foodie,代码行数:14,代码来源:HomeActivity.java

示例12: onLocationChanged

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onLocationChanged(Location location) {
    Log.d("onLocationChanged", "entered");

    mLastLocation = location;
    if (mCurrLocationMarker != null) {
        mCurrLocationMarker.remove();
    }

    //Place current location marker
    latitude = location.getLatitude();
    longitude = location.getLongitude();
    LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
    MarkerOptions markerOptions = new MarkerOptions();
    markerOptions.position(latLng);
    markerOptions.title("Current Position");
    markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
    mCurrLocationMarker = mMap.addMarker(markerOptions);

    //move map camera
    mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
    mMap.animateCamera(CameraUpdateFactory.zoomTo(18));

    Log.d("onLocationChanged", String.format("latitude:%.3f longitude:%.3f",latitude,longitude));

    //stop location updates
    if (mGoogleApiClient != null) {
        LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
        Log.d("onLocationChanged", "Removing Location Updates");
    }
    Log.d("onLocationChanged", "Exit");

}
 
开发者ID:LewisVo,项目名称:Overkill,代码行数:34,代码来源:ViewNearbyPlaces.java

示例13: onLocationChanged

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onLocationChanged(Location location) {
    Log.d("onLocationChanged", "entered");

    mLastLocation = location;
    if (mCurrLocationMarker != null) {
        mCurrLocationMarker.remove();
    }

    //Place current location marker
    latitude = location.getLatitude();
    longitude = location.getLongitude();
    LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
    MarkerOptions markerOptions = new MarkerOptions();
    markerOptions.position(latLng);
    markerOptions.title("Current Position");
    markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
    mCurrLocationMarker = mMap.addMarker(markerOptions);

    //move map camera
    mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
    mMap.animateCamera(CameraUpdateFactory.zoomTo(11));
    Toast.makeText(MapsActivity2.this,"Your Current Location", Toast.LENGTH_LONG).show();

    Log.d("onLocationChanged", String.format("latitude:%.3f longitude:%.3f",latitude,longitude));

    //stop location updates
    if (mGoogleApiClient != null) {
        LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
        Log.d("onLocationChanged", "Removing Location Updates");
    }
    Log.d("onLocationChanged", "Exit");

}
 
开发者ID:ayushghd,项目名称:iSPY,代码行数:35,代码来源:MapsActivity2.java

示例14: onLocationChanged

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onLocationChanged(Location location) {
    Log.d("onLocationChanged", "entered");

    mLastLocation = location;
    if (mCurrLocationMarker != null) {
        mCurrLocationMarker.remove();
    }

    //Place current location marker
    latitude = location.getLatitude();
    longitude = location.getLongitude();
    LatLng latLng = new LatLng(latitude1, longitude1);
    MarkerOptions markerOptions = new MarkerOptions();
    markerOptions.position(latLng);
    markerOptions.title("Current Position");
    markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
    mCurrLocationMarker = mMap.addMarker(markerOptions);

    //move map camera
    mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
    mMap.animateCamera(CameraUpdateFactory.zoomTo(11));
    Toast.makeText(MapsActivity3.this,"Your Current Location", Toast.LENGTH_LONG).show();

    Log.d("onLocationChanged", String.format("latitude:%.3f longitude:%.3f",latitude,longitude));

    //stop location updates
    if (mGoogleApiClient != null) {
        LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
        Log.d("onLocationChanged", "Removing Location Updates");
    }
    Log.d("onLocationChanged", "Exit");

}
 
开发者ID:ayushghd,项目名称:iSPY,代码行数:35,代码来源:MapsActivity3.java

示例15: addMarker

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
/**
 * Adds a marker to the map
 *
 * @param marker marker to be added
 *
 * @return true if marker has been successfully added, false otherwise
 */
public Marker addMarker(com.ubudu.gmaps.model.Marker marker){
    if(marker.getLocation()==null)
        return null;
    if(marker.getTitle()==null)
        marker.setTitle("");
    MarkerOptions markerOptions = marker.getMarkerOptionsStrategy().getNormalMarkerOptions();
    markerOptions.position(marker.getLocation());
    markerOptions.title(marker.getTitle());
    Marker customMarker = addMarkerToGoogleMap(markerOptions);
    if(customMarker!=null)
        customMarkersMap.put(marker,customMarker);
    return customMarker;
}
 
开发者ID:Ubudu,项目名称:GoogleMapsLayout-Android,代码行数:21,代码来源:MapLayout.java


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