[OpenLayers-Users] Icon in my map using his natural size

pvrsouza pvrsouza at gmail.com
Tue Mar 25 03:32:46 PDT 2014


Hello everybody,

It's my first time here and I didn't find any topic like this one here. Then
here we go:

I'd like to show the Icon in my map using his natural size (width and height
original). How can i do it?

Now i have this code:

var contextResource = 
{
	getWidthIcon : function(feature){
		//i'm trying to get the current width
    },
    getHeightIcon : function(feature){
		//i'm trying to get the current height
		},
	
	getMarker : function(feature) 
     {
		// getting the icon with a rest reponse
		var lstIcons = feature.attributes.satellites;
		var sUrlIcon = "${sBaseURL}/AvlCore/rest/icon/resource/composed/"+
feature.attributes.orientation;
		for ( var n = 0; n < lstIcons.length; n++) {
			sUrlIcon = sUrlIcon + "/" + lstIcons[n];
		}
		return sUrlIcon;
	},
	getBackgroundMarker : function(feature)
	{
		///blah blah blah
	    }
				
		return urlBackground;
	},
	getVisibility : function(feature)
	{
		///blah blah blah
	},
	getLabel : function(feature)
	{
		///blah blah blah
	}
	
};

//This is my style builder
var resourceStyle = new OpenLayers.Style({
	externalGraphic : '<% out.print("${getMarker}"); %>',
	backgroundGraphic : '<% out.print("${getBackgroundMarker}"); %>',
	graphicOpacity: 1,
	graphicWidth: '<% out.print("${getWidthIcon}"); %>',
	graphicHeight:'<% out.print("${getHeightIcon}"); %>',
	label: '<% out.print("${getLabel}"); %>',
	fontFamily: "Arial",
	fontSize: '11px',
	labelYOffset: -30,
	labelOutlineColor: "white",
	labelOutlineWidth: 3,
	display: '<% out.print("${getVisibility}"); %>'
}, { context: contextResource });

If I put a fixed graphicWidth and graphicHeight works normally. I want to
display icons in different sizes. Is it possible using this strategy?

Thanks



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Icon-in-my-map-using-his-natural-size-tp5130893.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list