GWT中的Google Maps FusionTable实现

时间:2015-04-11 14:36:21

标签: javascript google-maps gwt google-maps-api-3

是否可以在GWT中使用完全相同的功能?

    layer = new google.maps.FusionTablesLayer({
    query: {
      select: 'geometry',
      from: '1ertEwm-1bMBhpEwHhtNYT47HQ9k2ki_6sRa-UQ'
    },
    styles: [{
      polygonOptions: {
        fillColor: '#00FF00',
        fillOpacity: 0.3
      }
    }, {
      where: 'birds > 300',
      polygonOptions: {
        fillColor: '#0000FF'
      }
    }, {
      where: 'population > 5',
      polygonOptions: {
        fillOpacity: 1.0
      }
    }]
  });

我正在努力实现这一点:https://developers.google.com/maps/documentation/javascript/examples/layer-fusiontables-styling

到目前为止,我已设法在此处实现单一样式Custom coloring of countries in Google Maps : GWT?但我想在给定的javascript代码片段中应用条件样式,即#ofbirds> 300然后fillColor: '#0000FF'如果#ofbirds> 500然后fillColor: '#0000FE'

由于

1 个答案:

答案 0 :(得分:2)

经过大量痛苦的试验和错误,我能够做到这一点。张贴在这里,以便其他人可以受益。

private native FusionTablesLayer createFusionTableLayer()/*-{
    return new $wnd.google.maps.FusionTablesLayer({
        query: {
        select: 'geometry',
        from: '1tJkzVXTv-B2-rFeQVO9bX_vICCvJ9Xq1LU6xog5f'
        },
        styles: [{
            polygonOptions: {
            fillColor: '#00FF00',
            fillOpacity: 0.3
          }
         }, {
             where: 'birds > 300',
             polygonOptions: {
             fillColor: '#0000FF'
            }
        }, {
          where: 'population > 5',
          polygonOptions: {
          fillOpacity: 1.0
          }
       }]
    });
}-*/;