com.google.android.gms.maps.model.MarkerOptions Java Examples

The following examples show how to use com.google.android.gms.maps.model.MarkerOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: PressureNet   Author: Cbsoftware   File: BarometerNetworkActivity.java    License: GNU General Public License v3.0 6 votes vote down vote up
private void displayTemperatureFrame(int frame) {
	temperatureAnimationStep = frame;
	Iterator<TemperatureForecast> temperatureIterator = forecastRecents
			.iterator();
	int num = 0;
	mMap.clear();
	while (temperatureIterator.hasNext()) {
		TemperatureForecast forecast = temperatureIterator.next();
		try {
			MarkerOptions markerOpts = temperatureAnimationMarkerOptions.get(num);
			if (forecast.getForecastHour() == frame) {
				mMap.addMarker(markerOpts);
			}
		} catch(IndexOutOfBoundsException ioobe) {
			// 
		}
		num++;
	}
	
	updateAnimationTime("left", activeForecastStartTime, frame);
	
}
 
Example #2
Source Project: FimiX8-RE   Author: wladimir-computin   File: GglMapAiLineManager.java    License: MIT License 6 votes vote down vote up
public void resetSmallMakerByMap(Marker marker1, Marker marker2, int n) {
    MapPointLatLng mpl1 = (MapPointLatLng) marker1.getTag();
    MapPointLatLng mpl2 = (MapPointLatLng) marker2.getTag();
    LatLng[] latLng = this.mapCalcAngle.getLineLatLngInterval(marker1.getPosition(), marker2.getPosition(), 3);
    mpl2.setAngle(getPointAngle(mpl1, mpl2));
    float[] angleArray = new float[]{mpl2.showAngle, mpl2.showAngle};
    for (int i = 0; i < latLng.length; i++) {
        MapPointLatLng mpl = new MapPointLatLng();
        mpl.isSelect = true;
        mpl.setAngle(angleArray[i]);
        Marker mMarker = this.googleMap.addMarker(new MarkerOptions().position(latLng[i]).icon(this.gdCustemMarkerView.createPointWithSmallArrow(this.context, R.drawable.x8_ai_line_point_small1, mpl.showAngle, true)).anchor(0.5f, 0.5f).draggable(false));
        mMarker.setTag(mpl);
        mMarker.setFlat(true);
        this.arrowMarkerList.add(n + i, mMarker);
    }
}
 
Example #3
Source Project: UberClone   Author: SimCoderYoutube   File: DriverMapActivity.java    License: MIT License 6 votes vote down vote up
private void getAssignedCustomerPickupLocation(){
    assignedCustomerPickupLocationRef = FirebaseDatabase.getInstance().getReference().child("customerRequest").child(customerId).child("l");
    assignedCustomerPickupLocationRefListener = assignedCustomerPickupLocationRef.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            if(dataSnapshot.exists() && !customerId.equals("")){
                List<Object> map = (List<Object>) dataSnapshot.getValue();
                double locationLat = 0;
                double locationLng = 0;
                if(map.get(0) != null){
                    locationLat = Double.parseDouble(map.get(0).toString());
                }
                if(map.get(1) != null){
                    locationLng = Double.parseDouble(map.get(1).toString());
                }
                pickupLatLng = new LatLng(locationLat,locationLng);
                pickupMarker = mMap.addMarker(new MarkerOptions().position(pickupLatLng).title("pickup location").icon(BitmapDescriptorFactory.fromResource(R.mipmap.ic_pickup)));
                getRouteToMarker(pickupLatLng);
            }
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {
        }
    });
}
 
Example #4
Source Project: FimiX8-RE   Author: wladimir-computin   File: GglMapAiPoint2PointManager.java    License: MIT License 6 votes vote down vote up
public void addPointLatLng(LatLng latLng, float distance, LatLng deviceLocation) {
    if (this.pointMarker == null) {
        this.mp = new MapPointLatLng();
        this.mp.altitude = 5.0f;
        if (StateManager.getInstance().getX8Drone().isConnect()) {
            int h = Math.round(StateManager.getInstance().getX8Drone().getHeight());
            if (h > 5) {
                this.mp.altitude = (float) h;
            }
        }
        this.pointMarker = this.googleMap.addMarker(new MarkerOptions().position(latLng).icon(new GglMapCustomMarkerView().createCustomMarkerViewForP2P(this.context, R.drawable.x8_img_ai_follow_point2, this.mp.altitude, this.mp.nPos)).anchor(0.5f, 0.9f).draggable(false));
        this.pointMarker.setDraggable(true);
        this.pointMarker.setTag(this.mp);
    } else {
        this.pointMarker.setPosition(latLng);
    }
    drawPointLine(deviceLocation);
    this.mp.distance = distance;
    if (this.point2PointMarkerSelectListener != null) {
        this.point2PointMarkerSelectListener.onMarkerSelect(true, this.mp.altitude, this.mp, false);
    }
    this.isFollow = true;
}
 
Example #5
Source Project: LocationPicker   Author: shivpujan12   File: LocationPickerActivity.java    License: MIT License 6 votes vote down vote up
private void addMarker() {

        LatLng coordinate = new LatLng(mLatitude, mLongitude);
        if (mMap != null) {
            MarkerOptions markerOptions;
            try {
                mMap.clear();
                imgSearch.setText("" + userAddress);

                markerOptions = new MarkerOptions().position(coordinate).title(userAddress).icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_place_red_800_24dp));
                CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(coordinate, 14);
                mMap.animateCamera(cameraUpdate);
                mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);

                Marker marker = mMap.addMarker(markerOptions);
                marker.showInfoWindow();
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }

    }
 
Example #6
Source Project: Complete-Google-Map-API-Tutorial   Author: mohammadima3oud   File: MarkerActivity.java    License: Apache License 2.0 6 votes vote down vote up
private void addMarkersToMap()
{
	MarkerOptions options =new MarkerOptions();
	options.position(BRISBANE);
	options.title("brisbane");
	options.snippet("Population: 2,544,634");
	options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE));
	options.draggable(true);
	CustomInfoWindowAdapter.brisbane=googleMap.addMarker(options);


	MarkerOptions options2 =new MarkerOptions();
	options2.position(ADELAIDE);
	options2.title("adelaide");
	options2.snippet("Population: 3,543,222");
	Drawable drawable=ContextCompat.getDrawable(getApplicationContext(),R.drawable.ic_person_pin_circle_black_24dp);
	options2.icon(convertDrawableToBitmap(drawable));
	options2.draggable(true);
	CustomInfoWindowAdapter.adelaide=googleMap.addMarker(options2);
}
 
Example #7
Source Project: google-io-2014-compat   Author: unrarp   File: AbstractDetailActivity.java    License: Apache License 2.0 6 votes vote down vote up
private void setupMap() {
    final GoogleMap map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();

    double lat = getIntent().getDoubleExtra("lat", 37.6329946);
    double lng = getIntent().getDoubleExtra("lng", -122.4938344);
    float zoom = getIntent().getFloatExtra("zoom", 15);

    LatLng position = new LatLng(lat, lng);
    map.moveCamera(CameraUpdateFactory.newLatLngZoom(position, zoom));
    map.addMarker(new MarkerOptions().position(position));

    // We need the snapshot of the map to prepare the shader for the circular reveal.
    // So the map is visible on activity start and then once the snapshot is taken, quickly hidden.
    map.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {
        @Override
        public void onMapLoaded() {
            map.snapshot(new GoogleMap.SnapshotReadyCallback() {
                @Override
                public void onSnapshotReady(Bitmap bitmap) {
                    mapLoaded(bitmap);
                }
            });
        }
    });
}
 
Example #8
Source Project: geopackage-android-map   Author: ngageoint   File: GoogleMapShapeConverter.java    License: MIT License 6 votes vote down vote up
/**
 * Add a MultiPolylineOptions to the map as markers
 *
 * @param shapeMarkers          google map shape markers
 * @param map                   google map
 * @param multiPolyline         multi polyline options
 * @param polylineMarkerOptions polyline marker options
 * @param globalPolylineOptions global polyline options
 * @return multi polyline markers
 */
public MultiPolylineMarkers addMultiPolylineToMapAsMarkers(
        GoogleMapShapeMarkers shapeMarkers, GoogleMap map,
        MultiPolylineOptions multiPolyline,
        MarkerOptions polylineMarkerOptions,
        PolylineOptions globalPolylineOptions) {
    MultiPolylineMarkers polylines = new MultiPolylineMarkers();
    for (PolylineOptions polylineOptions : multiPolyline
            .getPolylineOptions()) {
        PolylineMarkers polylineMarker = addPolylineToMapAsMarkers(map,
                polylineOptions, polylineMarkerOptions,
                globalPolylineOptions);
        shapeMarkers.add(polylineMarker);
        polylines.add(polylineMarker);
    }
    return polylines;
}
 
Example #9
Source Project: android-samples   Author: googlemaps   File: CircleDemoActivity.java    License: Apache License 2.0 6 votes vote down vote up
public DraggableCircle(LatLng center, double radiusMeters) {
    this.radiusMeters = radiusMeters;
    centerMarker = map.addMarker(new MarkerOptions()
            .position(center)
            .draggable(true));
    radiusMarker = map.addMarker(new MarkerOptions()
            .position(toRadiusLatLng(center, radiusMeters))
            .draggable(true)
            .icon(BitmapDescriptorFactory.defaultMarker(
                    BitmapDescriptorFactory.HUE_AZURE)));
    circle = map.addCircle(new CircleOptions()
            .center(center)
            .radius(radiusMeters)
            .strokeWidth(strokeWidthBar.getProgress())
            .strokeColor(strokeColorArgb)
            .fillColor(fillColorArgb)
            .clickable(clickabilityCheckbox.isChecked()));
}
 
Example #10
Source Project: BloodBank   Author: imShakil   File: GetNearbyPlacesData.java    License: GNU General Public License v3.0 6 votes vote down vote up
private void showNearbyPlaces(List<HashMap<String, String>> nearbyplaces)
{
    for(int i=0; i<nearbyplaces.size(); i++)
    {
        MarkerOptions markerOptions = new MarkerOptions();
        HashMap<String, String> googlePlace = nearbyplaces.get(i);

        String PlaceName = googlePlace.get("place_name");
        String vicinity = googlePlace.get("vicinity");
        double lat = Double.parseDouble(googlePlace.get("lat"));
        double lng = Double.parseDouble(googlePlace.get("lng"));

        LatLng latLng = new LatLng(lat, lng);
        markerOptions.position(latLng);
        markerOptions.title(PlaceName+" "+vicinity);
        markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));

        mMap.addMarker(markerOptions);
        mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
        mMap.animateCamera(CameraUpdateFactory.zoomBy(10));
    }
}
 
Example #11
Source Project: coursera-android   Author: aporter   File: MapsEarthquakeMapActivity.java    License: MIT License 6 votes vote down vote up
private void placeMarkers() {

        // Add a marker for every earthquake
        for (EarthQuakeRec rec : mRetainedFragment.getData()) {

            // Add a new marker for this earthquake
            mMap.addMarker(new MarkerOptions()

                    // Set the Marker's position
                    .position(new LatLng(rec.getLat(), rec.getLng()))

                    // Set the title of the Marker's information window
                    .title(String.valueOf(rec.getMagnitude()))

                    // Set the color for the Marker
                    .icon(BitmapDescriptorFactory
                            .defaultMarker(getMarkerColor(rec
                                    .getMagnitude()))));

        }
    }
 
Example #12
Source Project: mage-android   Author: ngageoint   File: ObservationTask.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected Void doInBackground(Observation... observations) {
    for (Observation o : observations) {
        boolean passesFilter = true;
        for (Filter filter : filters) {
            passesFilter = filter.passesFilter(o);
            if (!passesFilter) {
                break;
            }
        }

        if (passesFilter) {
            Geometry geometry = o.getGeometry();
            Point centroid = GeometryUtils.getCentroid(geometry);
            MarkerOptions options = new MarkerOptions().position(new LatLng(centroid.getY(), centroid.getX())).icon(ObservationBitmapFactory.bitmapDescriptor(context, o));
            publishProgress(new Pair<>(options, o));
        }
    }

    return null;
}
 
Example #13
Source Project: UberClone   Author: IramML   File: Home.java    License: MIT License 6 votes vote down vote up
@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    mMap.getUiSettings().setZoomControlsEnabled(true);
    mMap.getUiSettings().setZoomGesturesEnabled(true);
    mMap.setInfoWindowAdapter(new CustomInfoWindow(this));
    googleMap.setMapStyle(MapStyleOptions.loadRawResourceStyle(this, R.raw.uber_style_map));

    mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
        @Override
        public void onMapClick(LatLng latLng) {
            if(destinationMarker!=null)
                destinationMarker.remove();
            destinationMarker=mMap.addMarker(new MarkerOptions().position(latLng)
                    .icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_destination_marker))
                    .title("Destination"));
            mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 15.0f));

            BottomSheetRiderFragment mBottomSheet=BottomSheetRiderFragment.newInstance(String.format("%f,%f", currentLat, currentLng),
                    String.format("%f,%f",latLng.latitude, latLng.longitude), true);
            mBottomSheet.show(getSupportFragmentManager(), mBottomSheet.getTag());
        }
    });
    mMap.setOnInfoWindowClickListener(this);
}
 
Example #14
Source Project: osmdroid   Author: osmdroid   File: MapWrapper.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void addMarker(final Marker aMarker) {
	final MarkerOptions marker = new MarkerOptions();
	marker.position(new LatLng(aMarker.latitude, aMarker.longitude));
	if (!TextUtils.isEmpty(aMarker.title)) {
		marker.title(aMarker.title);
	}
	if (!TextUtils.isEmpty(aMarker.snippet)) {
		marker.snippet(aMarker.snippet);
	}
	if (aMarker.bitmap != null) {
		marker.icon(BitmapDescriptorFactory.fromBitmap(aMarker.bitmap));
	} else {
		if (aMarker.icon != 0) {
			marker.icon(BitmapDescriptorFactory.fromResource(aMarker.icon));
		}
	}
	if (aMarker.anchor == Marker.Anchor.CENTER) {
		marker.anchor(0.5f, 0.5f);
	}
	mGoogleMap.addMarker(marker);
}
 
Example #15
Source Project: MapViewPager   Author: nitrico   File: MapViewPager.java    License: Apache License 2.0 6 votes vote down vote up
private void populateMulti(final MultiAdapter adapter) {
    map.clear();
    allMarkers = new LinkedList<>();
    for (int page = 0; page < adapter.getCount(); page++) {
        LinkedList<Marker> pageMarkers = new LinkedList<>();
        if (adapter.getCameraPositions(page) != null) {
            for (int i = 0; i < adapter.getCameraPositions(page).size(); i++) {
                CameraPosition cp = adapter.getCameraPositions(page).get(i);
                if (cp != null) {
                    MarkerOptions mo = createMarkerOptions(cp, adapter.getMarkerTitle(page, i));
                    pageMarkers.add(map.addMarker(mo));
                }
                else pageMarkers.add(null);
            }
        }
        allMarkers.add(pageMarkers);
    }
    map.setOnMarkerClickListener(createMarkerClickListenerMulti(adapter));
    initDefaultPositions(adapter);
}
 
Example #16
Source Project: JalanJalan   Author: pratamawijaya   File: AddMapActivity.java    License: Do What The F*ck You Want To Public License 6 votes vote down vote up
@Override
public void onConnected(Bundle bundle) {
    if (location == null) {
        // get last location device
        location = LocationServices.FusedLocationApi.getLastLocation(googleApiClient);
        if (mMap != null) {
            mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(), location.getLongitude()), 13));
            mMap.addMarker(new MarkerOptions()
                            .position(new LatLng(location.getLatitude(), location.getLongitude()))
                            .title("Starting Point")
                            .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_marker))
            );
            lat = location.getLatitude();
            lng = location.getLongitude();

            Toast.makeText(this, "Lokasi kamu saat ini, sebagai patokan titik awal perjalanan kamu kak :')", Toast.LENGTH_LONG).show();
        }
    }

}
 
Example #17
Source Project: NYU-BusTracker-Android   Author: tbpalsulich   File: MainActivity.java    License: Apache License 2.0 6 votes vote down vote up
private void updateMapWithNewBusLocations() {
    if (startStop == null || endStop == null) {
        mMap.clear();
        displayStopError();
        return;
    }
    List<Route> routesBetweenStartAndEnd = startStop.getRoutesTo(endStop);
    BusManager sharedManager = BusManager.getBusManager();
    for (Marker m : busesOnMap) {
        m.remove();
    }
    busesOnMap = new ArrayList<>();
    if (clickableMapMarkers == null)
        clickableMapMarkers = new HashMap<>();  // New set of buses means new set of clickable markers!
    for (Route r : routesBetweenStartAndEnd) {
        for (Bus b : sharedManager.getBuses()) {
            //if (BuildConfig.DEBUG) Log.v("BusLocations", "bus id: " + b.getID() + ", bus route: " + b.getRoute() + " vs route: " + r.getID());
            if (b.getRoute().equals(r.getID())) {
                Marker mMarker = mMap.addMarker(new MarkerOptions().position(b.getLocation()).icon(BitmapDescriptorFactory.fromBitmap(rotateBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.ic_bus_arrow), b.getHeading()))).anchor(0.5f, 0.5f));
                clickableMapMarkers.put(mMarker.getId(), false);    // Unable to click on buses.
                busesOnMap.add(mMarker);
            }
        }
    }
}
 
Example #18
Source Project: android-samples   Author: googlemaps   File: MarkerCloseInfoWindowOnRetapDemoActivity.java    License: Apache License 2.0 6 votes vote down vote up
private void addMarkersToMap() {
   mMap.addMarker(new MarkerOptions()
            .position(BRISBANE)
            .title("Brisbane")
            .snippet("Population: 2,074,200"));

    mMap.addMarker(new MarkerOptions()
            .position(SYDNEY)
            .title("Sydney")
            .snippet("Population: 4,627,300"));

    mMap.addMarker(new MarkerOptions()
            .position(MELBOURNE)
            .title("Melbourne")
            .snippet("Population: 4,137,400"));

    mMap.addMarker(new MarkerOptions()
            .position(PERTH)
            .title("Perth")
            .snippet("Population: 1,738,800"));

    mMap.addMarker(new MarkerOptions()
            .position(ADELAIDE)
            .title("Adelaide")
            .snippet("Population: 1,213,000"));
}
 
Example #19
Source Project: geopackage-android-map   Author: ngageoint   File: StyleUtils.java    License: MIT License 6 votes vote down vote up
/**
 * Set the icon into the marker options
 *
 * @param markerOptions marker options
 * @param icon          icon row
 * @param density       display density: {@link android.util.DisplayMetrics#density}
 * @param iconCache     icon cache
 * @return true if icon was set into the marker options
 */
public static boolean setIcon(MarkerOptions markerOptions, IconRow icon, float density, IconCache iconCache) {

    boolean iconSet = false;

    if (icon != null) {

        Bitmap iconImage = createIcon(icon, density, iconCache);
        markerOptions.icon(BitmapDescriptorFactory
                .fromBitmap(iconImage));
        iconSet = true;

        double anchorU = icon.getAnchorUOrDefault();
        double anchorV = icon.getAnchorVOrDefault();

        markerOptions.anchor((float) anchorU, (float) anchorV);
    }

    return iconSet;
}
 
Example #20
Source Project: YelpQL   Author: pranayairan   File: BusinessDetailsActivity.java    License: MIT License 6 votes vote down vote up
private void showPointerOnMap(final double latitude, final double longitude) {
    mvRestaurantLocation.getMapAsync(new OnMapReadyCallback() {
        @Override
        public void onMapReady(GoogleMap googleMap) {
            LatLng latLng = new LatLng(latitude, longitude);
            googleMap.addMarker(new MarkerOptions()
                    .icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_flag))
                    .anchor(0.0f, 1.0f)
                    .position(latLng));
            googleMap.getUiSettings().setMyLocationButtonEnabled(false);
            googleMap.getUiSettings().setZoomControlsEnabled(true);

            // Updates the location and zoom of the MapView
            CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 15);
            googleMap.moveCamera(cameraUpdate);
        }
    });
}
 
Example #21
Source Project: android-samples   Author: googlemaps   File: MapsMarkerActivity.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Manipulates the map when it's available.
 * The API invokes this callback when the map is ready to be used.
 * This is where we can add markers or lines, add listeners or move the camera. In this case,
 * we just add a marker near Sydney, Australia.
 * If Google Play services is not installed on the device, the user receives a prompt to install
 * Play services inside the SupportMapFragment. The API invokes this method after the user has
 * installed Google Play services and returned to the app.
 */
// [END_EXCLUDE]
// [START maps_marker_on_map_ready_add_marker]
@Override
public void onMapReady(GoogleMap googleMap) {
    // [START_EXCLUDE silent]
    // Add a marker in Sydney, Australia,
    // and move the map's camera to the same location.
    // [END_EXCLUDE]
    LatLng sydney = new LatLng(-33.852, 151.211);
    googleMap.addMarker(new MarkerOptions()
        .position(sydney)
        .title("Marker in Sydney"));
    // [START_EXCLUDE silent]
    googleMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
    // [END_EXCLUDE]
}
 
Example #22
Source Project: actor-platform   Author: actorapp   File: MapFragment.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    longitude = getArguments().getDouble("longitude");
    latitude = getArguments().getDouble("latitude");


    final MapView map = new MapView(getActivity());

    map.onCreate(null);

    map.getMapAsync(new OnMapReadyCallback() {
        @Override
        public void onMapReady(GoogleMap googleMap) {
            mapController = googleMap;
            googleMap.addMarker(new MarkerOptions().position(new LatLng(latitude, longitude)).title(""));
            googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
                    new LatLng(latitude, longitude),
                    16));
            map.onResume();
        }
    });

    return map;

}
 
Example #23
Source Project: Krishi-Seva   Author: aksh98   File: MapsActivity.java    License: MIT License 6 votes vote down vote up
@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);

    //Initialize Google Play Services
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        if (ContextCompat.checkSelfPermission(this,
                Manifest.permission.ACCESS_FINE_LOCATION)
                == PackageManager.PERMISSION_GRANTED) {
            buildGoogleApiClient();
            mMap.setMyLocationEnabled(true);
        }
    }
    else {
        buildGoogleApiClient();
        mMap.setMyLocationEnabled(true);
    }
    googleMap.addMarker(new MarkerOptions().position(kochi)
            .title("Farmer Location"));
    googleMap.moveCamera(CameraUpdateFactory.newLatLng(kochi));
    mMap.setOnMapClickListener(this);



}
 
Example #24
Source Project: mollyim-android   Author: mollyim   File: SignalMapView.java    License: GNU General Public License v3.0 5 votes vote down vote up
public ListenableFuture<Bitmap> display(final SignalPlace place) {
  final SettableFuture<Bitmap> future = new SettableFuture<>();

  this.mapView.onCreate(null);
  this.mapView.onResume();

  this.mapView.setVisibility(View.VISIBLE);
  this.imageView.setVisibility(View.GONE);

  this.mapView.getMapAsync(new OnMapReadyCallback() {
    @Override
    public void onMapReady(final GoogleMap googleMap) {
      googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(place.getLatLong(), 13));
      googleMap.addMarker(new MarkerOptions().position(place.getLatLong()));
      googleMap.setBuildingsEnabled(true);
      googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
      googleMap.getUiSettings().setAllGesturesEnabled(false);
      googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {
        @Override
        public void onMapLoaded() {
          googleMap.snapshot(new GoogleMap.SnapshotReadyCallback() {
            @Override
            public void onSnapshotReady(Bitmap bitmap) {
              future.set(bitmap);
              imageView.setImageBitmap(bitmap);
              imageView.setVisibility(View.VISIBLE);
              mapView.setVisibility(View.GONE);
              mapView.onPause();
              mapView.onDestroy();
            }
          });
        }
      });
    }
  });

  this.textView.setText(place.getDescription());

  return future;
}
 
Example #25
Source Project: xposed-gps   Author: hilarycheng   File: MainActivity.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);

	settings = new Settings(getApplicationContext());
	FragmentManager fm = getFragmentManager();
	Fragment frag = fm.findFragmentById(R.id.map);
	if (frag instanceof MapFragment) {
		MapFragment mapf = (MapFragment) frag;
		mMap = (GoogleMap) mapf.getMap();
		mMap.setOnCameraChangeListener(this);
		mMarker = new MarkerOptions();
		mInit = new LatLng(settings.getLat(), settings.getLng());
		mMarker.position(mInit);
		mMarker.draggable(true);

		CameraUpdate cam = CameraUpdateFactory.newLatLng(mInit);
		mMap.moveCamera(cam);
		mMap.addMarker(mMarker);
	}

	Button set   = (Button) findViewById(R.id.set_location);
	set.setOnClickListener(this);
	Button start = (Button) findViewById(R.id.start);
	start.setOnClickListener(this);
	Button sel   = (Button) findViewById(R.id.select_apps);
	sel.setOnClickListener(this);

	start.setText(settings.isStarted() ? getString(R.string.stop) : getString(R.string.start));
}
 
Example #26
Source Project: PressureNet   Author: Cbsoftware   File: BarometerNetworkActivity.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void addConditionMarkersToMap() {
	try {
		for(MarkerOptions options : liveMarkerOptions) {
			Marker marker = mMap.addMarker(options);	
		}	
	} catch(ConcurrentModificationException cme) {
		log("concurrentmodificationexception adding markers to map " + cme.getMessage());
	}
	
}
 
Example #27
Source Project: geopackage-android-map   Author: ngageoint   File: StyleUtils.java    License: MIT License 5 votes vote down vote up
/**
 * Create new marker options populated with the style
 *
 * @param style style row
 * @return marker options populated with the style
 */
public static MarkerOptions createMarkerOptions(StyleRow style) {

    MarkerOptions markerOptions = new MarkerOptions();
    setStyle(markerOptions, style);

    return markerOptions;
}
 
Example #28
Source Project: FimiX8-RE   Author: wladimir-computin   File: GglMapAiSurroundManager.java    License: MIT License 5 votes vote down vote up
public void setAiSurroundMark(double latitude, double logitude) {
    FLatLng fLatLng = GpsCorrect.Earth_To_Mars(latitude, logitude);
    LatLng latLng = new LatLng(fLatLng.latitude, fLatLng.longitude);
    if (this.pointMarker == null) {
        BitmapDescriptor mBitmapDescriptor = new GglMapCustomMarkerView().createCustomMarkerView(this.context, R.drawable.x8_img_ai_follow_point2);
        this.mp = new MapPointLatLng();
        this.pointMarker = this.googleMap.addMarker(new MarkerOptions().position(latLng).icon(mBitmapDescriptor).anchor(0.5f, 0.5f).draggable(true));
        this.pointMarker.setTag(this.mp);
        return;
    }
    this.pointMarker.setPosition(latLng);
}
 
Example #29
Source Project: FimiX8-RE   Author: wladimir-computin   File: GglMapLocationManager.java    License: MIT License 5 votes vote down vote up
@SuppressLint({"RestrictedApi"})
public GglMapLocationManager(GoogleMap googleMap, Context context) {
    this.mGoogleMap = googleMap;
    this.context = context;
    buildGoogleApiClient();
    this.markerOptions = new MarkerOptions();
    this.markerOptions.title("Current Position");
    this.markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.location_map));
    this.locationRequest = new LocationRequest();
    this.locationRequest.setInterval(1000);
    this.locationRequest.setFastestInterval(1000);
    this.locationRequest.setPriority(100);
}
 
Example #30
Source Project: actor-platform   Author: actorapp   File: MapPickerActivity.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
private void showItemsOnTheMap(ArrayList<MapItem> array) {
    markers = new HashMap<String, Marker>();
    for (MapItem mapItem : array) {

        markers.put(mapItem.id,
                mMap.addMarker(new MarkerOptions()
                        .position(mapItem.getLatLng())
                        // .title(mapItem.name)
                        .draggable(false)
                        .icon(BitmapDescriptorFactory.fromResource(R.drawable.picker_map_marker))
                ));
    }
}