JavaScript WordPress Geo Mashup Mapstraction自定义标记

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaScript WordPress Geo Mashup Mapstraction自定义标记相关的知识,希望对你有一定的参考价值。

(function() {
	
	GeoMashup.addAction( 'colorIcon', function( properties, icon, color_name ) {
		// For single category icons use the Geo Mashup color icon names, 
		// but the 24x24 ones in the custom image directory
		icon.image = properties.custom_url_path + '/images/mm_20_' + color_name + '.png';
		icon.iconShadow = '';
		icon.iconSize = [ 24, 24 ];
		icon.iconAnchor = [ 12, 24 ];
		icon.iconInfoWindowAnchor = [ 12, 1 ];
	} );

	GeoMashup.addAction( 'objectIcon', function( properties, obj ) {

		if ( obj.terms.category.length == 0 ) {

			// When there are no categories - mm_20_uncategorised.png
			obj.icon.image = properties.custom_url_path + '/images/mm_20_uncategorised.png';
			obj.icon.iconShadow = '';
			obj.icon.iconSize = [ 24, 24 ];
			obj.icon.iconAnchor = [ 12, 24 ];
			obj.icon.iconInfoWindowAnchor = [ 12, 1 ];

		} else if ( obj.terms.category.length > 1 ) {

			// When there is more than one category - mm_20_mixed.png
			obj.icon.image = properties.custom_url_path + '/images/mm_20_mixed.png';
			obj.icon.iconShadow = '';
			obj.icon.iconSize = [ 24, 24 ];
			obj.icon.iconAnchor = [ 12, 24 ];
			obj.icon.iconInfoWindowAnchor = [ 12, 1 ];

		}
	} );

	GeoMashup.addAction( 'multiObjectMarker', function( properties, marker ) {
	
		// When there is more than one marker assigned to the same location - mm_20_plus.png
		marker.setIcon( properties.custom_url_path + '/images/mm_20_plus.png' );

	} );

	GeoMashup.addAction( 'singleMarkerOptions', function ( properties, options ) {

		// When the map is a single object map with just one marker
		options.icon.image = properties.custom_url_path + '/images/mm_20_uncategorised.png';
		options.icon.iconShadow = '';
		options.icon.iconSize = [ 24, 24 ];
		options.icon.iconAnchor = [ 12, 24 ];
		options.icon.iconInfoWindowAnchor = [ 12, 1 ];

	} );
	
	GeoMashup.addAction( 'glowMarkerIcon', function( properties, glow_options ) {
	    glow_options.icon = properties.custom_url_path + '/images/mm_20_glow.png';
	    glow_options.iconSize = [ 22, 30 ];
	    glow_options.iconAnchor = [ 11, 27 ];
	} );
}());

以上是关于JavaScript WordPress Geo Mashup Mapstraction自定义标记的主要内容,如果未能解决你的问题,请参考以下文章

PHP WordPress Geo Mashup - 自动添加地图到帖子的插件

WordPress Geo Mashup-自动向帖子添加地图的插件

php facetwp index geo my wordpress latitude / longitute

从WP-Geo-WordPress插件中删除CSSJS和/或仪表板小部件

javascript Yandex.Maps路由与geo

javascript GEO工具