Skip to content

Commit

Permalink
Import DataSource 01 Restructuring - Should fix last build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
adube committed Oct 12, 2017
1 parent 5ba9e31 commit 2d9ac1e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
16 changes: 10 additions & 6 deletions src/datasource/datasource.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@ ngeo.datasource.DataSource = class {

/**
* The attributes of the data source.
*
* Note: `attributes` is not using the conventionnal getter/setter due
* to: See: https://github.com/google/closure-compiler/issues/1089
*
* @type {?Array.<ngeox.Attribute>}
* @private
* @export
*/
this.attributes_ = options.attributes || null;
this.attributes = options.attributes || null;

/**
* (Required) The data source id.
Expand Down Expand Up @@ -143,16 +147,16 @@ ngeo.datasource.DataSource = class {
* @return {?Array.<ngeox.Attribute>} Attributes
* @export
*/
get attributes() {
return this.attributes_;
getAttributes() {
return this.attributes;
}

/**
* @param {?Array.<ngeox.Attribute>} attributes Attributes
* @export
*/
set attributes(attributes) {
this.attributes_ = attributes;
setAttributes(attributes) {
this.attributes = attributes;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/datasource/datasourceshelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ ngeo.datasource.DataSourcesHelper = class {
const attributes = new ngeo.format.WFSAttribute().read(complexContent);

// Set the attributes in the data source
dataSource.attributes = attributes;
dataSource.setAttributes(attributes);

wfsDescribeFeatureTypeDefer.resolve(attributes);
});
Expand Down
17 changes: 9 additions & 8 deletions src/datasource/ogc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ goog.require('ol.format.WFS');
goog.require('ol.format.WMSGetFeatureInfo');


/**
* @implements {ngeox.datasource.OGC}
*/
ngeo.datasource.OGC = class extends ngeo.datasource.DataSource {

/**
Expand Down Expand Up @@ -422,19 +425,17 @@ ngeo.datasource.OGC = class extends ngeo.datasource.DataSource {
// =======================================

/**
* @return {?Array.<ngeox.Attribute>} Attributes
* @export
* @inheritDoc
*/
get attributes() {
getAttributes() {
return super.attributes;
}

/**
* @param {?Array.<ngeox.Attribute>} attributes Attributes
* @export
* @inheritDoc
*/
set attributes(attributes) {
super.attributes = attributes;
setAttributes(attributes) {
super.setAttributes(attributes);
this.updateGeometryNameFromAttributes_();
}

Expand Down Expand Up @@ -888,7 +889,7 @@ ngeo.datasource.OGC = class extends ngeo.datasource.DataSource {
* @private
*/
updateGeometryNameFromAttributes_() {
let geometryName = ngeo.datasource.DataSource.DEFAULT_GEOMETRY_NAME_;
let geometryName = ngeo.datasource.OGC.DEFAULT_GEOMETRY_NAME_;

if (this.attributes) {
for (const attribute of this.attributes) {
Expand Down
2 changes: 2 additions & 0 deletions src/services/querent.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ ngeo.Querent = class {
} else {
features = dataSource.wmsFormat.readFeatures(response.data);
}
} else {
features = []
}
}
const dataSourceId = dataSource.id;
Expand Down

0 comments on commit 2d9ac1e

Please sign in to comment.