Both are compliments, BUT, a crotch grab is inappropriate and an invasion of privacy and personal space.
If you were at Folsum Street Fair, then neither of these should be unexpected considering that specific venue.
The gym is not appropriate in either situation particularly considering the expectation of normal behavior in that situation where there are straight and gay men are in a mixed venue.
A club is where a lot of guys go to hookup. Being offended here is a little like being offended that some of the guys are getting drunk at a bar.
I had someone grab my crotch once, and I simply grabbed his wrist and said, "If I want your hand there, I'll put it there myself."