File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

map program

 
Syamsul Hussin
Ranch Hand
Posts: 59
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I want to write a program that generates a map. The map should be represented as colors, the colors being the height(z-axis) of that point in the map. The way I store the data is by using a 2-dimensional integer array and setting each (x,y,z) point in the map as map[x][y]=z and when i want to draw the map, I iterate through the array and paint each point according to its z value. Is there a better way to store the data and to draw the map?
 
karl koch
Ranch Hand
Posts: 388
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
the two-dimensional array aproach is actually the same as a bitmap (bmp) image. (eg. an colour bitmap with 16.7 m. colours is a 3 dimensional array of 8 bit values: (2^8)^3 = 16.7m )
so you could probably apply a "non lossy reduction" algorithm such as gif or png to your data (gif only works for 256 colours, i think png is better. so much about the theory...i dont have a clue how to do this...
maybe this can give you some new ideas...
k
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic