Home Reference Source

src/Gisplay/Feature.js

//Intermediate API

/**
 * This class represents a Feature. Each feature belongs to one Aesthetic element.
 * 
 * @exports Feature
 * @class Feature
 */
export class Feature {
    /**
     * Creates an instance of Feature.
     * @example 1-> {"id":0,"properties":{"f1":"Alabama","f2":"Autauga","f3":150,"_gisplayid":0},
                     "triangles":[{"itemSize":2,"numItems":417}],"borders":[{"itemSize":2,"numItems":141}],"points":[]}
     * @param {number} id - This Feature id.
     * @param {{fx: string, _gisplayid:number}} properties - Properties associated with this Feature.  
     * @param {{itemSize: number, numItems: number}} triangles - Number of triangles associated with this Feature. 
     * @param {{itemSize: number, numItems: number}} borders - Number of borders associated with this Feature.
     * @param {number[]} points - The points that belong to this Feature.
     * 
     * @memberOf Feature
     */
    constructor(id, properties, triangles, borders, points) {
        /**
         * This Feature id.
         * @type {number} 
         */
        this._id = id;
        /**
         * Properties associated with this Feature.  
         * @type {{fx: string, _gisplayid:number}}  
         */
        this._properties = properties;
        /**
         * Number of triangles associated with this Feature.
         * @type {{itemSize: number, numItems: number}}
         */
        this._triangles = triangles;
        /**
         * Number of borders associated with this Feature.
         * @type {{itemSize: number, numItems: number}}
         */
        this._borders = borders;
        /**
         * The points that belong to this Feature.
         * @type {number[]}
         */
        this._points = points;
        return this;// @Rui Remover this
    }
}
 /* if (window.count == 0) {
            var obj = {
                i: id,
                prs: properties,
                ts: triangles,
                bs: borders,
                pts: points,
            }
            window.count++;
            console.log(JSON.stringify(obj))
        }*/