Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then((olStyle: OlParserStyleFct) => {
expect(olStyle).toBeDefined();
const scaleWithinFirst: number = scaleDenomLineCircle.rules[0].scaleDenominator.min;
const scaleWithinSecond: number = scaleDenomLineCircle.rules[1].scaleDenominator.min;
const scaleBeyond: number = scaleDenomLineCircle.rules[1].scaleDenominator.max;
const resolutionWithinFirst = MapUtil.getResolutionForScale(scaleWithinFirst, 'm');
const resolutionWithinSecond = MapUtil.getResolutionForScale(scaleWithinSecond, 'm');
const resolutionBeyond = MapUtil.getResolutionForScale(scaleBeyond, 'm');
const dummyFeat = new OlFeature();
const styleWithinFirst = olStyle(dummyFeat, resolutionWithinFirst);
const styleWithinSecond = olStyle(dummyFeat, resolutionWithinSecond);
const styleBeyond = olStyle(dummyFeat, resolutionBeyond);
expect(styleWithinFirst).toHaveLength(1);
expect(styleWithinSecond).toHaveLength(1);
expect(styleBeyond).toHaveLength(0);
const styleFirst: OlStyle = styleWithinFirst[0];
const expecFirst = scaleDenomLineCircle.rules[0].symbolizers[0] as LineSymbolizer;
const olStroke = styleFirst.getStroke();
expect(olStroke).toBeDefined();
expect(olStroke.getColor()).toEqual(expecFirst.color);
expect(olStroke.getWidth()).toBeCloseTo(expecFirst.width);
.then((olStyle: OlParserStyleFct) => {
expect(olStyle).toBeDefined();
const scaleWithinFirst: number = scaleDenomLineCircle.rules[0].scaleDenominator.min;
const scaleWithinSecond: number = scaleDenomLineCircle.rules[1].scaleDenominator.min;
const scaleBeyond: number = scaleDenomLineCircle.rules[1].scaleDenominator.max;
const resolutionWithinFirst = MapUtil.getResolutionForScale(scaleWithinFirst, 'm');
const resolutionWithinSecond = MapUtil.getResolutionForScale(scaleWithinSecond, 'm');
const resolutionBeyond = MapUtil.getResolutionForScale(scaleBeyond, 'm');
const dummyFeat = new OlFeature();
const styleWithinFirst = olStyle(dummyFeat, resolutionWithinFirst);
const styleWithinSecond = olStyle(dummyFeat, resolutionWithinSecond);
const styleBeyond = olStyle(dummyFeat, resolutionBeyond);
expect(styleWithinFirst).toHaveLength(1);
expect(styleWithinSecond).toHaveLength(1);
expect(styleBeyond).toHaveLength(0);
const styleFirst: OlStyle = styleWithinFirst[0];
const expecFirst = scaleDenomLineCircle.rules[0].symbolizers[0] as LineSymbolizer;
const olStroke = styleFirst.getStroke();
expect(olStroke).toBeDefined();
.then((olStyle: OlParserStyleFct) => {
expect(olStyle).toBeDefined();
const scaleOnlyFirst: number = scaleDenomLineCircleOverlap.rules[0].scaleDenominator.min;
const scaleOverlap: number = scaleDenomLineCircleOverlap.rules[1].scaleDenominator.min;
const scaleOnlySecond: number = scaleDenomLineCircleOverlap.rules[1].scaleDenominator.max - 1;
const resolutionOnlyFirst = MapUtil.getResolutionForScale(scaleOnlyFirst, 'm');
const resolutionOverlap = MapUtil.getResolutionForScale(scaleOverlap, 'm');
const resolutionOnlySecond = MapUtil.getResolutionForScale(scaleOnlySecond, 'm');
const dummyFeat = new OlFeature();
const styleOnlyFirst = olStyle(dummyFeat, resolutionOnlyFirst);
const styleOverlap = olStyle(dummyFeat, resolutionOverlap);
const styleOnlySecond = olStyle(dummyFeat, resolutionOnlySecond);
expect(styleOnlyFirst).toHaveLength(1);
expect(styleOverlap).toHaveLength(2);
expect(styleOnlySecond).toHaveLength(1);
});
});
const defaultOnZoomLevelSelect = (selectedScale: string) => {
const mapView = props.map.getView();
const calculatedResolution = MapUtil.getResolutionForScale(
selectedScale, mapView.getProjection().getUnits()
);
mapView.setResolution(calculatedResolution);
};
.then((olStyle: OlParserStyleFct) => {
expect(olStyle).toBeDefined();
const withinScale: number = scaleDenomLine.rules[0].scaleDenominator.min;
const beyondScale: number = scaleDenomLine.rules[0].scaleDenominator.max;
const resolutionRuleOne = MapUtil.getResolutionForScale(withinScale, 'm');
const resolutionRuleTwo = MapUtil.getResolutionForScale(beyondScale, 'm');
const dummyFeat = new OlFeature();
const styleWithinScale = olStyle(dummyFeat, resolutionRuleOne);
const styleBeyondScale = olStyle(dummyFeat, resolutionRuleTwo);
expect(styleWithinScale).toHaveLength(1);
expect(styleBeyondScale).toHaveLength(0);
});
});
.then((olStyle: OlParserStyleFct) => {
expect(olStyle).toBeDefined();
const scaleOnlyFirst: number = scaleDenomLineCircleOverlap.rules[0].scaleDenominator.min;
const scaleOverlap: number = scaleDenomLineCircleOverlap.rules[1].scaleDenominator.min;
const scaleOnlySecond: number = scaleDenomLineCircleOverlap.rules[1].scaleDenominator.max - 1;
const resolutionOnlyFirst = MapUtil.getResolutionForScale(scaleOnlyFirst, 'm');
const resolutionOverlap = MapUtil.getResolutionForScale(scaleOverlap, 'm');
const resolutionOnlySecond = MapUtil.getResolutionForScale(scaleOnlySecond, 'm');
const dummyFeat = new OlFeature();
const styleOnlyFirst = olStyle(dummyFeat, resolutionOnlyFirst);
const styleOverlap = olStyle(dummyFeat, resolutionOverlap);
const styleOnlySecond = olStyle(dummyFeat, resolutionOnlySecond);
expect(styleOnlyFirst).toHaveLength(1);
expect(styleOverlap).toHaveLength(2);
expect(styleOnlySecond).toHaveLength(1);
});
});
.then((olStyle: OlParserStyleFct) => {
expect(olStyle).toBeDefined();
const scaleWithinFirst: number = scaleDenomLineCircle.rules[0].scaleDenominator.min;
const scaleWithinSecond: number = scaleDenomLineCircle.rules[1].scaleDenominator.min;
const scaleBeyond: number = scaleDenomLineCircle.rules[1].scaleDenominator.max;
const resolutionWithinFirst = MapUtil.getResolutionForScale(scaleWithinFirst, 'm');
const resolutionWithinSecond = MapUtil.getResolutionForScale(scaleWithinSecond, 'm');
const resolutionBeyond = MapUtil.getResolutionForScale(scaleBeyond, 'm');
const dummyFeat = new OlFeature();
const styleWithinFirst = olStyle(dummyFeat, resolutionWithinFirst);
const styleWithinSecond = olStyle(dummyFeat, resolutionWithinSecond);
const styleBeyond = olStyle(dummyFeat, resolutionBeyond);
expect(styleWithinFirst).toHaveLength(1);
expect(styleWithinSecond).toHaveLength(1);
expect(styleBeyond).toHaveLength(0);
const styleFirst: OlStyle = styleWithinFirst[0];
const expecFirst = scaleDenomLineCircle.rules[0].symbolizers[0] as LineSymbolizer;
const olStroke = styleFirst.getStroke();
expect(olStroke).toBeDefined();
expect(olStroke.getColor()).toEqual(expecFirst.color);
.then((olStyle: OlParserStyleFct) => {
expect(olStyle).toBeDefined();
const withinScale: number = scaleDenomLine.rules[0].scaleDenominator.min;
const beyondScale: number = scaleDenomLine.rules[0].scaleDenominator.max;
const resolutionRuleOne = MapUtil.getResolutionForScale(withinScale, 'm');
const resolutionRuleTwo = MapUtil.getResolutionForScale(beyondScale, 'm');
const dummyFeat = new OlFeature();
const styleWithinScale = olStyle(dummyFeat, resolutionRuleOne);
const styleBeyondScale = olStyle(dummyFeat, resolutionRuleTwo);
expect(styleWithinScale).toHaveLength(1);
expect(styleBeyondScale).toHaveLength(0);
});
});
.then((olStyle: OlParserStyleFct) => {
expect(olStyle).toBeDefined();
const scaleOnlyFirst: number = scaleDenomLineCircleOverlap.rules[0].scaleDenominator.min;
const scaleOverlap: number = scaleDenomLineCircleOverlap.rules[1].scaleDenominator.min;
const scaleOnlySecond: number = scaleDenomLineCircleOverlap.rules[1].scaleDenominator.max - 1;
const resolutionOnlyFirst = MapUtil.getResolutionForScale(scaleOnlyFirst, 'm');
const resolutionOverlap = MapUtil.getResolutionForScale(scaleOverlap, 'm');
const resolutionOnlySecond = MapUtil.getResolutionForScale(scaleOnlySecond, 'm');
const dummyFeat = new OlFeature();
const styleOnlyFirst = olStyle(dummyFeat, resolutionOnlyFirst);
const styleOverlap = olStyle(dummyFeat, resolutionOverlap);
const styleOnlySecond = olStyle(dummyFeat, resolutionOnlySecond);
expect(styleOnlyFirst).toHaveLength(1);
expect(styleOverlap).toHaveLength(2);
expect(styleOnlySecond).toHaveLength(1);
});
});