This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def azimute_reto(self,p1, p2): | |
| print "reto" | |
| delta_x = round(p2.x - p1.x, 2) | |
| delta_y = round(p2.y - p1.y, 2) | |
| print "dX", delta_x | |
| print "dY", delta_y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def azimute_reto(self,p1, p2, casas=3): | |
| # guarda para nao entramos em loop infinito. | |
| if casas > 15: | |
| return None | |
| delta_x = round(p2.x - p1.x, casas) | |
| delta_y = round(p2.y - p1.y, casas) | |
| if delta_x == 0 and delta_y == 0: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def azimute_puissant(self, p1, p2): | |
| """ | |
| Calcula azimute puissant | |
| """ | |
| f = 0.00335281068118 | |
| inv_f = 298.257222101 | |
| e2 = 0.00669438002290 | |
| a = 6378137 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def partition(v, left, right): | |
| i = left | |
| for j in range(left + 1, right + 1): | |
| if v[j] < v[left]: # Se um elemento j for menor que o pivo | |
| i += 1 # .. incrementa-se i | |
| v[i], v[j] = v[j], v[i] # .. e troca o elemento j de posicao o elemento i | |
| v[i], v[left] = v[left], v[i] # O pivo e' colocado em sua posicao final | |
| return i | |
| def quicksort(v, left, right): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| OpenLayers.Format.TastyPie = OpenLayers.Class(OpenLayers.Format.JSON, { | |
| geoJsonReader : new OpenLayers.Format.GeoJSON(), | |
| geometryField : null, | |
| read : function(json, type, filter) { | |
| var results = null; | |
| var obj = null; | |
| if (typeof json == "string") { | |
| obj = OpenLayers.Format.JSON.prototype.read.apply(this, | |
| [json, filter]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo "instalando postgresql" | |
| sudo apt-get update | |
| sudo apt-get upgrade | |
| sudo apt-get -y -q install postgresql-9.1 postgresql-contrib-9.1 libpq-dev postgresql-server-dev-9.1 g++ libxml2-dev | |
| echo "instalando postgis" | |
| mkdir postgis | |
| cd postgis/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CalculadoraAzimuteDistancia(object): | |
| """ | |
| Calcula o azimute entre dois pontos | |
| """ | |
| def distancia(self, p1, p2, h1=0, h2=0): | |
| """ | |
| Calcula p1 distância entre dois pontos p1 e p2 | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // configure os usings de acordo!!! | |
| using ESRI.ArcGis.Geometry; | |
| public class CalculaAzimute | |
| { | |
| public CalculaAzimute() | |
| {} | |
| public double CalcularAzimute(IPoint de, IPoint para) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // usings | |
| public namespace Fulano | |
| { | |
| [TestFixture] | |
| public class TesteAzimute() | |
| { | |
| // Lembre-se: | |
| // 0 graus ou 360 = Norte | |
| // 90 graus = Leste |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # coding: utf-8 | |
| from twisted.internet.protocol import Factory | |
| from twisted.protocols.basic import LineReceiver | |
| from twisted.internet import reactor | |
| class Gateway(LineReceiver): | |
| """Classe para lidar com as conexões""" |