Strider
Jan 24th, 2005, 04:42 AM
On the device i want to have an image eg a floor plan.
The image will remain the same and never change.
I want to be able to determine what area of the image that the user has selected.
In this case which room was selected.
So i presume it will involve obtaining the co-ordinates from the image and comparing these to be between certain values for each area.
Any advice on the best way to do this would be very helpful
thanks guys
Shaggy Hiker
Jan 24th, 2005, 02:03 PM
Your specific problem may be on a PDA, but the actual problem would get better solutions in one of the general forums, because it really applies to a much larger arena: How do I determine which part of an image a mouse click applies to (a mouse click would be much like a stylus tap).
You state that the plan wouldn't change, which simplifies things considerably. I would suggest that you implememnt the plan as a database of objects where all objects are rectangles of various sizes. Round objects could be handled withing bounding boxes if that is precise enough, and if it isn't precise enough, you will need more than just rectangles in the database.
If the database contains simply rectangles, then you could have fields: Top, left, width and heigh. Then on a mouse click, you could query on those cases where Top + Height > click Y > Top and Left + Width > click X > Left. That would limit the objects to just those under the click (which might be more than one if a rectangle is within another, or overlaps another). To determine those two cases....well, that might not even be necessary depending on how you wanted to deal with the image. However, if you needed to do that, you would have to somehow deal with an IsIn kind of case, for which there are probably many solutions.