OpenLayers OpenLayers

Changeset 1789

Show
Ignore:
Timestamp:
11/09/06 09:07:09 (2 years ago)
Author:
pgiraud
Message:

formatting and commenting

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/bertil/lib/OpenLayers/Feature/Geometry/Aggregate.js

    r1775 r1789  
    1 /* Copyright (c) 2006 CampToCamp SA, Bertil Chapuis, published under the BSD license. */ 
     1/* Copyright (c) 2006 CampToCamp SA, Bertil Chapuis, Pierre Giraud, 
     2 * published under the BSD license. */ 
    23 
     4/** 
     5 * @class 
     6 */ 
    37OpenLayers.Feature.Geometry.Aggregate = function() {} 
    48OpenLayers.Feature.Geometry.Aggregate.prototype = { 
    59 
     10    /** 
     11     * @returns the components of the geometry 
     12     */ 
    613    getComponents: function(){ 
    7         return this.components?this.components:null; 
     14        return this.components ? this.components : null; 
    815    }, 
    916 
    1017    addComponents: function(components){ 
    11    if(!(components instanceof Array)) { 
    12        components = [components]; 
    13    
     18        if(!(components instanceof Array)) { 
     19            components = [components]; 
     20       
    1421 
    15    if(this.components) { 
    16        this.components = this.components.concat(components); 
    17    } else { 
    18        this.components = [].concat(components); 
    19    
     22        if(this.components) { 
     23            this.components = this.components.concat(components); 
     24        } else { 
     25            this.components = [].concat(components); 
     26       
    2027    }, 
    2128 
    22     removeComponents: function(components){ 
    23     if(!(components instanceof Array)) 
    24     components = [components]; 
    25  
    26     for (var i = 0; i < components.length; i++) { 
    27         this.components = this.components.without(components[i]); 
    28     } 
     29    removeComponents: function(components) { 
     30        if(!(components instanceof Array)) { 
     31            components = [components]; 
     32        } 
     33         
     34        for (var i = 0; i < components.length; i++) { 
     35            this.components = this.components.without(components[i]); 
     36        } 
    2937    }, 
    3038 
    31     addSupportedComponents: function(classes){ 
    32         if(!(classes instanceof Array)) 
    33     classes = [classes]; 
    34  
    35         if(this.SupportedComponents) 
    36     this.SupportedComponents = this.SupportedComponents.concat(classes); 
    37         else 
    38     this.SupportedComponents = [].concat(classes); 
     39    addSupportedComponents: function(classes) { 
     40        if(!(classes instanceof Array)) { 
     41            classes = [classes]; 
     42        } 
     43         
     44        if(this.SupportedComponents) { 
     45            this.SupportedComponents = this.SupportedComponents.concat(classes); 
     46        } else { 
     47            this.SupportedComponents = [].concat(classes); 
    3948    }, 
    4049 
    41     removeSupportedComponents: function(classes)
    42     if(!(classes instanceof Array)) 
    43    classes = [classes]; 
    44  
    45    for (var i = 0; i < classes.length; i++) { 
    46        this.SupportedComponents = this.SupportedComponents.without(classes[i]); 
    47    
     50    removeSupportedComponents: function(classes)
     51        if(!(classes instanceof Array)) { 
     52            classes = [classes]; 
     53        } 
     54        for (var i = 0; i < classes.length; i++) { 
     55            this.SupportedComponents = this.SupportedComponents.without(classes[i]); 
     56       
    4857    }, 
    4958 
  • sandbox/bertil/lib/OpenLayers/Feature/Geometry/Curve.js

    r1777 r1789  
    1 /* Copyright (c) 2006 CampToCamp SA, Bertil Chapuis, published under the BSD license. */ 
     1/* Copyright (c) 2006 CampToCamp SA, Bertil Chapuis, Pierre Giraud, 
     2 * published under the BSD license. */ 
     3  
     4// @requires OpenLayers/Feature/Geometry.js 
     5/** 
     6 * @class 
     7 */ 
     8OpenLayers.Feature.Geometry.Curve = OpenLayers.Class.create(); 
     9OpenLayers.Feature.Geometry.Curve.prototype =  
     10    OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Curve.prototype, 
     11        OpenLayers.Feature.Geometry.prototype); 
     12OpenLayers.Feature.Geometry.Curve.prototype =  
     13    OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Curve.prototype, { 
    214 
    3 OpenLayers.Feature.Geometry.Curve = OpenLayers.Class.create(); 
    4 OpenLayers.Feature.Geometry.Curve.prototype = OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Curve.prototype, OpenLayers.Feature.Geometry.prototype); 
    5 OpenLayers.Feature.Geometry.Curve.prototype = OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Curve.prototype, { 
    615 
     16    /** 
     17    * @constructor 
     18    * 
     19    * @param {array} points 
     20    */ 
    721    initialize: function(points) { 
    822        OpenLayers.Feature.Geometry.prototype.initialize.apply(this, arguments); 
     
    1933    }, 
    2034     
     35    /** 
     36     * @returns the extent of the geometry 
     37     * @type OpenLayers.Bounds 
     38     */ 
    2139    getBoundingBox: function(){ 
    2240        if (this.path.length > 0) { 
    23         // compute the extent of the geometry 
    2441            var xmin, ymin, xmax, ymax = null; 
    2542            this.path.each(function(point) { 
     
    4360        }         
    4461    }, 
    45      
     62 
     63    /** 
     64     * Adds a point to geometry path at the given index (optional) 
     65     * or a the end of the path 
     66     * 
     67     * @param {OpenLayers.Feature.Geometry.Point} point 
     68     * @param {int} index 
     69     */     
    4670    addPoint: function(point, index) { 
    4771        if(point && point.CLASS_NAME == "OpenLayers.Feature.Geometry.Point"){ 
     
    5478    }, 
    5579     
     80    /** 
     81     * @param Point 
     82     */ 
    5683    removePoint: function(point){ 
    5784        this.path = this.path.without(point);