Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Компьютеры » Программы » SAS.Планета (часть 2)

Модерирует : gyra, Maz

Widok (02-11-2009 18:25): Лимит страниц. Продолжаем здесь.  Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

   

zporuchik



Silver Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Map detect</title>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAn5RDa1wbCvyHdFxWgxB8pBRlMH3AT-4NBJ0KCmnpzqOD3XyFFRSPvwcrM5HkRKECFgl2SXoa5xkwQA"
      type="text/javascript"></script>
    <script type="text/javascript">
 
    //<![CDATA[
 
 
    function pad(num, count) {
      var lenDiff = count - String(num).length;
      var padding = "";
       
      if (lenDiff > 0)
        while (lenDiff--)
          padding += "0";
       
      return padding + num;
    }
 
 
 
    // A Rectangle is a simple overlay that outlines a lat/lng bounds on the
    // map. It has a border of the given weight and color and can optionally
    // have a semi-transparent background color.
    function Rectangle(bounds, opt_weight, opt_color) {
      this.bounds_ = bounds;
      this.weight_ = opt_weight || 2;
      this.color_ = opt_color || "#888888";
    }
    Rectangle.prototype = new GOverlay();
 
    // Creates the DIV representing this rectangle.
    Rectangle.prototype.initialize = function(map) {
      // Create the DIV representing our rectangle
      var div = document.createElement("div");
      div.style.border = this.weight_ + "px solid " + this.color_;
      div.style.position = "absolute";
 
      // Our rectangle is flat against the map, so we add our selves to the
      // MAP_PANE pane, which is at the same z-index as the map itself (i.e.,
      // below the marker shadows)
      map.getPane(G_MAP_MAP_PANE).appendChild(div);
 
      this.map_ = map;
      this.div_ = div;
    }
 
    // Remove the main DIV from the map pane
    Rectangle.prototype.remove = function() {
      this.div_.parentNode.removeChild(this.div_);
    }
 
    // Copy our data to a new Rectangle
    Rectangle.prototype.copy = function() {
      return new Rectangle(this.bounds_, this.weight_, this.color_,
                           this.backgroundColor_, this.opacity_);
    }
 
    // Redraw the rectangle based on the current projection and zoom level
    Rectangle.prototype.redraw = function(force) {
      // We only need to redraw if the coordinate system has changed
      if (!force) return;
 
      // Calculate the DIV coordinates of two opposite corners of our bounds to
      // get the size and position of our rectangle
      var c1 = this.map_.fromLatLngToDivPixel(this.bounds_.getSouthWest());
      var c2 = this.map_.fromLatLngToDivPixel(this.bounds_.getNorthEast());
 
      // Now position our DIV based on the DIV coordinates of our bounds
      this.div_.style.width = Math.abs(c2.x - c1.x) + "px";
      this.div_.style.height = Math.abs(c2.y - c1.y) + "px";
      this.div_.style.left = (Math.min(c2.x, c1.x) - this.weight_) + "px";
      this.div_.style.top = (Math.min(c2.y, c1.y) - this.weight_) + "px";
    }
 
     
    function initialize() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(55.7, 37.5), 6);
 
 
        GEvent.addListener(map,"click", function(overlay,latlng) {      
          if (latlng) {    
            var lat = latlng.lat();
            var lon = latlng.lng();
 
            map.clearOverlays();
            var rectBounds = new GLatLngBounds(
                new GLatLng(Math.floor(lat/2)*2,   Math.floor(lon/3)*3),  
                new GLatLng(Math.floor(lat/2)*2+2, Math.floor(lon/3)*3+3));
            map.addOverlay(new Rectangle(rectBounds));
            var rectBounds = new GLatLngBounds(
                new GLatLng(Math.floor(lat*3)/3,     Math.floor(lon*2)/2),  
                new GLatLng(Math.floor(lat*3)/3+1/3, Math.floor(lon*2)/2+1/2));
            map.addOverlay(new Rectangle(rectBounds, 1, "#222222"));
 
            var plat = lat;
            var plon = lon;
 
            var ltr = (plat<0 ? "x" : "" ) + String.fromCharCode("A".charCodeAt(0) + Math.abs(plat) / 4);  
            var sq001 = ltr + "-" + Math.floor((plon+180)/6+1).toFixed(0);
            var sq500 = sq001 + "-" + (1 + 2   -  2*Math.floor(((plat+100)%4)/2)   + Math.floor(((plon+180)%6)/3) ).toFixed(0);
            var sq200 = sq001 + "-" + pad( Math.ceil(1 + 30  -  6*Math.floor(((plat+100)%4)/2*3) + Math.floor(((plon+180)%6))),   2 );
            var sq100 = sq001 + "-" + pad( Math.ceil(1 + 132 - 12*Math.floor(((plat+100)%4)*3)   + Math.floor(((plon+180)%6)*2)), 3 );
            var sq050 = sq100 + "-" + (1 + 2   -  2*Math.floor(((plat+100)%(1/3))*6)   + Math.floor(((plon+180)%(1/2))*4) ).toFixed(0)
 
            var myHtml = "<table><tr><td>WGS: <td>(" + lat.toFixed(5) + ", " + lon.toFixed(5) + ")" +  
//                "<tr><td>Pulkovo: <td>(" + plat.toFixed(5) + ", " + plon.toFixed(5) + ")" +
                "</table>" +  
                "<table>" +  
                "<tr><td> 1 : 1000000 </td><td> " + sq001 + " </td>" +
                "<tr><td> 1 : 500000 </td><td> " + sq500 + " </td>" +
                "<tr><td> 1 : 200000 </td><td> " + sq200 + " </td>" +
                "<tr><td> 1 : 100000 </td><td> " + sq100 + " </td>" +
                "<tr><td> 1 : 50000 </td><td> " + sq050 + " </td>" +
                "</table>";
            map.openInfoWindow(latlng, myHtml);
          }
        });
 
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
      }
    }
 
    //]]>
    </script>
  </head>
 
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-7497955-2");
pageTracker._trackPageview();
} catch(err) {}</script>  
   
  <body onload="initialize()" onunload="GUnload()">
    <div id="map_canvas" style="width: 640px; height: 400px"></div>
    <div id="sq"><br/>Click on map <br/><br/> (c) liosha, xliosha@gmail.com <br/><br/>
    <img src="http://www.hitcounter.ru/count.php?liosha" border="0" alt="&#65533;&#65533;&#65533;&#31274;" /></div>
  </body>
 
</html>

Всего записей: 2131 | Зарегистр. 17-03-2005 | Отправлено: 14:53 19-03-2009 | Исправлено: zporuchik, 15:21 19-03-2009
   

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Компьютеры » Программы » SAS.Планета (часть 2)
Widok (02-11-2009 18:25): Лимит страниц. Продолжаем здесь.


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru