Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Graphics
  4. Map Wrapping

Map Wrapping

Scheduled Pinned Locked Moved Graphics
csharpalgorithmshelp
6 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jim Warburton
    wrote on last edited by
    #1

    I orginally posted this in the C# form (the language I am trying to write this in) and recieved no responses :( . Thought I would try here before giving up. I am trying to allow wrapping of a world map from east to west or west to east (the map is split down the Pacific Ocean). Thus the map would appear to be a cylinder not a rectangle. As the user scrolls across the dividing line the other map edge appears. I thought this would be resonable but I have not been able to find much searching (map, warpping and scrolling appear in many contexts). Any help would be greatly appericated. Thanks, Jim

    this thing looks like it was written by an epileptic ferret Dave Kreskowiak

    P 1 Reply Last reply
    0
    • J Jim Warburton

      I orginally posted this in the C# form (the language I am trying to write this in) and recieved no responses :( . Thought I would try here before giving up. I am trying to allow wrapping of a world map from east to west or west to east (the map is split down the Pacific Ocean). Thus the map would appear to be a cylinder not a rectangle. As the user scrolls across the dividing line the other map edge appears. I thought this would be resonable but I have not been able to find much searching (map, warpping and scrolling appear in many contexts). Any help would be greatly appericated. Thanks, Jim

      this thing looks like it was written by an epileptic ferret Dave Kreskowiak

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      What you're after is applying Mercator Projection. This[^] might help you.

      "WPF has many lovers. It's a veritable porn star!" - Josh Smith

      My blog | My articles | MoXAML PowerToys

      J 1 Reply Last reply
      0
      • P Pete OHanlon

        What you're after is applying Mercator Projection. This[^] might help you.

        "WPF has many lovers. It's a veritable porn star!" - Josh Smith

        My blog | My articles | MoXAML PowerToys

        J Offline
        J Offline
        Jim Warburton
        wrote on last edited by
        #3

        Yes, I want to apply a Mercator Projection but I don't think I was clear with my orginal question, I'll try again. Only part of the map is visible at any given time. What happens when the user reaches the left/right edge of the map in order to see more they must scroll to the opposite edge. Similar to a huge mercator projection painted on a 500 foot long sheet of paper lying flat on the ground. You reach the end of the paper and if you want to see more of the map you have to go back to the other edge (what I have now). If what you are interested in is over or close to the split you are always going back and forth. Now picture that same map on cyclinderical tower which has a 500 foot diameter. The two edges of the map meet and you don't have to go back and forth (what I want to have). I have attempted to do this by using an oversized map (shows 380 degrees of longtitude when viewed completely) and resetting the X location. I haven't been able to get this to work. Any ideas? Jim

        this thing looks like it was written by an epileptic ferret Dave Kreskowiak

        L 1 Reply Last reply
        0
        • J Jim Warburton

          Yes, I want to apply a Mercator Projection but I don't think I was clear with my orginal question, I'll try again. Only part of the map is visible at any given time. What happens when the user reaches the left/right edge of the map in order to see more they must scroll to the opposite edge. Similar to a huge mercator projection painted on a 500 foot long sheet of paper lying flat on the ground. You reach the end of the paper and if you want to see more of the map you have to go back to the other edge (what I have now). If what you are interested in is over or close to the split you are always going back and forth. Now picture that same map on cyclinderical tower which has a 500 foot diameter. The two edges of the map meet and you don't have to go back and forth (what I want to have). I have attempted to do this by using an oversized map (shows 380 degrees of longtitude when viewed completely) and resetting the X location. I haven't been able to get this to work. Any ideas? Jim

          this thing looks like it was written by an epileptic ferret Dave Kreskowiak

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          Hi, I don't see where the problem could be (unless you hope to solve this with a PictureBox :-D ). Here are some thoughts, they may not be optimal, just intended to show a possible way: 1. if you have an image of the world (say from longitude 0 to long 360), then you need to paint it in two steps, first from your starting longitude x0 upto 360, then from 0 to the right border (x0 again). So calling some overload of Graphics.DrawImage twice should do it. An altenative is to construct a double-sized image once (that is from 0 to 360 and again from 0 to 360) and then paint the right part of it. 2. if you are drawing the world yourself, you can draw it in the regular way, you only need to adjust the x coordinate and again tranform the longitudes [0,360) to [x0...360, 0...x0). This by itself could be handled by modifying all x coordinates; or more easily by having your paint code execute twice, once with a translation that takes care of the left part so [0, x0) gets clipped of at the left, and once with a translation that takes care of the right part so [x0, 360) gets clipped of at the right. :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets


          J 1 Reply Last reply
          0
          • L Luc Pattyn

            Hi, I don't see where the problem could be (unless you hope to solve this with a PictureBox :-D ). Here are some thoughts, they may not be optimal, just intended to show a possible way: 1. if you have an image of the world (say from longitude 0 to long 360), then you need to paint it in two steps, first from your starting longitude x0 upto 360, then from 0 to the right border (x0 again). So calling some overload of Graphics.DrawImage twice should do it. An altenative is to construct a double-sized image once (that is from 0 to 360 and again from 0 to 360) and then paint the right part of it. 2. if you are drawing the world yourself, you can draw it in the regular way, you only need to adjust the x coordinate and again tranform the longitudes [0,360) to [x0...360, 0...x0). This by itself could be handled by modifying all x coordinates; or more easily by having your paint code execute twice, once with a translation that takes care of the left part so [0, x0) gets clipped of at the left, and once with a translation that takes care of the right part so [x0, 360) gets clipped of at the right. :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets


            J Offline
            J Offline
            Jim Warburton
            wrote on last edited by
            #5

            Thanks for your help. Jim

            this thing looks like it was written by an epileptic ferret Dave Kreskowiak

            L 1 Reply Last reply
            0
            • J Jim Warburton

              Thanks for your help. Jim

              this thing looks like it was written by an epileptic ferret Dave Kreskowiak

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              You're welcome. :)

              Luc Pattyn [Forum Guidelines] [My Articles]


              - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets


              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups