2008/10/1 joe_ [EMAIL PROTECTED]

 Hello Joe,
Yes, I'm trying to create an Circle section as a focal point and azimuth,
but it could not create the polygon.
I got some code ready but I said nothing much.
For example, I indicate a central point Lat and LGT and a Azimuth angle of
245 º and then I want to create a Circle section of the azimuth circle.

 I used a code and it works only can not I convert it to the google maps if
someone can help me I would ...
the code is:
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
 <title>MAP </title>
 <!-- <script type="text/javascript"
src="../../modulos/js/webraska_framework.php?map=true"></script> -->
 <script src="
http://www.apontador.com.br/aptapi.php?v=0.2.1&o=15&key=493f997b65aa481c74edc049d08ff3b7229b6e32";
type="text/javascript" charset="ISO-8859-1"></script>
 <!-- <script src="
http://apt-v6/aptapi.php?v=0.2.1&o=15&key=a29986fc292593e9c78b890e954a55f1f25ee8ee";
type="text/javascript"></script> -->
 <script src="
http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAqd8halY7-G0n7VebDgd6GRS0EI3oIapbMuQVuDnWIarD3SyQjhSwJ7QFA_e9mv9vLGM19O4Q-2uc7Q";
type="text/javascript" charset="UTF-8"></script>

 <script type="text/javascript">
  testMashup = new Mashup({
         map : 1
        },
        {
        });
  mapObj = testMashup.map;

  doOnload = function() {
   mapObj[0].startMap('map1',
        {
         center : new aptGeopoint(-23.573643, -46.689177),
         zoom : 4,
         toolbar : { hybrid : true, satellite : true, zoomslider : true,
zoombuttons : true }
        });
  }

  getAzimuthDraw = function() {
   var pcenter = new aptGeopoint($('lat').value, $('lon').value);
   var pradius = $('radius').value.isNumber();
   var pazimuth = $('az').value.isNumber();

   var aptGeopointArr = makeTriangles(pcenter, pradius, pazimuth);

   optionsToDraw = {
    color : '#000000',
    opacity : '0.45',
    stroke : '2pt',
    fill : '#FF0000',
    fillOpacity : '0.3'
   }

   mapObj[0].drawPolygon(new aptShape(aptGeopointArr, optionsToDraw));
   centerDraw(pcenter, pradius)
  }

  makeTriangles = function(center, radius, azimuth) {
   /*
   O ponto inicial (azimute = 0) é direção Norte em nossa referência e
direção Leste no ciclo trigonométrico
   */
   azimuth = azimuth - 90; // Necessário para reajustar o azimute sendo a
linha central do desenho
   var vertices = 2000;
   var degreeToRad = 0.017453292519943295769236907684886;
   var distance = mapObj[0].metricToDegree(center, radius);
   var passes = [];
   var pointsarr = [];
   var angleToDraw = 120;

   var deltaangle = (angleToDraw / (vertices - 1)).isNumber();
   var iniangle = (azimuth - (Math.floor(vertices / 2) *
deltaangle)).isNumber();

   for(var j = 0; j < vertices; j++) {
    passes[j] = { x : (distance * Math.cos((iniangle + (deltaangle * j)) *
degreeToRad)), y : (distance * Math.sin((iniangle + (deltaangle * j)) *
degreeToRad)) };
   }

   pointsarr[0] = center;

   for(var i = 0; i < vertices; i++) {
    pointsarr[i + 1] = new aptGeopoint((center.lat() - passes[i].y),
(center.lon() + passes[i].x));
   }

   return pointsarr;
  }

  centerDraw = function(center, radius) {
   var distance = mapObj[0].metricToDegree(center, radius);
   southeast = new aptGeopoint(center.lat() - (distance * 1.1), center.lon()
+ (distance * 1.1));
   northwest = new aptGeopoint(center.lat() + (distance * 1.1), center.lon()
- (distance * 1.1));

   mapObj[0].setBounds(northwest, southeast);
  }


 </script>
</head>
<body onLoad='doOnload();'>
 <center>
  Latitude: <input type='text' size='10' id='lat' />
  Longitude: <input type='text' size='10' id='lon' /><br/>
  Raio: <input type='text' size='10' id='radius' value='10' />
  Azimute: <input type='text' size='10' id='az' value='0' /><br/>
  <input type='button' value='azimuthTest' onClick='getAzimuthDraw();' />
 </center>
  <div id='map1' style='width : 800px; height : 600px; border : 1px solid
#B4B4B4; position : relative;'></div>
 <center>
  <div id="debug"></div>
 </center>
</body>
</html>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to