Project

General

Profile

Bug #1253 ยป fix-precision.patch

Alex V, 09/17/2014 07:09 PM

View differences:

src/Wt/WGoogleMap.C
std::stringstream strm;
if (apiVersion_ == Version2) {
strm << "var marker = new google.maps.Marker(new google.maps.LatLng("
strm << std::setprecision(15) << "var marker = new google.maps.Marker(new google.maps.LatLng("
<< pos.latitude() << ", " << pos.longitude() << "));"
<< jsRef() << ".map.addOverlay(marker);";
} else {
strm << "var position = new google.maps.LatLng("
strm << std::setprecision(15) << "var position = new google.maps.LatLng("
<< pos.latitude() << ", " << pos.longitude() << ");"
<< "var marker = new google.maps.Marker({"
<< "position: position,"
......
throw std::logic_error("WGoogleMap::addIconMarker is not supported "
"in the Google Maps API v2.");
} else {
strm << "var position = new google.maps.LatLng("
strm << std::setprecision(15) << "var position = new google.maps.LatLng("
<< pos.latitude() << ", " << pos.longitude() << ");"
<< "var marker = new google.maps.Marker({"
......
double strokeOpacity = strokeColor.alpha() / 255.0;
double fillOpacity = fillColor.alpha() / 255.0;
strm << "var mapLocal = " << jsRef() + ".map;"
strm << std::setprecision(15) << "var mapLocal = " << jsRef() + ".map;"
<< "var latLng = new google.maps.LatLng("
<< center.latitude() << "," << center.longitude() << ");"
<< "var circle = new google.maps.Circle( "
......
std::stringstream strm;
strm << "var waypoints = [];";
for (size_t i = 0; i < points.size(); ++i)
strm << "waypoints[" << i << "] = new google.maps.LatLng("
strm << std::setprecision(15) << "waypoints[" << i << "] = new google.maps.LatLng("
<< points[i].latitude() << ", " << points[i].longitude() << ");";
if (apiVersion_ == Version2) {
......
const WString& myHtml)
{
std::stringstream strm;
strm << "var pos = new google.maps.LatLng("
strm << std::setprecision(15) << "var pos = new google.maps.LatLng("
<< pos.latitude() << ", " << pos.longitude() << ");";
if (apiVersion_ == Version2) {
......
void WGoogleMap::setCenter(const Coordinate& center)
{
std::stringstream strm;
strm << jsRef() << ".map.setCenter(new google.maps.LatLng("
strm << std::setprecision(15) << jsRef() << ".map.setCenter(new google.maps.LatLng("
<< center.latitude() << ", " << center.longitude() << "));";
doGmJavaScript(strm.str());
......
void WGoogleMap::setCenter(const Coordinate& center, int zoom)
{
std::stringstream strm;
strm << jsRef() << ".map.setCenter(new google.maps.LatLng("
strm << std::setprecision(15) << jsRef() << ".map.setCenter(new google.maps.LatLng("
<< center.latitude() << ", " << center.longitude() << ")); "
<< jsRef() << ".map.setZoom(" << zoom << ");";
......
void WGoogleMap::panTo(const Coordinate& center)
{
std::stringstream strm;
strm << jsRef() << ".map.panTo(new google.maps.LatLng("
strm << std::setprecision(15) << jsRef() << ".map.panTo(new google.maps.LatLng("
<< center.latitude() << ", " << center.longitude() << "));";
doGmJavaScript(strm.str());
......
doGmJavaScript(jsRef() + ".map.savePosition();");
} else {
std::stringstream strm;
strm
strm << std::setprecision(15)
<< jsRef() << ".map.savedZoom = " << jsRef() << ".map.getZoom();"
<< jsRef() << ".map.savedPosition = " << jsRef() << ".map.getCenter();";
doGmJavaScript(strm.str());
......
doGmJavaScript(jsRef() + ".map.returnToSavedPosition();");
} else {
std::stringstream strm;
strm
strm << std::setprecision(15)
<< jsRef() << ".map.setZoom(" << jsRef() << ".map.savedZoom);"
<< jsRef() << ".map.setCenter(" << jsRef() << ".map.savedPosition);";
doGmJavaScript(strm.str());
......
Coordinate(std::max(topLeft.latitude(), rightBottom.latitude()),
std::max(topLeft.longitude(), rightBottom.longitude()));
std::stringstream strm;
strm << "var bbox = new google.maps.LatLngBounds(new google.maps.LatLng("
strm << std::setprecision(15) << "var bbox = new google.maps.LatLngBounds(new google.maps.LatLng("
<< topLeftC.latitude() << ", " << topLeftC.longitude() << "), "
<< "new google.maps.LatLng("
<< rightBottomC.latitude() << ", " << rightBottomC.longitude() << "));";
if (apiVersion_ == Version2) {
strm
strm << std::setprecision(15)
<< "var zooml = " << jsRef() << ".map.getBoundsZoomLevel(bbox);"
<< jsRef() << ".map.setCenter(new google.maps.LatLng("
<< center.latitude() << ", " << center.longitude() << "), zooml);";
    (1-1/1)