New topic: Coordinate Mapping or alternate suggestion requested
<http://forums.realsoftware.com/viewtopic.php?t=30534> Page 1 of 1 [ 4 posts ] Previous topic | Next topic Author Message seaaggie Post subject: Coordinate Mapping or alternate suggestion requestedPosted: Sat Oct 17, 2009 10:01 pm Joined: Wed Jul 29, 2009 10:56 pm Posts: 22 Hi there, I'm looking for a slick way to determine what part of a picture was clicked. I am working on a program with a map of teh US, and I just want to be able to tell what state was clicked on. I know how to get the xy coords for a click, but am just curious if there is some time-saving way other than me programming in all the xy coords. Any suggestions/thoughts are appreciated. Thanks SS Top DaveS Post subject: Re: Coordinate Mapping or alternate suggestion requestedPosted: Sat Oct 17, 2009 10:43 pm Joined: Sun Aug 05, 2007 10:46 am Posts: 1667 Location: San Diego, CA Try reducing each state to a vector polygon.... and then use an algorithm to determine if you mouse click is inside the defined shape. Sorry I don't have the specifics.... but there should be plenty of examples on Google. Its a common function of HTML webspages as well. _________________ Dave Sisemore MacPro, OSX 10.5.8 RB2009r2 Top pony Post subject: Re: Coordinate Mapping or alternate suggestion requestedPosted: Sat Oct 17, 2009 10:55 pm Joined: Sat Nov 11, 2006 2:43 pm Posts: 359 Location: DFW area, Texas, USA Visit this site : http://www.yourchildlearns.com/us_map.htm view the HTML source and you'll find all the co-ordinates already mapped out, it should give you an idea how someone else did it. The page is copyright, but you could email them and ask if you can just leech their hard work _________________ Fly like a mouse, run like a cushion, be the small bookcase. Beware the Aguamoose Man. Top Phil M Post subject: Re: Coordinate Mapping or alternate suggestion requestedPosted: Sun Oct 18, 2009 2:08 am Joined: Fri Sep 30, 2005 12:18 pm Posts: 140 A computer is much better at picking out colors than the human eye. For example, there are 256 shades of each RGB element, which is a total of 16,777,216 unique colors in a photograph. You COULD have an offscreen picture (or use the same one) and define a different color for each state, then using a Dictionary with Color as Key, can return the state name, or ID or whatever. Two points... for it to work correctly, you should have sharp edges between the states... blends of colors will not work for the lookup. Secondly, DON'T use JPG format to save these since that will add artifacts and the state's colors will no longer be pure... PNG will work perfectly. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 4 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
