Jump to content

SUBIECTE NOI
« 1 / 5 »
RSS
Cum sterg mails din Promotions

Vanzare cumparare fara transfer b...

Receptie ciudata, in functie de t...

Dupa 20 ani de facultate, am uita...
 Mobile.de ofera imprumut de bani ...

problema test grila

Digi24 a disparut de pe TV Lg

Drept de proprietate intelectuala...
 Jante noi shitbox

Trinitas TV 4K

Dacia 1316 cu 6 usi ...

Frecventa modificata radio
 Un nou pericol pt batrani

Ar trebui sa vindem imobiliarele ...

Dupa renuntarea la aparat dentar

pelerinaj in Balcik
 

problema google map

- - - - -
  • Please log in to reply
No replies to this topic

#1
bunicu9

bunicu9

    Member

  • Grup: Members
  • Posts: 253
  • Înscris: 14.07.2013
Am o problema cu acest script.


index.html
<!DOCTYPE HTML>
<html>
<head>
	<title>SanMap</title>
	<!-- Disallow users to scale this page -->
	<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
	<style type="text/css">
		/* Allow the canvas to use the full height and have no margins */
		html, body, #map-canvas {
			height: 100%;
			margin: 0
		}
	</style>
</head>
<body>
<!-- The container the map is rendered in -->
<div id="map-canvas"></div>
<!-- Load all javascript -->
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="js/SanMap.min.js"></script>
<script>
/*
  * Define the map types we will be using.
  *
  * SanMapType parameters: minZoom, maxZoom, getTileUrlFunction, [optional]tileSize.
  *
  * The default value for tileSize is 512.
  */
 
	var mapType = new SanMapType(0, 2, function (zoom, x, y) {
		return x == -1 && y == -1
  ? "tiles/map.outer.png"
  : "tiles/map." + zoom + "." + x + "." + y + ".png";//Where the tiles are located
	});

	var satType = new SanMapType(0, 3, function (zoom, x, y) {
		return x == -1 && y == -1
  ? null
  : "tiles/sat." + zoom + "." + x + "." + y + ".png";//Where the tiles are located
	});

/*
  * Create the map.
  *
  * createMap parameters: canvas, mapTypes, [optional]defaultZoomLevel,
  *	 [optional]defaultLocation, [optional]allowRepeating, [optional]defaultMapType.
  *
  * The default value for defaultZoomLevel is 2.
  * The default value for defaultLocation is null.
  * The default value for allowRepeating is false.
  * The default value for defaultMapType is the first key in mapTypes.
  */
	var map = SanMap.createMap(document.getElementById('map-canvas'),
  {'Map': mapType, 'Satellite': satType}, 2, null, false, 'Satellite');
/*
  *
  * The above code contain methods SanMap provide
  * From here on forth we only use methods provided by the Google API
  *
  */

/* Create a basic marker near the Pershing Square bank.
  * When you click on this marker, a info window is shown.
  */
var bankInfoWindow = new google.maps.InfoWindow({
  content: '<h3>LS Bank</h3><p><b>At this bank</b>, your money is welcome.</p>'
});
var bankMarker = new google.maps.Marker({
  position: SanMap.getLatLngFromPos(1500, -1590),
  map: map
});
google.maps.event.addListener(bankMarker, 'click', function() {
  map.setCenter(bankMarker.position);
  bankInfowindow.open(map,bankMarker);
});


/* Create a basic marker near Blueberry Acres.
  * When you click on this marker, an info window is shown.
  */
var bbInfoWindow = new google.maps.InfoWindow({
  content: '<h3>Blueberry</h3><p><b>This place</b>, is the center of the world!</p>'
});
var bbMarker = new google.maps.Marker({
  position: SanMap.getLatLngFromPos(0, 0),
  map: map
});
google.maps.event.addListener(bbMarker, 'click', function() {
  map.setCenter(bbMarker.position);
  bbInfowindow.open(map,bbMarker);
});

/* Create a basic marker near Idlewood. The marker has a custom icon.
  * When you click on this marker, an info window is shown.
  */
var homeInfoWindow = new google.maps.InfoWindow({
  content: '<h3>I live here</h3><p><b>Home</b>, sweet home!</p>'
});
var homeMarker = new google.maps.Marker({
  position: SanMap.getLatLngFromPos(2050, -1700),
  map: map,
  icon: 'http://ikkentim.com/sanmap/green-house.gif'
});
google.maps.event.addListener(homeMarker, 'click', function() {
  map.setCenter(homeMarker.position);
  homeInfowindow.open(map,homeMarker);
});

//Uncomment to show an alert with the position when you click on the map
  google.maps.event.addListener(map, 'click', function(event) {
   var pos = SanMap.getPosFromLatLng(event.latLng);
			alert(pos.x + "," + pos.y);
		});
	var zone = new google.maps.Polygon({
	paths: [
	SanMap.getLatLngFromPos(243.992538, -4368.940917),
	SanMap.getLatLngFromPos(258.406707, -4368.940917),
	SanMap.getLatLngFromPos(258.406707, -4104.655761),
	SanMap.getLatLngFromPos(243.992538, -4104.655761)
  ],
	strokeWeight: 0,
	fillColor: '#000000',
	fillOpacity: 1.0
  });
  zone.setMap(map);
 
</script>
</body>


function SanMapProjection(e) {
	var n = e;
	this.pixelOrigin_ = new google.maps.Point(n / 2, n / 2), this.pixelsPerLonDegree_ = n / 360, this.fromLatLngToPoint = function(e, n) {
		var t = n || new google.maps.Point(0, 0);
		return t.x = this.pixelOrigin_.x + e.lng() * this.pixelsPerLonDegree_ * 2, t.y = this.pixelOrigin_.y - e.lat() * this.pixelsPerLonDegree_ * 2, t
	}, this.fromPointToLatLng = function(e) {
		var n = (e.x - this.pixelOrigin_.x) / this.pixelsPerLonDegree_ / 2,
			t = (-e.y + this.pixelOrigin_.y) / this.pixelsPerLonDegree_ / 2;
		return new google.maps.LatLng(t, n, !0)
	}
}
function SanMapType(e, n, t, a) {
	this.getImageMapType = function(o) {
		return a = a || 512, new google.maps.ImageMapType({
			getTileUrl: function(e, n) {
				var a = e.x,
					g = e.y,
					i = 1 << n;
				return 0 > g || g >= i || o !== !0 && (0 > a || a >= i) ? t(n, -1, -1) : t(n, (a % i + i) % i, g)
			},
			tileSize: new google.maps.Size(a, a),
			maxZoom: n,
			minZoom: e
		})
	}
}
function SanMap() {}
SanMap.createMap = function(e, n, t, a, o, g) {
	if (void 0 === n || 0 == n.length) return console.warn("SanMap: No map types were parsed with SanMap.createMap."), null;
	var i = new google.maps.Map(e, {
		zoom: t || 2,
		center: a || SanMap.getLatLngFromPos(0, 0),
		streetViewControl: !1,
		mapTypeControlOptions: {
			mapTypeIds: Object.keys(n)
		}
	});
	for (var p in n)
		if (n.hasOwnProperty(p)) {
			var r = n[p].getImageMapType(o || !1);
			r.name = r.alt = p, r.projection = new SanMapProjection(r.tileSize.width), i.mapTypes.set(p, r)
		}
	return i.setMapTypeId(g || Object.keys(n)[0]), o || (bounds = new google.maps.LatLngBounds(new google.maps.LatLng(-90, -90), new google.maps.LatLng(90, 90)), google.maps.event.addListener(i, "center_changed", function() {
		if (!bounds.contains(i.getCenter())) {
			var e = i.getCenter().lng(),
				n = i.getCenter().lat();
			e < bounds.getSouthWest().lng() && (e = bounds.getSouthWest().lng()), e > bounds.getNorthEast().lng() && (e = bounds.getNorthEast().lng()), n < bounds.getSouthWest().lat() && (n = bounds.getSouthWest().lat()), n > bounds.getNorthEast().lat() && (n = bounds.getNorthEast().lat()), i.setCenter(new google.maps.LatLng(n, e))
		}
	})), i
}, SanMap.width = 6e3, SanMap.height = 6e3, SanMap.ox = 0, SanMap.oy = 0, SanMap.setMapSize = function(e, n, t, a) {
	SanMap.width = e, SanMap.height = n, SanMap.ox = t, SanMap.oy = a
}, SanMap.getLatLngFromPos = function(e, n) {
	return "object" == typeof e ? new google.maps.LatLng((e.y - SanMap.oy) / SanMap.height * 180, (e.x - SanMap.ox) / SanMap.width * 180) : new google.maps.LatLng((n - SanMap.oy) / SanMap.height * 180, (e - SanMap.ox) / SanMap.width * 180)
}, SanMap.getPosFromLatLng = function(e) {
	return {
		x: e.lng() * SanMap.width / 180 + SanMap.ox,
		y: e.lat() * SanMap.height / 180 + SanMap.oy
	}
};

// SanMap.js
// Tool for drawing Google Maps of San Andreas.
// Written by Tim Potze
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
// For more information, please refer to <http://unlicense.org>
//
/* Create a set of helper classes.
*/
/**
* Projection specialized for San Andreas, based on GallPete###ion
* available at:
* https://developers.google.com/maps/documentation/javascript/examples/map-projection-simple
* @class SanMapProjection
* @constructor
* *implements {google.maps.Projection}
*/
function SanMapProjection(tileSize) {
/**
	 * The range across the map.
  *
  * @property projectionRange_
  * @type {Number}
  */
	var projectionRange_ = tileSize;

/**
	 * The origin of the map.
  *
  * @property pixelOrigin_
  * @type {Object}
  */
	this.pixelOrigin_ = new google.maps.Point(projectionRange_ / 2,
  projectionRange_ / 2);

/**
	 * The number of pixels per longitude degree.
  *
  * @property pixelsPerLonDegree_
  * @type {Number}
  */
	this.pixelsPerLonDegree_ = projectionRange_ / 360;

/**
	 * Converts a google.maps.LatLng to google.maps.Point.
  *
  * @method fromLatLngToPoint
  * @param {Object} latLng The LatLng object to convert.
  * @param {Object} opt_point optional point type to use as return type
  * instead of google.maps.Point.
  * @return {Object} The newly created point.
  */
	this.fromLatLngToPoint = function (latLng, opt_point) {
		var point = opt_point || new google.maps.Point(0, 0);
 
		point.x = this.pixelOrigin_.x + latLng.lng() *
   this.pixelsPerLonDegree_ * 2;
		point.y = this.pixelOrigin_.y - latLng.lat() *
   this.pixelsPerLonDegree_ * 2;
  
		return point;
	}

/**
	 * Converts a google.maps.Point to google.maps.LatLng.
  *
  * @method fromLatLngToPoint
  * @param {Object} point The Point object to convert.
  * @return {Object} The newly created LatLng.
  */
	this.fromPointToLatLng = function (point) {
		var lng = (point.x - this.pixelOrigin_.x) /
   this.pixelsPerLonDegree_ / 2;
		var lat = (-point.y + this.pixelOrigin_.y) /
   this.pixelsPerLonDegree_ / 2;
  
		return new google.maps.LatLng(lat, lng, true);
	}
};
/**
* Simple class for providing a google.maps.ImageMapType based on the provided
* zoom limitations and function for providing tiles.
* @class SanMapType
* @constructor
*/
function SanMapType(minZoom, maxZoom, getTileUrl, tileSize) {
/**
  * Creates an instance of google.maps.ImageMapType based on the provided
  * zoom limitations and function for providing tiles.
  *
  * @method getImageMapType
  * @param {Boolean} repeating Whether the map should repeat horizontally.
  * @return {Object} The newly created ImageMapType.
  */
	this.getImageMapType = function (repeating) {
  /* Default tileSize to 512.
   */
  tileSize = tileSize || 512;
 
		return new google.maps.ImageMapType({
			getTileUrl: function (coord, zoom) {
				var x = coord.x,
	 y = coord.y,
	 max = 1 << zoom;
	/* If not repeating and x is outside of the range -or- y is
	 * outside of the range, return a clear tile. This can be
	 * provided by getTileUrl, using the tile coordinates (-1, -1).
	 */
				if (y < 0 || y >= max ||
	 (repeating !== true && (x < 0 || x >= max))) {
					return getTileUrl(zoom, -1, -1);
				}
   
	/*
	 * Return the provided tile. Make sure x is within the
	 * range 0 - max.
	 */
				return getTileUrl(zoom, (((x % max) + max) % max), y);
			},
			tileSize: new google.maps.Size(tileSize, tileSize),
			maxZoom: maxZoom,
			minZoom: minZoom
		});
	}
};
/* Define a number of SanMap methods.
*/
function SanMap(){ }
/**
* Creates an instance of google.maps.Map with the provided map types.
*
* @method createMap
* @param {Object} canvas The element to draw the map on.
* @param {Number} mapTypes The map types available in the map control.
* @param {Number} zoom The initial zoom level.
* @param {Object} center The intial center point to focus on.
* @param {Boolean} repeating Whether the map should repeat horizontally.
* @param {String} defaultMap The default map type.
* @return {Object} The newly created Map.
*/
SanMap.createMap = function(canvas, mapTypes, zoom, center, repeating,
defaultMap) {
/* If no mapTypes are parsed, return null and display a warning
  */
	if (mapTypes === undefined || mapTypes.length == 0) {
  console.warn("SanMap: No map types were parsed with SanMap.createMap.");
		return null;
	}
/* Create the map
  */
	var map = new google.maps.Map(canvas,  {
		zoom: zoom || 2,
		center: center || SanMap.getLatLngFromPos(0, 0),
		streetViewControl: false,
		mapTypeControlOptions: {
			mapTypeIds: Object.keys(mapTypes)
		}
	});
/* Add every map type to the map.
  */
	for (var key in mapTypes) {
		if (mapTypes.hasOwnProperty(key)) {
			var type = mapTypes[key].getImageMapType(repeating || false);
			type.name = type.alt = key;
   type.projection = new SanMapProjection(type.tileSize.width);
			map.mapTypes.set(key, type);
		}
	}
/* Set the default map type.
  */
	map.setMapTypeId(defaultMap || Object.keys(mapTypes)[0]);
/* If not repeating, bound the viewable area.
  */
	if (!repeating) {
		bounds = new google.maps.LatLngBounds(new google.maps.LatLng(-90,-90),
   new google.maps.LatLng(90,90));
  /* When the center changes, check if the new center is within the bounds
   * of the map. If not, move the center to within these bounds.
   */
		google.maps.event.addListener(map, 'center_changed', function () {
			if (bounds.contains(map.getCenter()))
				return;
			var lng = map.getCenter().lng(),
				lat = map.getCenter().lat();
			if (lng < bounds.getSouthWest().lng())
	lng = bounds.getSouthWest().lng();
   
			if (lng > bounds.getNorthEast().lng())
	lng = bounds.getNorthEast().lng();
   
			if (lat < bounds.getSouthWest().lat())
	lat = bounds.getSouthWest().lat();
   
			if (lat > bounds.getNorthEast().lat())
	lat = bounds.getNorthEast().lat();
   
			map.setCenter(new google.maps.LatLng(lat, lng));
		});
	}

return map;
};
/* Conversion properties. */
SanMap.width = 6000;
SanMap.height = 6000;
SanMap.ox = 0;
SanMap.oy = 0;
/**
* Set the properties of the map coordinate system.
*
* @method setMapSize
* @param {Number} width The width of the map.
* @param {Number} y The GTA:SA y-coordinate.
*/
SanMap.setMapSize = function (width, height, offsetx, offsety) {
	SanMap.width = width;
	SanMap.height = height;
	SanMap.ox = offsetx;
	SanMap.oy = offsety;
}
/**
* Converts a GTA:SA coordinates to an instance of google.maps.LatLng.
*
* @method getLatLngFromPos
* @param {Number} x The GTA:SA x-coordinate.
* @param {Number} y The GTA:SA y-coordinate.
* @return {Object} The newly created LatLng.
*/
SanMap.getLatLngFromPos = function (x, y) {
	return typeof(x) == "object"
  ? new google.maps.LatLng((x.y - SanMap.oy) / SanMap.height * 180, (x.x - SanMap.ox) / SanMap.width * 180)
  : new google.maps.LatLng((y - SanMap.oy) / SanMap.height * 180, (x - SanMap.ox) / SanMap.width * 180);
}
/**
* Converts an instance of google.maps.LatLng to a GTA:SA coordinates.
*
* @method getPosFromLatLng
* @param {Object} latLng The LatLng to convert..
* @return {Object} An Object containing the GTA:SA coordinates.
*/
SanMap.getPosFromLatLng = function (latLng) {
	return {x: latLng.lng() * SanMap.width / 180 + SanMap.ox, y: latLng.lat() * SanMap.height / 180 + SanMap.oy};
}


in index.html
am facut
	var zone = new google.maps.Polygon({
	paths: [
	SanMap.getLatLngFromPos(243.992538, -4368.940917),
	SanMap.getLatLngFromPos(258.406707, -4368.940917),
	SanMap.getLatLngFromPos(258.406707, -4104.655761),
	SanMap.getLatLngFromPos(243.992538, -4104.655761)
  ],
	strokeWeight: 0,
	fillColor: '#000000',
	fillOpacity: 1.0
  });
  zone.setMap(map);

acel Polygon, nu se vede. el ar trebui sa se vada in partea de jos, dar nu vede, daca il fac mai sus il pot vedea.
mai am acest marker:
var bankMarker = new google.maps.Marker({
  position: SanMap.getLatLngFromPos(1500, -1590),
  map: map
});

problema e ca ca se dubleaza in partea stanga cand micsorez harta.

Ma poate ajuta cineva?

Anunturi

Chirurgia spinală minim invazivă Chirurgia spinală minim invazivă

Chirurgia spinală minim invazivă oferă pacienților oportunitatea unui tratament eficient, permițându-le o recuperare ultra rapidă și nu în ultimul rând minimizând leziunile induse chirurgical.

Echipa noastră utilizează un spectru larg de tehnici minim invazive, din care enumerăm câteva: endoscopia cu variantele ei (transnazală, transtoracică, transmusculară, etc), microscopul operator, abordurile trans tubulare și nu în ultimul rând infiltrațiile la toate nivelurile coloanei vertebrale.

www.neurohope.ro

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Forumul Softpedia foloseste "cookies" pentru a imbunatati experienta utilizatorilor Accept
Pentru detalii si optiuni legate de cookies si datele personale, consultati Politica de utilizare cookies si Politica de confidentialitate