0

fixed region group handling to actually use matcher, and to show non-matched regions

This commit is contained in:
Aaron Griffith
2011-07-22 08:19:18 -04:00
parent 0a119202f6
commit ef6ad96080

View File

@@ -394,59 +394,76 @@ var overviewer = {
point.x, point.y, point.z));
}
if (region.label) {
var name = region.label;
} else {
var name = "rawr";
}
if(region.opacity) {
var strokeOpacity = region.opacity;
var fillOpacity = region.opacity * 0.25;
} else {
var strokeOpacity = region.strokeOpacity;
var fillOpacity = region.fillOpacity;
}
var shapeOptions = {
'name': name,
'geodesic': false,
'map': null,
'strokeColor': region.color,
'strokeOpacity': strokeOpacity,
'strokeWeight': overviewerConfig.CONST.regionStrokeWeight,
'zIndex': j
};
if (region.closed) {
shapeOptions["fillColor"] = region.color;
shapeOptions["fillOpacity"] = fillOpacity;
shapeOptions["paths"] = converted;
} else {
shapeOptions["path"] = converted;
}
var matched = false;
for (k in overviewerConfig.objectGroups.regions) {
var regionGroup = overviewerConfig.objectGroups.regions[k];
var clickable = regionGroup.clickable;
var label = regionGroup.label;
if(region.label) {
var name = region.label
} else {
var name = 'rawr';
if (!regionGroup.match(region))
continue;
matched = true;
if (!region.label) {
clickable = false; // if it doesn't have a name, we dont have to show it.
}
if(region.opacity) {
var strokeOpacity = region.opacity;
var fillOpacity = region.opacity * 0.25;
if (region.closed) {
var shape = new google.maps.Polygon(shapeOptions);
} else {
var strokeOpacity = region.strokeOpacity;
var fillOpacity = region.fillOpacity;
var shape = new google.maps.Polyline(shapeOptions);
}
if (region.closed) {
var shape = new google.maps.Polygon({
'name': name,
'clickable': clickable,
'geodesic': false,
'map': null,
'strokeColor': region.color,
'strokeOpacity': strokeOpacity,
'strokeWeight': overviewerConfig.CONST.regionStrokeWeight,
'fillColor': region.color,
'fillOpacity': fillOpacity,
'zIndex': j,
'paths': converted
});
} else {
var shape = new google.maps.Polyline({
'name': name,
'clickable': clickable,
'geodesic': false,
'map': null,
'strokeColor': region.color,
'strokeOpacity': strokeOpacity,
'strokeWeight': overviewerConfig.CONST.regionStrokeWeight,
'zIndex': j,
'path': converted
});
}
overviewer.collections.regions[label].push(shape);
if (clickable) {
overviewer.util.createRegionInfoWindow(shape);
}
}
// if we haven't matched anything, go ahead and add it
if (!matched) {
if (region.closed) {
var shape = new google.maps.Polygon(shapeOptions);
} else {
var shape = new google.maps.Polyline(shapeOptions);
}
shape.setMap(overviewer.map);
}
}
}
},