Packagenet.systemeD.potlatch2.mapfeatures
Classpublic class MapFeatures
InheritanceMapFeatures Inheritance flash.events.EventDispatcher

All the information about all available map features that can be selected by the user or matched against entities in the map. The list of map features is populated from an XML file the first time the MapFeatures instance is accessed.

There are four "types" of features: point, line, area, relation. However, the autocomplete functions refer to these as node, way (line/area) and relation.



Public Properties
 PropertyDefined by
  categories : Array
[read-only] Array of every Category found in the map features file.
MapFeatures
  definition : XML
[read-only] The loaded source XML file itself.
MapFeatures
  features : Array
[read-only] All features.
MapFeatures
  pois : Array
[read-only] All Features of type "point".
MapFeatures
Public Methods
 MethodDefined by
  
Find the first Feature (template) that matches the given Entity (actual existing object in the map).
MapFeatures
  
getAutoCompleteKeys(type:String):Array
A list of all Keys for all features of the given type, sorted.
MapFeatures
  
getAutoCompleteValues(type:String, key:String):Array
Get all the possible values that could go with a given key and type.
MapFeatures
  
getCategoriesForType(type:String):Array
Categories that contain at least one Feature corresponding to a certain type, such as "area" or "point".
MapFeatures
  
[static] Instantiates MapFeatures by loading it if required.
MapFeatures
  
hasLoaded():Boolean
Indicates whether the XML file has finished being loaded.
MapFeatures
Protected Methods
 MethodDefined by
  
loadFeatures():void
Loads list of map features from XML file which it first retrieves.
MapFeatures
Property detail
categoriesproperty
categories:Array  [read-only]

Array of every Category found in the map features file.

This property can be used as the source for data binding.

Implementation
    public function get categories():Array
definitionproperty 
definition:XML  [read-only]

The loaded source XML file itself.

Implementation
    public function get definition():XML
featuresproperty 
features:Array  [read-only]

All features.

This property can be used as the source for data binding.

Implementation
    public function get features():Array
poisproperty 
pois:Array  [read-only]

All Features of type "point".

This property can be used as the source for data binding.

Implementation
    public function get pois():Array
Method detail
findMatchingFeature()method
public function findMatchingFeature(entity:Entity):Feature

Find the first Feature (template) that matches the given Entity (actual existing object in the map). This is done to provide appropriate editing controls that correspond to the selected Entity.

Parameters
entity:Entity — The Entity to try and match against.

Returns
Feature — The first suitable Feature, or null.
getAutoCompleteKeys()method 
public function getAutoCompleteKeys(type:String):Array

A list of all Keys for all features of the given type, sorted.

Parameters
type:String

Returns
Array

Example
getAutoCompleteKeys ("way")
Returns: [{name: "building"}, {name: "highway"}...]

getAutoCompleteValues()method 
public function getAutoCompleteValues(type:String, key:String):Array

Get all the possible values that could go with a given key and type. TODO: Include values previously entered by the user, but not existent in XML file.

Parameters
type:String
 
key:String

Returns
Array

Example
getAutoCompleteValues("way", "highway")
Returns: [{name: "motorway"}, {name: "residential"}...]

getCategoriesForType()method 
public function getCategoriesForType(type:String):Array

Categories that contain at least one Feature corresponding to a certain type, such as "area" or "point".

Parameters
type:String

Returns
Array — Filtered Array of Category objects, possibly empty. null if XML file is not yet processed.
getInstance()method 
public static function getInstance():MapFeatures

Instantiates MapFeatures by loading it if required.

Returns
MapFeatures
hasLoaded()method 
public function hasLoaded():Boolean

Indicates whether the XML file has finished being loaded.

Returns
Boolean
loadFeatures()method 
protected function loadFeatures():void

Loads list of map features from XML file which it first retrieves.