@evergis/sp-api
Advanced tools
Comparing version 0.4.18 to 0.4.19
@@ -66,3 +66,3 @@ import { SpatialProcessor } from "./SpatialProcessor"; | ||
ServiceSnappingProvider: ServiceSnappingProvider, | ||
version: "0.4.18", | ||
version: "0.4.19", | ||
releaseDate: "22.02.2019" | ||
@@ -69,0 +69,0 @@ }; |
@@ -34,2 +34,8 @@ import { PointFeature } from "@evergis/sgis/features/PointFeature"; | ||
}; | ||
function normalizeFeatureAttribute(attributes) { | ||
return attributes && attributes.reduce((acc, { Key, Value }) => { | ||
acc[Key] = Value; | ||
return acc; | ||
}, {}); | ||
} | ||
export const deserializeFeature = function (obj, crs) { | ||
@@ -39,4 +45,12 @@ let Constructor = geometryTypeMap[obj.geometryType]; | ||
error('Unknown geometry type'); | ||
return new Constructor(obj.geometry, { crs: crs, attributes: obj.attributes, sourceName: obj.sourceName, id: obj.id, symbol: defaultSymbols[obj.geometryType] }); | ||
const feature = new Constructor(obj.geometry, { | ||
crs, | ||
symbol: defaultSymbols[obj.geometryType] | ||
}); | ||
// feature constructor not set other attributes | ||
feature.attributes = normalizeFeatureAttribute(obj.attributes); | ||
feature.sourceName = obj.sourceName; | ||
feature.id = obj.id; | ||
return feature; | ||
}; | ||
//# sourceMappingURL=JsonSerializer.js.map |
{ | ||
"name": "@evergis/sp-api", | ||
"version": "0.4.18", | ||
"version": "0.4.19", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/compilation/everGis.js", |
@@ -67,3 +67,3 @@ import {SpatialProcessor} from "./SpatialProcessor"; | ||
ServiceSnappingProvider: ServiceSnappingProvider, | ||
version: "0.4.18", | ||
version: "0.4.19", | ||
releaseDate: "22.02.2019" | ||
@@ -70,0 +70,0 @@ }; |
@@ -34,2 +34,9 @@ import {PointFeature} from "@evergis/sgis/features/PointFeature"; | ||
function normalizeFeatureAttribute(attributes: { Key: string, Value: any }[]) { | ||
return attributes && attributes.reduce((acc, { Key, Value }) => { | ||
acc[Key] = Value; | ||
return acc; | ||
}, {}) | ||
} | ||
export const deserializeFeature = function(obj, crs) { | ||
@@ -39,3 +46,12 @@ let Constructor = geometryTypeMap[obj.geometryType]; | ||
return new Constructor(obj.geometry, { crs: crs, attributes: obj.attributes, sourceName: obj.sourceName, id: obj.id, symbol: defaultSymbols[obj.geometryType] }); | ||
const feature = new Constructor(obj.geometry, { | ||
crs, | ||
symbol: defaultSymbols[obj.geometryType] | ||
}); | ||
// feature constructor not set other attributes | ||
feature.attributes = normalizeFeatureAttribute(obj.attributes); | ||
feature.sourceName = obj.sourceName; | ||
feature.id = obj.id; | ||
return feature; | ||
}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1687013
18651