我有两个功能来过滤标记到Google Map,并且我想将两个过滤器链接起来以获得结果。
如何使用当前当前的代码执行此操作?
// filter markers by category
filterMarkers = function(category) {
for (i = 0; i < gmarkers1.length; i++) {
marker = gmarkers1[i];
// If is same category or category not picked
if (marker.category == category || category.length === 0) {
marker.setVisible(true);
}
// categories don't match
else {
marker.setVisible(false);
}
}
}
// filter markers by session
filterMarkersx = function(session) {
for (i = 0; i < gmarkers1.length; i++) {
marker = gmarkers1[i];
// If is same session or session not picked
if (marker.session == session || session.length === 0) {
marker.setVisible(true);
}
// session don't match
else {
marker.setVisible(false);
}
}
}