If I just try to add a property when initializing the Pushpin, Bing Maps will not take notice of that property due to the setOptions function on the Pushpin object. I don't really want to override the setOptions function - since I don't know the domino effect. So there are still two ways to solve the problem.
- Add a property on the Pushpin object - it is Javascript. Such as.
var pin = new Microsoft.Maps.Pushpin(OpenSMILWebPart.map.getCenter(), { height: 50, width: 50 });
and just add a property:
pin.customfield = 'customData';
- Add get and set method on the Pushpin object such as:
Microsoft.Maps.Pushpin.prototype.setAttributes = function () { this._attributes = arguments[0] }; Microsoft.Maps.Pushpin.prototype.getAttributes = function () { return this._attributes; };
and set properties such as:
pin.setAttributes({ customObject: 'some data' });
use get method to receive data:
pin.getAttributes();
Microsoft - feel free to add a Tag property to each geometry type giving the opportunity storing values in.