	function GeoQuery() {
	}
	GeoQuery.prototype.CIRCLE='circle';
	GeoQuery.prototype.COLOR = '#ffcc00';
	
	/*---------------------inicializar el circulo----------*/
	GeoQuery.prototype.initializeCircle = function(radius, point, map) {
		this._type = this.CIRCLE;
		this._radius = radius;
		this._map = map;
		this._dragHandlePosition = destination(point, 90, this._radius/1000);
		this._dragHandle = new GMarker(this._dragHandlePosition, queryLineOptions);
		this._centerHandlePosition = point;
		this._centerHandle = new GMarker(this._centerHandlePosition, queryCenterOptions);
		this._color = this.COLOR;
		map.addOverlay(this._dragHandle);
		map.addOverlay(this._centerHandle);
		var myObject = this;
		GEvent.addListener (this._dragHandle, "dragend", function() {myObject.updateCircle(1);});
		GEvent.addListener (this._dragHandle, "drag", function() {myObject.updateCircle(1);});
		GEvent.addListener(this._centerHandle, "dragend", function() {myObject.updateCircle(2);});
		GEvent.addListener(this._centerHandle, "drag", function() {myObject.updateCircle(2);});
		checkPoints();//Esto consulta los puntos que están activos e inactivos para pintarlos u ocultarlos
	}
		
	/*--------------------------------------MODIFICAR EL CIRCULO--------------------------*/
	GeoQuery.prototype.updateCircle = function (type) {
		this._map.removeOverlay(this._polyline);
		if (type==1) {
			this._dragHandlePosition = this._dragHandle.getPoint();
			this._radius = distance(this._centerHandlePosition, this._dragHandlePosition) * 1000;
			this.render();
		} else {
			this._centerHandlePosition = this._centerHandle.getPoint();
			this.render();
			this._dragHandle.setPoint(this.getEast());
		}
		checkPoints();//Esto consulta los puntos que están activos e inactivos para pintarlos u ocultarlos
	}
	
	
	/*-------------------------------------Mover el circulo----------------------------------------------------*/
	GeoQuery.prototype.moveCircle = function (position) {
		this._centerHandle.setLatLng(position);
		this._radius = 5000;
		this.updateCircle(2);
	}
	/*------------------------------------------Borrar el circulo----------------------------------------*/
	GeoQuery.prototype.deleteCircle = function () {
		this._map.removeOverlay(this._polyline);
		this._map.removeOverlay(this._dragHandle);
		this._radius = 1;
		this._centerHandle.disableDragging();
		//this.render();
		circulo_creado = 0;
	}
	/*-----------------------------crear el circulo--------------------*/
	GeoQuery.prototype.render = function() {
		if (this._type == this.CIRCLE) {
		    this._points = [];
		    var distance = this._radius/1000;
		    for (i = 0; i < 72; i++) {
		      this._points.push(destination(this._centerHandlePosition, i * 360/72, distance) );
		    }
			this._points.push(destination(this._centerHandlePosition, 0, distance) );
		    this._polyline = new GPolygon(this._points, this._color, 1, 1, this._color, 0.2);
		    this._map.addOverlay(this._polyline)
		  }
	}

	//Esto sirve para mover al pollo	
	GeoQuery.prototype.getEast = function() {
		return this._points[(72/4)];
	}

		
