Classes | Public Types | Public Member Functions

Wt::WGoogleMap Class Reference

A widget that displays a google map. More...

#include <Wt/WGoogleMap>

Inherits Wt::WCompositeWidget.

List of all members.

Classes

class  Coordinate
 A geographical coordinate (latitude/longitude). More...

Public Types

enum  MapTypeControl { NoControl, DefaultControl, MenuControl, HierarchicalControl }
 

MapTypeControl.

More...

Public Member Functions

 WGoogleMap (WContainerWidget *parent=0)
 Creates a map widget with optional parent.
virtual ~WGoogleMap ()
 Destructor.
void addMarker (const Coordinate &pos)
 Adds a marker overlay to the map.
void addPolyline (const std::vector< Coordinate > &points, const WColor &color=red, int width=2, double opacity=1.0)
 Adds a polyline overlay to the map.
void clearOverlays ()
 Removes all overlays from the map.
void openInfoWindow (const Coordinate &pos, const Wt::WString &myHtml)
 Opens a text bubble with html text at a specific location.
void setCenter (const Coordinate &center)
 Sets the map view to the given center.
void setCenter (const Coordinate &center, int zoom)
 Sets the map view to the given center and zoom level.
void panTo (const Coordinate &center)
 Changes the center point of the map to the given point.
void zoomWindow (const std::pair< Coordinate, Coordinate > &bbox)
 Zooms the map to a region defined by a bounding box.
void zoomWindow (const Coordinate &topLeft, const Coordinate &bottomRight)
 Zooms the map to a region defined by a bounding box.
void setZoom (int level)
 Sets the zoom level to the given new value.
void zoomIn ()
 Increments zoom level by one.
void zoomOut ()
 Decrements zoom level by one.
void savePosition ()
 Stores the current map position and zoom level.
void returnToSavedPosition ()
 Restores the map view that was saved by savePosition().
void checkResize ()
 Notifies the map of a change of the size of its container.
void enableDragging ()
 Enables the dragging of the map (enabled by default).
void disableDragging ()
 Disables the dragging of the map.
void enableDoubleClickZoom ()
 Enables double click to zoom in and out (enabled by default).
void disableDoubleClickZoom ()
 Disables double click to zoom in and out.
void enableGoogleBar ()
 Enables the GoogleBar, an integrated search control, on the map.
void disableGoogleBar ()
 Disables the GoogleBar integrated search control.
void enableScrollWheelZoom ()
 Enables zooming using a mouse's scroll wheel.
void disableScrollWheelZoom ()
 Disables zooming using a mouse's scroll wheel.
void setMapTypeControl (MapTypeControl type)
 Sets the map type control.
JSignal< Coordinate > & clicked ()
 The click event.
JSignal< Coordinate > & doubleClicked ()
 The double click event.
JSignal< Coordinate > & mouseMoved ()
 This event is fired when the user moves the mouse inside the map.

Detailed Description

A widget that displays a google map.

This widget uses the online Google Maps server to display a map. It exposes a part of the google maps API.

To use the map on a public server you will need to obtain a key. The widget will look for this key as the configuration property "google_api_key". If this configuration property has not been set, it will use a key that is suitable for localhost.

CSS

Styling through CSS is not applicable.

Contributed by: Richard Ulrich.


Member Enumeration Documentation

MapTypeControl.

Enumerator:
NoControl 

Show no maptype control.

DefaultControl 

Show the default maptype control.

MenuControl 

Show the menu maptype control.

HierarchicalControl 

Show the hierarchical maptype control.


Member Function Documentation

void Wt::WGoogleMap::addPolyline ( const std::vector< Coordinate > &  points,
const WColor color = red,
int  width = 2,
double  opacity = 1.0 
)

Adds a polyline overlay to the map.

specify a value between 0.0 and 1.0 for the opacity.

void Wt::WGoogleMap::checkResize (  ) 

Notifies the map of a change of the size of its container.

Call this method after the size of the container DOM object has changed, so that the map can adjust itself to fit the new size.

JSignal<Coordinate>& Wt::WGoogleMap::clicked (  )  [inline]

The click event.

This event is fired when the user clicks on the map with the mouse.

void Wt::WGoogleMap::disableGoogleBar (  ) 

Disables the GoogleBar integrated search control.

When disabled, the default Powered by Google logo occupies the position formerly containing this control. Note that this control is already disabled by default.

void Wt::WGoogleMap::disableScrollWheelZoom (  ) 

Disables zooming using a mouse's scroll wheel.

Scroll wheel zoom is disabled by default.

JSignal<Coordinate>& Wt::WGoogleMap::doubleClicked (  )  [inline]

The double click event.

This event is fired when a double click is done on the map.

void Wt::WGoogleMap::enableGoogleBar (  ) 

Enables the GoogleBar, an integrated search control, on the map.

When enabled, this control takes the place of the default Powered By Google logo.

This control is initially disabled.

void Wt::WGoogleMap::enableScrollWheelZoom (  ) 

Enables zooming using a mouse's scroll wheel.

Scroll wheel zoom is disabled by default.

void Wt::WGoogleMap::panTo ( const Coordinate center  ) 

Changes the center point of the map to the given point.

If the point is already visible in the current map view, change the center in a smooth animation.

void Wt::WGoogleMap::savePosition (  ) 

Stores the current map position and zoom level.

You can later restore this position using returnToSavedPosition().

void Wt::WGoogleMap::setMapTypeControl ( MapTypeControl  type  ) 

Sets the map type control.

The control allows selecting and switching between supported map types via buttons.


Generated on Mon Nov 29 2010 08:03:18 for Wt by doxygen 1.7.1