change feature obj literal property names to match GeoJSON

This commit is contained in:
Mike Adair
2012-06-21 03:31:57 -04:00
parent 22bffd9d8b
commit f3ab95b051
2 changed files with 10 additions and 10 deletions

View File

@@ -18,9 +18,9 @@ ol.FeatureLike;
ol.feature = function(opt_arg){ ol.feature = function(opt_arg){
/** @type {Object|undefined} */ /** @type {Object|undefined} */
var attrs; var properties;
/** @type {ol.geom.Geometry|undefined} */ /** @type {ol.geom.Geometry|undefined} */
var geom; var geometry;
/** @type {string|undefined} */ /** @type {string|undefined} */
var type; var type;
@@ -29,8 +29,8 @@ ol.feature = function(opt_arg){
return opt_arg; return opt_arg;
} }
else if (goog.isObject(opt_arg)) { else if (goog.isObject(opt_arg)) {
attrs = opt_arg['attrs']; properties = opt_arg['properties'];
geom = opt_arg['geom']; geometry = opt_arg['geometry'];
type = opt_arg['type']; type = opt_arg['type'];
} }
else { else {
@@ -44,11 +44,11 @@ ol.feature = function(opt_arg){
//format.read(opt_arg); //format.read(opt_arg);
} else { } else {
if (goog.isDef(attrs)) { if (goog.isDef(properties)) {
feature.setAttributes(attrs); feature.setAttributes(properties);
} }
if (goog.isDef(geom)) { if (goog.isDef(geometry)) {
feature.setGeometry(geom); feature.setGeometry(geometry);
} }
} }
return feature; return feature;

View File

@@ -38,13 +38,13 @@ describe("ol.feature", function() {
it("should be easy to create a feature from object literals", function() { it("should be easy to create a feature from object literals", function() {
var feat = ol.feature({ var feat = ol.feature({
attrs: { properties: {
foo: 'bar', foo: 'bar',
two: 'deux', two: 'deux',
size: 3, size: 3,
flag: true flag: true
}, },
geom: ol.geom.point([56, 22]) geometry: ol.geom.point([56, 22])
}); });
var geom = feat.geometry(); var geom = feat.geometry();