Rays are nice and all for generic tests, but more than a tad costly from what i've experienced. For something as specific as that screenshot, you could probably benifit from some form of grid based lookup or tree structure.
Tile-based is nice and easy (simply change your coords into tile indices and check the tile you're over/about to enter. Very fast, but means that your level geometry is limited in both resolution and variation.
If your terrain objects are static, then its time to wheel out the tried and tested bsp tree
Simplified to a 2d based tree, you can build the tree on level load or precompile it into the level file, then search though it to check if a given point is 'inside' or 'outside'. For best results you'll probably want a sealed level, but thats not really a major problem.
Should be plenty of papers etc. on 2d and 3d bsp's if you want more info. Bsp's have been around much longer than their much publiced use in the original Doom