Results 1 to 4 of 4
  1. #1
    Shamister is offline Member
    Join Date
    Mar 2014
    Posts
    3
    Rep Power
    0

    Question Reading Polish Format (*.mp file)

    Hi
    I got assignment from uni to display a map from file
    I know how to draw it on JPanel but I do not understand how it works
    The extension is *.mp
    I did googling and I am not sure whether it's true, it's called polish format

    Here the partial code of the file :

    [POLYGON]
    Type=0x7
    EndLevel=2
    CityIdx=32
    Data0=(-36.78826,174.62689),(-36.78843,174.62620),(-36.78763,174.62590),(-36.78746,174.62654)
    [END]
    ...
    ...

    Does anyone can explain how to translate this code into a map ?

    Thanks

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,415
    Rep Power
    5

    Default Re: Reading Polish Format (*.mp file)

    A map simply stores key value pairs. So you could have a map of type HashMap<String,Integer> and then do something like:

    Java Code:
    Map<String,Integer> map = new HashMap<>();
    map.put("Type", 7);
    The problem you face is how to parse and store the input file. Maps only store one value per unique key. Your Data0 has multiple values. The value may be either a single type or an array or list of some type.

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  3. #3
    Shamister is offline Member
    Join Date
    Mar 2014
    Posts
    3
    Rep Power
    0

    Default Re: Reading Polish Format (*.mp file)

    Quote Originally Posted by jim829 View Post
    A map simply stores key value pairs. So you could have a map of type HashMap<String,Integer> and then do something like:

    Java Code:
    Map<String,Integer> map = new HashMap<>();
    map.put("Type", 7);
    The problem you face is how to parse and store the input file. Maps only store one value per unique key. Your Data0 has multiple values. The value may be either a single type or an array or list of some type.

    Regards,
    Jim
    Thanks Jim

    But now the problem is how to use those values to draw a map on panel. I really have no idea about what is type, endlevel, cityIdx, data0, etc. It seems only GIS students can read those values.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: Reading Polish Format (*.mp file)

    I've never seen the specifications for what you are asking about. You'll do better asking with a search engine for those definitions.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Greeting from Polish
    By zaper in forum Introductions
    Replies: 0
    Last Post: 04-25-2013, 12:18 AM
  2. Replies: 11
    Last Post: 04-27-2012, 07:43 PM
  3. Replies: 0
    Last Post: 02-09-2012, 09:25 AM
  4. polish signs in log-file
    By rafzio4 in forum Java Servlet
    Replies: 3
    Last Post: 10-20-2010, 02:04 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •