Classes | Public Types | Public Member Functions

Wt::WGoogleMap Class Reference

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

#include <Wt/WGoogleMap>

Inheritance diagram for Wt::WGoogleMap:
Inheritance graph
[legend]

List of all members.

Classes

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

Public Types

enum  ApiVersion { Version2, Version3 }
 

ApiVersion.

More...
enum  MapTypeControl {
  NoControl, DefaultControl, MenuControl, HierarchicalControl,
  HorizontalBarControl
}
 

MapTypeControl.

More...

Public Member Functions

 WGoogleMap (ApiVersion version, WContainerWidget *parent=0)
 Creates a map widget with a version and optionally a parent argument.
 WGoogleMap (WContainerWidget *parent=0)
 Creates a map widget with optionally a parent argument.
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.
ApiVersion apiVersion ()
 Return the used Google Maps API version.

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.

This widget supports both version 2 and version 3 of the Google Maps API. The version 2 API is used by default, to enable the version 3 API, use the constructor's version argument.

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

ApiVersion.

Enumerator:
Version2 

API Version 2.x.

Version3 

API Version 3.x.

MapTypeControl.

Enumerator:
NoControl 

Show no maptype control.

DefaultControl 

Show the default maptype control.

MenuControl 

Show the dropdown menu maptype control.

HierarchicalControl 

Show the hierarchical maptype control.

HorizontalBarControl 

Show the horizontal bar 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.

Deprecated:
the map is resized automatically when necessary
JSignal<Coordinate>& Wt::WGoogleMap::clicked (  )

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.

Note:
This functionality is no longer available in the Google Maps API v3.
void Wt::WGoogleMap::disableScrollWheelZoom (  )

Disables zooming using a mouse's scroll wheel.

Scroll wheel zoom is disabled by default.

JSignal<Coordinate>& Wt::WGoogleMap::doubleClicked (  )

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.

Note:
This functionality is no longer available in the Google Maps API v3.
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.

 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator

Generated on Fri Feb 4 2011 for the C++ Web Toolkit (Wt) by doxygen 1.7.2