Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
map3d:mapId="your_map_id"
map3d:mode="hybrid"
map3d:mapMode="hybrid"
map3d:centerLat="40.748392"
map3d:centerLng="-73.986060"
map3d:centerAlt="175"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
map3d:mapId="your_map_id"
map3d:mode="hybrid"
map3d:mapMode="hybrid"
map3d:centerLat="40.748392"
map3d:centerLng="-73.986060"
map3d:centerAlt="175"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
map3d:minAltitude="0"
map3d:minHeading="0"
map3d:minTilt="0"
map3d:mode="satellite"
map3d:mapMode="satellite"
map3d:range="4000"
map3d:roll="0"
map3d:tilt="67" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

<com.google.android.gms.maps3d.Map3DView
android:id="@+id/map3dView"
map3d:mode="satellite"
map3d:mapMode="satellite"
map3d:centerLat="40.748392"
map3d:centerLng="-73.986060"
map3d:centerAlt="175"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<com.google.android.gms.maps3d.Map3DView
android:id="@+id/map3dView"
map3d:mapId="bcce776b92de1336e22c569f"
map3d:mode="hybrid"
map3d:mapMode="hybrid"
map3d:centerLat="38.743498"
map3d:centerLng="-109.499307"
map3d:centerAlt="1467"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<com.google.android.gms.maps3d.Map3DView
android:id="@+id/map3dView"
map3d:mode="hybrid"
map3d:mapMode="hybrid"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected void onCreate(Bundle savedInstanceState) {
@Override
public void onMap3DViewReady(GoogleMap3D googleMap3D) {
super.onMap3DViewReady(googleMap3D);

googleMap3D.setOnMapReadyListener((map) -> {
googleMap3D.setOnMapReadyListener(null);
initializeMap(googleMap3D);
Expand All @@ -94,18 +94,21 @@ private void initializeMap(@NonNull GoogleMap3D googleMap3D) {
googleMap3D.setMapMode(Map3DMode.HYBRID);

// Listeners for map clicks.
googleMap3D.setMap3DClickListener((location, placeId) -> {
googleMap3D.setMap3DClickListener((event) -> {
runOnUiThread(() -> {
String message;
if (placeId != null) {
message = "Clicked Place ID: " + placeId;
if (event.getPlaceId() != null) {
message = "Clicked Place ID: " + event.getPlaceId();
} else {
message = "Clicked Location: " + location.getLatitude() + ", " + location.getLongitude();
message = "Clicked Location: " + event.getLocation().getLatitude() + ", "
+ event.getLocation().getLongitude();
}
clickedInfoText.setText(message);
clickedInfoText.setContentDescription(message);
showToast(message);

});
return true;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,24 @@

package com.example.maps3djava.markers;

import com.google.android.gms.maps3d.model.FlyAroundOptions;
import com.google.android.gms.maps3d.model.PopoverOptions;
import com.google.android.gms.maps3d.Popover;
import org.json.JSONObject;
import org.json.JSONArray;
import android.graphics.Color;
import android.util.Log;
import android.widget.TextView;
import android.widget.PopupMenu;
import java.util.concurrent.CompletableFuture;
import android.os.Looper;
import android.os.Handler;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Random;
import static com.example.maps3d.common.UtilitiesKt.toValidCamera;

import android.graphics.Color;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import android.widget.PopupMenu;
import android.widget.TextView;
import com.example.maps3dcommon.R;
import com.example.maps3djava.sampleactivity.SampleBaseActivity;
import com.google.android.gms.maps3d.GoogleMap3D;
import com.google.android.gms.maps3d.Popover;
import com.google.android.gms.maps3d.model.AltitudeMode;
import com.google.android.gms.maps3d.model.Camera;
import com.google.android.gms.maps3d.model.CollisionBehavior;
import com.google.android.gms.maps3d.model.FlyAroundOptions;
import com.google.android.gms.maps3d.model.FlyToOptions;
import com.google.android.gms.maps3d.model.Glyph;
import com.google.android.gms.maps3d.model.ImageView;
Expand All @@ -48,9 +40,13 @@
import com.google.android.gms.maps3d.model.Marker;
import com.google.android.gms.maps3d.model.MarkerOptions;
import com.google.android.gms.maps3d.model.PinConfiguration;

import java.util.List;
import com.google.android.gms.maps3d.model.PopoverOptions;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.concurrent.CompletableFuture;

/**
* Demonstrates the use of different altitude modes for markers in a 3D map.
Expand Down Expand Up @@ -111,9 +107,9 @@ public final Camera getInitialCamera() {
@Override
public void onMap3DViewReady(GoogleMap3D googleMap3D) {
super.onMap3DViewReady(googleMap3D);

Log.d(getTAG(), "onMap3DViewReady called");

googleMap3D.setOnMapReadyListener((map) -> {
Log.w(getTAG(), "on map ready listener fired");
googleMap3D.setOnMapReadyListener(null);
Expand Down Expand Up @@ -201,13 +197,17 @@ private void initializeMap(GoogleMap3D googleMap3D) {
stopButton.setOnClickListener(v -> stopMonsterTour(googleMap3D));
}

googleMap3D.setMap3DClickListener((location, placeId) -> {
runOnUiThread(() -> {
if (activePopover != null) {
activePopover.remove();
activePopover = null;
}
});
googleMap3D.setMap3DClickListener((event) -> {
boolean hadActivePopover = activePopover != null;
if (hadActivePopover) {
runOnUiThread(() -> {
if (activePopover != null) {
activePopover.remove();
activePopover = null;
}
});
}
return hadActivePopover;
});

// Marker 1: Absolute Altitude
Expand Down Expand Up @@ -594,4 +594,4 @@ private int getMonsterBlurbResId(String monsterId) {
return 0;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,14 @@ public void onMap3DViewReady(@NonNull GoogleMap3D googleMap3D) {
super.onMap3DViewReady(googleMap3D);

// Enable surface tap to re-project arbitrary coordinates
googleMap3D.setMap3DClickListener((location, placeId) -> {
googleMap3D.setMap3DClickListener((event) -> {
activeLandmarkNameRes = R.string.landmark_custom_pin;
activeLocation = location;
activeLocation = event.getLocation();
Camera cam = googleMap3D.getCamera();
if (cam != null) {
updateProjection(cam);
}
return true;
});

// Listen for camera updates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,18 @@ class MapInteractionsActivity : SampleBaseActivity() {

// Listeners for map clicks. We use lifecycleScope to ensure coroutines are cancelled when the activity is destroyed.
lifecycleScope.launch {
googleMap3D.setMap3DClickListener { location, placeId ->
googleMap3D.setMap3DClickListener { event ->
runOnUiThread {
val message = if (placeId != null) {
"Clicked Place ID: $placeId"
val message = if (event.placeId != null) {
"Clicked Place ID: ${event.placeId}"
} else {
"Clicked Location: ${location.latitude}, ${location.longitude}"
"Clicked Location: ${event.location.latitude}, ${event.location.longitude}"
}
clickedInfoText.text = message
clickedInfoText.contentDescription = message
showToast(message)
}
return@setMap3DClickListener true
}
}
}
Expand Down
Loading
Loading