|
From: Eric A. <eri...@gm...> - 2005-04-08 15:33:56
|
I think I personally would not want that much bandwidth to go to the satellite imagery. I think what would be more useful is to not download the chunks until the user requests them ,then alert the user when all the chunks visible on the screen are downloaded and then he/she can switch to thr satellite view. On Thu, 7 Apr 2005 6:21pm, Adam Bliss wrote: > Update of /cvsroot/hipgmap/gmap/com/trileet/gmap > In directory > sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10307/com/trileet/gmap > > Modified Files: > GMap.java ImageCache.java Point.java TileSet.java > Log Message: > This is still VERY rough, but I have shown how to compute the correct > offset at which to display the photo. This does not work, because we > are still passing the WAP flag to the HTTPRequest, which causes the > 256x256 JPEG to be resized. If we request without the WAP flag, the > photo will not display at all (I have posted to the UI form on > developer.danger.com about this.) > > Now, the big question... do we want to alter the tileset to support > the two different tile-widths and coordinate-systems, and have GMap > maintain two independent tilesets loading tiles from different > sources, and have a button to swap between them? This would give the > closest experience to the web application, but I feel the photo tiles > are too slow-loading to proceed in this way. > > > > Index: Point.java > =================================================================== > RCS file: /cvsroot/hipgmap/gmap/com/trileet/gmap/Point.java,v > retrieving revision 1.4 > retrieving revision 1.5 > diff -C2 -d -r1.4 -r1.5 > *** Point.java 6 Apr 2005 23:39:42 -0000 1.4 > --- Point.java 8 Apr 2005 00:07:53 -0000 1.5 > *************** > *** 91,99 **** > private static final hipfloat h2p18 = new hipfloat(1<<19); > private static final char[] KHCHARS = {'t','q','s','r'}; > public static String latLngToKH(hipfloat lat, hipfloat lng) { > int y = lat.add(h180).div(h360).mul(h2p18).toint(); > int x = lng.add(h180).div(h360).mul(h2p18).toint(); > > ! char[] outArr = new char[20]; > for (int i=0; i<19; i++) { > int index = ((x & 1<<(19-i))>>(18-i)); > --- 91,103 ---- > private static final hipfloat h2p18 = new hipfloat(1<<19); > private static final char[] KHCHARS = {'t','q','s','r'}; > + /** > + * Returns a string of length 19. First char is t. Remaining > + * chars encode the given point. > + */ > public static String latLngToKH(hipfloat lat, hipfloat lng) { > int y = lat.add(h180).div(h360).mul(h2p18).toint(); > int x = lng.add(h180).div(h360).mul(h2p18).toint(); > > ! char[] outArr = new char[19]; > for (int i=0; i<19; i++) { > int index = ((x & 1<<(19-i))>>(18-i)); > > Index: ImageCache.java > =================================================================== > RCS file: /cvsroot/hipgmap/gmap/com/trileet/gmap/ImageCache.java,v > retrieving revision 1.9 > retrieving revision 1.10 > diff -C2 -d -r1.9 -r1.10 > *** ImageCache.java 7 Apr 2005 02:18:16 -0000 1.9 > --- ImageCache.java 8 Apr 2005 00:07:52 -0000 1.10 > *************** > *** 120,134 **** > return; > } > boolean kh = false; > if (url.substring(7,9).equals("kh")) { > System.out.println("Got a kh response"); > kh = true; > } > // Build the image > Bitmap image= null; > try { > ! //image = Bitmap.newFromPNGData(response.getBytes()); > ! image = kh?ImageCodec.decodeJPEG(response.getBytes()) : > ! ImageCodec.decodePNG(response.getBytes()); > } catch (Throwable t) { > System.out.println("Unable to decode image: " + url + " error: " + > t.getMessage()); > --- 120,141 ---- > return; > } > + byte[] bytes = response.getBytes(); > boolean kh = false; > if (url.substring(7,9).equals("kh")) { > System.out.println("Got a kh response"); > kh = true; > + /** > + System.out.println(bytes.length); > + for (int i=0; i<=32; i++) { > + System.out.print(Integer.toHexString((int)(bytes[i]))); > + } > + **/ > + > } > // Build the image > Bitmap image= null; > try { > ! image = Bitmap.newFromEncodedData(bytes); > ! //image = Bitmap.convertToScreenColorSpace(image); > } catch (Throwable t) { > System.out.println("Unable to decode image: " + url + " error: " + > t.getMessage()); > *************** > *** 138,142 **** > System.out.println("ImageCodec gave null:"); > for (int i=0; i<=32; i++) { > ! System.out.print(Integer.toHexString((int)(response.getBytes()[i]))); > } > > --- 145,149 ---- > System.out.println("ImageCodec gave null:"); > for (int i=0; i<=32; i++) { > ! System.out.print(Integer.toHexString((int)(bytes[i]))); > } > > *************** > *** 174,186 **** > // Store the PNG data to the datastore if asked > if (request.store) { > ! saveToDataStore(url, response.getBytes()); > } > } > - if (hasImage(url)) { > - System.out.println("Got it."); > - } > - else { > - System.out.println("Don't got it."); > - } > } > > --- 181,187 ---- > // Store the PNG data to the datastore if asked > if (request.store) { > ! saveToDataStore(url, bytes); > } > } > } > > > Index: GMap.java > =================================================================== > RCS file: /cvsroot/hipgmap/gmap/com/trileet/gmap/GMap.java,v > retrieving revision 1.24 > retrieving revision 1.25 > diff -C2 -d -r1.24 -r1.25 > *** GMap.java 7 Apr 2005 02:18:16 -0000 1.24 > --- GMap.java 8 Apr 2005 00:07:50 -0000 1.25 > *************** > *** 84,87 **** > --- 84,88 ---- > > s_searchWindow.dirsFrom(((Hit)e.argument).getSearchableAddress()); > return true; > + > case SHOW_DRIVE: > s_searchWindow.hide(); > *************** > *** 89,95 **** > s_directionWindow.show(); > return true; > ! case SEARCH_MAP: > ! s_searchWindow.show(); > ! s_searchWindow.searchNear(s_mapWindow.getCoords()); > return true; > case SHOW_DIRS: > --- 90,97 ---- > s_directionWindow.show(); > return true; > ! case SHOW_MAP: > ! s_searchWindow.hide(); > ! s_directionWindow.hide(); > ! s_mapWindow.show(); > return true; > case SHOW_DIRS: > *************** > *** 99,102 **** > --- 101,109 ---- > s_searchWindow.show(); > return true; > + > + case SEARCH_MAP: > + s_searchWindow.show(); > + s_searchWindow.searchNear(s_mapWindow.getCoords()); > + return true; > case SHOW_SAVED_HITS: > s_searchWindow.show(); > *************** > *** 235,240 **** > > public static int requestURL(String url, ResponseListener listener){ > System.out.println("REQUESTING: " + url); > ! HTTPConnection.get(url, null, (short) 0, ++s_transactionId, true); > s_listeners.put(new Integer(s_transactionId), new Request(url, > listener)); > return s_transactionId; > --- 242,253 ---- > > public static int requestURL(String url, ResponseListener listener){ > + boolean kh = false; > + if (url.substring(7,9).equals("kh")) { > + System.out.println("Got a kh response"); > + kh = true; > + } > + > System.out.println("REQUESTING: " + url); > ! HTTPConnection.get(url, null, (short) 0, ++s_transactionId, > true);//!kh); > s_listeners.put(new Integer(s_transactionId), new Request(url, > listener)); > return s_transactionId; > > Index: TileSet.java > =================================================================== > RCS file: /cvsroot/hipgmap/gmap/com/trileet/gmap/TileSet.java,v > retrieving revision 1.21 > retrieving revision 1.22 > diff -C2 -d -r1.21 -r1.22 > *** TileSet.java 7 Apr 2005 02:18:16 -0000 1.21 > --- TileSet.java 8 Apr 2005 00:07:53 -0000 1.22 > *************** > *** 397,407 **** > else { > // Photo mode. > ! Bitmap photo = > ImageCache.requestImage(Tile.makePhotoURL(Point.latLngToKH(getLat(),getLng()),m_zoom),null); > if (photo == null) { > System.out.println("Null photo!"); > return; > } > ! //todo: find offset > ! p.drawBitmap(0,0,photo); > > } > --- 397,408 ---- > else { > // Photo mode. > ! String khCenter = Point.latLngToKH(getLat(),getLng()); > ! Bitmap photo = > ImageCache.requestImage(Tile.makePhotoURL(khCenter,m_zoom),null); > if (photo == null) { > System.out.println("Null photo!"); > return; > } > ! String khTail = khCenter.substring(18-m_zoom); > ! p.drawBitmap(khToXOff(khTail),khToYOff(khTail),photo); > > } > *************** > *** 530,534 **** > > } > ! > public void quit() { > ImageCache.quit(); > --- 531,590 ---- > > } > ! /** > ! * When we convert the center of our map into a KH coordinate to > ! * fetch the correct aerial photo tile, we will cut off the first > ! * (18-zoom) characters and put them in the URL. The remaining > ! * characters will tell us where, in the bitmap that gets > ! * returned, is our point. > ! * > ! * Since the photo image is 256 pixels across, the first 8 > ! * characters of the KH tail tell us exactly which pixel we are > ! * referring to. > ! */ > ! int khToXOff(String khTail) { > ! int x = 0; > ! for (int i=0; i <8; i++) { > ! x = x << 1; > ! char c='t'; > ! if (khTail.length()>i) > ! c = khTail.charAt(i); > ! switch (c) { > ! case 'q': > ! case 't': > ! break; > ! case 'r': > ! case 's': > ! x |= 1; > ! break; > ! default: > ! throw new IllegalArgumentException("Bad KH String:" + khTail); > ! } > ! > ! } > ! return 120-x; > ! } > ! int khToYOff(String khTail) { > ! int y = 0; > ! for (int i=0; i <8; i++) { > ! y = y << 1; > ! char c='t'; > ! if (khTail.length()>i) > ! c = khTail.charAt(i); > ! switch (c) { > ! case 's': > ! case 't': > ! break; > ! case 'r': > ! case 'q': > ! y |= 1; > ! break; > ! default: > ! throw new IllegalArgumentException("Bad KH String:" + khTail); > ! } > ! > ! } > ! return y-186; > ! > ! } > public void quit() { > ImageCache.quit(); > *************** > *** 644,647 **** > public boolean photoAvailable = false; > private boolean displayPhoto = false; > ! > } > --- 700,704 ---- > public boolean photoAvailable = false; > private boolean displayPhoto = false; > ! int m_offsetXPhoto; > ! int m_offsetYPhoto; > } > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real > users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Hipgmap-cvs mailing list > Hip...@li... > https://lists.sourceforge.net/lists/listinfo/hipgmap-cvs |