bruce-cesium 0.1.7 → 0.1.9

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.
@@ -1,5 +1,5 @@
1
1
  import { BruceEvent, Cartes, Carto, Geometry, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, DelayQueue, Entity as Entity$1, EntityFilterGetter, BatchedDataGetter, ObjectUtils, Tileset, MenuItem, ProjectView, ProjectViewBookmark, ProjectViewTileSource, Camera } from 'bruce-models';
2
- import { Cartesian2, Cartographic, Math as Math$1, Viewer, ArcGisMapServerImageryProvider, ScreenSpaceEventType, Color, HeightReference, Cartesian3, Entity, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, HeadingPitchRange, OrthographicFrustum, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, createWorldTerrain, CesiumTerrainProvider, EllipsoidTerrainProvider, Matrix4, Cesium3DTileset, EllipsoidGeodesic } from 'cesium';
2
+ import { Cartesian2, Cartographic, Math as Math$1, Viewer, ArcGisMapServerImageryProvider, ScreenSpaceEventType, Color, HeightReference, Cartesian3, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, HeadingPitchRange, OrthographicFrustum, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, createWorldTerrain, CesiumTerrainProvider, EllipsoidTerrainProvider, Matrix4, Cesium3DTileset, EllipsoidGeodesic } from 'cesium';
3
3
 
4
4
  var TIME_LAG = 300;
5
5
  var POSITION_CHECK_TIMER = 950;
@@ -829,25 +829,60 @@ var EntityRenderEngine;
829
829
  function Render(params) {
830
830
  var entity = params.entity;
831
831
  var style = params.style;
832
- var bColor = style.color ? Calculator.GetValue(style.color, entity, params.tags) : null;
833
- var cColor = bColor ? colorToCColor(bColor) : Color.RED;
834
- var size = style.size ? Calculator.GetValue(style.size, entity, params.tags) : null;
835
- if (size == null) {
836
- size = 30;
832
+ var type = style.Type;
833
+ var cEntity = null;
834
+ if (type == Style.EPointType.Icon) {
835
+ var icon = Calculator.GetValue(style.iconUrl, entity, params.tags);
836
+ var iconUrl = null;
837
+ if (typeof icon == "string") {
838
+ iconUrl = icon;
839
+ }
840
+ if (!iconUrl && style.iconId) {
841
+ iconUrl = ClientFile.GetUrl(params.api, style.iconId);
842
+ }
843
+ if (iconUrl) {
844
+ var iconScale = +Calculator.GetValue(style.iconScale, entity, params.tags);
845
+ if (!iconScale && iconScale != 0) {
846
+ iconScale = 1;
847
+ }
848
+ if (iconScale > 0) {
849
+ cEntity = new Entity({
850
+ billboard: {
851
+ horizontalOrigin: HorizontalOrigin.CENTER,
852
+ verticalOrigin: VerticalOrigin.BOTTOM,
853
+ image: iconUrl,
854
+ heightReference: getHeightRef(style)
855
+ },
856
+ position: EntityUtils.GetPos(params.viewer, entity),
857
+ show: false
858
+ });
859
+ }
860
+ }
837
861
  }
838
- if (size <= 0) {
839
- return null;
862
+ if (type == Style.EPointType.Cylinder) ;
863
+ if (!cEntity) {
864
+ var bColor = style.color ? Calculator.GetValue(style.color, entity, params.tags) : null;
865
+ var cColor = bColor ? colorToCColor(bColor) : Color.RED;
866
+ var size = style.size ? Calculator.GetValue(style.size, entity, params.tags) : null;
867
+ if (size == null) {
868
+ size = 30;
869
+ }
870
+ if (size <= 0) {
871
+ return null;
872
+ }
873
+ cEntity = new Entity({
874
+ point: {
875
+ pixelSize: size,
876
+ color: cColor,
877
+ heightReference: getHeightRef(style)
878
+ },
879
+ position: EntityUtils.GetPos(params.viewer, entity),
880
+ show: false
881
+ });
882
+ }
883
+ if (cEntity) {
884
+ params.viewer.entities.add(cEntity);
840
885
  }
841
- var cEntity = new Entity({
842
- point: {
843
- pixelSize: size,
844
- color: cColor,
845
- heightReference: getHeightRef(style)
846
- },
847
- position: EntityUtils.GetPos(params.viewer, entity),
848
- show: false
849
- });
850
- params.viewer.entities.add(cEntity);
851
886
  return cEntity;
852
887
  }
853
888
  Point.Render = Render;
@@ -882,7 +917,8 @@ var EntityRenderEngine;
882
917
  entity: entity,
883
918
  style: pStyle,
884
919
  tags: tags,
885
- viewer: params.viewer
920
+ viewer: params.viewer,
921
+ api: api
886
922
  });
887
923
  cEntity._renderGroup = getRenderGroupId(zoomItem);
888
924
  cEntities[entity.Bruce.ID] = cEntity;
@@ -1692,18 +1728,22 @@ function select(visual) {
1692
1728
  cEntity.point._orgColor = cEntity.point.color;
1693
1729
  cEntity.point.color = color.clone();
1694
1730
  }
1695
- else if (cEntity.polyline) {
1731
+ if (cEntity.polyline) {
1696
1732
  cEntity.polyline._orgColor = cEntity.polyline.material;
1697
1733
  cEntity.polyline.material = color.clone();
1698
1734
  }
1699
- else if (cEntity.polygon) {
1735
+ if (cEntity.polygon) {
1700
1736
  cEntity.polygon._orgColor = cEntity.polygon.material;
1701
1737
  cEntity.polygon.material = color.clone();
1702
1738
  }
1703
- else if (cEntity.model) {
1739
+ if (cEntity.model) {
1704
1740
  cEntity.model._orgColor = cEntity.model.color;
1705
1741
  cEntity.model.color = color.clone();
1706
1742
  }
1743
+ if (cEntity.billboard) {
1744
+ cEntity.billboard._orgColor = cEntity.billboard.color;
1745
+ cEntity.billboard.color = color.clone();
1746
+ }
1707
1747
  }
1708
1748
  }
1709
1749
  else if (visual instanceof Primitive) ;
@@ -1721,15 +1761,18 @@ function deselect(visual) {
1721
1761
  if (cEntity.point) {
1722
1762
  cEntity.point.color = cEntity.point._orgColor;
1723
1763
  }
1724
- else if (cEntity.polyline) {
1764
+ if (cEntity.polyline) {
1725
1765
  cEntity.polyline.material = cEntity.polyline._orgColor;
1726
1766
  }
1727
- else if (cEntity.polygon) {
1767
+ if (cEntity.polygon) {
1728
1768
  cEntity.polygon.material = cEntity.polygon._orgColor;
1729
1769
  }
1730
- else if (cEntity.model) {
1770
+ if (cEntity.model) {
1731
1771
  cEntity.model.color = cEntity.model._orgColor;
1732
1772
  }
1773
+ if (cEntity.billboard) {
1774
+ cEntity.billboard.color = cEntity.billboard._orgColor;
1775
+ }
1733
1776
  }
1734
1777
  }
1735
1778
  else if (visual instanceof Primitive) ;