GWT中的Google Maps FusionTable实现 [英] Google Maps FusionTable implementation in GWT
问题描述
是否可以在GWT中拥有完全相同的功能?
Is it possible to have this exact same functionality in 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
到目前为止,我已经设法在这里实现单一样式在Google中自定义着色国家地图:GWT?,但我想在给定的JavaScript代码片段中应用条件样式,即if #ofbirds> 300,然后 fillColor:'#0000FF'
if# ofbirds> 500 then fillColor:'#0000FE'
So far I have managed to implement single style here Custom coloring of countries in Google Maps : GWT? but I want to apply conditional styling as in the given javascript code snippet i.e if #ofbirds > 300 then fillColor: '#0000FF'
if #ofbirds > 500 then fillColor: '#0000FE'
谢谢
Thanks
推荐答案
在经历了很多痛苦的试验和错误之后,我能够做到这一点。
After a lot of painful trial and error I was able to do it. Posting here so that others could benefit.
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
}
}]
});
}-*/;
这篇关于GWT中的Google Maps FusionTable实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!