All files / engine/Source/Scene/Model MappedPositions.js

91.66% Statements 11/12
100% Branches 0/0
80% Functions 4/5
91.66% Lines 11/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85                                                              7x 6x 5x       4x     3x 3x 3x 3x                 1x                 1x                 1x                            
import Check from "../../Core/Check.js";
 
/**
 * A collection of cartographic positions (and their bounding rectangle) that
 * have been computed from cartesian positions, for a specific ellipsoid.
 *
 * This is used in the <code>ModelPrimitiveImagery</code> class, and stores
 * the positions of the primitive, mapped to an ellipsoid that was used
 * on one of the imagery layers. This avoids recomputing the transform
 * of the primitive POSITION attribute values into ECEF, and the subsequent
 * conversion of these positions into cartographic positions.
 *
 * @private
 */
class MappedPositions {
  /**
   * Creates a new instance
   *
   * @param {Iterable<Cartographic>} cartographicPositions The positions
   * @param {number} numPositions The number of positions
   * @param {Rectangle} cartographicBoundingRectangle The bounding
   * rectangle of the positions
   * @param {Ellipsoid} ellipsoid The ellipsoid
   */
  constructor(
    cartographicPositions,
    numPositions,
    cartographicBoundingRectangle,
    ellipsoid,
  ) {
    //>>includeStart('debug', pragmas.debug);
    Check.defined("cartographicPositions", cartographicPositions);
    Check.typeOf.number.greaterThanOrEquals("numPositions", numPositions, 0);
    Check.defined(
      "cartographicBoundingRectangle",
      cartographicBoundingRectangle,
    );
    Check.defined("ellipsoid", ellipsoid);
    //>>includeEnd('debug');
 
    this._cartographicPositions = cartographicPositions;
    this._numPositions = numPositions;
    this._cartographicBoundingRectangle = cartographicBoundingRectangle;
    this._ellipsoid = ellipsoid;
  }
 
  /**
   * Returns the cartographic positions
   *
   * @returns {Iterable<Cartographic>} The positions
   */
  get cartographicPositions() {
    return this._cartographicPositions;
  }
 
  /**
   * Returns the number of positions
   *
   * @returns {number} The number of positions
   */
  get numPositions() {
    return this._numPositions;
  }
 
  /**
   * Returns the cartographic bounding rectangle
   *
   * @returns {Rectangle} The rectangle
   */
  get cartographicBoundingRectangle() {
    return this._cartographicBoundingRectangle;
  }
 
  /**
   * Returns the ellipsoid for which these positions have been created
   *
   * @returns {Ellipsoid} The ellipsoid
   */
  get ellipsoid() {
    return this._ellipsoid;
  }
}
 
export default MappedPositions;