Fixed rendering regions. genPOI.py: add new line to baseMakers.js; views.js: add polygons, with all the features that Google provides, polylines work fine; regions.js: example of usage
This commit is contained in:
@@ -452,6 +452,7 @@ def main():
|
||||
with open(os.path.join(destdir, "baseMarkers.js"), "w") as output:
|
||||
output.write("overviewer.util.injectMarkerScript('markersDB.js');\n")
|
||||
output.write("overviewer.util.injectMarkerScript('markers.js');\n")
|
||||
output.write("overviewer.util.injectMarkerScript('regions.js');\n")
|
||||
output.write("overviewer.collections.haveSigns=true;\n")
|
||||
logging.info("Done")
|
||||
|
||||
|
||||
@@ -496,6 +496,26 @@ overviewer.views.SignControlView = Backbone.View.extend({
|
||||
'strokeColor': entity['strokeColor']
|
||||
});
|
||||
dataRoot[i].markerObjs.push(polyline);
|
||||
}
|
||||
|
||||
// Polygons
|
||||
if (typeof entity['polygon'] != 'undefined') {
|
||||
var polypath = new Array();
|
||||
for (point in entity.polygon) {
|
||||
polypath.push(overviewer.util.fromWorldToLatLng(entity.polygon[point].x, entity.polygon[point].y, entity.polygon[point].z, overviewer.mapView.options.currentTileSet));
|
||||
}
|
||||
|
||||
var polygon = new google.maps.Polygon({
|
||||
'clickable': false,
|
||||
'fillColor': entity['fillColor'],
|
||||
'fillOpacity': entity['fillOpacity'],
|
||||
'map': overviewer.map,
|
||||
'path': polypath,
|
||||
'strokeColor': entity['strokeColor'],
|
||||
'strokeOpacity': entity['strokeOpacity'],
|
||||
'visible': false
|
||||
});
|
||||
dataRoot[i].markerObjs.push(polygon);
|
||||
}
|
||||
}
|
||||
dataRoot[i].created = true;
|
||||
|
||||
@@ -1,9 +1,34 @@
|
||||
// This is just an example. You can run some scripts to generate regions that
|
||||
// will be drawn here.
|
||||
overviewer.collections.regionDatas.push([
|
||||
// {"color": "#FFAA00", "opacity": 0.5, "closed": true, "path": [
|
||||
// {"x": 0, "y": 0, "z": 0},
|
||||
// {"x": 0, "y": 10, "z": 0},
|
||||
// {"x": 0, "y": 0, "z": 10}
|
||||
// ]},
|
||||
]);
|
||||
/*
|
||||
var groupName = "Regions";
|
||||
var displayName = "Areas";
|
||||
var world = "top";
|
||||
|
||||
markersDB[groupName] = {
|
||||
"raw": [
|
||||
{
|
||||
"fillColor": "#00FF00",
|
||||
"fillOpacity": 0.2,
|
||||
"strokeColor": "#FF0000",
|
||||
"strokeOpacity": 1,
|
||||
"polygon" : [
|
||||
{"x": 347, "y": 67, "z": 95},
|
||||
{"x": 347, "y": 77, "z": 95},
|
||||
{"x": 347, "y": 77, "z": 105},
|
||||
{"x": 347, "y": 67, "z": 105},
|
||||
{"x": 347, "y": 67, "z": 105}
|
||||
]}
|
||||
],
|
||||
"name": "Regions",
|
||||
"created": false
|
||||
}
|
||||
|
||||
markers[world].push(
|
||||
{
|
||||
"groupName": groupName,
|
||||
"icon": "signpost_icon.png",
|
||||
"createInfoWindow": false,
|
||||
"displayName": displayName,
|
||||
"checked": true
|
||||
});
|
||||
*/
|
||||
Reference in New Issue
Block a user