diff --git a/dist/olHelpers/SortedFeatures.d.ts b/dist/olHelpers/SortedFeatures.d.ts index 1c0a74becd46b47a7cfaf85e40195aef3bcf85fd..abe20f841bdbdafc64d2e625e11d5dcb2ea88e69 100644 --- a/dist/olHelpers/SortedFeatures.d.ts +++ b/dist/olHelpers/SortedFeatures.d.ts @@ -1,8 +1,9 @@ import Feature from 'ol/Feature'; -export default class SortedFeatures { +export declare class SortedFeatures { sortedFeatures: Feature[]; propertyName: string; _propertyType: string; constructor(features: Feature[], propertyName: string); getFeature(propertyValue: string, exactMatch?: boolean, sortedFeatures?: Feature[]): Feature; } +export default SortedFeatures; diff --git a/dist/olHelpers/SortedFeatures.js b/dist/olHelpers/SortedFeatures.js index 615efbc6264a9199e8a14afa2325047348367130..0614d1ef26b82668ae4f21a30d627a982d60914b 100644 --- a/dist/olHelpers/SortedFeatures.js +++ b/dist/olHelpers/SortedFeatures.js @@ -96,7 +96,7 @@ class SortedFeatures { return null; } } +exports.SortedFeatures = SortedFeatures; +nm.SortedFeatures = SortedFeatures; exports.default = SortedFeatures; -// nm.SortedFeatures = SortedFeatures; -// export default SortedFeatures; -//# sourceMappingURL=SortedFeatures.js.map \ No newline at end of file +//# sourceMappingURL=sortedFeatures.js.map \ No newline at end of file diff --git a/dist/olHelpers/SortedFeatures.js.map b/dist/olHelpers/SortedFeatures.js.map index ef603f034bcddb3a678482e725e7a4a64d0f0091..576a0c3dc674bc2f51b108c1771947978bac2503 100644 --- a/dist/olHelpers/SortedFeatures.js.map +++ b/dist/olHelpers/SortedFeatures.js.map @@ -1 +1 @@ -{"version":3,"file":"SortedFeatures.js","sourceRoot":"","sources":["../../src/olHelpers/SortedFeatures.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,6CAAsC;AAEtC,IAAI,EAAE,GAAG,iBAAO,CAAC,WAAW,CAAC,CAAC;AAE9B,MAAqB,cAAc;IAK/B,YAAY,QAAmB,EAAE,YAAoB;QACjD,kCAAkC;QAClC,oCAAoC;QAEpC,w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J;AAhGD,iCAgGC;AAED,sCAAsC;AACtC,iCAAiC","sourcesContent":["/**\r\n * Created by gavorhes on 12/23/2015.\r\n */\r\nimport provide from '../util/provide';\r\nimport Feature from 'ol/Feature';\r\nlet nm = provide('olHelpers');\r\n\r\nexport default class SortedFeatures {\r\n sortedFeatures: Feature[];\r\n propertyName: string;\r\n _propertyType: string;\r\n\r\n constructor(features: Feature[], propertyName: string) {\r\n // this.sortedFeatures = features;\r\n // this.propertyName = propertyName;\r\n\r\n // if (this.sortedFeatures.length > 0) {\r\n // this._propertyType = typeof this.sortedFeatures[0].getProperties()[this.propertyName];\r\n //\r\n // // let __this = this;\r\n // this.sortedFeatures.sort( (a: Feature, b: Feature) : number =>{\r\n // if (this._propertyType == 'number'){\r\n // let aMinusB = a.getProperties()[this.propertyName] - b.getProperties()[this.propertyName];\r\n // if (aMinusB == 0){\r\n // return 0;\r\n // } else {\r\n // return aMinusB > 0 ? 1 : -1;\r\n // }\r\n // } else if (this._propertyType == 'string'){\r\n // let propA = a.getProperties()[this.propertyName] || '';\r\n // let propB = b.getProperties()[this.propertyName] || '';\r\n // propA = propA.toString().trim();\r\n // propB = propB.toString().trim();\r\n //\r\n // if (propA == propB){\r\n // return 0;\r\n // } else {\r\n // return propA > propB ? 1 : 0;\r\n // }\r\n // }\r\n // });\r\n // }\r\n }\r\n\r\n // getFeature(propertyValue: number|string, exactMatch: boolean = false, sortedFeatures? :Array<Feature>): Feature {\r\n getFeature(propertyValue: string, exactMatch: boolean = false, sortedFeatures? :Feature[]): Feature {\r\n // if (typeof sortedFeatures == 'undefined'){\r\n // sortedFeatures = this.sortedFeatures;\r\n // }\r\n //\r\n //\r\n // if (sortedFeatures.length == 0){\r\n // return undefined;\r\n // }\r\n //\r\n // if (sortedFeatures.length == 1){\r\n // if (exactMatch){\r\n // if (sortedFeatures[0].getProperties()[this.propertyName] == propertyValue){\r\n // return sortedFeatures[0];\r\n // } else {\r\n // return undefined;\r\n // }\r\n // } else {\r\n // return sortedFeatures[0];\r\n // }\r\n // }\r\n //\r\n // let lowProp = sortedFeatures[0].getProperties()[this.propertyName];\r\n // let highProp = sortedFeatures[sortedFeatures.length - 1].getProperties()[this.propertyName];\r\n //\r\n // if (exactMatch){\r\n // if (lowProp == propertyValue){\r\n // return sortedFeatures[0];\r\n // } else if (propertyValue < lowProp){\r\n // return undefined;\r\n // } else if (highProp == propertyValue){\r\n // return sortedFeatures[sortedFeatures.length - 1];\r\n // } else if (propertyValue > highProp){\r\n // return undefined;\r\n // }\r\n // } else {\r\n // if (propertyValue <= lowProp){\r\n // return sortedFeatures[0];\r\n // } else if (propertyValue >= highProp){\r\n // return sortedFeatures[sortedFeatures.length - 1];\r\n // }\r\n // }\r\n //\r\n // let midIndex = Math.floor(sortedFeatures.length / 2);\r\n // let midFeature = sortedFeatures[midIndex];\r\n // let midProperty = midFeature.getProperties()[this.propertyName];\r\n //\r\n // if (midProperty === propertyValue){\r\n // return midFeature;\r\n // }\r\n //\r\n // if (propertyValue < midProperty){\r\n // return this.getFeature(propertyValue, exactMatch, sortedFeatures.slice(0, midIndex));\r\n // } else {\r\n // return this.getFeature(propertyValue, exactMatch, sortedFeatures.slice(midIndex));\r\n // }\r\n return null;\r\n }\r\n}\r\n\r\n// nm.SortedFeatures = SortedFeatures;\r\n// export default SortedFeatures;\r\n\r\n"]} \ No newline at end of file +{"version":3,"file":"sortedFeatures.js","sourceRoot":"","sources":["../../src/olHelpers/sortedFeatures.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,6CAAsC;AAEtC,IAAI,EAAE,GAAG,iBAAO,CAAC,WAAW,CAAC,CAAC;AAE9B,MAAa,cAAc;IAKvB,YAAY,QAAmB,EAAE,YAAoB;QACjD,kCAAkC;QAClC,oCAAoC;QAEpC,wCAAwC;QACxC,6FAA6F;QAC7F,EAAE;QACF,4BAA4B;QAC5B,sEAAsE;QACtE,+CAA+C;QAC/C,yGAAyG;QACzG,iCAAiC;QACjC,4BAA4B;QAC5B,uBAAuB;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ide from '../util/provide';\r\nimport Feature from 'ol/Feature';\r\nlet nm = provide('olHelpers');\r\n\r\nexport class SortedFeatures {\r\n sortedFeatures: Feature[];\r\n propertyName: string;\r\n _propertyType: string;\r\n\r\n constructor(features: Feature[], propertyName: string) {\r\n // this.sortedFeatures = features;\r\n // this.propertyName = propertyName;\r\n\r\n // if (this.sortedFeatures.length > 0) {\r\n // this._propertyType = typeof this.sortedFeatures[0].getProperties()[this.propertyName];\r\n //\r\n // // let __this = this;\r\n // this.sortedFeatures.sort( (a: Feature, b: Feature) : number =>{\r\n // if (this._propertyType == 'number'){\r\n // let aMinusB = a.getProperties()[this.propertyName] - b.getProperties()[this.propertyName];\r\n // if (aMinusB == 0){\r\n // return 0;\r\n // } else {\r\n // return aMinusB > 0 ? 1 : -1;\r\n // }\r\n // } else if (this._propertyType == 'string'){\r\n // let propA = a.getProperties()[this.propertyName] || '';\r\n // let propB = b.getProperties()[this.propertyName] || '';\r\n // propA = propA.toString().trim();\r\n // propB = propB.toString().trim();\r\n //\r\n // if (propA == propB){\r\n // return 0;\r\n // } else {\r\n // return propA > propB ? 1 : 0;\r\n // }\r\n // }\r\n // });\r\n // }\r\n }\r\n\r\n // getFeature(propertyValue: number|string, exactMatch: boolean = false, sortedFeatures? :Array<Feature>): Feature {\r\n getFeature(propertyValue: string, exactMatch: boolean = false, sortedFeatures? :Feature[]): Feature {\r\n // if (typeof sortedFeatures == 'undefined'){\r\n // sortedFeatures = this.sortedFeatures;\r\n // }\r\n //\r\n //\r\n // if (sortedFeatures.length == 0){\r\n // return undefined;\r\n // }\r\n //\r\n // if (sortedFeatures.length == 1){\r\n // if (exactMatch){\r\n // if (sortedFeatures[0].getProperties()[this.propertyName] == propertyValue){\r\n // return sortedFeatures[0];\r\n // } else {\r\n // return undefined;\r\n // }\r\n // } else {\r\n // return sortedFeatures[0];\r\n // }\r\n // }\r\n //\r\n // let lowProp = sortedFeatures[0].getProperties()[this.propertyName];\r\n // let highProp = sortedFeatures[sortedFeatures.length - 1].getProperties()[this.propertyName];\r\n //\r\n // if (exactMatch){\r\n // if (lowProp == propertyValue){\r\n // return sortedFeatures[0];\r\n // } else if (propertyValue < lowProp){\r\n // return undefined;\r\n // } else if (highProp == propertyValue){\r\n // return sortedFeatures[sortedFeatures.length - 1];\r\n // } else if (propertyValue > highProp){\r\n // return undefined;\r\n // }\r\n // } else {\r\n // if (propertyValue <= lowProp){\r\n // return sortedFeatures[0];\r\n // } else if (propertyValue >= highProp){\r\n // return sortedFeatures[sortedFeatures.length - 1];\r\n // }\r\n // }\r\n //\r\n // let midIndex = Math.floor(sortedFeatures.length / 2);\r\n // let midFeature = sortedFeatures[midIndex];\r\n // let midProperty = midFeature.getProperties()[this.propertyName];\r\n //\r\n // if (midProperty === propertyValue){\r\n // return midFeature;\r\n // }\r\n //\r\n // if (propertyValue < midProperty){\r\n // return this.getFeature(propertyValue, exactMatch, sortedFeatures.slice(0, midIndex));\r\n // } else {\r\n // return this.getFeature(propertyValue, exactMatch, sortedFeatures.slice(midIndex));\r\n // }\r\n return null;\r\n }\r\n}\r\n\r\nnm.SortedFeatures = SortedFeatures;\r\nexport default SortedFeatures;\r\n\r\n"]} \ No newline at end of file diff --git a/src/olHelpers/SortedFeatures.ts b/src/olHelpers/sortedFeatures.ts similarity index 97% rename from src/olHelpers/SortedFeatures.ts rename to src/olHelpers/sortedFeatures.ts index 04c3d82fed60d513bd731ab0d8acd24f06ac419b..662fca9bdc5a188052fb60406b5d3cf0f4cef077 100644 --- a/src/olHelpers/SortedFeatures.ts +++ b/src/olHelpers/sortedFeatures.ts @@ -5,7 +5,7 @@ import provide from '../util/provide'; import Feature from 'ol/Feature'; let nm = provide('olHelpers'); -export default class SortedFeatures { +export class SortedFeatures { sortedFeatures: Feature[]; propertyName: string; _propertyType: string; @@ -103,6 +103,6 @@ export default class SortedFeatures { } } -// nm.SortedFeatures = SortedFeatures; -// export default SortedFeatures; +nm.SortedFeatures = SortedFeatures; +export default SortedFeatures;