Bienvenue sur PostGIS.fr

Bienvenue sur PostGIS.fr , le site de la communauté des utilisateurs francophones de PostGIS.

PostGIS ajoute le support d'objets géographique à la base de données PostgreSQL. En effet, PostGIS "spatialise" le serverur PostgreSQL, ce qui permet de l'utiliser comme une base de données SIG.

Maintenu à jour, en fonction de nos disponibilités et des diverses sorties des outils que nous testons, nous vous proposons l'ensemble de nos travaux publiés en langue française.

source: trunk/workshop-routing-foss4g/web/OpenLayers/lib/OpenLayers/Geometry/Rectangle.js @ 76

Revision 76, 2.2 KB checked in by djay, 12 years ago (diff)

Ajout du répertoire web

  • Property svn:executable set to *
Line 
1/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
2 * full list of contributors). Published under the Clear BSD license. 
3 * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
4 * full text of the license. */
5
6/**
7 * @requires OpenLayers/Geometry.js
8 */
9
10/**
11 * Class: OpenLayers.Geometry.Rectangle
12 * This class is *not supported*, and probably isn't what you're looking for.
13 *     Instead, most users probably want something like:
14 *     (code)
15 *     var poly = new OpenLayers.Bounds(0,0,10,10).toGeometry();
16 *     (end)
17 *     This will create a rectangular Polygon geometry.
18 *
19 * Inherits:
20 *  - <OpenLayers.Geometry>
21 */
22
23OpenLayers.Geometry.Rectangle = OpenLayers.Class(OpenLayers.Geometry, {
24
25    /**
26     * Property: x
27     * {Float}
28     */
29    x: null,
30
31    /**
32     * Property: y
33     * {Float}
34     */
35    y: null,
36
37    /**
38     * Property: width
39     * {Float}
40     */
41    width: null,
42
43    /**
44     * Property: height
45     * {Float}
46     */
47    height: null,
48
49    /**
50     * Constructor: OpenLayers.Geometry.Rectangle
51     *
52     * Parameters:
53     * points - {Array(<OpenLayers.Geometry.Point>}
54     */
55    initialize: function(x, y, width, height) {
56        OpenLayers.Geometry.prototype.initialize.apply(this, arguments);
57       
58        this.x = x;
59        this.y = y;
60
61        this.width = width;
62        this.height = height;
63    },
64   
65    /**
66     * Method: calculateBounds
67     * Recalculate the bounds for the geometry.
68     */
69    calculateBounds: function() {
70        this.bounds = new OpenLayers.Bounds(this.x, this.y,
71                                            this.x + this.width, 
72                                            this.y + this.height);
73    },
74   
75   
76    /**
77     * APIMethod: getLength
78     *
79     * Returns:
80     * {Float} The length of the geometry
81     */
82    getLength: function() {
83        var length = (2 * this.width) + (2 * this.height);
84        return length;
85    },
86
87    /**
88     * APIMethod: getArea
89     *
90     * Returns:
91     * {Float} The area of the geometry
92     */
93    getArea: function() {
94        var area = this.width * this.height;
95        return area;
96    },   
97
98    CLASS_NAME: "OpenLayers.Geometry.Rectangle"
99});
Note: See TracBrowser for help on using the repository browser.