Here are the examples of the java api com.eegeo.mapapi.EegeoMap taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
56 Examples
19
Source : MapsceneApplier.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced MapsceneApplier {
private EegeoMap m_map;
public MapsceneApplier(EegeoMap map) {
this.m_map = map;
}
public void ApplyMapscene(final Mapscene mapscene) {
/* Note: Currently only applies camera position due to lacking in APIs for setting the rest. */
/* Ideally also updated to apply all features of a Mapscene via corresponding APIs */
LatLngAlt startLocation = mapscene.startLocation.startLocation;
CameraPosition position = new CameraPosition.Builder().target(startLocation.lareplacedude, startLocation.longitude).bearing(mapscene.startLocation.startLocationBearing).distance(mapscene.startLocation.startLocationDistanceToInterest).indoor(mapscene.startLocation.startLocationIndoorMapId, mapscene.startLocation.startLocationIndoorMapFloorIndex).build();
m_map.moveCamera(CameraUpdateFactory.newCameraPosition(position));
}
}
18
Source : MainActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced MainActivity extends AppCompatActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private IndoorMapView m_interiorView = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.activity_main);
m_mapView = (MapView) findViewById(R.id.mapView);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
RelativeLayout uiContainer = (RelativeLayout) findViewById(R.id.eegeo_ui_container);
m_interiorView = new IndoorMapView(m_mapView, uiContainer, m_eegeoMap);
Toast.makeText(MainActivity.this, "Hello World!", Toast.LENGTH_LONG).show();
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
m_mapView.onDestroy();
}
}
18
Source : SearchExampleActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced SearchExampleActivity extends WrldExampleActivity implements OnPoiSearchCompletedListener {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private int m_failedSearches = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.basic_map_activity);
m_mapView = (MapView) findViewById(R.id.basic_mapview);
m_mapView.onCreate(savedInstanceState);
final OnPoiSearchCompletedListener listener = this;
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
PoiService poiService = map.createPoiService();
poiService.searchText(new TextSearchOptions("free", map.getCameraPosition().target).radius(1000.0).number(60).onPoiSearchCompletedListener(listener));
poiService.searchTag(new TagSearchOptions("coffee", map.getCameraPosition().target).onPoiSearchCompletedListener(listener));
poiService.searchAutocomplete(new AutocompleteOptions("auto", map.getCameraPosition().target).onPoiSearchCompletedListener(listener));
}
});
}
@Override
public void onPoiSearchCompleted(PoiSearchResponse response) {
List<PoiSearchResult> results = response.getResults();
// Icon/Tag mapping, see:
// https://github.com/wrld3d/wrld-icon-tools/blob/master/data/search_tags.json
Map<String, String> iconKeyTagDict = new HashMap<String, String>() {
{
put("park", "park");
put("coffee", "coffee");
put("general", "general");
}
};
if (response.succeeded() && results.size() > 0) {
for (PoiSearchResult poi : results) {
String iconKey = "pin";
String[] tags = poi.tags.split(" ");
for (String tag : tags) {
if (iconKeyTagDict.containsKey(tag)) {
iconKey = iconKeyTagDict.get(tag);
}
}
MarkerOptions options = new MarkerOptions().labelText(poi.replacedle).position(poi.latLng).iconKey(iconKey);
if (poi.indoor) {
options.indoor(poi.indoorId, poi.floorId);
}
m_eegeoMap.addMarker(options);
}
} else {
m_failedSearches += 1;
if (m_failedSearches >= 3) {
new AlertDialog.Builder(this).setreplacedle("No POIs found").setMessage("Visit https://mapdesigner.wrld3d.com/poi/latest/ to create some POIs.").setIcon(android.R.drawable.ic_dialog_alert).show();
}
}
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
m_mapView.onDestroy();
}
}
18
Source : QueryIndoorMapFloorOutlineInformationActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced QueryIndoorMapFloorOutlineInformationActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.query_indoor_map_floor_outline_information_activity);
m_mapView = this.findViewById(R.id.query_indoor_map_floor_outline_information_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
final int transparentBlue = ColorUtils.setAlphaComponent(Color.BLUE, 128);
final OnIndoorMapFloorOutlineInformationLoadedListener listener = new OnIndoorMapFloorOutlineInformationLoadedListener() {
@Override
public void onIndoorMapFloorOutlineInformationLoaded(IndoorMapFloorOutlineInformation indoorMapFloorOutlineInformation) {
for (IndoorMapFloorOutlinePolygon outlinePolygon : indoorMapFloorOutlineInformation.getIndoorMapFloorOutlinePolygons()) {
PolygonOptions options = new PolygonOptions();
for (LatLng latLng : outlinePolygon.outerRing.latLngPoints) {
options.add(latLng);
}
for (IndoorMapFloorOutlinePolygonRing innerContour : outlinePolygon.innerRings) {
options.addHole(innerContour.latLngPoints);
}
options.fillColor(transparentBlue);
options.indoor(indoorMapFloorOutlineInformation.getIndoorMapId(), indoorMapFloorOutlineInformation.getIndoorMapFloorId());
m_eegeoMap.addPolygon(options);
}
displayToastMessage(indoorMapFloorOutlineInformation);
}
};
map.addInitialStreamingCompleteListener(new OnInitialStreamingCompleteListener() {
@Override
public void onInitialStreamingComplete() {
CameraPosition position = new CameraPosition.Builder().target(56.460078, -2.978325).indoor("westport_house", 2).zoom(18).tilt(0).build();
map.moveCamera(CameraUpdateFactory.newCameraPosition(position));
}
});
map.addOnIndoorEnteredListener(new OnIndoorEnteredListener() {
@Override
public void onIndoorEntered() {
m_eegeoMap.addIndoorMapFloorOutlineInformation("westport_house", 2, listener);
}
});
}
});
}
private void displayToastMessage(IndoorMapFloorOutlineInformation indoorFloorOutlineInformation) {
Toast.makeText(this, String.format(Locale.getDefault(), "IndoorMapMapFloorOutlineInformation for %s floor %d has finished loading.", indoorFloorOutlineInformation.getIndoorMapId(), indoorFloorOutlineInformation.getIndoorMapFloorId()), Toast.LENGTH_LONG).show();
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
m_mapView.onDestroy();
}
}
18
Source : PrecachingMapDataActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced PrecachingMapDataActivity extends WrldExampleActivity implements OnPrecacheOperationCompletedListener {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.add_building_highlight_activity);
m_mapView = (MapView) findViewById(R.id.add_building_highlight_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
// Precache a 2000 meter radius around this point
m_eegeoMap.precache(new LatLng(37.7952, -122.4028), 2000.0, PrecachingMapDataActivity.this);
}
});
}
@Override
public void onPrecacheOperationCompleted(PrecacheOperationResult precacheOperationResult) {
AlertDialog dialog = new AlertDialog.Builder(PrecachingMapDataActivity.this).setreplacedle("Precache status").setMessage(String.format(Locale.getDefault(), "Precaching %s", precacheOperationResult.succeeded() ? "complete" : "failed")).setIcon(android.R.drawable.ic_dialog_alert).create();
dialog.show();
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
m_mapView.onDestroy();
}
}
18
Source : PositionCodeCreatedViewOnMapActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced PositionCodeCreatedViewOnMapActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private OnPositionerChangedListener m_positionerChangedListener = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Initialise the EegeoApi with your api key - this needs calling either in the application
// instance, or in the activity that contains the MapView
EegeoApi.init(this, getString(R.string.eegeo_api_key));
// The MapView is contained in a layout xml
setContentView(R.layout.position_code_created_view_on_map_activity);
m_mapView = (MapView) findViewById(R.id.position_code_created_view_on_map_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
ImageView imageView = new ImageView(PositionCodeCreatedViewOnMapActivity.this);
imageView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
imageView.setImageResource(R.drawable.wrld3d);
m_mapView.addView(imageView);
imageView.setVisibility(View.INVISIBLE);
m_positionerChangedListener = new ViewAnchorAdapter(imageView, 0.5f, 0.5f);
m_eegeoMap.addPositionerChangedListener(m_positionerChangedListener);
m_eegeoMap.addPositioner(new PositionerOptions().position(new LatLng(37.802355, -122.405848)));
}
});
}
public void onClickMapCollapse(View view) {
if (m_eegeoMap != null) {
m_eegeoMap.setMapCollapsed(!m_eegeoMap.isMapCollapsed());
}
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
m_mapView.onDestroy();
}
private clreplaced ViewAnchorAdapter implements OnPositionerChangedListener {
private View m_view;
private PointF m_anchorUV;
ViewAnchorAdapter(@NonNull View view, float u, float v) {
m_view = view;
m_anchorUV = new PointF(u, v);
}
@UiThread
public void onPositionerChanged(Positioner positioner) {
if (positioner.isScreenPointProjectionDefined()) {
m_view.setVisibility(View.VISIBLE);
Point screenPoint = positioner.getScreenPointOrNull();
if (screenPoint != null)
ViewAnchor.positionView(m_view, screenPoint, m_anchorUV);
} else {
m_view.setVisibility(View.INVISIBLE);
}
}
}
}
18
Source : PlaceObjectsOnBuildingsActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced PlaceObjectsOnBuildingsActivity extends WrldExampleActivity implements OnInitialStreamingCompleteListener {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.place_objects_on_buildings_activity);
m_mapView = (MapView) findViewById(R.id.place_objects_on_buildings_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
m_eegeoMap.addInitialStreamingCompleteListener(PlaceObjectsOnBuildingsActivity.this);
}
});
}
@Override
public void onInitialStreamingComplete() {
addMarkerAboveBuilding(new LatLng(37.795159, -122.404336), "Point A");
addMarkerAboveBuilding(new LatLng(37.794817, -122.403543), "Point B");
}
private void addMarkerAboveBuilding(final LatLng latLng, final String replacedle) {
m_eegeoMap.pickFeatureAtLatLng(latLng).then(new Ready<PickResult>() {
@UiThread
@Override
public void ready(PickResult pickResult) {
m_eegeoMap.addMarker(new MarkerOptions().position(latLng).elevation(pickResult.intersectionPoint.alreplacedude).elevationMode(ElevationMode.HeightAboveSeaLevel).labelText(replacedle));
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
m_mapView.onDestroy();
}
}
18
Source : PickingIndoorEntityActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced PickingIndoorEnreplacedyActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private HashMap<String, Integer> m_enreplacedyIdsToColorIndex;
private ArrayList<Integer> m_colors;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
m_enreplacedyIdsToColorIndex = new HashMap<String, Integer>();
m_colors = new ArrayList<Integer>();
m_colors.add(0x7fff0000);
m_colors.add(0x7f00ff00);
m_colors.add(0x7f0000ff);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.picking_indoor_enreplacedies_example_activity);
m_mapView = (MapView) findViewById(R.id.picking_indoor_enreplacedies_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
CameraPosition position = new CameraPosition.Builder().target(56.459801, -2.977928).indoor("westport_house", 2).zoom(15).build();
map.moveCamera(CameraUpdateFactory.newCameraPosition(position));
map.addOnIndoorEnreplacedyPickedListener(new EnreplacedyPickedListener());
}
});
}
public void onClearHighlightsButtonPressed(View view) {
m_eegeoMap.clearAllIndoorEnreplacedyHighlights();
m_enreplacedyIdsToColorIndex.clear();
}
public clreplaced EnreplacedyPickedListener implements OnIndoorEnreplacedyPickedListener {
@Override
public void onIndoorEnreplacedyPicked(IndoorEnreplacedyPickedMessage message) {
for (String indoorMapEnreplacedyId : message.indoorMapEnreplacedyIds) {
int currentColorIdx = m_enreplacedyIdsToColorIndex.containsKey(indoorMapEnreplacedyId) ? m_enreplacedyIdsToColorIndex.get(indoorMapEnreplacedyId) + 1 : 0;
if (currentColorIdx == m_colors.size()) {
currentColorIdx = 0;
}
m_enreplacedyIdsToColorIndex.put(indoorMapEnreplacedyId, currentColorIdx);
}
m_eegeoMap.setIndoorEnreplacedyHighlights(message.indoorMapId, message.indoorMapEnreplacedyIds, m_colors.get(m_enreplacedyIdsToColorIndex.get(message.indoorMapEnreplacedyIds.get(0))));
}
}
}
18
Source : OutdoorRouteActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced OutdoorRouteActivity extends WrldExampleActivity implements OnRoutingQueryCompletedListener {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.routing_example_activity);
m_mapView = (MapView) findViewById(R.id.routing_example_mapview);
m_mapView.onCreate(savedInstanceState);
final OnRoutingQueryCompletedListener listener = this;
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
RoutingService routingService = map.createRoutingService();
routingService.findRoutes(new RoutingQueryOptions().addWaypoint(new LatLng(56.460918, -2.981560)).addWaypoint(new LatLng(56.461207, -2.977993)).onRoutingQueryCompletedListener(listener));
}
});
}
@Override
public void onRoutingQueryCompleted(RoutingQuery query, RoutingQueryResponse response) {
if (response.succeeded()) {
Toast.makeText(OutdoorRouteActivity.this, "Found routes", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(OutdoorRouteActivity.this, "Failed to find routes", Toast.LENGTH_LONG).show();
}
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
m_mapView.onDestroy();
}
}
18
Source : NameIndoorExampleActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced NameIndoorExampleActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.name_indoor_example_activity);
m_mapView = (MapView) findViewById(R.id.name_indoor_mapview);
m_mapView.onCreate(savedInstanceState);
final Button exitButton = (Button) findViewById(R.id.name_exit_indoor_button);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
IndoorEventListener listener = new IndoorEventListener(exitButton, m_eegeoMap, NameIndoorExampleActivity.this);
map.addOnIndoorEnteredListener(listener);
map.addOnIndoorExitedListener(listener);
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
m_mapView.onDestroy();
}
public void onExit(View view) {
m_eegeoMap.onExitIndoorClicked();
}
public clreplaced IndoorEventListener implements OnIndoorEnteredListener, OnIndoorExitedListener {
private Button m_button;
private EegeoMap m_map;
private Context m_context;
IndoorEventListener(Button button, EegeoMap map, Context context) {
this.m_button = button;
this.m_map = map;
this.m_context = context;
}
@Override
public void onIndoorEntered() {
IndoorMap indoorMap = m_map.getActiveIndoorMap();
new AlertDialog.Builder(m_context).setreplacedle("Entered Indoor Map:").setMessage(indoorMap.name).setIcon(android.R.drawable.ic_dialog_alert).show();
m_button.setEnabled(true);
}
@Override
public void onIndoorExited() {
m_button.setEnabled(false);
}
}
}
18
Source : MoveIndoorExampleActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced MoveIndoorExampleActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.move_floor_indoor_example_activity);
m_mapView = (MapView) findViewById(R.id.move_floor_indoor_mapview);
m_mapView.onCreate(savedInstanceState);
final List<Button> buttons = new ArrayList<Button>();
buttons.add((Button) findViewById(R.id.topfloor_indoor_button));
buttons.add((Button) findViewById(R.id.moveup_indoor_button));
buttons.add((Button) findViewById(R.id.movedown_indoor_button));
buttons.add((Button) findViewById(R.id.bottomfloor_indoor_button));
buttons.add((Button) findViewById(R.id.move_floor_exit_indoor_button));
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
IndoorEventListener listener = new IndoorEventListener(buttons);
map.addOnIndoorEnteredListener(listener);
map.addOnIndoorExitedListener(listener);
m_eegeoMap = map;
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
m_mapView.onDestroy();
}
public void onExit(View view) {
m_eegeoMap.onExitIndoorClicked();
}
public void onTopFloor(View view) {
IndoorMap indoorMap = m_eegeoMap.getActiveIndoorMap();
m_eegeoMap.setIndoorFloor(indoorMap.floorCount - 1);
}
public void onBottomFloor(View view) {
m_eegeoMap.setIndoorFloor(0);
}
public void onMoveUp(View view) {
m_eegeoMap.moveIndoorUp();
}
public void onMoveDown(View view) {
m_eegeoMap.moveIndoorDown();
}
public clreplaced IndoorEventListener implements OnIndoorEnteredListener, OnIndoorExitedListener {
private List<Button> m_buttons;
IndoorEventListener(List<Button> buttons) {
this.m_buttons = buttons;
}
@Override
public void onIndoorEntered() {
SetButtonStates(true);
}
@Override
public void onIndoorExited() {
SetButtonStates(false);
}
private void SetButtonStates(boolean state) {
for (Iterator<Button> i = m_buttons.iterator(); i.hasNext(); ) {
Button b = i.next();
b.setEnabled(state);
}
}
}
}
18
Source : MoveCameraToIndoorActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced MoveCameraToIndoorActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private boolean m_indoors = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.move_camera_to_indoor_example_activity);
m_mapView = (MapView) findViewById(R.id.move_camera_to_indoor_mapview);
m_mapView.onCreate(savedInstanceState);
final Button button = (Button) findViewById(R.id.exit_indoor_button);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
map.addInitialStreamingCompleteListener(new OnInitialStreamingCompleteListener() {
@Override
public void onInitialStreamingComplete() {
IndoorEventListener listener = new IndoorEventListener(button);
map.addOnIndoorEnteredListener(listener);
map.addOnIndoorExitedListener(listener);
CameraPosition position = new CameraPosition.Builder().target(37.782332, -122.404667).indoor("intercontinental_hotel_8628", 2).zoom(19).bearing(270).build();
map.moveCamera(CameraUpdateFactory.newCameraPosition(position));
}
});
}
});
}
public void onClick(View view) {
if (m_indoors) {
m_eegeoMap.exitIndoorMap();
}
}
public clreplaced IndoorEventListener implements OnIndoorEnteredListener, OnIndoorExitedListener {
private Button m_button;
IndoorEventListener(Button button) {
this.m_button = button;
}
@Override
public void onIndoorEntered() {
m_indoors = true;
m_button.setEnabled(true);
}
@Override
public void onIndoorExited() {
m_indoors = false;
m_button.setEnabled(false);
}
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
m_mapView.onDestroy();
}
}
18
Source : MarkerWithElevationActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced MarkerWithElevationActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private Marker m_marker = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.marker_with_elevation_activity);
m_mapView = (MapView) findViewById(R.id.marker_with_elevation_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
m_marker = createAndAddMarker();
}
});
}
private Marker createAndAddMarker() {
return m_eegeoMap.addMarker(new MarkerOptions().position(new LatLng(37.7952, -122.4028)).elevation(260.0).labelText("Transamerica Pyramid"));
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
m_eegeoMap.removeMarker(m_marker);
}
m_mapView.onDestroy();
}
}
18
Source : MarkerWithAbsoluteAltitudeActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced MarkerWithAbsoluteAlreplacedudeActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private Marker m_marker = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.marker_with_absolute_alreplacedude_activity);
m_mapView = (MapView) findViewById(R.id.marker_with_absolute_alreplacedude_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
m_marker = createAndAddMarker();
}
});
}
private Marker createAndAddMarker() {
return m_eegeoMap.addMarker(new MarkerOptions().position(new LatLng(37.802617, -122.405783)).elevationMode(ElevationMode.HeightAboveSeaLevel).elevation(80.7).labelText("Telegraph Hill"));
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
m_eegeoMap.removeMarker(m_marker);
}
m_mapView.onDestroy();
}
}
18
Source : MarkerCustomIconActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced MarkerCustomIconActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private Marker m_marker = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.marker_custom_icon_activity);
m_mapView = (MapView) findViewById(R.id.marker_custom_icon_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
m_marker = m_eegeoMap.addMarker(new MarkerOptions().position(new LatLng(37.784560, -122.402092)).iconKey("park").labelText("This marker has a park icon"));
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
m_eegeoMap.removeMarker(m_marker);
}
m_mapView.onDestroy();
}
}
18
Source : MarkerChangeTextActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced MarkerChangeTextActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private Marker m_marker = null;
private boolean m_replacedleToggle = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.marker_change_text_activity);
m_mapView = (MapView) findViewById(R.id.marker_change_text_mapview);
m_mapView.onCreate(savedInstanceState);
final String replacedleA = "Initial marker text";
final String replacedleB = "Altered marker text";
final Handler timerHandler = new Handler();
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
m_marker = m_eegeoMap.addMarker(new MarkerOptions().position(new LatLng(37.784560, -122.402092)).labelText(replacedleA));
timerHandler.postDelayed(new Runnable() {
@Override
public void run() {
if (m_eegeoMap != null) {
m_marker.setreplacedle(m_replacedleToggle ? replacedleA : replacedleB);
m_replacedleToggle = !m_replacedleToggle;
}
timerHandler.postDelayed(this, 2000);
}
}, 5000);
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
m_eegeoMap.removeMarker(m_marker);
m_eegeoMap = null;
}
m_mapView.onDestroy();
}
}
18
Source : MarkerChangeDrawOrderActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced MarkerChangeDrawOrderActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private Marker m_markerA = null;
private Marker m_markerB = null;
private boolean m_drawOrderToggle = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.marker_change_draw_order_activity);
m_mapView = (MapView) findViewById(R.id.marker_change_draw_order_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
final int highPriorityDrawOrder = 0;
final int midPriorityDrawOrder = 1;
final int lowPriorityDrawOrder = 2;
m_markerA = m_eegeoMap.addMarker(new MarkerOptions().position(new LatLng(37.784560, -122.402256)).labelText("Marker A").drawOrder(midPriorityDrawOrder));
m_markerB = m_eegeoMap.addMarker(new MarkerOptions().position(new LatLng(37.784560, -122.402016)).labelText("Marker B").drawOrder(lowPriorityDrawOrder));
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
if (m_eegeoMap != null) {
m_drawOrderToggle = !m_drawOrderToggle;
m_markerB.setDrawOrder(m_drawOrderToggle ? highPriorityDrawOrder : lowPriorityDrawOrder);
handler.postDelayed(this, 2000);
}
}
}, 2000);
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
m_eegeoMap.removeMarker(m_markerA);
m_eegeoMap.removeMarker(m_markerB);
m_eegeoMap = null;
}
m_mapView.onDestroy();
}
}
18
Source : LoadMapsceneActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced LoadMapsceneActivity extends WrldExampleActivity implements OnMapsceneRequestCompletedListener {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.basic_map_activity);
m_mapView = (MapView) findViewById(R.id.basic_mapview);
m_mapView.onCreate(savedInstanceState);
final OnMapsceneRequestCompletedListener listener = this;
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
MapsceneService mapsceneService = map.createMapsceneService();
mapsceneService.requestMapscene(new MapsceneRequestOptions("https://wrld.mp/63fcc9b").onMapsceneRequestCompletedListener(listener));
}
});
}
@Override
public void onMapsceneRequestCompleted(MapsceneRequestResponse response) {
if (response.succeeded()) {
String message = "Mapscene '" + response.getMapscene().name + "' loaded";
Toast.makeText(LoadMapsceneActivity.this, message, Toast.LENGTH_LONG).show();
} else {
Toast.makeText(LoadMapsceneActivity.this, "Failed to load mapscene", Toast.LENGTH_LONG).show();
}
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
m_mapView.onDestroy();
}
}
18
Source : HighlightIndoorEntityActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced HighlightIndoorEnreplacedyActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.highlight_indoor_enreplacedies_example_activity);
m_mapView = (MapView) findViewById(R.id.highlight_indoor_enreplacedies_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
CameraPosition position = new CameraPosition.Builder().target(56.459801, -2.977928).indoor("westport_house", 2).zoom(15).build();
map.moveCamera(CameraUpdateFactory.newCameraPosition(position));
}
});
}
public void onHighlightEnreplacediesButtonPressed(View view) {
highlightEnreplacedies();
}
public void onClearHighlightsButtonPressed(View view) {
m_eegeoMap.clearAllIndoorEnreplacedyHighlights();
}
private void highlightEnreplacedies() {
ArrayList<String> indoorEnreplacedyIdsRed = new ArrayList<String>();
indoorEnreplacedyIdsRed.add("0007");
indoorEnreplacedyIdsRed.add("Meeting Room Small");
m_eegeoMap.setIndoorEnreplacedyHighlights("westport_house", indoorEnreplacedyIdsRed, 0x7fff0000);
ArrayList<String> indoorEnreplacedyIdsBlue = new ArrayList<String>();
indoorEnreplacedyIdsBlue.add("0002");
indoorEnreplacedyIdsBlue.add("Meeting Room Large");
m_eegeoMap.setIndoorEnreplacedyHighlights("westport_house", indoorEnreplacedyIdsBlue, 0x7f0000ff);
ArrayList<String> indoorEnreplacedyIdsGreen = new ArrayList<String>();
indoorEnreplacedyIdsGreen.add("0033");
m_eegeoMap.setIndoorEnreplacedyHighlights("westport_house", indoorEnreplacedyIdsGreen, 0x7f00ff00);
}
}
18
Source : ExitIndoorExampleActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced ExitIndoorExampleActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private boolean m_indoors = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.exit_indoor_example_activity);
m_mapView = (MapView) findViewById(R.id.exit_indoor_mapview);
m_mapView.onCreate(savedInstanceState);
final Button button = (Button) findViewById(R.id.exit_indoor_button);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
map.addInitialStreamingCompleteListener(new OnInitialStreamingCompleteListener() {
@Override
public void onInitialStreamingComplete() {
IndoorEventListener listener = new IndoorEventListener(button);
map.addOnIndoorEnteredListener(listener);
map.addOnIndoorExitedListener(listener);
m_eegeoMap = map;
button.setEnabled(true);
}
});
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
m_mapView.onDestroy();
}
public void onClick(View view) {
if (m_indoors) {
m_eegeoMap.exitIndoorMap();
} else {
LatLng indoorMapLatLng = new LatLng(Double.parseDouble(getString(R.string.indoor_start_lat)), Double.parseDouble(getString(R.string.indoor_start_lon)));
m_eegeoMap.moveCamera(CameraUpdateFactory.newLatLng(indoorMapLatLng));
m_eegeoMap.enterIndoorMap("intercontinental_hotel_8628");
}
}
public clreplaced IndoorEventListener implements OnIndoorEnteredListener, OnIndoorExitedListener {
private Button m_button;
IndoorEventListener(Button button) {
this.m_button = button;
}
@Override
public void onIndoorEntered() {
m_button.setText("Exit");
m_indoors = true;
}
@Override
public void onIndoorExited() {
m_button.setText("Enter");
m_indoors = false;
}
}
}
18
Source : CancelPrecachingMapDataActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced CancelPrecachingMapDataActivity extends WrldExampleActivity implements OnPrecacheOperationCompletedListener {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.add_building_highlight_activity);
m_mapView = (MapView) findViewById(R.id.add_building_highlight_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
// Start precaching a 2000 meter radius around this point
PrecacheOperation precacheOperation = m_eegeoMap.precache(new LatLng(37.7952, -122.4028), 2000.0, CancelPrecachingMapDataActivity.this);
// Cancel the precache operation
precacheOperation.cancel();
}
});
}
@Override
public void onPrecacheOperationCompleted(PrecacheOperationResult precacheOperationResult) {
AlertDialog dialog = new AlertDialog.Builder(CancelPrecachingMapDataActivity.this).setreplacedle("Precache status").setMessage(String.format(Locale.getDefault(), "Precaching %s", precacheOperationResult.succeeded() ? "complete" : "cancelled")).setIcon(android.R.drawable.ic_dialog_alert).create();
dialog.show();
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
m_mapView.onDestroy();
}
}
18
Source : AnimateCameraToIndoorActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced AnimateCameraToIndoorActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private boolean m_indoors = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.animate_camera_to_indoor_example_activity);
m_mapView = (MapView) findViewById(R.id.animate_camera_to_indoor_mapview);
m_mapView.onCreate(savedInstanceState);
final Button button = (Button) findViewById(R.id.exit_indoor_button);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
map.addInitialStreamingCompleteListener(new OnInitialStreamingCompleteListener() {
@Override
public void onInitialStreamingComplete() {
IndoorEventListener listener = new IndoorEventListener(button);
map.addOnIndoorEnteredListener(listener);
map.addOnIndoorExitedListener(listener);
CameraPosition position = new CameraPosition.Builder().target(37.782332, -122.404667).indoor("intercontinental_hotel_8628", 2).zoom(19).bearing(270).build();
CameraAnimationOptions animationOptions = new CameraAnimationOptions.Builder().build();
map.animateCamera(CameraUpdateFactory.newCameraPosition(position), animationOptions);
}
});
}
});
}
public void onClick(View view) {
if (m_indoors) {
m_eegeoMap.exitIndoorMap();
}
}
public clreplaced IndoorEventListener implements OnIndoorEnteredListener, OnIndoorExitedListener {
private Button m_button;
IndoorEventListener(Button button) {
this.m_button = button;
}
@Override
public void onIndoorEntered() {
m_indoors = true;
m_button.setEnabled(true);
}
@Override
public void onIndoorExited() {
m_indoors = false;
m_button.setEnabled(false);
}
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
m_mapView.onDestroy();
}
}
18
Source : AddMarkerActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced AddMarkerActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private Marker m_marker = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.add_marker_activity);
m_mapView = (MapView) findViewById(R.id.add_marker_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
m_marker = m_eegeoMap.addMarker(new MarkerOptions().position(new LatLng(37.784560, -122.402092)).labelText("This is a marker"));
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
m_eegeoMap.removeMarker(m_marker);
}
m_mapView.onDestroy();
}
}
18
Source : AddHeatmapIndoorsActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced AddHeatmapIndoorsActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private IndoorMapView m_indoorMapView = null;
private Heatmap m_heatmap = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setLockedOrientation();
setContentView(R.layout.add_heatmap_indoors_activity);
m_mapView = (MapView) findViewById(R.id.add_heatmap_indoors_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
RelativeLayout uiContainer = (RelativeLayout) findViewById(R.id.eegeo_ui_container);
m_indoorMapView = new IndoorMapView(m_mapView, uiContainer, m_eegeoMap);
map.addInitialStreamingCompleteListener(new OnInitialStreamingCompleteListener() {
@Override
public void onInitialStreamingComplete() {
CameraPosition position = new CameraPosition.Builder().target(56.460075, -2.978326).indoor("westport_house", 2).zoom(19).build();
map.moveCamera(CameraUpdateFactory.newCameraPosition(position));
}
});
m_heatmap = m_eegeoMap.addHeatmap(new HeatmapOptions().polygon(new PolygonOptions().indoor("westport_house", 2)).add(getExampleOccupancyPerDayData()).weightMin(2.0).weightMax(8.0).intensityBias(0.5f).interpolateDensityByZoom(18.5, 21.0).addDensityStop(0.0f, 0.6, 1.0).addDensityStop(0.5f, 1.3, 0.75).addDensityStop(1.0f, 2.1, 0.5).gradient(// transparent at mid-point, with differing hues either side,
// suitable for diverging data set. Similar to:
// http://colorbrewer2.org/#type=diverging&scheme=RdYlBu&n=6
new float[] { 0.f, 0.1f, 0.4f, 0.49f, 0.51f, 0.6f, 0.9f, 1.f }, new int[] { 0x4575b4ff, 0x91bfdbff, 0xe0f3f8ff, 0xffffff00, 0xffffff00, 0xfee090ff, 0xfc8d59ff, 0xd73027ff }).opacity(0.8f));
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
m_eegeoMap.removeHeatmap(m_heatmap);
m_mapView.onDestroy();
}
private void setLockedOrientation() {
if (getResources().getBoolean(R.bool.is_large_device)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
} else {
// force portrait on phone
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
}
private WeightedLatLngAlt[] getExampleOccupancyPerDayData() {
WeightedLatLngAlt[] points = new WeightedLatLngAlt[] { new WeightedLatLngAlt(56.460035, -2.978334, 7.78), new WeightedLatLngAlt(56.459999, -2.978309, 0.0), new WeightedLatLngAlt(56.460003, -2.978280, 8.2), new WeightedLatLngAlt(56.459990, -2.978305, 7.91), new WeightedLatLngAlt(56.459994, -2.978276, 7.36), new WeightedLatLngAlt(56.459960, -2.978294, 0.0), new WeightedLatLngAlt(56.459963, -2.978265, 7.89), new WeightedLatLngAlt(56.459951, -2.978290, 7.57), new WeightedLatLngAlt(56.459954, -2.978261, 7.84), new WeightedLatLngAlt(56.459918, -2.978280, 8.01), new WeightedLatLngAlt(56.459921, -2.978250, 7.72), new WeightedLatLngAlt(56.459909, -2.978276, 0.0), new WeightedLatLngAlt(56.459912, -2.978246, 0.0), new WeightedLatLngAlt(56.459883, -2.978266, 7.42), new WeightedLatLngAlt(56.459886, -2.978237, 7.9), new WeightedLatLngAlt(56.459874, -2.978262, 0.0), new WeightedLatLngAlt(56.459877, -2.978233, 0.0), new WeightedLatLngAlt(56.459851, -2.978255, 7.68), new WeightedLatLngAlt(56.459855, -2.978225, 0.0), new WeightedLatLngAlt(56.459843, -2.978250, 0.0), new WeightedLatLngAlt(56.459846, -2.978221, 0.0), new WeightedLatLngAlt(56.459849, -2.978172, 0.0), new WeightedLatLngAlt(56.459858, -2.978176, 0.0), new WeightedLatLngAlt(56.459897, -2.978170, 9.56), new WeightedLatLngAlt(56.459906, -2.978174, 0.0), new WeightedLatLngAlt(56.459909, -2.978145, 7.52), new WeightedLatLngAlt(56.459932, -2.978164, 7.52), new WeightedLatLngAlt(56.459941, -2.978168, 0.99), new WeightedLatLngAlt(56.459935, -2.978135, 7.49), new WeightedLatLngAlt(56.459944, -2.978139, 7.71), new WeightedLatLngAlt(56.459944, -2.978043, 7.9), new WeightedLatLngAlt(56.459961, -2.978196, 0.73), new WeightedLatLngAlt(56.459983, -2.978059, 7.84), new WeightedLatLngAlt(56.459970, -2.978200, 0.07), new WeightedLatLngAlt(56.460001, -2.978211, 2.97), new WeightedLatLngAlt(56.459900, -2.978141, 7.66), new WeightedLatLngAlt(56.460010, -2.978215, 7.79), new WeightedLatLngAlt(56.460008, -2.978190, 7.80), new WeightedLatLngAlt(56.459981, -2.978076, 7.55), new WeightedLatLngAlt(56.460195, -2.978007, 7.21), new WeightedLatLngAlt(56.460197, -2.977982, 0.44), new WeightedLatLngAlt(56.460206, -2.977988, 7.23), new WeightedLatLngAlt(56.460203, -2.978013, 7.81), new WeightedLatLngAlt(56.460186, -2.978083, 7.07), new WeightedLatLngAlt(56.460195, -2.978090, 8.74), new WeightedLatLngAlt(56.460189, -2.978058, 7.22), new WeightedLatLngAlt(56.460198, -2.978064, 7.39), new WeightedLatLngAlt(56.460180, -2.978134, 7.18), new WeightedLatLngAlt(56.460189, -2.978140, 0.0), new WeightedLatLngAlt(56.460183, -2.978109, 7.72), new WeightedLatLngAlt(56.460192, -2.978115, 7.16), new WeightedLatLngAlt(56.460224, -2.978018, 7.62), new WeightedLatLngAlt(56.460227, -2.977993, 7.61), new WeightedLatLngAlt(56.460236, -2.977999, 7.03), new WeightedLatLngAlt(56.460233, -2.978025, 7.34), new WeightedLatLngAlt(56.460216, -2.978095, 7.9), new WeightedLatLngAlt(56.460225, -2.978101, 0.15), new WeightedLatLngAlt(56.460219, -2.978069, 8.14), new WeightedLatLngAlt(56.460227, -2.978075, 7.93), new WeightedLatLngAlt(56.460210, -2.978145, 8.57), new WeightedLatLngAlt(56.460219, -2.978151, 7.61), new WeightedLatLngAlt(56.460213, -2.978120, 7.02), new WeightedLatLngAlt(56.460222, -2.978126, 7.91), new WeightedLatLngAlt(56.460254, -2.978029, 7.34), new WeightedLatLngAlt(56.460257, -2.978004, 7.03), new WeightedLatLngAlt(56.460266, -2.978010, 7.52), new WeightedLatLngAlt(56.460263, -2.978035, 7.19), new WeightedLatLngAlt(56.460245, -2.978106, 7.81), new WeightedLatLngAlt(56.460254, -2.978112, 7.85), new WeightedLatLngAlt(56.460248, -2.978080, 6.17), new WeightedLatLngAlt(56.460257, -2.978086, 7.68), new WeightedLatLngAlt(56.460240, -2.978156, 8.47), new WeightedLatLngAlt(56.460248, -2.978162, 7.44), new WeightedLatLngAlt(56.460242, -2.978131, 9.75), new WeightedLatLngAlt(56.460251, -2.978137, 7.99), new WeightedLatLngAlt(56.460284, -2.978040, 7.31), new WeightedLatLngAlt(56.460286, -2.978015, 7.12), new WeightedLatLngAlt(56.460295, -2.978021, 7.13), new WeightedLatLngAlt(56.460292, -2.978046, 7.1), new WeightedLatLngAlt(56.460275, -2.978117, 0.0), new WeightedLatLngAlt(56.460284, -2.978123, 7.06), new WeightedLatLngAlt(56.460278, -2.978091, 7.23), new WeightedLatLngAlt(56.460287, -2.978097, 1.06), new WeightedLatLngAlt(56.460269, -2.978167, 9.02), new WeightedLatLngAlt(56.460278, -2.978173, 7.01), new WeightedLatLngAlt(56.460272, -2.978142, 7.37), new WeightedLatLngAlt(56.460281, -2.978148, 7.4), new WeightedLatLngAlt(56.460313, -2.978051, 0.0), new WeightedLatLngAlt(56.460316, -2.978026, 7.99), new WeightedLatLngAlt(56.460325, -2.978032, 7.03), new WeightedLatLngAlt(56.460322, -2.978057, 7.98), new WeightedLatLngAlt(56.460305, -2.978127, 7.69), new WeightedLatLngAlt(56.460313, -2.978134, 7.38), new WeightedLatLngAlt(56.460307, -2.978102, 0.76), new WeightedLatLngAlt(56.460316, -2.978108, 7.32), new WeightedLatLngAlt(56.460299, -2.978178, 0.0), new WeightedLatLngAlt(56.460308, -2.978184, 7.95), new WeightedLatLngAlt(56.460302, -2.978153, 0.0), new WeightedLatLngAlt(56.460311, -2.978159, 7.63), new WeightedLatLngAlt(56.460303, -2.978253, 7.97), new WeightedLatLngAlt(56.460312, -2.978259, 7.97), new WeightedLatLngAlt(56.460306, -2.978227, 7.59), new WeightedLatLngAlt(56.460315, -2.978233, 7.13), new WeightedLatLngAlt(56.460274, -2.978242, 7.84), new WeightedLatLngAlt(56.460282, -2.978248, 7.18), new WeightedLatLngAlt(56.460276, -2.978216, 7.9), new WeightedLatLngAlt(56.460285, -2.978222, 7.74), new WeightedLatLngAlt(56.460194, -2.978269, 7.15), new WeightedLatLngAlt(56.460206, -2.978250, 7.18), new WeightedLatLngAlt(56.460203, -2.978275, 7.51), new WeightedLatLngAlt(56.460197, -2.978244, 7.07), new WeightedLatLngAlt(56.460200, -2.978218, 0.09), new WeightedLatLngAlt(56.460208, -2.978224, 0.0), new WeightedLatLngAlt(56.460162, -2.978257, 7.85), new WeightedLatLngAlt(56.460174, -2.978238, 7.23), new WeightedLatLngAlt(56.460171, -2.978263, 5.65), new WeightedLatLngAlt(56.460165, -2.978232, 7.99), new WeightedLatLngAlt(56.460168, -2.978207, 7.01), new WeightedLatLngAlt(56.460177, -2.978213, 7.95), new WeightedLatLngAlt(56.460270, -2.978498, 7.82), new WeightedLatLngAlt(56.460262, -2.978491, 0.0), new WeightedLatLngAlt(56.460268, -2.978523, 7.76), new WeightedLatLngAlt(56.460259, -2.978517, 7.91), new WeightedLatLngAlt(56.460267, -2.978441, 7.02), new WeightedLatLngAlt(56.460273, -2.978472, 7.8), new WeightedLatLngAlt(56.460265, -2.978466, 7.54), new WeightedLatLngAlt(56.460276, -2.978447, 7.42), new WeightedLatLngAlt(56.460276, -2.978365, 7.03), new WeightedLatLngAlt(56.460282, -2.978396, 7.99), new WeightedLatLngAlt(56.460273, -2.978390, 7.43), new WeightedLatLngAlt(56.460285, -2.978371, 8.1), new WeightedLatLngAlt(56.460241, -2.978487, 7.01), new WeightedLatLngAlt(56.460232, -2.978481, 4.66), new WeightedLatLngAlt(56.460238, -2.978512, 7.23), new WeightedLatLngAlt(56.460229, -2.978506, 7.66), new WeightedLatLngAlt(56.460238, -2.978430, 7.37), new WeightedLatLngAlt(56.460244, -2.978461, 8.33), new WeightedLatLngAlt(56.460235, -2.978455, 7.75), new WeightedLatLngAlt(56.460246, -2.978436, 7.12), new WeightedLatLngAlt(56.460246, -2.978354, 7.53), new WeightedLatLngAlt(56.460252, -2.978385, 7.44), new WeightedLatLngAlt(56.460243, -2.978379, 3.01), new WeightedLatLngAlt(56.460255, -2.978360, 7.81), new WeightedLatLngAlt(56.460213, -2.978368, 7.76), new WeightedLatLngAlt(56.460217, -2.978425, 8.17), new WeightedLatLngAlt(56.460205, -2.978444, 7.58), new WeightedLatLngAlt(56.460214, -2.978450, 7.03), new WeightedLatLngAlt(56.460208, -2.978419, 7.67), new WeightedLatLngAlt(56.460199, -2.978495, 7.68), new WeightedLatLngAlt(56.460208, -2.978501, 7.72), new WeightedLatLngAlt(56.460202, -2.978470, 7.11), new WeightedLatLngAlt(56.460211, -2.978476, 3.98), new WeightedLatLngAlt(56.460222, -2.978374, 7.58), new WeightedLatLngAlt(56.460184, -2.978357, 7.96), new WeightedLatLngAlt(56.460187, -2.978414, 7.03), new WeightedLatLngAlt(56.460176, -2.978434, 0.0), new WeightedLatLngAlt(56.460184, -2.978440, 7.01), new WeightedLatLngAlt(56.460178, -2.978408, 0.0), new WeightedLatLngAlt(56.460170, -2.978484, 7.08), new WeightedLatLngAlt(56.460179, -2.978490, 7.94), new WeightedLatLngAlt(56.460173, -2.978459, 7.69), new WeightedLatLngAlt(56.460182, -2.978465, 7.69), new WeightedLatLngAlt(56.460193, -2.978364, 7.94), new WeightedLatLngAlt(56.460152, -2.978454, 0.0), new WeightedLatLngAlt(56.460143, -2.978448, 7.02), new WeightedLatLngAlt(56.460149, -2.978479, 0.0), new WeightedLatLngAlt(56.460140, -2.978473, 0.0), new WeightedLatLngAlt(56.460149, -2.978397, 0.0), new WeightedLatLngAlt(56.460155, -2.978429, 0.0), new WeightedLatLngAlt(56.460146, -2.978423, 7.41), new WeightedLatLngAlt(56.460157, -2.978403, 7.73), new WeightedLatLngAlt(56.460157, -2.978321, 0.0), new WeightedLatLngAlt(56.460163, -2.978353, 7.6), new WeightedLatLngAlt(56.460154, -2.978347, 7.79), new WeightedLatLngAlt(56.460166, -2.978327, 7.77), new WeightedLatLngAlt(56.460108, -2.978438, 7.23), new WeightedLatLngAlt(56.460099, -2.978432, 7.36), new WeightedLatLngAlt(56.460105, -2.978463, 7.78), new WeightedLatLngAlt(56.460096, -2.978457, 3.05), new WeightedLatLngAlt(56.460105, -2.978381, 7.8), new WeightedLatLngAlt(56.460111, -2.978413, 7.90), new WeightedLatLngAlt(56.460102, -2.978407, 7.55), new WeightedLatLngAlt(56.460114, -2.978387, 7.33), new WeightedLatLngAlt(56.460113, -2.978305, 0.0), new WeightedLatLngAlt(56.460119, -2.978337, 7.27), new WeightedLatLngAlt(56.460111, -2.978331, 7.02), new WeightedLatLngAlt(56.460122, -2.978311, 7.22), new WeightedLatLngAlt(56.460008, -2.978435, 6.99), new WeightedLatLngAlt(56.459999, -2.978429, 7.64), new WeightedLatLngAlt(56.460005, -2.978378, 6.69), new WeightedLatLngAlt(56.460011, -2.978409, 7.48), new WeightedLatLngAlt(56.460002, -2.978403, 7.34), new WeightedLatLngAlt(56.460014, -2.978384, 0.0), new WeightedLatLngAlt(56.459990, -2.978508, 0.0), new WeightedLatLngAlt(56.459996, -2.978539, 0.0), new WeightedLatLngAlt(56.459987, -2.978533, 0.0), new WeightedLatLngAlt(56.459999, -2.978514, 0.0), new WeightedLatLngAlt(56.459978, -2.978424, 0.0), new WeightedLatLngAlt(56.459969, -2.978418, 0.0), new WeightedLatLngAlt(56.459975, -2.978367, 0.0), new WeightedLatLngAlt(56.459981, -2.978399, 0.0), new WeightedLatLngAlt(56.459972, -2.978393, 0.0), new WeightedLatLngAlt(56.459984, -2.978373, 0.0), new WeightedLatLngAlt(56.459961, -2.978497, 0.0), new WeightedLatLngAlt(56.459967, -2.978529, 0.0), new WeightedLatLngAlt(56.459958, -2.978522, 0.0), new WeightedLatLngAlt(56.459969, -2.978503, 0.0), new WeightedLatLngAlt(56.459975, -2.978449, 0.0), new WeightedLatLngAlt(56.459967, -2.978443, 0.0), new WeightedLatLngAlt(56.459948, -2.978413, 0.0), new WeightedLatLngAlt(56.459940, -2.978407, 0.0), new WeightedLatLngAlt(56.459945, -2.978356, 0.0), new WeightedLatLngAlt(56.459951, -2.978388, 0.0), new WeightedLatLngAlt(56.459942, -2.978382, 0.0), new WeightedLatLngAlt(56.459954, -2.978362, 0.0), new WeightedLatLngAlt(56.459931, -2.978486, 0.0), new WeightedLatLngAlt(56.459937, -2.978518, 0.0), new WeightedLatLngAlt(56.459928, -2.978512, 0.0), new WeightedLatLngAlt(56.459940, -2.978492, 0.0), new WeightedLatLngAlt(56.459946, -2.978438, 0.0), new WeightedLatLngAlt(56.459937, -2.978432, 0.0), new WeightedLatLngAlt(56.459910, -2.978481, 0.0), new WeightedLatLngAlt(56.459898, -2.978501, 0.0), new WeightedLatLngAlt(56.459907, -2.978507, 0.0), new WeightedLatLngAlt(56.459901, -2.978475, 0.0), new WeightedLatLngAlt(56.459924, -2.978352, 0.0), new WeightedLatLngAlt(56.459913, -2.978371, 0.0), new WeightedLatLngAlt(56.459922, -2.978377, 0.0), new WeightedLatLngAlt(56.459916, -2.978346, 0.0), new WeightedLatLngAlt(56.459910, -2.978396, 0.0), new WeightedLatLngAlt(56.459919, -2.978402, 0.0), new WeightedLatLngAlt(56.459871, -2.978464, 0.0), new WeightedLatLngAlt(56.459877, -2.978496, 0.0), new WeightedLatLngAlt(56.459868, -2.978490, 0.0), new WeightedLatLngAlt(56.459880, -2.978471, 0.0), new WeightedLatLngAlt(56.459841, -2.978456, 0.0), new WeightedLatLngAlt(56.459829, -2.978475, 0.0), new WeightedLatLngAlt(56.459838, -2.978481, 0.0), new WeightedLatLngAlt(56.459832, -2.978450, 0.0), new WeightedLatLngAlt(56.459826, -2.978501, 0.0), new WeightedLatLngAlt(56.459832, -2.978532, 0.0), new WeightedLatLngAlt(56.459823, -2.978526, 0.0), new WeightedLatLngAlt(56.459835, -2.978507, 0.0), new WeightedLatLngAlt(56.459908, -2.978120, 0.0), new WeightedLatLngAlt(56.459920, -2.978090, 0.0), new WeightedLatLngAlt(56.459915, -2.978068, 0.0), new WeightedLatLngAlt(56.459907, -2.978080, 0.0), new WeightedLatLngAlt(56.459969, -2.978175, 0.0) };
return points;
}
}
18
Source : AddHeatmapActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced AddHeatmapActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private Heatmap m_heatmap = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.add_heatmap_activity);
m_mapView = (MapView) findViewById(R.id.add_heatmap_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
final PolygonOptions polygonOptions = new PolygonOptions().add(new LatLng(51.508604, -0.104459), new LatLng(51.508443, -0.096146), new LatLng(51.507262, -0.091732), new LatLng(51.506585, -0.084959), new LatLng(51.504438, -0.076184), new LatLng(51.502556, -0.070538), new LatLng(51.495054, -0.076442), new LatLng(51.494416, -0.085674), new LatLng(51.494161, -0.094522), new LatLng(51.495264, -0.100525), new LatLng(51.498727, -0.104775));
final LatLng sw = new LatLng(51.493606, -0.105091);
final LatLng ne = new LatLng(51.508994, -0.068091);
final WeightedLatLngAlt[] data = generateRandomData(1000, sw, ne);
m_heatmap = m_eegeoMap.addHeatmap(new HeatmapOptions().polygon(polygonOptions).add(data).addDensityStop(0.0f, 15.0, 1.0).addDensityStop(1.0f, 45.0, 0.2).interpolateDensityByZoom(14.0, 17.0));
}
});
}
private WeightedLatLngAlt[] generateRandomData(int count, LatLng sw, LatLng ne) {
Random random = new Random(1);
WeightedLatLngAlt[] points = new WeightedLatLngAlt[count];
for (int i = 0; i < count; ++i) {
double lat = random.nextDouble() * (ne.lareplacedude - sw.lareplacedude) + sw.lareplacedude;
double lng = random.nextDouble() * (ne.longitude - sw.longitude) + sw.longitude;
points[i] = new WeightedLatLngAlt(lat, lng, 1.0);
}
return points;
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
m_eegeoMap.removeHeatmap(m_heatmap);
}
m_mapView.onDestroy();
}
}
18
Source : AddBuildingHighlightActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced AddBuildingHighlightActivity extends WrldExampleActivity implements OnInitialStreamingCompleteListener {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.add_building_highlight_activity);
m_mapView = (MapView) findViewById(R.id.add_building_highlight_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
m_eegeoMap.addInitialStreamingCompleteListener(AddBuildingHighlightActivity.this);
}
});
}
@Override
public void onInitialStreamingComplete() {
m_eegeoMap.addBuildingHighlight(new BuildingHighlightOptions().highlightBuildingAtLocation(new LatLng(37.795189, -122.402777)).color(ColorUtils.setAlphaComponent(Color.YELLOW, 128)));
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
m_mapView.onDestroy();
}
}
17
Source : QueryIndoorMapEntityInformationActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced QueryIndoorMapEnreplacedyInformationActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private List<Marker> m_markers = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.query_indoor_map_enreplacedy_information_activity);
m_mapView = this.findViewById(R.id.query_indoor_map_enreplacedy_information_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
map.addIndoorMapEnreplacedyInformation("westport_house", new OnIndoorMapEnreplacedyInformationChangedListener() {
@Override
public void onIndoorMapEnreplacedyInformationChanged(IndoorMapEnreplacedyInformation indoorMapEnreplacedyInformation) {
displayToastMessage(indoorMapEnreplacedyInformation);
removeMarkers();
addMarkers(indoorMapEnreplacedyInformation);
}
});
map.addInitialStreamingCompleteListener(new OnInitialStreamingCompleteListener() {
@Override
public void onInitialStreamingComplete() {
CameraPosition position = new CameraPosition.Builder().target(56.459801, -2.977928).indoor("westport_house", 2).zoom(18).build();
map.moveCamera(CameraUpdateFactory.newCameraPosition(position));
}
});
}
});
}
private void displayToastMessage(IndoorMapEnreplacedyInformation indoorMapEnreplacedyInformation) {
Toast.makeText(this, String.format(Locale.getDefault(), "IndoorMapEnreplacedyInformation for %s \n load state: %s \n enreplacedies: %d", indoorMapEnreplacedyInformation.getIndoorMapId(), indoorMapEnreplacedyInformation.getLoadState(), indoorMapEnreplacedyInformation.getIndoorMapEnreplacedies().size()), Toast.LENGTH_LONG).show();
}
private void removeMarkers() {
for (Marker marker : m_markers) {
m_eegeoMap.removeMarker(marker);
}
m_markers.clear();
}
private void addMarkers(@NonNull final IndoorMapEnreplacedyInformation indoorMapEnreplacedyInformation) {
for (IndoorMapEnreplacedy indoorMapEnreplacedy : indoorMapEnreplacedyInformation.getIndoorMapEnreplacedies()) {
m_markers.add(m_eegeoMap.addMarker(new MarkerOptions().indoor(indoorMapEnreplacedyInformation.getIndoorMapId(), indoorMapEnreplacedy.indoorMapFloorId).position(indoorMapEnreplacedy.position).elevation(2.0).labelText(indoorMapEnreplacedy.indoorMapEnreplacedyId)));
}
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
m_mapView.onDestroy();
}
}
17
Source : QueryBuildingInformationActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced QueryBuildingInformationActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private BuildingHighlight m_highlight = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.query_building_information_activity);
m_mapView = (MapView) findViewById(R.id.query_building_information_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
m_highlight = m_eegeoMap.addBuildingHighlight(new BuildingHighlightOptions().highlightBuildingAtLocation(new LatLng(37.784079, -122.396762)).informationOnly().buildingInformationReceivedListener(new OnBuildingInformationReceivedListener() {
@Override
public void onBuildingInformationReceived(BuildingHighlight buildingHighlight) {
BuildingInformation buildingInformation = buildingHighlight.getBuildingInformation();
if (buildingInformation == null) {
Toast.makeText(QueryBuildingInformationActivity.this, String.format("No building information was received for building highlight"), Toast.LENGTH_LONG).show();
return;
}
Toast.makeText(QueryBuildingInformationActivity.this, buildingInformation.buildingId, Toast.LENGTH_LONG).show();
BuildingDimensions buildingDimensions = buildingInformation.buildingDimensions;
double buildingHeight = buildingDimensions.topAlreplacedude - buildingDimensions.baseAlreplacedude;
String replacedle = String.format("Height: %1$.2f m", buildingHeight);
m_eegeoMap.addMarker(new MarkerOptions().labelText(replacedle).position(buildingDimensions.centroid).elevation(buildingDimensions.topAlreplacedude).elevationMode(ElevationMode.HeightAboveSeaLevel));
for (BuildingContour contour : buildingInformation.contours) {
m_eegeoMap.addPolyline(new PolylineOptions().add(contour.points).add(contour.points[0]).elevationMode(ElevationMode.HeightAboveSeaLevel).elevation(contour.topAlreplacedude).color(Color.BLUE));
}
}
}));
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null && m_highlight != null) {
m_eegeoMap.removeBuildingHighlight(m_highlight);
}
m_mapView.onDestroy();
}
}
17
Source : PositionViewOnMapActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced PositionViewOnMapActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private OnPositionerChangedListener m_positionerChangedListener = null;
View m_calloutView;
TextView m_screenView;
TextView m_worldView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Initialise the EegeoApi with your api key - this needs calling either in the application
// instance, or in the activity that contains the MapView
EegeoApi.init(this, getString(R.string.eegeo_api_key));
// The MapView is contained in a layout xml
setContentView(R.layout.position_view_on_map_activity);
m_mapView = (MapView) findViewById(R.id.position_view_on_map_mapview);
m_mapView.onCreate(savedInstanceState);
m_calloutView = findViewById(R.id.position_view_on_map_callout);
m_calloutView.setVisibility(View.INVISIBLE);
m_screenView = (TextView) findViewById(R.id.screen_text_view_on_map_text);
m_worldView = (TextView) findViewById(R.id.world_text_view_on_map_text);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
m_positionerChangedListener = new OnScreenPointChangedListener(m_calloutView, m_screenView, m_worldView);
m_eegeoMap.addPositionerChangedListener(m_positionerChangedListener);
map.addPositioner(new PositionerOptions().position(new LatLng(37.802355, -122.405848)).elevation(10.0).elevationMode(HeightAboveGround));
}
});
}
public void onClickMapCollapse(View view) {
if (m_eegeoMap != null) {
m_eegeoMap.setMapCollapsed(!m_eegeoMap.isMapCollapsed());
}
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
m_mapView.onDestroy();
}
private clreplaced OnScreenPointChangedListener implements OnPositionerChangedListener {
private View m_callout;
private TextView m_screenTextView;
private TextView m_worldTextView;
OnScreenPointChangedListener(@NonNull View callout, @NonNull TextView screenTextView, @NonNull TextView worldTextView) {
m_callout = callout;
m_screenTextView = screenTextView;
m_worldTextView = worldTextView;
}
@UiThread
public void onPositionerChanged(Positioner positioner) {
String notVisibleString = getString(R.string.not_visible_add_positioner_activity);
if (positioner.isScreenPointProjectionDefined()) {
Point screenPoint = positioner.getScreenPointOrNull();
if (screenPoint != null) {
m_screenTextView.setText(String.format(getString(R.string.screen_point_add_positioner_activity), screenPoint.x, screenPoint.y));
PointF anchorUV = new PointF(0.5f, 1.0f);
ViewAnchor.positionView(m_callout, screenPoint, anchorUV);
} else {
m_screenTextView.setText(notVisibleString);
}
LatLngAlt transformedPoint = positioner.getTransformedPointOrNull();
if (transformedPoint != null) {
m_worldTextView.setText(String.format(getString(R.string.world_point_add_positioner_activity), transformedPoint.lareplacedude, transformedPoint.longitude, transformedPoint.alreplacedude));
} else {
m_worldTextView.setText(notVisibleString);
}
m_callout.setVisibility(View.VISIBLE);
} else {
m_screenTextView.setText(notVisibleString);
m_worldTextView.setText(notVisibleString);
m_callout.setVisibility(View.INVISIBLE);
}
}
}
}
17
Source : MultipartRouteActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced MultipartRouteActivity extends WrldExampleActivity implements OnRoutingQueryCompletedListener {
private MapView m_mapView;
private IndoorMapView m_indoorMapView = null;
private EegeoMap m_eegeoMap = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.routing_indoors_example_activity);
m_mapView = (MapView) findViewById(R.id.routing_example_mapview);
m_mapView.onCreate(savedInstanceState);
final OnRoutingQueryCompletedListener listener = this;
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
RelativeLayout uiContainer = (RelativeLayout) findViewById(R.id.eegeo_ui_container);
m_indoorMapView = new IndoorMapView(m_mapView, uiContainer, m_eegeoMap);
RoutingService routingService = map.createRoutingService();
routingService.findRoutes(new RoutingQueryOptions().addIndoorWaypoint(new LatLng(56.461231653264029, -2.983122836389253), 2).addIndoorWaypoint(new LatLng(56.4600344, -2.9783117), 2).onRoutingQueryCompletedListener(listener));
}
});
}
@Override
public void onRoutingQueryCompleted(RoutingQuery query, RoutingQueryResponse response) {
if (response.succeeded()) {
Toast.makeText(MultipartRouteActivity.this, "Found routes", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(MultipartRouteActivity.this, "Failed to find routes", Toast.LENGTH_LONG).show();
}
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
m_mapView.onDestroy();
}
}
17
Source : MarkerTappedNotificationActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced MarkerTappedNotificationActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private Marker m_markerA = null;
private Marker m_markerB = null;
private OnMarkerClickListener m_markerTappedListener = new MarkerClickListenerImpl();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.marker_tapped_notification_activity);
m_mapView = (MapView) findViewById(R.id.marker_tapped_notification_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
m_eegeoMap.addMarkerClickListener(m_markerTappedListener);
m_markerA = m_eegeoMap.addMarker(new MarkerOptions().position(new LatLng(37.784560, -122.402092)).labelText("Marker A"));
m_markerB = m_eegeoMap.addMarker(new MarkerOptions().position(new LatLng(37.783372, -122.400834)).labelText("Marker B"));
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
m_eegeoMap.removeMarker(m_markerA);
m_eegeoMap.removeMarker(m_markerB);
}
m_mapView.onDestroy();
}
private clreplaced MarkerClickListenerImpl implements OnMarkerClickListener {
public void onMarkerClick(Marker marker) {
String message = String.format(Locale.getDefault(), "'%1s' [%2$.6f, %3$.6f]", marker.getreplacedle(), marker.getPosition().lareplacedude, marker.getPosition().longitude);
Context context = MarkerTappedNotificationActivity.this;
new AlertDialog.Builder(context).setreplacedle("Marker tapped").setMessage(message).setIcon(android.R.drawable.ic_dialog_map).show();
}
}
}
17
Source : MarkerChangeLocationActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced MarkerChangeLocationActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private Marker m_marker = null;
private boolean m_locationToggle = false;
private Handler m_timerHandler = new Handler();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.marker_change_location_activity);
m_mapView = (MapView) findViewById(R.id.marker_change_location_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
final LatLng locationA = new LatLng(37.784560, -122.402092);
final LatLng locationB = new LatLng(37.783372, -122.400834);
m_marker = m_eegeoMap.addMarker(new MarkerOptions().position(locationA).labelText("This is a moving marker"));
m_timerHandler.postDelayed(new Runnable() {
@Override
public void run() {
if (m_eegeoMap != null) {
m_locationToggle = !m_locationToggle;
LatLng newLocation = m_locationToggle ? locationB : locationA;
m_marker.setPosition(newLocation);
m_timerHandler.postDelayed(this, 2000);
}
}
}, 2000);
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
m_eegeoMap.removeMarker(m_marker);
m_eegeoMap = null;
}
m_mapView.onDestroy();
}
}
17
Source : IndoorRouteActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced IndoorRouteActivity extends WrldExampleActivity implements OnRoutingQueryCompletedListener {
private MapView m_mapView;
private IndoorMapView m_indoorMapView = null;
private EegeoMap m_eegeoMap = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.routing_indoors_example_activity);
m_mapView = (MapView) findViewById(R.id.routing_example_mapview);
m_mapView.onCreate(savedInstanceState);
final OnRoutingQueryCompletedListener listener = this;
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
RelativeLayout uiContainer = (RelativeLayout) findViewById(R.id.eegeo_ui_container);
m_indoorMapView = new IndoorMapView(m_mapView, uiContainer, m_eegeoMap);
RoutingService routingService = map.createRoutingService();
routingService.findRoutes(new RoutingQueryOptions().addIndoorWaypoint(new LatLng(56.46024, -2.978629), 0).addIndoorWaypoint(new LatLng(56.4600344, -2.9783117), 2).onRoutingQueryCompletedListener(listener));
}
});
}
@Override
public void onRoutingQueryCompleted(RoutingQuery query, RoutingQueryResponse response) {
if (response.succeeded()) {
Toast.makeText(IndoorRouteActivity.this, "Found routes", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(IndoorRouteActivity.this, "Failed to find routes", Toast.LENGTH_LONG).show();
}
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
m_mapView.onDestroy();
}
}
17
Source : BlueSphereIndoorsActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced BlueSphereIndoorsActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private BlueSphere m_bluesphere = null;
private boolean m_locationToggle = false;
private Handler m_timerHandler = new Handler();
private IndoorMapView m_indoorMapView = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setLockedOrientation();
setContentView(R.layout.bluesphere_change_location_activity);
m_mapView = (MapView) findViewById(R.id.bluesphere_change_location_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
RelativeLayout uiContainer = (RelativeLayout) findViewById(R.id.eegeo_ui_container);
m_indoorMapView = new IndoorMapView(m_mapView, uiContainer, m_eegeoMap);
final LatLng locationA = new LatLng(56.460017, -2.978245);
final LatLng locationB = new LatLng(56.459943, -2.978216);
m_bluesphere = m_eegeoMap.getBlueSphere();
m_bluesphere.setEnabled(true);
m_bluesphere.setPosition(locationA);
m_bluesphere.setIndoorMap("westport_house", 2);
m_timerHandler.postDelayed(new Runnable() {
@Override
public void run() {
if (m_eegeoMap != null) {
m_locationToggle = !m_locationToggle;
LatLng newLocation = m_locationToggle ? locationB : locationA;
m_bluesphere.setPosition(newLocation);
m_timerHandler.postDelayed(this, 2000);
}
}
}, 2000);
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
m_eegeoMap = null;
}
m_mapView.onDestroy();
}
private void setLockedOrientation() {
if (getResources().getBoolean(R.bool.is_large_device)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
} else {
// force portrait on phone
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
}
}
17
Source : BlueSphereChangeLocationActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced BlueSphereChangeLocationActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private BlueSphere m_bluesphere = null;
private boolean m_locationToggle = false;
private Handler m_timerHandler = new Handler();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.bluesphere_change_location_activity);
m_mapView = (MapView) findViewById(R.id.bluesphere_change_location_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
final LatLng locationA = new LatLng(56.459811, -2.977928);
final LatLng locationB = new LatLng(56.459675, -2.977205);
m_bluesphere = m_eegeoMap.getBlueSphere();
m_bluesphere.setEnabled(true);
m_bluesphere.setPosition(locationA);
m_timerHandler.postDelayed(new Runnable() {
@Override
public void run() {
if (m_eegeoMap != null) {
m_locationToggle = !m_locationToggle;
LatLng newLocation = m_locationToggle ? locationB : locationA;
m_bluesphere.setPosition(newLocation);
m_timerHandler.postDelayed(this, 2000);
}
}
}, 2000);
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
m_eegeoMap = null;
}
m_mapView.onDestroy();
}
}
17
Source : BlueSphereChangeElevationActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced BlueSphereChangeElevationActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private BlueSphere m_bluesphere = null;
private boolean m_elevationToggle = false;
private Handler m_timerHandler = new Handler();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.bluesphere_change_elevation_activity);
m_mapView = (MapView) findViewById(R.id.bluesphere_change_elevation_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
final double elevationA = 0;
final double elevationB = 45;
final LatLng startPosition = new LatLng(56.459721, -2.977541);
m_bluesphere = m_eegeoMap.getBlueSphere();
m_bluesphere.setEnabled(true);
m_bluesphere.setPosition(startPosition);
m_bluesphere.setElevation(elevationA);
m_timerHandler.postDelayed(new Runnable() {
@Override
public void run() {
if (m_eegeoMap != null) {
m_elevationToggle = !m_elevationToggle;
double newElevation = m_elevationToggle ? elevationB : elevationA;
m_bluesphere.setElevation(newElevation);
m_timerHandler.postDelayed(this, 2000);
}
}
}, 2000);
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
m_eegeoMap = null;
}
m_mapView.onDestroy();
}
}
17
Source : BlueSphereChangeBearingActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced BlueSphereChangeBearingActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private BlueSphere m_bluesphere = null;
private Handler m_timerHandler = new Handler();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.bluesphere_change_bearing_activity);
m_mapView = (MapView) findViewById(R.id.bluesphere_change_bearing_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
final LatLng startPosition = new LatLng(56.459721, -2.977541);
m_bluesphere = m_eegeoMap.getBlueSphere();
m_bluesphere.setEnabled(true);
m_bluesphere.setPosition(startPosition);
m_bluesphere.setBearing(0);
m_timerHandler.postDelayed(new Runnable() {
@Override
public void run() {
if (m_eegeoMap != null) {
m_bluesphere.setBearing(m_bluesphere.getBearing() + 45);
m_timerHandler.postDelayed(this, 2000);
}
}
}, 2000);
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
m_eegeoMap = null;
}
m_mapView.onDestroy();
}
}
17
Source : AddPropIndoorsActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced AddPropIndoorsActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private IndoorMapView m_indoorMapView = null;
private List<Prop> m_props = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setLockedOrientation();
setContentView(R.layout.add_prop_indoors_activity);
m_mapView = (MapView) findViewById(R.id.add_prop_indoors_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
RelativeLayout uiContainer = (RelativeLayout) findViewById(R.id.eegeo_ui_container);
m_indoorMapView = new IndoorMapView(m_mapView, uiContainer, m_eegeoMap);
final int numberOfFloors = 5;
for (int floorId = 0; floorId < numberOfFloors; ++floorId) {
Prop prop = m_eegeoMap.addProp(new PropOptions().position(new LatLng(37.782084, -122.404578)).indoor("intercontinental_hotel_8628", floorId).geometryId("duck").headingDegrees(90).elevation(0.0));
m_props.add(prop);
}
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
for (Prop prop : m_props) {
m_eegeoMap.removeProp(prop);
}
}
m_mapView.onDestroy();
}
private void setLockedOrientation() {
if (getResources().getBoolean(R.bool.is_large_device)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
} else {
// force portrait on phone
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
}
}
17
Source : AddPolylineIndoorsActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced AddPolylineIndoorsActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private IndoorMapView m_indoorMapView = null;
private List<Polyline> m_polylines = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.add_polyline_indoors_activity);
m_mapView = (MapView) findViewById(R.id.add_polyline_indoors_mapview);
m_mapView.onCreate(savedInstanceState);
final int transparentRed = ColorUtils.setAlphaComponent(Color.RED, 128);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
RelativeLayout uiContainer = (RelativeLayout) findViewById(R.id.eegeo_ui_container);
m_indoorMapView = new IndoorMapView(m_mapView, uiContainer, m_eegeoMap);
final int numberOfFloors = 5;
for (int floorId = 0; floorId < numberOfFloors; ++floorId) {
Polyline polyline = m_eegeoMap.addPolyline(new PolylineOptions().add(new LatLng(37.782084, -122.404578), new LatLng(37.782126, -122.404530), new LatLng(37.782057, -122.404440), new LatLng(37.782012, -122.404491)).color(transparentRed).indoor("intercontinental_hotel_8628", floorId));
m_polylines.add(polyline);
}
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
for (Polyline polyline : m_polylines) {
m_eegeoMap.removePolyline(polyline);
}
}
m_mapView.onDestroy();
}
}
17
Source : AddPolylineActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced AddPolylineActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private Polyline m_polyline = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.add_polyline_activity);
m_mapView = (MapView) findViewById(R.id.add_polyline_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
m_polyline = m_eegeoMap.addPolyline(new PolylineOptions().add(new LatLng(37.786617, -122.404654), new LatLng(37.797843, -122.407057), new LatLng(37.798962, -122.398260), new LatLng(37.794299, -122.395234)).color(ColorUtils.setAlphaComponent(Color.RED, 128)));
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
m_eegeoMap.removePolyline(m_polyline);
}
m_mapView.onDestroy();
}
}
17
Source : AddPolygonWithHolesActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced AddPolygonWithHolesActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private Polygon m_polygon = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.add_polygon_with_holes_activity);
m_mapView = (MapView) findViewById(R.id.add_polygon_with_holes_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
m_polygon = m_eegeoMap.addPolygon(new PolygonOptions().add(new LatLng(37.786617, -122.404654), new LatLng(37.797843, -122.407057), new LatLng(37.798962, -122.398260), new LatLng(37.794299, -122.395234)).addHole(Arrays.asList(new LatLng(37.795168, -122.402665), new LatLng(37.792300, -122.403781), new LatLng(37.792656, -122.400420))).addHole(Arrays.asList(new LatLng(37.790979, -122.403028), new LatLng(37.790404, -122.401272), new LatLng(37.788705, -122.402579), new LatLng(37.789706, -122.403516))).fillColor(ColorUtils.setAlphaComponent(Color.BLUE, 128)));
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
m_eegeoMap.removePolygon(m_polygon);
}
m_mapView.onDestroy();
}
}
17
Source : AddPolygonWithElevationActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced AddPolygonWithElevationActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private Polygon m_lowerPolygon = null;
private Polygon m_upperPolygon = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.add_polygon_with_elevation_activity);
m_mapView = (MapView) findViewById(R.id.add_polygon_with_elevation_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
LatLng[] points = { new LatLng(55.945976, -3.162339), new LatLng(55.943671, -3.158673), new LatLng(55.941648, -3.159911), new LatLng(55.943248, -3.163275) };
m_lowerPolygon = m_eegeoMap.addPolygon(new PolygonOptions().add(points).fillColor(ColorUtils.setAlphaComponent(Color.BLUE, 128)));
m_upperPolygon = m_eegeoMap.addPolygon(new PolygonOptions().add(points).elevation(200.0).fillColor(ColorUtils.setAlphaComponent(Color.RED, 128)));
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
m_eegeoMap.removePolygon(m_lowerPolygon);
m_eegeoMap.removePolygon(m_upperPolygon);
}
m_mapView.onDestroy();
}
}
17
Source : AddPolygonIndoorsActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced AddPolygonIndoorsActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private IndoorMapView m_indoorMapView = null;
private List<Polygon> m_polygons = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setLockedOrientation();
setContentView(R.layout.add_polygon_indoors_activity);
m_mapView = (MapView) findViewById(R.id.add_polygon_indoors_mapview);
m_mapView.onCreate(savedInstanceState);
final int transparentBlue = ColorUtils.setAlphaComponent(Color.BLUE, 128);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
RelativeLayout uiContainer = (RelativeLayout) findViewById(R.id.eegeo_ui_container);
m_indoorMapView = new IndoorMapView(m_mapView, uiContainer, m_eegeoMap);
final int numberOfFloors = 5;
for (int floorId = 0; floorId < numberOfFloors; ++floorId) {
Polygon polygon = m_eegeoMap.addPolygon(new PolygonOptions().add(new LatLng(37.782084, -122.404578), new LatLng(37.782126, -122.404530), new LatLng(37.782057, -122.404440), new LatLng(37.782012, -122.404491)).fillColor(transparentBlue).indoor("intercontinental_hotel_8628", floorId));
m_polygons.add(polygon);
}
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
for (Polygon polygon : m_polygons) {
m_eegeoMap.removePolygon(polygon);
}
}
m_mapView.onDestroy();
}
private void setLockedOrientation() {
if (getResources().getBoolean(R.bool.is_large_device)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
} else {
// force portrait on phone
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
}
}
17
Source : AddPolygonActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced AddPolygonActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private Polygon m_polygon = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.add_polygon_activity);
m_mapView = (MapView) findViewById(R.id.add_polygon_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
m_polygon = m_eegeoMap.addPolygon(new PolygonOptions().add(new LatLng(37.786617, -122.404654), new LatLng(37.797843, -122.407057), new LatLng(37.798962, -122.398260), new LatLng(37.794299, -122.395234)).fillColor(ColorUtils.setAlphaComponent(Color.BLUE, 128)));
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
m_eegeoMap.removePolygon(m_polygon);
}
m_mapView.onDestroy();
}
}
17
Source : AddIndoorMarkerActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced AddIndoorMarkerActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private IndoorMapView m_indoorMapView = null;
private List<Marker> m_markers = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setLockedOrientation();
setContentView(R.layout.add_indoor_marker_activity);
m_mapView = (MapView) findViewById(R.id.add_indoor_marker_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
RelativeLayout uiContainer = (RelativeLayout) findViewById(R.id.eegeo_ui_container);
m_indoorMapView = new IndoorMapView(m_mapView, uiContainer, m_eegeoMap);
final int numberOfFloors = 7;
for (int floorId = 0; floorId < numberOfFloors; ++floorId) {
Marker marker = m_eegeoMap.addMarker(new MarkerOptions().position(new LatLng(56.459948, -2.978094)).indoor("westport_house", floorId).labelText("Marker on floor " + floorId));
m_markers.add(marker);
}
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
for (Marker marker : m_markers) {
m_eegeoMap.removeMarker(marker);
}
}
m_mapView.onDestroy();
}
private void setLockedOrientation() {
if (getResources().getBoolean(R.bool.is_large_device)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
} else {
// force portrait on phone
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
}
}
17
Source : AccuracyRingAroundBlueSphereActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced AccuracyRingAroundBlueSphereActivity extends WrldExampleActivity {
private MapView m_mapView;
private EegeoMap m_eegeoMap = null;
private BlueSphere m_bluesphere = null;
private boolean m_accuracyRingToggle = false;
private Handler m_timerHandler = new Handler();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.show_accuracy_ring_around_bluesphere_activity);
m_mapView = (MapView) findViewById(R.id.show_accuracy_ring_bluesphere_mapview);
m_mapView.onCreate(savedInstanceState);
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
final LatLng location = new LatLng(56.459811, -2.977928);
final float initialAccuracyRingRadius = 5;
final float alteredAccuracyRingRadius = 10;
m_bluesphere = m_eegeoMap.getBlueSphere();
m_bluesphere.setEnabled(true);
m_bluesphere.setPosition(location);
m_bluesphere.setAccuracyRingEnabled(true);
m_bluesphere.setCurrentLocationAccuracy(initialAccuracyRingRadius);
m_timerHandler.postDelayed(new Runnable() {
@Override
public void run() {
if (m_eegeoMap != null) {
m_accuracyRingToggle = !m_accuracyRingToggle;
float accuracyRadius = m_accuracyRingToggle ? alteredAccuracyRingRadius : initialAccuracyRingRadius;
m_bluesphere.setCurrentLocationAccuracy(accuracyRadius);
m_timerHandler.postDelayed(this, 2000);
}
}
}, 2000);
}
});
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
m_eegeoMap = null;
}
m_mapView.onDestroy();
}
}
17
Source : RouteView.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced RouteView {
private EegeoMap m_map = null;
private Route m_route = null;
private List<Polyline> m_polylinesForward = new ArrayList();
private List<Polyline> m_polylinesBackward = new ArrayList();
private boolean m_currentlyOnMap = false;
private float m_width;
private int m_colorARGB;
private int m_forwardPathColorARGB;
private float m_miterLimit;
private Map<Integer, List<RoutingPolylineCreateParams>> m_routeStepToPolylineCreateParams = new HashMap<>();
/**
* Create a new RouteView for the given route and options, and add it to the map.
*
* @param map The EegeoMap to draw this RouteView on.
* @param route The Route to display.
* @param options Options for styling the route.
*/
public RouteView(EegeoMap map, Route route, RouteViewOptions options) {
this.m_map = map;
this.m_route = route;
this.m_width = options.getWidth();
this.m_colorARGB = options.getColor();
this.m_forwardPathColorARGB = options.getForwardPathColor();
this.m_miterLimit = options.getMiterLimit();
addToMap();
}
/**
* Add this RouteView back on to the map, if it has been removed.
*/
public void addToMap() {
int flattenedStepIndex = 0;
for (RouteSection section : m_route.sections) {
List<RouteStep> steps = section.steps;
for (int i = 0; i < steps.size(); ++i) {
RouteStep step = steps.get(i);
if (step.path.size() < 2) {
continue;
}
if (step.isMultiFloor) {
boolean isValidTransition = i > 0 && i < (steps.size() - 1) && step.isIndoors;
if (!isValidTransition) {
continue;
}
RouteStep stepBefore = steps.get(i - 1);
RouteStep stepAfter = steps.get(i + 1);
addLineCreationParamsForStep(step, stepBefore.indoorFloorId, stepAfter.indoorFloorId, flattenedStepIndex, false);
} else {
addLineCreationParamsForStep(step, flattenedStepIndex);
}
flattenedStepIndex++;
}
}
refreshPolylines();
m_currentlyOnMap = true;
}
private void addLineCreationParamsForStep(RouteStep routeStep, int flattenedStepIndex) {
if (routeStep.path.size() < 2) {
return;
}
m_routeStepToPolylineCreateParams.put(flattenedStepIndex, RouteViewHelper.createLinesForRouteDirection(routeStep, false));
}
private void addLineCreationParamsForStep(RouteStep routeStep, int stepBefore, int stepAfter, int flattenedStepIndex, boolean isForwardColor) {
if (routeStep.path.size() < 2) {
return;
}
m_routeStepToPolylineCreateParams.put(flattenedStepIndex, RouteViewHelper.createLinesForFloorTransition(routeStep, stepBefore, stepAfter, isForwardColor));
}
private void addLineCreationParamsForStep(RouteStep routeStep, int stepIndex, LatLng closestPointOnPath, int splitIndex) {
if (routeStep.path.size() < 2) {
return;
}
m_routeStepToPolylineCreateParams.put(stepIndex, RouteViewHelper.createLinesForRouteDirection(routeStep, splitIndex, closestPointOnPath));
}
private void refreshPolylines() {
removeFromMap();
List<RoutingPolylineCreateParams> allPolylineCreateParams = new ArrayList<>();
for (int i = 0; i < m_routeStepToPolylineCreateParams.size(); i++) {
allPolylineCreateParams.addAll(m_routeStepToPolylineCreateParams.get(i));
}
List<PolylineOptions> backwardPolyLineOptionsList = new ArrayList<>();
List<PolylineOptions> forwardPolyLineOptionsList = new ArrayList<>();
RouteViewAmalgamationHelper.createPolylines(allPolylineCreateParams, m_width, m_miterLimit, backwardPolyLineOptionsList, forwardPolyLineOptionsList);
for (PolylineOptions polyLineOption : backwardPolyLineOptionsList) {
polyLineOption.color(m_colorARGB);
Polyline routeLine = m_map.addPolyline(polyLineOption);
m_polylinesBackward.add(routeLine);
}
for (PolylineOptions polyLineOption : forwardPolyLineOptionsList) {
polyLineOption.color(m_forwardPathColorARGB);
Polyline routeLine = m_map.addPolyline(polyLineOption);
m_polylinesForward.add(routeLine);
}
}
/**
* Update the progress of turn by turn navigation on route.
*
* @param sectionIndex The index of current RouteSection.
* @param stepIndex The index of current RouteStep.
* @param closestPointOnRoute Closest point on the route in PointOnRoute.
* @param indexOfPathSegmentStartVertex Vertex index where the path segment starts for the projected point. Can be used to separate traversed path.
*/
public void updateRouteProgress(int sectionIndex, int stepIndex, LatLng closestPointOnRoute, int indexOfPathSegmentStartVertex) {
removeFromMap();
int flattenedStepIndex = 0;
for (int x = 0; x < m_route.sections.size(); ++x) {
List<RouteStep> steps = m_route.sections.get(x).steps;
for (int i = 0; i < steps.size(); ++i) {
RouteStep step = steps.get(i);
boolean isActiveStep = sectionIndex == x && stepIndex == i;
if (step.path.size() < 2) {
continue;
}
if (step.isMultiFloor) {
boolean isValidTransition = i > 0 && i < (steps.size() - 1) && step.isIndoors;
if (!isValidTransition) {
continue;
}
RouteStep stepBefore = steps.get(i - 1);
RouteStep stepAfter = steps.get(i + 1);
if (isActiveStep) {
boolean hasReachedEnd = indexOfPathSegmentStartVertex == (step.path.size() - 1);
addLineCreationParamsForStep(step, stepBefore.indoorFloorId, stepAfter.indoorFloorId, flattenedStepIndex, !hasReachedEnd);
} else {
addLineCreationParamsForStep(step, stepBefore.indoorFloorId, stepAfter.indoorFloorId, flattenedStepIndex, false);
}
} else {
if (isActiveStep) {
addLineCreationParamsForStep(step, flattenedStepIndex, closestPointOnRoute, indexOfPathSegmentStartVertex);
} else {
addLineCreationParamsForStep(step, flattenedStepIndex);
}
}
flattenedStepIndex++;
}
}
refreshPolylines();
}
/**
* Remove this RouteView from the map.
*/
public void removeFromMap() {
for (Polyline polyline : m_polylinesBackward) {
m_map.removePolyline(polyline);
}
m_polylinesBackward.clear();
for (Polyline polyline : m_polylinesForward) {
m_map.removePolyline(polyline);
}
m_polylinesForward.clear();
m_currentlyOnMap = false;
}
/**
* Sets the width of this RouteView's polylines.
*
* @param width The width of the polyline in screen pixels.
*/
@UiThread
public void setWidth(float width) {
m_width = width;
for (Polyline polyline : m_polylinesBackward) {
polyline.setWidth(m_width);
}
for (Polyline polyline : m_polylinesForward) {
polyline.setWidth(m_width);
}
}
/**
* Sets the color for this RouteView's polylines.
*
* @param color The color of the polyline as a 32-bit ARGB color.
*/
@UiThread
public void setColor(int color) {
m_colorARGB = color;
for (Polyline polyline : m_polylinesBackward) {
polyline.setColor(m_colorARGB);
}
}
/**
* Sets the Forward color for this RouteView's polylines.
*
* @param color The color of the polyline as a 32-bit ARGB color.
*/
@UiThread
public void setForwardColor(int color) {
m_forwardPathColorARGB = color;
for (Polyline polyline : m_polylinesForward) {
polyline.setColor(m_forwardPathColorARGB);
}
}
/**
* Sets the miter limit of this RouteView's polylines.
*
* @param miterLimit the miter limit, as a ratio between maximum allowed miter join diagonal
* length and the line width.
*/
@UiThread
public void setMiterLimit(float miterLimit) {
m_miterLimit = miterLimit;
for (Polyline polyline : m_polylinesBackward) {
polyline.setMiterLimit(m_miterLimit);
}
for (Polyline polyline : m_polylinesForward) {
polyline.setMiterLimit(m_miterLimit);
}
}
}
17
Source : IndoorMapView.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced IndoorMapView implements OnIndoorEnteredListener, OnIndoorExitedListener, OnFloorChangedListener, View.OnClickListener, View.OnTouchListener {
private final long m_stateChangeAnimationTimeMilliseconds = 200;
private final long m_stateChangeAnimationDelayMilliseconds = m_stateChangeAnimationTimeMilliseconds * 5;
private final long m_initialJumpThresholdPx = 5;
private final float LisreplacedemHeight;
private EegeoMap m_eegeoMap = null;
private RelativeLayout m_uiContainer = null;
private View m_uiRootView = null;
private View m_topPanel = null;
private View m_rightPanel = null;
private ImageView m_backButton = null;
private TextView m_floorNameView = null;
private RelativeLayout m_floorButton = null;
private TextView m_floorButtonText = null;
private Boolean m_draggingFloorButton;
private float m_topYPosActive;
private float m_topYPosInactive;
private RelativeLayout m_floorListContainer;
private BackwardsCompatibleListView m_floorList;
private int m_maxFloorsViewableCount = 5;
private RelativeLayout m_floorLayout;
private ImageView m_floorUpArrow;
private ImageView m_floorDownArrow;
private boolean m_isScrolling = false;
private float m_scrollYCoordinate;
private Handler m_scrollHandler;
private Runnable m_scrollingRunnable;
private float m_leftXPosActiveBackButton;
private float m_leftXPosActiveFloorListContainer;
private float m_leftXPosInactive;
private IndoorFloorListAdapter m_floorListAdapter = null;
private float m_previousYCoordinate;
private boolean m_isButtonInitialJumpRemoved = false;
private boolean m_isOnScreen = false;
private IndoorMap m_indoorMap = null;
private int m_currentFloorIndex = -1;
private final int TextColorNormal = Color.parseColor("#1256BE");
private final int TextColorDown = Color.parseColor("#CDFC0D");
public IndoorMapView(MapView mapView, final RelativeLayout uiContainer, EegeoMap eegeoMap) {
m_eegeoMap = eegeoMap;
m_uiContainer = uiContainer;
LayoutInflater inflater = LayoutInflater.from(m_uiContainer.getContext());
m_uiRootView = inflater.inflate(R.layout.interiors_explorer_layout, m_uiContainer, false);
LisreplacedemHeight = m_uiRootView.getContext().getResources().getDimension(R.dimen.elevator_list_item_height);
m_topPanel = m_uiRootView.findViewById(R.id.top_panel);
m_rightPanel = m_uiRootView.findViewById(R.id.right_panel);
m_backButton = (ImageView) m_uiRootView.findViewById(R.id.back_button);
m_backButton.setOnClickListener(this);
m_floorNameView = (TextView) m_uiRootView.findViewById(R.id.floor_name);
m_floorListContainer = (RelativeLayout) m_uiRootView.findViewById(R.id.interiors_floor_list_container);
m_floorList = (BackwardsCompatibleListView) m_uiRootView.findViewById(R.id.interiors_floor_item_list);
m_floorList.setOnTouchListener(new PropagateToViewTouchListener(mapView));
m_floorList.sereplacedemHeight(LisreplacedemHeight);
m_floorListAdapter = new IndoorFloorListAdapter(R.layout.interiors_floor_list_item);
m_floorList.setAdapter(m_floorListAdapter);
m_floorLayout = (RelativeLayout) m_uiRootView.findViewById(R.id.interiors_floor_layout);
m_floorUpArrow = (ImageView) m_uiRootView.findViewById(R.id.interiors_elevator_up_arrow);
m_floorDownArrow = (ImageView) m_uiRootView.findViewById(R.id.interiors_elevator_down_arrow);
m_floorButton = (RelativeLayout) m_uiRootView.findViewById(R.id.interiors_floor_list_button);
m_floorButtonText = (TextView) m_uiRootView.findViewById(R.id.interiors_floor_list_button_text);
m_floorButtonText.setTextColor(TextColorNormal);
m_draggingFloorButton = false;
m_floorButton.setOnTouchListener(this);
m_uiRootView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
final float screenWidth = m_uiContainer.getWidth();
float controlWidth = m_topPanel.getWidth();
float controlHeight = m_topPanel.getHeight();
m_topYPosActive = m_uiRootView.getContext().getResources().getDimension(R.dimen.elevator_top_margin);
m_topYPosInactive = -controlHeight;
m_topPanel.setX((screenWidth * 0.5f) - (controlWidth * 0.5f));
m_topPanel.setY(m_topYPosInactive);
controlWidth = m_floorListContainer.getWidth();
controlHeight = m_floorListContainer.getHeight();
int menuButtonMarginPx = (int) m_uiRootView.getContext().getResources().getDimension(R.dimen.elevator_side_margin);
m_leftXPosActiveBackButton = screenWidth - (menuButtonMarginPx + m_backButton.getWidth());
m_leftXPosActiveFloorListContainer = screenWidth - (menuButtonMarginPx + controlWidth - (controlWidth - m_backButton.getWidth()) / 2.0f);
m_leftXPosInactive = screenWidth;
m_floorListContainer.setX(m_leftXPosInactive);
m_backButton.setX(m_leftXPosInactive);
int screenHeight = m_uiContainer.getHeight();
RelativeLayout.LayoutParams rightPanelLayoutParams = (RelativeLayout.LayoutParams) m_rightPanel.getLayoutParams();
int rightPanelMarginTop = rightPanelLayoutParams.topMargin;
int rightPanelMarginBottom = rightPanelLayoutParams.bottomMargin;
RelativeLayout.LayoutParams floorListContainerLayoutParams = (RelativeLayout.LayoutParams) m_floorListContainer.getLayoutParams();
int floorListMarginTop = floorListContainerLayoutParams.topMargin;
int maxFloorContainerHeight = screenHeight - rightPanelMarginTop - m_backButton.getHeight() - floorListMarginTop - rightPanelMarginBottom;
m_maxFloorsViewableCount = (int) Math.floor(maxFloorContainerHeight / LisreplacedemHeight);
m_uiRootView.removeOnLayoutChangeListener(this);
}
});
m_uiContainer.addView(m_uiRootView);
m_uiRootView.setVisibility(View.VISIBLE);
hideFloorLabels();
m_eegeoMap.addOnIndoorEnteredListener(this);
m_eegeoMap.addOnIndoorExitedListener(this);
m_eegeoMap.addOnFloorChangedListener(this);
m_scrollHandler = new Handler();
m_scrollingRunnable = new Runnable() {
@Override
public void run() {
scrollingUpdate();
m_scrollHandler.postDelayed(m_scrollingRunnable, 1);
}
};
forceViewRelayout(mapView);
}
@UiThread
public void onIndoorEntered() {
m_indoorMap = m_eegeoMap.getActiveIndoorMap();
m_currentFloorIndex = m_eegeoMap.getCurrentFloorIndex();
updateFloors(m_indoorMap.floorIds, m_currentFloorIndex);
setFloorName(m_indoorMap.floorNames[m_currentFloorIndex]);
setSelectedFloorIndex(m_currentFloorIndex);
m_uiRootView.setVisibility(View.VISIBLE);
forceViewRelayout(m_uiRootView);
animateToActive();
}
public void onIndoorExited() {
m_uiRootView.setVisibility(View.INVISIBLE);
}
public void onFloorChanged(int selectedFloor) {
m_currentFloorIndex = selectedFloor;
setFloorName(m_indoorMap.floorNames[m_currentFloorIndex]);
setSelectedFloorIndex(m_currentFloorIndex);
}
private int getListViewHeight(ListView list) {
return list.getCount() * (int) LisreplacedemHeight;
}
private int getListViewHeight(int listCount) {
return listCount * (int) LisreplacedemHeight;
}
public void destroy() {
m_uiContainer.removeView(m_uiRootView);
m_uiRootView = null;
m_scrollHandler.removeCallbacks(m_scrollingRunnable);
}
public void updateFloors(String[] floorShortNames, int currentlySelectedFloorIndex) {
List<String> temp = new ArrayList<String>();
for (int i = floorShortNames.length - 1; i >= 0; --i) {
temp.add(floorShortNames[i]);
}
m_floorListAdapter.setData(temp);
float controlHeight = getListViewHeight(Math.min(m_floorList.getCount(), m_maxFloorsViewableCount));
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) m_floorListContainer.getLayoutParams();
layoutParams.height = (int) controlHeight;
m_floorListContainer.setLayoutParams(layoutParams);
refreshFloorIndicator(currentlySelectedFloorIndex);
moveButtonToFloorIndex(currentlySelectedFloorIndex, false);
boolean floorSelectionEnabled = floorShortNames.length > 1;
m_floorListContainer.setVisibility(floorSelectionEnabled ? View.VISIBLE : View.GONE);
m_floorUpArrow.setY(m_floorList.getY());
m_floorDownArrow.setY(m_floorList.getY() + controlHeight - m_floorDownArrow.getHeight());
}
private void setArrowState(boolean showUp, boolean showDown) {
m_floorUpArrow.setVisibility(showUp ? View.VISIBLE : View.INVISIBLE);
m_floorDownArrow.setVisibility(showDown ? View.VISIBLE : View.INVISIBLE);
}
private void moveButtonToFloorIndex(int floorIndex, Boolean shouldAnimate) {
int floorCount = m_floorListAdapter.getCount();
int halfMaxFloorsViewableCount = (int) Math.ceil(m_maxFloorsViewableCount / 2.0f);
int startFloorIndex = floorCount - floorIndex;
if (floorCount - startFloorIndex >= halfMaxFloorsViewableCount) {
startFloorIndex = Math.max(startFloorIndex - halfMaxFloorsViewableCount, 0);
}
int screenFloorIndex = floorCount - 1 - floorIndex;
if (floorCount > m_maxFloorsViewableCount) {
startFloorIndex = Math.min(startFloorIndex, floorCount - m_maxFloorsViewableCount);
screenFloorIndex = floorCount - 1 - floorIndex - startFloorIndex;
}
float topY = (m_floorList.getY()) + (LisreplacedemHeight * 0.5f) - m_floorButton.getWidth() * 0.5f;
float newY = topY + screenFloorIndex * LisreplacedemHeight;
newY = Math.max(0.0f, Math.min(getListViewHeight(m_floorList), newY));
if (shouldAnimate) {
m_floorButton.animate().y(newY).setDuration(m_stateChangeAnimationTimeMilliseconds).start();
m_floorList.smoothScrollToPositionFromTop(startFloorIndex, 0);
} else {
m_floorButton.setY(newY);
m_floorList.setSelection(startFloorIndex);
}
if (floorCount > m_maxFloorsViewableCount) {
setArrowState(floorCount - floorIndex > halfMaxFloorsViewableCount, floorCount - startFloorIndex > m_maxFloorsViewableCount);
} else {
setArrowState(false, false);
}
}
public void setFloorName(String name) {
m_floorNameView.setText(name);
}
public void setSelectedFloorIndex(int index) {
refreshFloorIndicator(index);
if (!m_draggingFloorButton) {
moveButtonToFloorIndex(index, true);
}
}
@Override
public boolean onTouch(View view, MotionEvent event) {
if (view == m_floorButton) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
startDraggingButton(event.getRawY());
} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
updateDraggingButton(event.getRawY());
} else if (event.getAction() == MotionEvent.ACTION_UP) {
endDraggingButton();
}
return true;
}
return false;
}
private void startDraggingButton(float initialYCoordinate) {
showFloorLabels();
m_floorButton.getBackground().setState(new int[] { android.R.attr.state_pressed });
m_floorButtonText.setTextColor(TextColorDown);
m_previousYCoordinate = initialYCoordinate;
m_draggingFloorButton = true;
m_isButtonInitialJumpRemoved = false;
m_eegeoMap.expandIndoor();
startScrollingUpdate();
}
private void updateDraggingButton(float yCoordinate) {
m_scrollYCoordinate = yCoordinate;
if (!m_isButtonInitialJumpRemoved) {
detectAndRemoveInitialJump(m_scrollYCoordinate);
}
}
private void endDraggingButton() {
endScrollingUpdate();
hideFloorLabels();
m_draggingFloorButton = false;
m_floorButton.getBackground().setState(new int[] {});
m_floorButtonText.setTextColor(TextColorNormal);
View firstVisibleChild = m_floorList.getChildAt(0);
float topY = (m_floorList.getFirstVisiblePosition() * LisreplacedemHeight) - firstVisibleChild.getTop();
float dragParameter = 1.0f - ((topY + m_floorButton.getY()) / (getListViewHeight(m_floorList.getCount() - 1)));
int floorCount = m_floorListAdapter.getCount() - 1;
int selectedFloor = Math.round(dragParameter * floorCount);
moveButtonToFloorIndex(selectedFloor, true);
m_eegeoMap.collapseIndoor();
m_eegeoMap.setIndoorFloor(selectedFloor);
}
private float getScrollSpeed(float t) {
final float maxScrollSpeed = m_uiRootView.getContext().getResources().getDimension(R.dimen.elevator_max_scroll_speed);
t = Math.max(-1, Math.min(1, t));
return t * Math.abs(t) * maxScrollSpeed;
}
/**
* This function will remove the starting jump on slider if detected
*
* @param yCoordinate
*/
private void detectAndRemoveInitialJump(float yCoordinate) {
float y = yCoordinate;
float deltaY = y - m_previousYCoordinate;
if (Math.abs(deltaY) > m_initialJumpThresholdPx) {
m_previousYCoordinate += deltaY;
m_isButtonInitialJumpRemoved = true;
}
}
@Override
public void onClick(View view) {
if (view == m_backButton) {
animateToInactive();
m_uiRootView.setVisibility(View.INVISIBLE);
m_eegeoMap.onExitIndoorClicked();
}
}
public void animateToActive() {
m_isOnScreen = true;
animateViewToY((int) m_topYPosActive);
animateViewToX((int) m_leftXPosActiveBackButton, (int) m_leftXPosActiveFloorListContainer, m_isOnScreen);
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
int[] rootViewPosition = { 0, 0 };
m_uiRootView.getLocationInWindow(rootViewPosition);
int[] backButtonPosition = { 0, 0 };
m_backButton.getLocationInWindow(backButtonPosition);
int[] floorButtonPosition = { 0, 0 };
m_floorButton.getLocationInWindow(floorButtonPosition);
}
}, m_stateChangeAnimationTimeMilliseconds + (m_isOnScreen ? m_stateChangeAnimationDelayMilliseconds : 0));
}
public void animateToInactive() {
endScrollingUpdate();
m_isOnScreen = false;
animateViewToY((int) m_topYPosInactive);
animateViewToX((int) m_leftXPosInactive, (int) m_leftXPosInactive, m_isOnScreen);
}
protected void animateViewToY(final int yAsPx) {
m_topPanel.animate().y(yAsPx).setDuration(m_stateChangeAnimationTimeMilliseconds);
}
protected void animateViewToX(final int xAsPxBackButton, final int xAsPxFloorListContainer, final boolean addDelay) {
long delay = addDelay ? m_stateChangeAnimationDelayMilliseconds : 0;
m_floorListContainer.animate().x(xAsPxFloorListContainer).setDuration(m_stateChangeAnimationTimeMilliseconds).setStartDelay(delay);
m_backButton.animate().x(xAsPxBackButton).setDuration(m_stateChangeAnimationTimeMilliseconds).setStartDelay(delay);
}
public void notifyOnPause() {
endScrollingUpdate();
}
private void refreshFloorIndicator(int floorIndex) {
int nameIndex = (m_floorListAdapter.getCount() - 1) - floorIndex;
m_floorButtonText.setText((String) m_floorListAdapter.gereplacedem(nameIndex));
}
private void hideFloorLabels() {
m_floorLayout.animate().alpha(0.5f).setDuration(m_stateChangeAnimationTimeMilliseconds);
}
private void showFloorLabels() {
m_floorLayout.animate().alpha(1.0f).setDuration(m_stateChangeAnimationTimeMilliseconds);
}
private void startScrollingUpdate() {
if (!m_isScrolling) {
m_previousYCoordinate = m_scrollYCoordinate;
m_scrollingRunnable.run();
}
m_isScrolling = true;
}
private void scrollingUpdate() {
if (m_isScrolling) {
final float joystickScrollThresholdDistance = 0.25f;
if (!m_isButtonInitialJumpRemoved) {
detectAndRemoveInitialJump(m_scrollYCoordinate);
}
float newY = m_floorButton.getY() + (m_scrollYCoordinate - m_previousYCoordinate);
newY = Math.max(0.0f, Math.min(Math.min(getListViewHeight(m_maxFloorsViewableCount - 1), getListViewHeight(m_floorList.getCount() - 1)), newY));
m_floorButton.setY(newY);
m_previousYCoordinate = m_scrollYCoordinate;
float scrollDelta = 0;
float listViewHeightOnScreen = getListViewHeight(m_maxFloorsViewableCount - 1);
float normalisedNewY = newY / listViewHeightOnScreen;
if (normalisedNewY <= joystickScrollThresholdDistance) {
float localT = normalisedNewY / joystickScrollThresholdDistance;
scrollDelta = getScrollSpeed(1 - localT);
} else if (normalisedNewY >= 1 - joystickScrollThresholdDistance) {
float localT = (normalisedNewY - (1 - joystickScrollThresholdDistance)) / joystickScrollThresholdDistance;
scrollDelta = getScrollSpeed(-localT);
}
m_floorList.scrollListBy_compat(-Math.round(scrollDelta));
View firstVisibleChild = m_floorList.getChildAt(0);
float topY = (m_floorList.getFirstVisiblePosition() * LisreplacedemHeight) - firstVisibleChild.getTop();
float dragParameter = 1.0f - ((topY + newY) / (getListViewHeight(m_floorList.getCount() - 1)));
float floorParam = dragParameter * (m_floorList.getCount() - 1);
m_eegeoMap.setIndoorFloorInterpolation(floorParam);
int nearestFloorIndex = Math.round(floorParam);
setFloorName(m_indoorMap.floorNames[nearestFloorIndex]);
refreshFloorIndicator(nearestFloorIndex);
int floorCount = m_floorList.getCount();
if (floorCount > m_maxFloorsViewableCount) {
int firstFloorVisibleInView = m_floorList.getFirstVisiblePosition();
boolean showUp = firstFloorVisibleInView > 0 || firstVisibleChild.getTop() < -(LisreplacedemHeight * 0.5f);
boolean showDown = floorCount - firstFloorVisibleInView - (firstVisibleChild.getTop() < 0 ? 1 : 0) > m_maxFloorsViewableCount;
setArrowState(showUp, showDown);
}
}
}
private void endScrollingUpdate() {
m_isScrolling = false;
m_scrollHandler.removeCallbacks(m_scrollingRunnable);
}
private clreplaced PropagateToViewTouchListener implements View.OnTouchListener {
private View m_target;
PropagateToViewTouchListener(View target) {
m_target = target;
}
@Override
public boolean onTouch(View view, MotionEvent event) {
return m_target.onTouchEvent(event);
}
}
@UiThread
private void forceViewRelayout(View view) {
view.measure(View.MeasureSpec.makeMeasureSpec(view.getMeasuredWidth(), View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(view.getMeasuredHeight(), View.MeasureSpec.EXACTLY));
view.layout(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
}
}
16
Source : RouteViewMarkersActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced RouteViewMarkersActivity extends WrldExampleActivity implements OnRoutingQueryCompletedListener {
private MapView m_mapView;
private IndoorMapView m_indoorMapView = null;
private EegeoMap m_eegeoMap = null;
private List<RouteView> m_routeViews = new ArrayList<RouteView>();
private List<Marker> m_markers = new ArrayList<Marker>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.routing_indoors_example_activity);
m_mapView = (MapView) findViewById(R.id.routing_example_mapview);
m_mapView.onCreate(savedInstanceState);
final OnRoutingQueryCompletedListener listener = this;
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
RelativeLayout uiContainer = (RelativeLayout) findViewById(R.id.eegeo_ui_container);
m_indoorMapView = new IndoorMapView(m_mapView, uiContainer, m_eegeoMap);
RoutingService routingService = map.createRoutingService();
routingService.findRoutes(new RoutingQueryOptions().addIndoorWaypoint(new LatLng(56.461231653264029, -2.983122836389253), 2).addIndoorWaypoint(new LatLng(56.4600344, -2.9783117), 2).onRoutingQueryCompletedListener(listener));
}
});
}
@Override
public void onRoutingQueryCompleted(RoutingQuery query, RoutingQueryResponse response) {
if (response.succeeded()) {
Toast.makeText(RouteViewMarkersActivity.this, "Found routes", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(RouteViewMarkersActivity.this, "Failed to find routes", Toast.LENGTH_LONG).show();
}
for (Route route : response.getResults()) {
RouteViewOptions options = new RouteViewOptions().color(Color.argb(128, 255, 0, 0)).width(8.0f);
RouteView routeView = new RouteView(m_eegeoMap, route, options);
m_routeViews.add(routeView);
for (RouteSection section : route.sections) {
for (RouteStep step : section.steps) {
MarkerOptions markerOptions = new MarkerOptions().position(step.path.get(0));
if (step.isIndoors) {
markerOptions.indoor(step.indoorId, step.indoorFloorId);
}
Marker marker = m_eegeoMap.addMarker(markerOptions);
m_markers.add(marker);
}
}
}
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
for (RouteView routeView : m_routeViews) {
routeView.removeFromMap();
}
for (Marker marker : m_markers) {
m_eegeoMap.removeMarker(marker);
}
}
m_mapView.onDestroy();
}
}
16
Source : RouteViewActivity.java
with BSD 2-Clause "Simplified" License
from wrld3d
with BSD 2-Clause "Simplified" License
from wrld3d
public clreplaced RouteViewActivity extends WrldExampleActivity implements OnRoutingQueryCompletedListener {
private MapView m_mapView;
private IndoorMapView m_indoorMapView = null;
private EegeoMap m_eegeoMap = null;
private List<RouteView> m_routeViews = new ArrayList<RouteView>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EegeoApi.init(this, getString(R.string.eegeo_api_key));
setContentView(R.layout.routing_example_activity);
m_mapView = (MapView) findViewById(R.id.routing_example_mapview);
m_mapView.onCreate(savedInstanceState);
final OnRoutingQueryCompletedListener listener = this;
m_mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final EegeoMap map) {
m_eegeoMap = map;
RelativeLayout uiContainer = (RelativeLayout) findViewById(R.id.eegeo_ui_container);
m_indoorMapView = new IndoorMapView(m_mapView, uiContainer, m_eegeoMap);
RoutingService routingService = map.createRoutingService();
routingService.findRoutes(new RoutingQueryOptions().addIndoorWaypoint(new LatLng(56.461231653264029, -2.983122836389253), 2).addIndoorWaypoint(new LatLng(56.4600344, -2.9783117), 2).onRoutingQueryCompletedListener(listener));
}
});
}
@Override
public void onRoutingQueryCompleted(RoutingQuery query, RoutingQueryResponse response) {
if (response.succeeded()) {
Toast.makeText(RouteViewActivity.this, "Found routes", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(RouteViewActivity.this, "Failed to find routes", Toast.LENGTH_LONG).show();
}
for (Route route : response.getResults()) {
RouteViewOptions options = new RouteViewOptions().color(Color.argb(128, 255, 0, 0)).width(8.0f);
RouteView routeView = new RouteView(m_eegeoMap, route, options);
m_routeViews.add(routeView);
}
}
@Override
protected void onResume() {
super.onResume();
m_mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
m_mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (m_eegeoMap != null) {
for (RouteView routeView : m_routeViews) {
routeView.removeFromMap();
}
}
m_mapView.onDestroy();
}
}
See More Examples