public class MapView
extends Fragment
setMap(Map, MappedinCallback)
to display the first map.Constructor and Description |
---|
MapView() |
Modifier and Type | Method and Description |
---|---|
void |
addAllStoreLabels(Venue venue,
TextPaint textPaint)
Adds store labels to all of the Polygons in this Venue.
|
void |
addElement(Element child)
Add one child element into the MapView
|
void |
contractMaps(MappedinCallback<Map> callback) |
void |
expandMaps(Map[] maps,
Vector3 translation,
MappedinCallback<Map> callback) |
void |
frame(Focusable[] framing,
float heading,
float tilt,
float over)
move camera to fit all focusable objects into screen with request heading and tilt
in period of time
|
void |
frame(Focusable[] framing,
float heading,
float tilt,
float over,
float padding)
move camera to fit all focusable objects into screen with request heading, tilt and padding
in period of time
|
void |
frame(Focusable framing,
float heading,
float tilt,
float over)
move camera to fit focusable object into screen with request heading and tilt
in period of time
|
void |
frame(Focusable framing,
float heading,
float tilt,
float over,
float padding)
move camera to fit focusable object into screen with request heading, tilt and padding
in period of time
|
int |
getBackgroundColor()
Gets the MapView background color
|
float |
getCameraHeading()
Returns the current direction the MapView is pointing at, in radians, relative to North.
|
float |
getCameraTilting()
Returns how much the MapView camera is tilted up or down, in radians
|
boolean |
getRotateGestureEnabled()
Returns whether the user can rotate the map with gestures
|
View |
onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) |
void |
onDrawFrame(GL10 gl) |
void |
onPause() |
void |
onResume() |
void |
onSurfaceChanged(GL10 gl,
int width,
int height) |
void |
onSurfaceCreated(GL10 gl,
EGLConfig config) |
void |
orbit(Focusable[] orbiting,
float heading,
float tilt,
float over)
move camera to fit all focusable objects into screen with request heading and tilt in
period of time
|
void |
orbit(Focusable[] orbiting,
float heading,
float tilt,
float over,
float padding)
move camera to fit all focusable objects into screen with request heading, tilt and padding
in period of time
|
void |
orbit(Focusable orbiting,
float heading,
float tilt,
float over)
Move the camera to fit a focusable object into screen with, rotating to the
requested heading and tilt, over a period of time
|
void |
orbit(Focusable orbiting,
float heading,
float tilt,
float over,
float padding)
Move the camera to fit a focusable object into screen with, rotating to the
requested heading, tilt and padding, over a period of time
|
void |
removeAllElements()
Remove all the child elements in this MapView
|
void |
removeAllStoreLabels(Venue venue)
Removes all store labels from all maps in the venue
|
void |
removeElement(Element child)
Remove the specific child element from the MapView
|
void |
resetPolygon(Polygon polygon)
Sets the (highlight)polygon back to it's original color and height
does nothing if not highlight polygon
|
void |
setBackgroundColor(int color)
Sets the MapView background color
|
void |
setColor(Polygon polygon,
int color,
float over)
Changes the polygon color, animated over some time.
|
void |
setColor(Polygon polygon,
int color,
int labelColor,
float over)
Changes the polygon and text annotation color, animated over some time.
|
void |
setDelegate(MapViewDelegate delegate)
Your MapViewDelegate, whose functions will get called when the has certain interactions with the MapView
|
void |
setHeight(Polygon polygon,
float height,
float over)
Changes the polygon height over time.
|
void |
setMap(Map map)
Sets the MapView to display specific map associated with the current venue.
|
void |
setMap(Map map,
MappedinCallback<Map> callback)
Sets the MapView to display specific map associated with the current venue.
|
void |
setRotateGestureEnabled(boolean enabled)
Sets whether the user can rotate the map with gestures
|
void |
zoom(int level,
float over)
Zooms in/out the camera
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
public void onPause()
public void onResume()
public void setBackgroundColor(int color)
color
- the color of the backgroundpublic int getBackgroundColor()
public void setMap(Map map)
Sets the MapView to display specific map associated with the current venue.
This will also draw any Element
objects (like part of a Path
) that fall onto the new map.
map
- The map to display. Typically this would be another floor.
mapView.setMap(polygon.getMap());
public void setMap(Map map, MappedinCallback<Map> callback)
Sets the MapView to display specific map associated with the current venue. trigger the MappedinCallback.onComplete when map loading is finished
This will also draw any Element
objects (like part of a Path
) that fall onto the new map.
map
- The map to display. Typically this would be another floor.callback
- MappedinCallback
call back function when mapView finish loading
map. onComplete function should use
runOnUiThread (only the least callback will be
called)
MappedinCallback setMapCallback = new MappedinCallback
public void setDelegate(MapViewDelegate delegate)
delegate
- MapViewDelegate
public void onSurfaceCreated(GL10 gl, EGLConfig config)
public void onSurfaceChanged(GL10 gl, int width, int height)
public void onDrawFrame(GL10 gl)
public void expandMaps(Map[] maps, Vector3 translation, MappedinCallback<Map> callback)
public void contractMaps(MappedinCallback<Map> callback)
public float getCameraHeading()
public float getCameraTilting()
public void orbit(Focusable orbiting, float heading, float tilt, float over)
orbiting
- A Focusable
object (such as Polygon
or Map
) to fit into screenheading
- Camera heading valuetilt
- Camera tilt valueover
- Period of time to animate the camera movement, in seconds.
Cylinder cylinder = new Cylinder(1.7f, 3.2f, Color.GRAY);
mapView.orbit(cylinder, 0f, (float) Math.PI / 5, 1f);
public void orbit(Focusable orbiting, float heading, float tilt, float over, float padding)
orbiting
- A Focusable
object (such as Polygon
or Map
) to fit into screenheading
- Camera heading valuetilt
- Camera tilt valueover
- Period of time to animate the camera movement, in seconds.padding
- padding between the view and the focusable object in meters.
Cylinder cylinder = new Cylinder(1.7f, 3.2f, Color.GRAY);
mapView.orbit(cylinder, 0f, (float) Math.PI / 5, 1f, 1.5f);
public void zoom(int level, float over)
level
- sets the camera to the specified zoom level. by default, ther are 10 levels 0-9.over
- Period of time to animate the camera movement, in seconds.public void orbit(Focusable[] orbiting, float heading, float tilt, float over)
orbiting
- Focusable objects (could be Coordinate
, Polygon
and/or
Map
) to fit into screenheading
- camera heading valuetilt
- camera tilt valueover
- period of time
Cylinder cylinder = new Cylinder(1.7f, 3.2f, Color.GRAY);
android.location.Location geoLocation = new android.location.Location("mappedin example");
geoLocation.setLatitude(43.825103);
geoLocation.setLongitude(-79.539562);
Coordinate coordinate = new Coordinate(geoLocation,venue.getMaps()[0]);
mapView.orbit(new Focusable[]{cylinder, coordinate}, 0f, (float) Math.PI / 5, 1f);
public void orbit(Focusable[] orbiting, float heading, float tilt, float over, float padding)
orbiting
- Focusable objects (could be Coordinate
, Polygon
and/or
Map
) to fit into screenheading
- camera heading valuetilt
- camera tilt valueover
- period of time padding
- padding between the view and the focusable object in meters.
Cylinder cylinder = new Cylinder(1.7f, 3.2f, Color.GRAY);
android.location.Location geoLocation = new android.location.Location("mappedin example");
geoLocation.setLatitude(43.825103);
geoLocation.setLongitude(-79.539562);
Coordinate coordinate = new Coordinate(geoLocation,venue.getMaps()[0]);
mapView.orbit(new Focusable[]{cylinder, coordinate}, 0f, (float) Math.PI / 5, 1f, 1.5f);
public void frame(Focusable framing, float heading, float tilt, float over)
public void frame(Focusable framing, float heading, float tilt, float over, float padding)
framing
- Focusable object (either Polygon
or Map
) to be fit into screenheading
- camera heading valuetilt
- camera tilt valueover
- period of timepadding
- padding between the view and the focusable object in meters.
Cylinder cylinder = new Cylinder(1.7f, 3.2f, Color.GRAY);
mapView.frame(cylinder, 0f, (float) Math.PI / 5, 1f, 1.5f);
public void frame(Focusable[] framing, float heading, float tilt, float over)
framing
- Focusable objectsheading
- camera heading valuetilt
- camera tilt valueover
- period of time
Cylinder cylinder = new Cylinder(1.7f, 3.2f, Color.GRAY);
android.location.Location geoLocation = new android.location.Location("mappedin example");
geoLocation.setLatitude(43.825103);
geoLocation.setLongitude(-79.539562);
Coordinate coordinate = new Coordinate(geoLocation,venue.getMaps()[0]);
mapView.frame(new Focusable[]{cylinder, coordinate}, 0f, (float) Math.PI / 5, 1f);
public void frame(Focusable[] framing, float heading, float tilt, float over, float padding)
framing
- Focusable objectsheading
- camera heading valuetilt
- camera tilt valueover
- period of timepadding
- padding between the view and the focusable object in meters.
Cylinder cylinder = new Cylinder(1.7f, 3.2f, Color.GRAY);
android.location.Location geoLocation = new android.location.Location("mappedin example");
geoLocation.setLatitude(43.825103);
geoLocation.setLongitude(-79.539562);
Coordinate coordinate = new Coordinate(geoLocation,venue.getMaps()[0]);
mapView.frame(new Focusable[]{cylinder, coordinate}, 0f, (float) Math.PI / 5, 1f, 1.5f);
public void setRotateGestureEnabled(boolean enabled)
enabled
- to enable rotate gestures set to true.public boolean getRotateGestureEnabled()
public void addElement(Element child)
child
- Element
public void removeElement(Element child)
child
- Element
public void removeAllElements()
public void setColor(Polygon polygon, int color, float over)
polygon
- Polygon
color
- android.graphics.Color
over
- the animation time in secondspublic void setColor(Polygon polygon, int color, int labelColor, float over)
polygon
- Polygon
color
- android.graphics.Color
Set polygon to this colorlabelColor
- android.graphics.Color
Set text label to this color if it has a
text annotation attach to this polygonover
- the animation time in secondspublic void setHeight(Polygon polygon, float height, float over)
polygon
- Polygon
height
- the rising distance in metersover
- the animation time in secondspublic void resetPolygon(Polygon polygon)
polygon
- Polygon
public void addAllStoreLabels(Venue venue, TextPaint textPaint)
venue
- The target venuetextPaint
- TextPaint
set label's size, color and font here
(if the content is too big to fit in the polygon it will
try shrink it text size to 75%, 50% and 25%)
TextPaint textPaint = new TextPaint();
textPaint.setColor(Color.BLACK);
textPaint.setTextSize(20);
textPaint.setTypeface(Typeface.SANS_SERIF);
mapView.addAllStoreLabels(venue, textPaint);
public void removeAllStoreLabels(Venue venue)
venue
- The target venue