![]()  | 
	
 
  | 
		
			
  | 	
	
	
		
		|||||||
| Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны | 
| 
		 | 
	Опции темы | Поиск в этой теме | Опции просмотра | 
| 
		 
			 
			#1  
			
			
			
			
		 
		
		
	 | 
||||
		
		
  | 
||||
| 
	
	
		
			
			 Помогите перевести код С# на Delphi! 
		
	
		
		
		
		
		
	
		
		
	
	
	class gmaps { ... public Point tile(double lat, double lng, int zoom) { return new System.Drawing.Point(Xpixel(lng, zoom) / 256, Ypixel(lat, zoom)); } public int Xpixel(double lng, int zoom) { // Instead of -180 to +180, we want 0 to 360 double dlng = this.lng.Value + 180.0; // 256 = tile Width double dxpixel = dlng / 360.0 * 256 * Math.Pow(2, 17 - zoom); int xpixel = Convert.ToInt32(Math.Floor(dxpixel)); return xpixel; } public int Ypixel(double lat, int zoom) { // The 25 comes from 17 + (256=>2^8=>8) 17+8 = 25 // ypixelcenter = the middle y pixel (the equator) at this zoom level double ypixelcenter = Math.Pow(2, 25 - zoom - 1); // PI/360 == degrees -> radians // The trig functions are done with radians double dypixel = ypixelcenter - Math.Log(Math.Tan(lat * Math.PI / 360 + Math.PI / 4)) * ypixelcenter / Math.PI; int ypixel = Convert.ToInt32(Math.Floor(dypixel)); return ypixel; } ... }  |