routeStyle(feature) {
    const { routeId } = feature.get('route');
    const isSelected = this.selectedRouteIds.includes(routeId);
    const isHovered =
      this.hoverFeature &&
      (this.hoverFeature.get('route') || {}).isClickable &&
      (this.hoverFeature.get('route') || {}).routeId === routeId;

    const routeStyle = this.styleFunction(
      feature.getProperties(),
      isSelected,
      isHovered,
    );

    const styleArray = Object.values(
      this.getOlStylesFromObject(routeStyle, isSelected, isHovered, feature),
    ).flat();

    if (isSelected) {
      /* Set route start and end style on selected routes */
      const lineStart = feature.getGeometry().getFirstCoordinate();
      const lineEnd = feature.getGeometry().getLastCoordinate();

      /* Set circle icon if it is the first sequence of a route */
      if (feature.get('isStart')) {
        styleArray.push(RouteLayer.getCircleStyle(lineStart));
      }

      /* Set flag and circle icons if it is the final sequence of a route */
      if (feature.get('isEnd')) {
        styleArray.push(RouteLayer.getCircleStyle(lineEnd));
        styleArray.push(
          new Style({
            geometry: new Point(lineEnd),
            image: new IconStyle({
              src: finishFlag,
              anchor: [4.5, 3.5],
              anchorXUnits: 'pixels',
              anchorYUnits: 'pixels',
              anchorOrigin: 'bottom-left',
              imgSize: [24, 24],
              crossOrigin: 'anonymous', // To ensure IE detects it in olMap.forEachLayerAtPixel.
            }),
            zIndex: 1,
          }),
        );
      }
    }

    return styleArray;
  }
/**
   * Returns the style of the given feature.
   * @private
   * @param {ol.feature} feature {@link https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html ol/Feature}
   * @returns {ol.style} get the feature's style function.
   */
Returns the style of the given feature.
Returns the style of the given feature .
routeStyle(feature) {
    const { routeId } = feature.get('route');
    const isSelected = this.selectedRouteIds.includes(routeId);
    const isHovered =
      this.hoverFeature &&
      (this.hoverFeature.get('route') || {}).isClickable &&
      (this.hoverFeature.get('route') || {}).routeId === routeId;
    const routeStyle = this.styleFunction(
      feature.getProperties(),
      isSelected,
      isHovered,
    );
    const styleArray = Object.values(
      this.getOlStylesFromObject(routeStyle, isSelected, isHovered, feature),
    ).flat();
    if (isSelected) {
      const lineStart = feature.getGeometry().getFirstCoordinate();
      const lineEnd = feature.getGeometry().getLastCoordinate();
      if (feature.get('isStart')) {
        styleArray.push(RouteLayer.getCircleStyle(lineStart));
      }
      if (feature.get('isEnd')) {
        styleArray.push(RouteLayer.getCircleStyle(lineEnd));
        styleArray.push(
          new Style({
            geometry: new Point(lineEnd),
            image: new IconStyle({
              src: finishFlag,
              anchor: [4.5, 3.5],
              anchorXUnits: 'pixels',
              anchorYUnits: 'pixels',
              anchorOrigin: 'bottom-left',
              imgSize: [24, 24],
              crossOrigin: 'anonymous', 
            }),
            zIndex: 1,
          }),
        );
      }
    }
    return styleArray;
  }
routeStyle ( feature ) { const { routeId } = feature . get ( 'route' ) ; const isSelected = this . selectedRouteIds . includes ( routeId ) ; const isHovered = this . hoverFeature && ( this . hoverFeature . get ( 'route' ) || { } ) . isClickable && ( this . hoverFeature . get ( 'route' ) || { } ) . routeId === routeId ; const routeStyle = this . styleFunction ( feature . getProperties ( ) , isSelected , isHovered , ) ; const styleArray = Object . values ( this . getOlStylesFromObject ( routeStyle , isSelected , isHovered , feature ) , ) . flat ( ) ; if ( isSelected ) { const lineStart = feature . getGeometry ( ) . getFirstCoordinate ( ) ; const lineEnd = feature . getGeometry ( ) . getLastCoordinate ( ) ; if ( feature . get ( 'isStart' ) ) { styleArray . push ( RouteLayer . getCircleStyle ( lineStart ) ) ; } if ( feature . get ( 'isEnd' ) ) { styleArray . push ( RouteLayer . getCircleStyle ( lineEnd ) ) ; styleArray . push ( new Style ( { geometry : new Point ( lineEnd ) , image : new IconStyle ( { src : finishFlag , anchor : [ 4.5 , 3.5 ] , anchorXUnits : 'pixels' , anchorYUnits : 'pixels' , anchorOrigin : 'bottom-left' , imgSize : [ 24 , 24 ] , crossOrigin : 'anonymous' , } ) , zIndex : 1 , } ) , ) ; } } return styleArray ; }
Returns the style of the given feature.
Returns the style of the given feature .
/* Set route start and end style on selected routes */ /* Set circle icon if it is the first sequence of a route */ /* Set flag and circle icons if it is the final sequence of a route */ // To ensure IE detects it in olMap.forEachLayerAtPixel.