Creating an object that stores properties only when needed in BaseObject class
This commit is contained in:
@@ -843,29 +843,32 @@ class GML3 extends GMLBase {
|
||||
context.serializers = {};
|
||||
context.serializers[featureNS] = {};
|
||||
}
|
||||
const properties = feature.getProperties();
|
||||
const keys = [];
|
||||
const values = [];
|
||||
for (const key in properties) {
|
||||
const value = properties[key];
|
||||
if (value !== null) {
|
||||
keys.push(key);
|
||||
values.push(value);
|
||||
if (
|
||||
key == geometryName ||
|
||||
typeof (/** @type {?} */ (value).getSimplifiedGeometry) === 'function'
|
||||
) {
|
||||
if (!(key in context.serializers[featureNS])) {
|
||||
context.serializers[featureNS][key] = makeChildAppender(
|
||||
this.writeGeometryElement,
|
||||
this
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (!(key in context.serializers[featureNS])) {
|
||||
context.serializers[featureNS][key] = makeChildAppender(
|
||||
writeStringTextNode
|
||||
);
|
||||
if (feature.hasProperties()) {
|
||||
const properties = feature.getProperties();
|
||||
for (const key in properties) {
|
||||
const value = properties[key];
|
||||
if (value !== null) {
|
||||
keys.push(key);
|
||||
values.push(value);
|
||||
if (
|
||||
key == geometryName ||
|
||||
typeof (/** @type {?} */ (value).getSimplifiedGeometry) ===
|
||||
'function'
|
||||
) {
|
||||
if (!(key in context.serializers[featureNS])) {
|
||||
context.serializers[featureNS][key] = makeChildAppender(
|
||||
this.writeGeometryElement,
|
||||
this
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (!(key in context.serializers[featureNS])) {
|
||||
context.serializers[featureNS][key] = makeChildAppender(
|
||||
writeStringTextNode
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user