@@ -31,9 +31,6 @@ import { StartupDataStore } from '../../../../js/model/Startup/startup'
31
31
const defaultColor = '#3c6dd5'
32
32
const eyeOffset = new Cesium . Cartesian3 ( 0 , 0 , 0 )
33
33
const pixelOffset = new Cesium . Cartesian2 ( 0.0 , 0 )
34
- const rulerColor = new Cesium . Color ( 0.31 , 0.43 , 0.52 )
35
- const rulerPointColor = '#506f85'
36
- const rulerLineHeight = 0
37
34
Cesium . BingMapsApi . defaultKey = StartupDataStore . Configuration . getBingKey ( ) || 0
38
35
const imageryProviderTypes = CesiumImageryProviderTypes
39
36
function setupTerrainProvider ( viewer : any , terrainProvider : any ) {
@@ -192,7 +189,6 @@ export default function CesiumMap(
192
189
const drawHelper = new ( DrawHelper as any ) ( map )
193
190
map . drawHelper = drawHelper
194
191
const billboardCollection = setupBillboardCollection ( )
195
- const labelCollection = setupLabelCollection ( )
196
192
setupTooltip ( map , selectionInterface )
197
193
function updateCoordinatesTooltip ( position : any ) {
198
194
const cartesian = map . camera . pickEllipsoid (
@@ -225,74 +221,6 @@ export default function CesiumMap(
225
221
map . scene . primitives . add ( billboardCollection )
226
222
return billboardCollection
227
223
}
228
- function setupLabelCollection ( ) {
229
- const labelCollection = new Cesium . LabelCollection ( )
230
- map . scene . primitives . add ( labelCollection )
231
- return labelCollection
232
- }
233
- /*
234
- * Returns a visible label that is in the same location as the provided label (geometryInstance) if one exists.
235
- * If findSelected is true, the function will also check for hidden labels in the same location but are selected.
236
- */
237
- function findOverlappingLabel ( findSelected : any , geometry : any ) {
238
- return _ . find (
239
- mapModel . get ( 'labels' ) ,
240
- ( label ) =>
241
- label . position . x === geometry . position . x &&
242
- label . position . y === geometry . position . y &&
243
- ( ( findSelected && label . isSelected ) || label . show )
244
- )
245
- }
246
- /*
247
- Only shows one label if there are multiple labels in the same location.
248
-
249
- Show the label in the following importance:
250
- - it is selected and the existing label is not
251
- - there is no other label displayed at the same location
252
- - it is the label that was found by findOverlappingLabel
253
-
254
- Arguments are:
255
- - the label to show/hide
256
- - if the label is selected
257
- - if the search for overlapping label should include hidden selected labels
258
- */
259
- function showHideLabel ( { geometry, findSelected = false } : any ) {
260
- const isSelected = geometry . isSelected
261
- const labelWithSamePosition = findOverlappingLabel ( findSelected , geometry )
262
- if (
263
- isSelected &&
264
- labelWithSamePosition &&
265
- ! labelWithSamePosition . isSelected
266
- ) {
267
- labelWithSamePosition . show = false
268
- }
269
- const otherLabelNotSelected = labelWithSamePosition
270
- ? ! labelWithSamePosition . isSelected
271
- : true
272
- geometry . show =
273
- ( isSelected && otherLabelNotSelected ) ||
274
- ! labelWithSamePosition ||
275
- geometry . id === labelWithSamePosition . id
276
- }
277
- /*
278
- Shows a hidden label. Used when deleting a label that is shown.
279
- */
280
- function showHiddenLabel ( geometry : any ) {
281
- if ( ! geometry . show ) {
282
- return
283
- }
284
- const hiddenLabel = _ . find (
285
- mapModel . get ( 'labels' ) ,
286
- ( label ) =>
287
- label . position . x === geometry . position . x &&
288
- label . position . y === geometry . position . y &&
289
- label . id !== geometry . id &&
290
- ! label . show
291
- )
292
- if ( hiddenLabel ) {
293
- hiddenLabel . show = true
294
- }
295
- }
296
224
297
225
const minimumHeightAboveTerrain = 2
298
226
const exposedMethods = {
@@ -713,81 +641,6 @@ export default function CesiumMap(
713
641
}
714
642
} )
715
643
} ,
716
- /*
717
- * Draws a marker on the map designating a start/end point for the ruler measurement. The given
718
- * coordinates should be an object with 'lat' and 'lon' keys with degrees values. The given
719
- * marker label should be a single character or digit that is displayed on the map marker.
720
- */
721
- addRulerPoint ( coordinates : any ) {
722
- const { lat, lon } = coordinates
723
- // a point requires an altitude value so just use 0
724
- const point = [ lon , lat , 0 ]
725
- const options = {
726
- id : ' ' ,
727
- title : `Selected ruler coordinate` ,
728
- image : DrawingUtility . getCircle ( {
729
- fillColor : rulerPointColor ,
730
- icon : null ,
731
- } ) ,
732
- view : this ,
733
- }
734
- return this . addPoint ( point , options )
735
- } ,
736
- /*
737
- * Removes the given Billboard from the map.
738
- */
739
- removeRulerPoint ( billboardRef : any ) {
740
- billboardCollection . remove ( billboardRef )
741
- map . scene . requestRender ( )
742
- } ,
743
- /*
744
- * Draws a line on the map between the points in the given array of points.
745
- */
746
- addRulerLine ( point : any ) {
747
- let startingCoordinates = mapModel . get ( 'startingCoordinates' )
748
- // creates an array of Cartesian3 points
749
- // a PolylineGeometry allows the line to follow the curvature of the surface
750
- map . coordArray = [
751
- startingCoordinates [ 'lon' ] ,
752
- startingCoordinates [ 'lat' ] ,
753
- rulerLineHeight ,
754
- point [ 'lon' ] ,
755
- point [ 'lat' ] ,
756
- rulerLineHeight ,
757
- ]
758
- return map . entities . add ( {
759
- polyline : {
760
- positions : new Cesium . CallbackProperty ( function ( ) {
761
- return Cesium . Cartesian3 . fromDegreesArrayHeights ( map . coordArray )
762
- } , false ) ,
763
- width : 5 ,
764
- show : true ,
765
- material : rulerColor ,
766
- } ,
767
- } )
768
- } ,
769
- /*
770
- * Update the position of the ruler line
771
- */
772
- setRulerLine ( point : any ) {
773
- let startingCoordinates = mapModel . get ( 'startingCoordinates' )
774
- map . coordArray = [
775
- startingCoordinates [ 'lon' ] ,
776
- startingCoordinates [ 'lat' ] ,
777
- rulerLineHeight ,
778
- point [ 'lon' ] ,
779
- point [ 'lat' ] ,
780
- rulerLineHeight ,
781
- ]
782
- map . scene . requestRender ( )
783
- } ,
784
- /*
785
- * Removes the given polyline entity from the map.
786
- */
787
- removeRulerLine ( polyline : any ) {
788
- map . entities . remove ( polyline )
789
- map . scene . requestRender ( )
790
- } ,
791
644
/*
792
645
Adds a billboard point utilizing the passed in point and options.
793
646
Options are a view to relate to, and an id, and a color.
@@ -914,41 +767,6 @@ export default function CesiumMap(
914
767
map . scene . requestRender ( )
915
768
return billboardRef
916
769
} ,
917
- /*
918
- Adds a label utilizing the passed in point and options.
919
- Options are a view to an id and text.
920
- */
921
- addLabel ( point : any , options : any ) {
922
- const pointObject = convertPointCoordinate ( point )
923
- const cartographicPosition = Cesium . Cartographic . fromDegrees (
924
- pointObject . longitude ,
925
- pointObject . latitude ,
926
- pointObject . altitude
927
- )
928
- const cartesianPosition =
929
- map . scene . globe . ellipsoid . cartographicToCartesian ( cartographicPosition )
930
- // X, Y offset values for the label
931
- const offset = new Cesium . Cartesian2 ( 20 , - 15 )
932
- // Cesium measurement for determining how to render the size of the label based on zoom
933
- const scaleZoom = new Cesium . NearFarScalar ( 1.5e4 , 1.0 , 8.0e6 , 0.0 )
934
- // Cesium measurement for determining how to render the translucency of the label based on zoom
935
- const translucencyZoom = new Cesium . NearFarScalar ( 1.5e6 , 1.0 , 8.0e6 , 0.0 )
936
- const labelRef = labelCollection . add ( {
937
- text : options . text ,
938
- position : cartesianPosition ,
939
- id : options . id ,
940
- pixelOffset : offset ,
941
- scale : 1.0 ,
942
- scaleByDistance : scaleZoom ,
943
- translucencyByDistance : translucencyZoom ,
944
- fillColor : Cesium . Color . BLACK ,
945
- outlineColor : Cesium . Color . WHITE ,
946
- outlineWidth : 10 ,
947
- style : Cesium . LabelStyle . FILL_AND_OUTLINE ,
948
- } )
949
- mapModel . addLabel ( labelRef )
950
- return labelRef
951
- } ,
952
770
/*
953
771
Adds a polyline utilizing the passed in line and options.
954
772
Options are a view to relate to, and an id, and a color.
@@ -1136,11 +954,6 @@ export default function CesiumMap(
1136
954
0 ,
1137
955
options . isSelected ? - 1 : 0
1138
956
)
1139
- } else if ( geometry . constructor === Cesium . Label ) {
1140
- geometry . isSelected = options . isSelected
1141
- showHideLabel ( {
1142
- geometry,
1143
- } )
1144
957
} else if ( geometry . constructor === Cesium . PolylineCollection ) {
1145
958
geometry . _polylines . forEach ( ( polyline : any ) => {
1146
959
polyline . material = options . isSelected
@@ -1158,10 +971,7 @@ export default function CesiumMap(
1158
971
Updates a passed in geometry to be hidden
1159
972
*/
1160
973
hideGeometry ( geometry : any ) {
1161
- if (
1162
- geometry . constructor === Cesium . Billboard ||
1163
- geometry . constructor === Cesium . Label
1164
- ) {
974
+ if ( geometry . constructor === Cesium . Billboard ) {
1165
975
geometry . show = false
1166
976
} else if ( geometry . constructor === Cesium . PolylineCollection ) {
1167
977
geometry . _polylines . forEach ( ( polyline : any ) => {
@@ -1175,11 +985,6 @@ export default function CesiumMap(
1175
985
showGeometry ( geometry : any ) {
1176
986
if ( geometry . constructor === Cesium . Billboard ) {
1177
987
geometry . show = true
1178
- } else if ( geometry . constructor === Cesium . Label ) {
1179
- showHideLabel ( {
1180
- geometry,
1181
- findSelected : true ,
1182
- } )
1183
988
} else if ( geometry . constructor === Cesium . PolylineCollection ) {
1184
989
geometry . _polylines . forEach ( ( polyline : any ) => {
1185
990
polyline . show = true
@@ -1189,16 +994,11 @@ export default function CesiumMap(
1189
994
} ,
1190
995
removeGeometry ( geometry : any ) {
1191
996
billboardCollection . remove ( geometry )
1192
- labelCollection . remove ( geometry )
1193
997
map . scene . primitives . remove ( geometry )
1194
998
//unminified cesium chokes if you feed a geometry with id as an Array
1195
999
if ( geometry . constructor === Cesium . Entity ) {
1196
1000
map . entities . remove ( geometry )
1197
1001
}
1198
- if ( geometry . constructor === Cesium . Label ) {
1199
- mapModel . removeLabel ( geometry )
1200
- showHiddenLabel ( geometry )
1201
- }
1202
1002
map . scene . requestRender ( )
1203
1003
} ,
1204
1004
destroyShapes ( ) {
0 commit comments