Feature #1171
closedAdd icon marker to google map
0%
Description
Hi all,
I had the need to add a marker to a google map and I hadded the following method to WGoogleMap:
file WGoogleMap:
@
/*! \brief Adds a icon marker overlay to the map.
*/
void addIconMarker(const Coordinate &pos, const std::string& iconURL);
@
@
file WGoogleMap.C:
void WGoogleMap::addIconMarker(const Coordinate &pos,
const std::string& iconURL)
{
std::stringstream strm;
if (apiVersion_ == Version2) {
throw std::logic_error("WGoogleMap::addIconMarker is not supported "
"in the Google Maps API v2.");
} else {
strm << "var position = new google.maps.LatLng("
<< pos.latitude() << ", " << pos.longitude() << ");"
<< "var marker = new google.maps.Marker({"
<< "position: position,"
<< "icon: \"\" << iconURL << "\",\"
<< "map: " << jsRef() << ".map"
<< "});"
<< jsRef() << ".map.overlays.push(marker);";
}
doGmJavaScript(strm.str());
}
@
Updated by Koen Deforche over 12 years ago
- Status changed from New to InProgress
- Assignee set to Pieter Libin
- Target version set to 3.2.1
Updated by Pieter Libin over 12 years ago
- Status changed from InProgress to Resolved