@evergis/react 2.0.220 → 2.0.221

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,6 +27,7 @@ var _Symbol = require('@evergis/sgis/es/symbols/Symbol');
27
27
  var Poly$1 = require('@evergis/sgis/es/features/Poly');
28
28
  var Point = require('@evergis/sgis/es/symbols/point/Point');
29
29
  var PointFeature = require('@evergis/sgis/es/features/PointFeature');
30
+ var Arc = require('@evergis/sgis/es/renders/Arc');
30
31
  var Render = require('@evergis/sgis/es/renders/Render');
31
32
  var SvgRender = require('@evergis/sgis/es/painters/DomPainter/SvgRender');
32
33
  var EventHandler = require('@evergis/sgis/es/EventHandler');
@@ -1657,44 +1658,6 @@ const createLabelSymbol = props => {
1657
1658
  });
1658
1659
  };
1659
1660
 
1660
- function createShadowRender(position, _ref) {
1661
- let {
1662
- strokeWidth = 2,
1663
- shadowColor,
1664
- shadowSize,
1665
- size = 6
1666
- } = _ref;
1667
- const shadowDiameter = size + strokeWidth + shadowSize;
1668
- return new Poly.PolyRender(polygonCircleFromPoint(position, shadowDiameter), {
1669
- fillColor: 'transparent',
1670
- strokeColor: shadowColor,
1671
- strokeWidth: shadowSize,
1672
- enclosed: true
1673
- });
1674
- }
1675
- function getEditorPointRenderer(position, _ref2) {
1676
- let {
1677
- strokeColor,
1678
- strokeWidth,
1679
- shadowColor,
1680
- fillColor,
1681
- shadowSize,
1682
- size = 0
1683
- } = _ref2;
1684
- return [createShadowRender(position, {
1685
- strokeWidth,
1686
- strokeColor,
1687
- shadowSize,
1688
- shadowColor,
1689
- size
1690
- }), new Poly.PolyRender(polygonCircleFromPoint(position, size), {
1691
- fillColor,
1692
- strokeColor,
1693
- strokeWidth,
1694
- enclosed: true
1695
- })];
1696
- }
1697
-
1698
1661
  let ShadowedPointSymbol = /*#__PURE__*/function (_PointSymbol) {
1699
1662
  _inherits(ShadowedPointSymbol, _PointSymbol);
1700
1663
 
@@ -1715,64 +1678,101 @@ let ShadowedPointSymbol = /*#__PURE__*/function (_PointSymbol) {
1715
1678
  position
1716
1679
  } = feature.projectTo(crs);
1717
1680
  const pxPosition = [position[0] / resolution + (this.offset[0] || 0), -position[1] / resolution + (this.offset[1] || 0)];
1718
- const shadowRender = this.getShadow(pxPosition, feature);
1719
- const pointArc = this.getPoint(pxPosition, feature);
1681
+ const shadowRender = this.getShadow(pxPosition, feature, position);
1682
+ const pointArc = this.getPoint(pxPosition, feature, position);
1720
1683
  return shadowRender ? [shadowRender, pointArc] : [pointArc];
1721
1684
  }
1722
1685
  }, {
1723
1686
  key: "getShadow",
1724
- value: function getShadow(position, _feature) {
1725
- return ShadowedPointSymbol.getShadowArc(position, this);
1687
+ value: function getShadow(position, _feature, mapCoordinates) {
1688
+ return ShadowedPointSymbol.getShadowArc(position, this, mapCoordinates);
1726
1689
  }
1727
1690
  }, {
1728
1691
  key: "getPoint",
1729
- value: function getPoint(position, _feature) {
1730
- return ShadowedPointSymbol.getPointArc(position, this);
1692
+ value: function getPoint(position, _feature, mapCoordinates) {
1693
+ return ShadowedPointSymbol.getPointArc(position, this, mapCoordinates);
1731
1694
  }
1732
1695
  }], [{
1733
1696
  key: "getShadowArc",
1734
- value: function getShadowArc(position, _ref) {
1697
+ value: function getShadowArc(position, _ref, mapCoordinates) {
1735
1698
  let {
1736
1699
  strokeWidth = 2,
1737
1700
  shadowColor,
1738
1701
  shadowSize,
1739
1702
  size = 6
1740
1703
  } = _ref;
1741
- return new Poly.PolyRender(polygonCircleFromPoint(position, size + strokeWidth + shadowSize), {
1742
- fillColor: 'transparent',
1704
+ return new Arc.Arc(position, {
1705
+ fillColor: "transparent",
1743
1706
  strokeColor: shadowColor,
1744
1707
  strokeWidth: shadowSize,
1745
- enclosed: true
1708
+ radius: (size + strokeWidth + shadowSize) / 2,
1709
+ mapCoordinates
1746
1710
  });
1747
1711
  }
1748
1712
  }, {
1749
1713
  key: "getPointArc",
1750
- value: function getPointArc(position, _ref2) {
1714
+ value: function getPointArc(position, _ref2, mapCoordinates) {
1751
1715
  let {
1752
1716
  strokeWidth,
1753
1717
  fillColor,
1754
1718
  strokeColor,
1755
1719
  size = 6
1756
1720
  } = _ref2;
1757
- return new Poly.PolyRender(polygonCircleFromPoint(position, size), {
1721
+ return new Arc.Arc(position, {
1758
1722
  fillColor,
1759
1723
  strokeColor,
1760
1724
  strokeWidth,
1761
- enclosed: true
1725
+ radius: size / 2,
1726
+ mapCoordinates
1762
1727
  });
1763
1728
  }
1764
- }, {
1765
- key: "getArcs",
1766
- value: function getArcs(position, params) {
1767
- const shadowRender = ShadowedPointSymbol.getShadowArc(position, params);
1768
- const pointRender = ShadowedPointSymbol.getPointArc(position, params);
1769
- return shadowRender ? [shadowRender, pointRender] : [pointRender];
1770
- }
1771
1729
  }]);
1772
1730
 
1773
1731
  return ShadowedPointSymbol;
1774
1732
  }(Point.PointSymbol);
1775
1733
 
1734
+ const getSimplifiedPolygonCoordinates = function getSimplifiedPolygonCoordinates(feature, crs, tolerance) {
1735
+ if (tolerance === void 0) {
1736
+ tolerance = 1;
1737
+ }
1738
+
1739
+ const projected = feature.crs.equals(crs) ? feature.rings : feature.projectTo(crs).rings;
1740
+ return math.simplifyCoordinates(projected, tolerance);
1741
+ };
1742
+ function createShadowRender(position, _ref) {
1743
+ let {
1744
+ strokeWidth = 1,
1745
+ shadowColor,
1746
+ shadowSize,
1747
+ size = 3,
1748
+ mapCoordinates
1749
+ } = _ref;
1750
+ const shadowRadius = (size + strokeWidth + shadowSize) / 2;
1751
+ return new Arc.Arc(position, {
1752
+ fillColor: "transparent",
1753
+ strokeColor: shadowColor,
1754
+ strokeWidth: shadowSize,
1755
+ radius: shadowRadius,
1756
+ mapCoordinates
1757
+ });
1758
+ }
1759
+ function createPointRender(position, _ref2) {
1760
+ let {
1761
+ strokeColor,
1762
+ strokeWidth,
1763
+ fillColor,
1764
+ size = 3,
1765
+ mapCoordinates
1766
+ } = _ref2;
1767
+ const radius = size / 2;
1768
+ return new Arc.Arc(position, {
1769
+ fillColor,
1770
+ strokeColor,
1771
+ strokeWidth,
1772
+ radius,
1773
+ mapCoordinates
1774
+ });
1775
+ }
1776
1776
  let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
1777
1777
  _inherits(ShadowedPolySymbol, _PolylineSymbol);
1778
1778
 
@@ -1792,9 +1792,10 @@ let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
1792
1792
 
1793
1793
  const coordinates = _get(_getPrototypeOf(ShadowedPolySymbol.prototype), "getRenderedCoordinates", this).call(this, feature, resolution, crs);
1794
1794
 
1795
- const polyRender = this.getPolyRender(coordinates, feature);
1796
- const shadowRender = this.getShadow(coordinates, feature);
1797
- const vertexRenders = this.getVertexRenders(coordinates);
1795
+ const simplifiedFeatureCoordinates = getSimplifiedPolygonCoordinates(feature, crs);
1796
+ const polyRender = this.getPolyRender(coordinates, feature, simplifiedFeatureCoordinates);
1797
+ const shadowRender = this.getShadow(coordinates, feature, simplifiedFeatureCoordinates);
1798
+ const vertexRenders = this.getVertexRenders(coordinates, simplifiedFeatureCoordinates);
1798
1799
  let renders = [polyRender];
1799
1800
 
1800
1801
  if (shadowRender) {
@@ -1809,42 +1810,66 @@ let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
1809
1810
  }
1810
1811
  }, {
1811
1812
  key: "getShadow",
1812
- value: function getShadow(coordinates, _feature) {
1813
+ value: function getShadow(coordinates, _feature, mapCoordinates) {
1813
1814
  return new Poly.PolyRender(coordinates, {
1814
1815
  fillStyle: Poly.FillStyle.None,
1815
1816
  enclosed: this.enclose,
1816
1817
  strokeColor: this.shadowColor,
1817
1818
  strokeWidth: this.shadowSize,
1818
- lineDash: this.lineDash
1819
+ lineDash: this.lineDash,
1820
+ mapCoordinates
1819
1821
  });
1820
1822
  }
1821
1823
  }, {
1822
1824
  key: "getPolyRender",
1823
- value: function getPolyRender(coordinates, _feature) {
1825
+ value: function getPolyRender(coordinates, _feature, mapCoordinates) {
1824
1826
  return new Poly.PolyRender(coordinates, {
1825
1827
  fillStyle: this.enclose ? Poly.FillStyle.Color : Poly.FillStyle.None,
1826
1828
  enclosed: this.enclose,
1827
1829
  fillColor: this.fillColor,
1828
1830
  strokeColor: this.strokeColor,
1829
1831
  strokeWidth: this.strokeWidth,
1830
- lineDash: this.lineDash
1832
+ lineDash: this.lineDash,
1833
+ mapCoordinates
1831
1834
  });
1832
1835
  }
1833
1836
  }, {
1834
1837
  key: "getVertexRenders",
1835
- value: function getVertexRenders(coordinates) {
1838
+ value: function getVertexRenders(coordinates, mapCoordinates) {
1836
1839
  if (!this.showVertex) return;
1837
- const vertexCoordinates = coordinates.reduce((acc, curr) => {
1838
- return acc.concat(curr);
1839
- }, []);
1840
- return vertexCoordinates.map(coord => getEditorPointRenderer(coord, {
1841
- size: 6,
1842
- strokeWidth: 2,
1843
- shadowColor: this.shadowColor,
1844
- strokeColor: this.strokeColor,
1845
- shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
1846
- fillColor: '#ffffff'
1847
- })).reduce((acc, curr) => acc.concat(curr), []);
1840
+ const pointRenderers = [];
1841
+ const shadowRenderers = [];
1842
+
1843
+ for (let i = 0; i < coordinates.length; i++) {
1844
+ const ring = coordinates[i];
1845
+
1846
+ for (let j = 0; j < ring.length; j++) {
1847
+ const point = ring[j];
1848
+ const featurePoint = mapCoordinates[i][j];
1849
+ const shadowRender = createShadowRender(point, {
1850
+ size: 6,
1851
+ strokeWidth: 2,
1852
+ shadowColor: this.shadowColor,
1853
+ strokeColor: this.strokeColor,
1854
+ shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
1855
+ fillColor: 'transparent',
1856
+ mapCoordinates: featurePoint
1857
+ });
1858
+ const pointRender = createPointRender(point, {
1859
+ size: 6,
1860
+ strokeWidth: 2,
1861
+ shadowColor: this.shadowColor,
1862
+ strokeColor: this.strokeColor,
1863
+ shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
1864
+ fillColor: '#ffffff',
1865
+ mapCoordinates: featurePoint
1866
+ });
1867
+ shadowRenderers.push(shadowRender);
1868
+ pointRenderers.push(pointRender);
1869
+ }
1870
+ }
1871
+
1872
+ return [...pointRenderers, ...shadowRenderers];
1848
1873
  }
1849
1874
  }]);
1850
1875
 
@@ -1897,15 +1922,15 @@ let SelectedPointSymbol = /*#__PURE__*/function (_ShadowedPointSymbol) {
1897
1922
 
1898
1923
  _createClass(SelectedPointSymbol, [{
1899
1924
  key: "getShadow",
1900
- value: function getShadow(position, feature) {
1925
+ value: function getShadow(position, feature, mapCoordinates) {
1901
1926
  if (feature.isSelected) {
1902
- return _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getShadow", this).call(this, position, feature);
1927
+ return _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getShadow", this).call(this, position, feature, mapCoordinates);
1903
1928
  }
1904
1929
  }
1905
1930
  }, {
1906
1931
  key: "getPoint",
1907
- value: function getPoint(position, feature) {
1908
- const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
1932
+ value: function getPoint(position, feature, mapCoordinates) {
1933
+ const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature, mapCoordinates);
1909
1934
 
1910
1935
  if (feature.isSelected) {
1911
1936
  pointRender.strokeColor = this.selectedStrokeColor;
@@ -1933,15 +1958,15 @@ let SelectedPolySymbol = /*#__PURE__*/function (_ShadowedPolySymbol) {
1933
1958
 
1934
1959
  _createClass(SelectedPolySymbol, [{
1935
1960
  key: "getShadow",
1936
- value: function getShadow(coordinates, feature) {
1961
+ value: function getShadow(coordinates, feature, mapCoordinates) {
1937
1962
  if (feature.isSelected) {
1938
- return _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getShadow", this).call(this, coordinates, feature);
1963
+ return _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getShadow", this).call(this, coordinates, feature, mapCoordinates);
1939
1964
  }
1940
1965
  }
1941
1966
  }, {
1942
1967
  key: "getPolyRender",
1943
- value: function getPolyRender(coordinates, feature) {
1944
- const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
1968
+ value: function getPolyRender(coordinates, feature, mapCoordinates) {
1969
+ const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature, mapCoordinates);
1945
1970
 
1946
1971
  if (feature.isSelected) {
1947
1972
  polyRender.fillColor = this.selectedFillColor;
@@ -7294,6 +7319,8 @@ exports.createHiddenCondition = createHiddenCondition;
7294
7319
  exports.createLabelSymbol = createLabelSymbol;
7295
7320
  exports.createLegendSymbol = createLegendSymbol;
7296
7321
  exports.createOtherHiddenCondition = createOtherHiddenCondition;
7322
+ exports.createPointRender = createPointRender;
7323
+ exports.createShadowRender = createShadowRender;
7297
7324
  exports.createSvgGradient = createSvgGradient;
7298
7325
  exports.createValueTitle = createValueTitle;
7299
7326
  exports.createValueTitleFromCondition = createValueTitleFromCondition;
@@ -7344,6 +7371,7 @@ exports.getRangeValues = getRangeValues$1;
7344
7371
  exports.getScale = getScale$1;
7345
7372
  exports.getServiceConfiguration = getServiceConfiguration;
7346
7373
  exports.getSignFromConditionPart = getSignFromConditionPart;
7374
+ exports.getSimplifiedPolygonCoordinates = getSimplifiedPolygonCoordinates;
7347
7375
  exports.getSymbolParameterInfo = getSymbolParameterInfo;
7348
7376
  exports.getSymbolRenders = getSymbolRenders;
7349
7377
  exports.getSymbolStrokeWidth = getSymbolStrokeWidth;