In your init: function()
//Awesome design
style = { styleMap: new OpenLayers.StyleMap({ "temporary": style})};
//Make the layer
this.selectLayer = new OpenLayers.Layer.Vector("draw_polygon", style);
//Make the control
this.selectControl = new OpenLayers.Control.DrawFeature(this.selectLayer, OpenLayers.Handler.Polygon, {featureAdded: this.toggleDraw});
whatever.map.addControl(this.selectControl);
Then:
toggleDraw: function(feature) {
//Do some magic with finding if the uses is inside (example) search_options.viewModel.searchForPerson(feature);
}
Я боюсь, что я не могу дать вам полный код, но вы получите идею.
https://developers.google.com/maps/documentation/javascript/reference?hl=ru#poly –