Problem: mapping mouse co-ordinates to a list of nodes in a graph.

Hi.
I have an undirected graph containing many nodes, some represent squares/tiles and some represent rooms in a board-game called Cluedo.
Each node has an ID: -
Rooms are called by the room name. -> Kitchen/Lounge
Squares are called by the concatenated x/y position. -> A1/A2/K20
I have created an algorithm to find the shortest path between two nodes in the graph.
The problem I'm faced with is finding a way to map co-ordinates on the image file to these IDs. I have seen an implementation of a similar idea with an invisible image acting as a "colour-mask", so when the click hits the graphical map a function works out the colour of that pixel on the "colour-mask" and then uses a look-up table to find out which ID that is associated to.
The problem with the above is that a Cluedo board has about 22x22 tiles and several rooms (each room would occupy several tiles in an undefined shape.)
I've provided two example map files:
http://www.dcs.qmul.ac.uk/~ade1/map.gif
http://www.dcs.qmul.ac.uk/~ade1/map2.gif
Does anyone have a suggestion of how I could solve this problem using what's available to me with Java?
I'd appreciate any suggestions,
Alexander Ellis

Create a two-dimensional array that maps from grid coordinates to node/room objects.
NodeOrRoom[][] grid = new NodeOrRoom[22][22];
grid[0][0] = kitchen;
grid[1][0] = kitchen;
nodeLookup(int pixelTop, int pixelLeft) {
  return grid[pixelTop / gridCellHeight][pixelLeft / gridCellWidth];
}Matthew

Similar Messages

  • T.code FBL5N: a problem with the print of the output list

    Hi All,
    with reference to the t.code FBL5N, I have  a problem with the print of the output list of the report.
    When I execute the print, I obtain one customer for each page printed.
    I wonder if is possible to obtain more customers for each page printed.
    Could anyone help me?
    Thanks
    Gandalf
    Edited by: Umberto Gandalf on Dec 21, 2008 10:36 PM

    Hi,
    Though personally i havent tried this option, check the same
    Go to Menu: Settings >> Switch List
    This will make the value displayed in ALV format and then try taking print outs.
    Regards,
    Sridevi

  • Problem mapping USB external drive connected to Airport Extreme on my PC

    I am having a problem mapping my USB external drive in my PC running WIndows Vista.   Here is what I have so far:
    USB External Drive connected to my AirPort Extreme which is connected to my Century Link modem/router.
    I have installed the USB drive using the Airport Utility.  In the Disks section the Enable File Sharing is checked, Secure Shared Disks is set to With a Disk Password, I have entered the password in the next 2 rows, and finally AirPort Disks Gues Access is set to Not Allowed.  The section below named These Settings Configure Windows File Sharing is empty.  Am I supposed to put something here?
    I was also told I need to map the drive in my PC, but when I go to do that via the Computer and the Map Network Drive, I get stuck where it asks me to enter a folder name.  I read many of the posts which tell me I need to enter among other things the disk's ip address, but I am unable to find it anywhere.  Where do I find what to put here?
    Can someone please help this frustrated user?

    I had my USB drive on my APE working with Time Machine under 10.5.1 very reliably. A few days ago however, I needed to suspend a backup operation, and when I came back to restart it, time machine refused to mount the disk image on the drive. After several attempts to get it to connect with no luck I decided to delete the image (the sparce image file) and start over. Now TM refuses to create a new image.
    BTW, on the Mac OSX hints site there have been suggestions to start a backup with the drive directly connected, then stop the backup, move the sparce image file to the root of the drive, reconnect the drive to the APE base station to get it working. I tried this again, but I think Apple has changed something in 10.5.2, because when directly connected TM no longer creates a sparce image file.
    Anybody else seen this behavior after upgrading to 10.5.2?

  • Having problem with mouse pionter in webpages

    i have a problem with mouse pionter in webpages since i've updated my firefox .
    when i'm reading a webpage and i click somewhere in the webpage,my mouse pointer goes from the normal pointer to the typing and selecting one. i also can not scroll up and down the page with up and down buttons on the keyboard because it goes straight to the top or the bottom of the page ! i only have this problem with mozilla firefox and it started when i updated my firefox about two months ago .

    thank you a lot madperson ! its okay now ! ;)

  • Problem while displaying top of page in list display

    Hi,
    M facing problem in displaying top of page in list .
    M using following methods:-
    lr_outer_grid TYPE REF TO cl_salv_form_layout_grid,
    lr_inner_grid TYPE REF TO cl_salv_form_layout_grid,
    lr_label TYPE REF TO cl_salv_form_label,
    lr_text TYPE REF TO cl_salv_form_text.
    For displaying the top of page m using event TOP_OF_PAGE.
      CREATE OBJECT lr_outer_grid.
    *Outer grid
      lr_inner_grid = lr_outer_grid->create_grid(
      row = 1
      column = 1 ).
    *... create lable information in inner_grid
    User ID
      lr_label = lr_inner_grid->create_label(
      row = 1
      column = 1
      text = text-h03 ).
    *... create text information in inner_grid
      lr_text = lr_inner_grid->create_text(
      row = 1
      column = 2
      text = sy-uname ).
    *... set label for text
      lr_label->set_label_for( lr_text ).
    But while m going to do same coding for second parameter its not intializing length so adding extra spaces while displaying second row.
    e.g
    USERID       abcdefghjik
    PLANT         jhk            to hjk
    I want that output should look like
    USERID      abcdefghjik
    PLANT        jhk to hjk
    Please tell me the solution what should i do for avoiding extra space

    Hi Neelema,
    You could try this sample code.
    [http://sap-img.com/fu037.htm]
    [http://sap-img.com/abap/sample-alv-heading-in-alv.htm]
    Regards,
    Amit.

  • Problems mapping 2 messages into 1

    Hi.
    I'm facing a problem mapping 2 messages into 1.
    I have a BPM that has 2 abstract messages. In a transformation step, i transform this two messages into one but when i check the IDOC that finally has arrived to R3 backend, the fields that belogns to one of the source messages doesn't appear.
    In message mapping i select the two source messages and the target message and the same in interface mapping.
    Because is a transformation step inside the BPM, i can't see in SXI_MONITOR what's happening.
    any idea of what's happening?
    Regards.
    Inigo.

    Inigo,
    Though its in BPM u can where well test the transformation mapping
    wht are the messages going in what is coming out
    Check How to monitorcc BPM
    https://websmp206.sap-ag.de/~sapdownload/011000358700003141152005E/HowToMonitorccBPM.pdf
    This PDF is very handy
    Regards
    Kavitha

  • Problem with removing items from a linked list

    Hello,
    I have something weird going with my code. Below is the snippet
    if (ParserDataList.isEmpty())
    try {
    Thread.sleep(10)
    catch (InterruptedException e) {
    else
    data = ParserDataList.remove();
    ParserDataList is declared as a LinkedList. Occasionally I receive the error on NoSuchElement on the remove. I put a try/catch around the remove and print out the value of ParserDataList.isEmpty which is always false. I am very confused on why if the linked list isn't empty I can't remove a data item. There are no other threads that remove data. Thank you in advance for any assistance on this problem.

    I am changing it from linked list to blocking queue however I do have a question about what I should use to poll the data? Instead of a remove should I use take which seemed to remove the first element and if there wasn't one wait until there was. I was trying to not have the threads blocked because I do need to stop them when a disconnect is sent from the main thread.

  • Problems logging in to my iTunes wish list

    I have been having problems logging in to my iTunes wish list, and other sections of iTunes. I keep getting a log-in window and those attempts never work. It appears that it is doing something and then just cycles back to the log in pop-up.  Pages also do not load completely missing artist's additonal albums, songs, or does not load at all.  iTunes Radio will not work either.   I re-installed iTunes, and turned off my firewall.  I tried many different remedies that these forums have recommended, but none have worked so far.  Anyone else have this issue recently?  The previous update to iTunes did not fix the problem either.  Thanks in advance to anyone with a remedy.

    The multiple dots is a simplistic attempt to hide, from someone looking over your shoulder, the number of characters in the password.
    Just eneter your password and ignore what appears in the password field.  If it still does not let you in then yo entered an incorrect password.
    In that case reset to defaults, which you appear to know how to do, and write down the new password when you are prompted for it.

  • Monitor problem. Mouse scrolls the desktop or application

    I've just plugged my monitor back in, It's a Mitsubishi Diamond Pro 2070 SB (21 inch) and put the mouse in, but for some reason (i think rendering problems) the mouse moves the screen up and down and left and right even though it shouldn't?
    Does anyone have any advice on this please?
    thanks

    Hi markj81-
    It sounds like the zoom function is turned on. You can check this by going to ->System Preferences ->Universal Access ->Seeing and see if the zoom box is checked.
    You can also use command-option-8 to turn it on and off from the keyboard.
    Luck-
    -DaddyPaycheck

  • Problem mapping JDO to an existing DB schema

    I'm having problems mapping a legacy database to JDO. Suppose I have a class
    public class Test {
    public int pk;
    public String fieldA;
    public String fieldB;
    public String fieldC;
    An existing legacy table TEST looks like
    TEST
    |============|
    | PK | ... |
    |============|
    | 1 | ... |
    |============|
    The fields values are stored in a separate table
    TEST_FIELDS
    |==========================|
    | PK | FIELD_ID | VALUE |
    |==========================|
    | 1 | 1 | fred |
    | 1 | 2 | accounts |
    | 1 | 3 | jim |
    | 2 | 1 | wilma |
    | 2 | 2 | research |
    | 2 | 3 | alice |
    |==========================
    So the value for fieldA of an object with key i in the TEST table
    would be found in the TEST_FIELDS table with key (i, 1), fieldB with
    key (i,2) and fieldC with (i,3) and so on. I'm not sure how I would express
    such a mapping in the JDO metadata file, or indeed whether this is
    even possible. Any suggestions?

    This mapping is not possible in the current incarnation of
    Kodo.

  • SB Live! 5.1 problem mapping effect to midi controllers

    Hi, I have a SB Li've! 5. and I am having problems mapping effects to the midi controller in the EAX Control Panel. After doing some searching it seems that you can only map 2 effects, to a controller, at any time (which is disappointing), but it seems that for some reason, I cannot even do that, it seems to only allow me to map one effect to a controller at any time.
    For example (In EAX Control Panel (AudioHQ) on the Midi tab) I have the following:
    Original Sound: Not mappable
    Reverb: Not mappable
    Chorus: Default
    Echo: Not mapped
    If I go and try to map Echo to a controller, Chorus changes to "Not mapped", and vice-versa (same with additional effects) thus I can only map one effect at a time.
    Anyone know what the problem is? (and why is Reverb Not mappable? which probablly has something to do with the problem)Message Edited by Russ on 0-3-2005 2:20 PM

    BTW: Not sure what the actual model name of the sound card is, (it said Sound Blaster Li've! 5. Digital on the box), but the model number is SB0220.
    Also, I forgot to mention that this is on Windows XP Professional.

  • Problem with showing mp3 album art in list view.

    Hello.
    I have litle problem with showing mp3 album artwork in list view.
    In SNOW LEOPARD all work fine, and all mp3 files have album art's preview in list mode in finder.
    But in LION i have only default preview mp3 icon.
    Option "Show icon preview" is already on!

    I have the fix!!!!
    I have had the same issue ever since Lion. Its been very painful not having album art preview in finder or the play button when rollover the file for so many versions of OSX. Today I worked hard in trying to solve the problem since Applecare support hasn't helped much, all they did was tell me to bring the computer in. The other main reason I got so motivated to try and fix this is because the DJ app for Mac only reads album art from the finder even if iTunes can display the album art. The other reason that got me curious is that my friends macbook pro album art worked fine, so I cross checked with his computer until I figured out a few things that helped and ultimately fixed the issue. FINALLY!
    My set up:
    - I have my full iTunes library folder on my external as I have over 700GB of music.
    - It includes all my database files in there, which is very important as I have many playlist settings from over 7 years of iTunes activity.
    SOLUTION:
    1. With every new computer I have purchased, I use to just pressed option on Mac and press iTunes to locate my folder (which I have said is located on my external drive).
    2. I tried today to press option again BUT locate and selected the default library in the user/music folder of my internal drive (standard setting from Apple).
    3. Miraculously, all the album art appeared in both my external drive library and also today's downloaded songs on my Macbook pro. Ofcourse with the new default location I don't have any songs or data.
    4. So I tried to find a way to keep this library data on my internal drive since it can help the finder display all my files properly, yes even have the play on rollover button but as well link it back to my external drive with all my 700GB songs.
    5. I then went into iTunes Preferences/Advance tab and in iTunes Media folder locationredirected the location to my external drive iTunes/ iTunes Media folder. If it asks to collate data, press NO.
    6. Then I quit iTunes.
    7. Next I copied the 4 files to my desktop from my external drive as I want to keep the data I have made with all my playlists etc. The four files are iTunes Library Extras.itdb ,iTunes Library Genius.itdb , iTunes Library.itl , iTunes Library.xml
    8. I then went to my internal drive User/Music/Itunes/ and dragged these 4 files I copied from my external drive into here and making sure to REPLACE the four existing files already there.
    9. Next open iTunes and you will find all your presettings appear with all your music linked to your external. What this does is keep the important library files on your internal drive (that somehow makes your finder files album art appear), BUT to read also all the music mp3 files located in the external drive (action from step 5)
    Presto!! All your music files whether on internal drive or external all the album art has appeared.
    Hope this helps!! Let me know if there are any other questions.
    I am on 10.8.1 running retina macbook pro.

  • Swap method for list of Nodes not working correctly

    Ok so I'm basically messing with a list of nodes, swapping, reversing, and cycling. My only problem is the swap method that I am implementing.
    It starts out with a boolean to see if the position is valid, and if so, it will go through the instructions.
    The first condition is that if the the position to be swapped( which is named secondPosition) equals 2, it goes through a certain method, which I have no problem with...BUT in the second condition, if secondPosition is greater than 2, I have to use a different way of swapping them...Of course, I have to change their references and not positions, since that's the way nodes work. Also, at the end of the list of nodes, the reference will be null, so I have to deal with that as well, which is to set it to the first node in the list. I am very sure I am writing the code for swapping correctly, but yet it seems that the lists that I swap in the second condition don't even change at all! I don't really see how its happening...could anyone help???
    Here is the run:
    TESTING SWAP
    Trying an invalid swap (position 0)
    Passed test
    Passed test
    Trying an invalid swap (position 4/list size 3)
    Passed test
    Passed test
    Trying a valid swap (position 3/list size 3)
    Passed test
    *** Failed test (bad list on swap)
    *// the result is supposed to be: John Jack Jill, but the list stays in its initial state*
    Jack
    Jill
    John
    Trying a valid swap (position 3/list size 4)
    Passed test
    *** Failed test (bad list on swap)
    *// result is supposed to be Jill Jack John Jerry, yet the list stays in its initial state*
    Jill
    John
    Jack
    Jerry
    Trying a valid swap (position 4/list size 4)
    Passed test
    *** Failed test (bad list on swap)
    *//result is supposed to be Jill Jack John Jerry, yet it still stays in its initial state*
    Jill
    John
    Jack
    Jerry
    Trying a valid swap (position 2/list size 3)
    Passed test
    Passed test
    Here is the method:
         public boolean swap(int secondPosition)
              boolean valid = false;
              if( secondPosition == 2)
                   valid = true;
                   Node<T> nodeOne = this.firstNode;
                   Node<T> nodeTwo = nodeOne.getNextNode();
                   Node<T> nodeThree = nodeTwo.getNextNode();
                   firstNode = nodeThree;
                   nodeThree = nodeOne;
                   nodeOne = nodeTwo;
              else if( secondPosition > 2 && secondPosition <= length)  //this loop is where I'm having problems
                   valid = true;
                   Node<T> nodeBefore = getNodeAt(secondPosition -2);
                   Node<T> nodeOne = nodeBefore.getNextNode();
                   Node<T> nodeTwo = nodeOne.getNextNode();
                   Node<T> nodeAfter = nodeTwo.getNextNode();
                   if( nodeAfter == null)
                        nodeAfter = firstNode;
                   nodeBefore = nodeTwo;
                   nodeTwo = nodeOne;
                   nodeOne = nodeAfter;
              return valid;
         }

    I'm sure there is a bug in swap method.
    if( secondPosition == 2)
                   valid = true;
                   Node<T> nodeOne = this.firstNode;
                   Node<T> nodeTwo = nodeOne.getNextNode();
                   Node<T> nodeThree = nodeTwo.getNextNode();
                   firstNode = nodeThree;
                   nodeThree = nodeOne;
                   nodeOne = nodeTwo;
              }All this code does not actually reorder your nodes. All it does is move a bunch of pointers about. For example firstNode will end up pointing to the last node in the list but this does not automagically make it the first node. If you were to make a call to firstNode .getNextNode I'm sure it will return null and not the next node in the list like you think.

  • Load Balance Problem in Oracle RAC 10.2.0.4 (two nodes with CRS)

    Hi all,
    I have an Oracle RAC 10.2.0.4 with two nodes and I'm having problems with sessions load balance.
    The problem is that all connections are going to the node which is enabled as 'master' in RAC, the node who has located .db resource in CRS.
    If .db resource is located in node1 all connections are made in node1. In the same way, all connections are made in node2 when .db resource from CRS stack is located in node2.
    The connections are made by a pool in Tomcat 6 using RAC service for made the connections.
    Any idea?
    Thanks in advance.
    Here is an example of my net configuration:
    listener.ora in node1:
    LISTENER_RAC_NODE1 =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = node1_vip)(PORT = 1525)(IP = FIRST))
    (ADDRESS = (PROTOCOL = TCP)(HOST = node1)(PORT = 1525)(IP = FIRST))
    tnsnames in node1:
    LISTENERS_RAC =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = node1_vip)(PORT = 1525))
    (ADDRESS = (PROTOCOL = TCP)(HOST = node2_vip)(PORT = 1525))
    NODE1 =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = node1_vip)(PORT = 1525))
    (ADDRESS = (PROTOCOL = TCP)(HOST = node1)(PORT = 1525))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = rac)
    (INSTANCE_NAME = rac1)
    RAC =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = node1_vip)(PORT = 1525))
    (ADDRESS = (PROTOCOL = TCP)(HOST = node2_vip)(PORT = 1525))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = rac)
    ********************************************************

    It is my fault.
    It was the connection service. I had one one with preferred option and one without it. Now is working well.

  • Response to mouse click by combo box list and underlying clickable label

    Hello,
    we developed a label responding to a mouse click by opening and thereby displaying an associated help text. The label extends a project specific hierarchy of labels and thus implements MouseListener, of course. Now we encountered a strange problem: It occurs when a combo box is placed above such a label in a panel. By clicking the combo box a selective list drops down and covers the label. As soon as a mouse click is performed on a list item directly covering (i.e., right in front of) the clickable label not only this item is selected but the help screen associated with the underlying label is displayed, too. So the mouse click is processed twice: as proposed by the combo box and unwantedly by the label. This behaviour could not be reproduced on other components being placed below a combobox. So the label itself seems to be the cause but we cannot imagine what could exactly be the reason for this double reaction. Perhaps anyone heard of something like that?
    We are currently working with IBM Visual Age for Java 2.0 (Java version 1.1.8 with the according Swing version). The clickable label reflectively calls methods of a model to determine whether help is available and if so later on to open this help text.
    Any help is appreciated!
    Danilo

    Thank you for your response. I tried both to check the focus and to consume the event. But I had to learn that labels are not able to catch the focus. I also was not able to consume an appropriate event of the combobox. So I finally solved the problem by extending JButton and implementing ActionListener. Thus my labels are actually buttons but I changed their appearance and behaviour so one cannot distinguish them from labels.

Maybe you are looking for

  • Set and get parameter id

    Hi, I need to store one variable value and I need to retrieve the same variable value in same program. For this I have written set and get parameter ids in the same program. It is working fine but if I log off the system and if I logon the system it

  • Error Message as " SU - SUBRC 12" when going to save SAP files in Excel

    Dear Sir/Madam, One of our User in SAP Getting the following error message when he is going to save any files in SAP as SYSTEM->LIST->LOCAL FILES  and then Spredshhet in Excell as : *"You are not Authorized to save lists in local files ( SY- SUBRC 12

  • Ok so i got a new ipod and now i can't put songs on the new one

    so you see i have a shuffle and i sold that one and now i got a nano and i am unable to put songs onto it when every i grab a song to put onto my nano it doesn't light up and i've tried everything to attempt to put songs onto it but it all just bring

  • Make ringtone in Logic Express 8?

    I´d like to use a recording as a ringtone via i-tunes. But that only seems to be possible with the latest Garage Band, witch I don´t have (my old G5 Power PC seems to be too slow for i-live ´09). Is there a way to make the recording a ringtone-file i

  • Entries meant for Queriac are going to Verizon "Search Assist" instead

    The way my about:config is set up, all URL-bar entries that aren't formatted like a URL are instead sent to "http://queri.ac/lenoxus/X", where X is the entry. The result is that I can treat the awesomebar as a command line of sorts; for example, if I