Open jaybarra opened 7 years ago
Similarly attempting to get all shapes by using the canvas based coordinates also returns an empty pick list.
var clientRect = this.worldWindow.canvas.getBoundingClientRect(),
canvasCoords = this.worldWindow.canvasCoordinates(clientRect.left, clientRect.top),
region = new WorldWind.Rectangle(
canvasCoords[0], canvasCoords[1],
clientRect.width, clientRect.height);
var pickList = this.worldWindow.pickShapesInRegion(region);
Jay, It's unlikely that pickShapesInRegion is entirely broken as you've suggested in this issue. In particular, the example PickAllShapesInRegion is able to use pickShapesInRegion to select placemark objects. Would you please compare your code with the PickAllShapesInRegion example, looking for differences in the method and the shapes involved?
Dave, I was able to get it to work but it is not consistent. I do not understand what the rectangle represents; whether it is a rectangle on the screen or a rectangle projected onto the globe.
In the example cannot get the circle to be picked if I give it a rectangle containing the entire canvas. If I rubberband a selection area around the circle I can get the circle to be selected only if I start the region in within portions of the circle.
Jay, Thanks for doing some digging. Based on your most recent test it does sound like there's an issue in pickShapesInRegion. We'll investigate from here.
We've found that WorldWindow.pickShapesInRegion interprets its rectangle as originating from its lower-left corner, whereas the application is expecting the upper-left corner.
I can also confirm that picking of SurfacePolyline by pickShapesInRegion returns all shapes which has bounding box intersected with specified region even if the line itself does not cross the region.
Is it a feature or a bug? If you place surface shape with coordinated -90 to 90 and -180 to 180 than it will be selected by any reqion located inside of it.
Using screen coordinates for the canvas in a worldWindow will not return any visible objects.