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

View File

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