public var missingIconCls:Class;
+ /** Create this Feature from an XML subtree. */
public function Feature(mapFeatures:MapFeatures, _xml:XML) {
this.mapFeatures = mapFeatures;
this._xml = _xml;
// parse tags
for each(var tag:XML in definition.tag) {
- _tags.push( { k:String(tag.@k), v:String(tag.@v)} );
+ _tags.push( { k:String(tag.@k), v:String(tag.@v), vmatch:String(tag.@vmatch)} );
}
// parse 'within'
var inputType:String = inputXML.@type;
var presenceStr:String = inputXML.@presence;
var sortOrderStr:String = inputXML.@priority;
+// _tags.push( { k:String(inputXML.@key) } ); /* add the key to tags so that e.g. addr:housenumber shows up on autocomplete */
var editor:EditorFactory = EditorFactory.createFactory(inputType, inputXML);
if ( editor != null ) {
editor.presence = Presence.getPresence(presenceStr);
}
[Bindable(event="nameChanged")]
- /** The human-readable name of the feature, or null if none. */
+ /** The human-readable name of the feature (@name), or null if none. */
public function get name():String {
if (_xml.attribute('name').length()>0) { return _xml.@name; }
return null;
}
[Bindable(event="imageChanged")]
- /** An icon for the feature. If none is defined, return default "missing icon". */
+ /** An icon for the feature (from icons[0]/@image). If none is defined, return default "missing icon". */
public function get image():ByteArray {
var icon:XMLList = _xml.icon;
var imageURL:String = null;
return makeHTMLIcon(icon, entity);
}
+ /** Convert the contents of the "icon" tag as an HTML string, with variable substitution. */
public static function makeHTMLIcon(icon:XMLList, entity:Entity):String {
if ( icon == null )
return "";
return txt;
}
+ /** Basic HTML escaping. */
public static function htmlEscape(str:String):String {
var newStr:String = str.replace(/&/g, "&");
newStr = newStr.replace(/</g, "<");