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/GeoExt/lib/GeoExt/data/FeatureRecord.js @ 76

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

Ajout du répertoire web

  • Property svn:executable set to *
Line 
1/**
2 * Copyright (c) 2008-2010 The Open Source Geospatial Foundation
3 *
4 * Published under the BSD license.
5 * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text
6 * of the license.
7 */
8
9/** api: (define)
10 *  module = GeoExt.data
11 *  class = FeatureRecord
12 *  base_link = `Ext.data.Record <http://dev.sencha.com/deploy/dev/docs/?class=Ext.data.Record>`_
13 */
14Ext.namespace("GeoExt.data");
15
16/** api: constructor
17 *  .. class:: FeatureRecord
18 * 
19 *      A record that represents an ``OpenLayers.Feature.Vector``. This record
20 *      will always have at least the following fields:
21 *
22 *      * state ``String``
23 *      * fid ``String``
24 *
25 */
26GeoExt.data.FeatureRecord = Ext.data.Record.create([
27    {name: "feature"}, {name: "state"}, {name: "fid"}
28]);
29
30/** api: method[getFeature]
31 *  :return: ``OpenLayers.Feature.Vector``
32 *
33 *  Gets the feature for this record.
34 */
35GeoExt.data.FeatureRecord.prototype.getFeature = function() {
36    return this.get("feature");
37};
38
39/** api: method[setLayer]
40 *  :param layer: ``OpenLayers.Feature.Vector``
41 *
42 *  Sets the feature for this record.
43 */
44GeoExt.data.FeatureRecord.prototype.setFeature = function(feature) {
45    if (feature !== this.data.feature) {
46        this.dirty = true;
47        if (!this.modified) {
48            this.modified = {};
49        }
50        if (this.modified.feature === undefined) {
51            this.modified.feature = this.data.feature;
52        }
53        this.data.feature = feature;
54        if (!this.editing){
55            this.afterEdit();
56        }
57    }
58};
59
60/** api: classmethod[create]
61 *  :param o: ``Array`` Field definition as in ``Ext.data.Record.create``. Can
62 *      be omitted if no additional fields are required.
63 *  :return: ``Function`` A specialized :class:`GeoExt.data.FeatureRecord`
64 *      constructor.
65 * 
66 *  Creates a constructor for a :class:`GeoExt.data.FeatureRecord`, optionally
67 *  with additional fields.
68 */
69GeoExt.data.FeatureRecord.create = function(o) {
70    var f = Ext.extend(GeoExt.data.FeatureRecord, {});
71    var p = f.prototype;
72
73    p.fields = new Ext.util.MixedCollection(false, function(field) {
74        return field.name;
75    });
76
77    GeoExt.data.FeatureRecord.prototype.fields.each(function(f) {
78        p.fields.add(f);
79    });
80
81    if(o) {
82        for(var i = 0, len = o.length; i < len; i++){
83            p.fields.add(new Ext.data.Field(o[i]));
84        }
85    }
86
87    f.getField = function(name) {
88        return p.fields.get(name);
89    };
90
91    return f;
92};
Note: See TracBrowser for help on using the repository browser.