riku
2025-09-11 307b17ef15c73a071912a262834f2a5f68e1fa87
src/model/Factor.js
@@ -51,6 +51,7 @@
  this.factorId;
  this.heights = []; //3d地图当前展示坐标点对应的高度数组
  this.colors = []; // 3d地图当前展示坐标点对应的颜色数组
  this.bottomColors = []; //最小值对应的图例色数组
  this.bottomColor; //最小值对应的图例色
  this.min = -1; // 当前显示的最小值
  this.max = -1; // 当前显示的最大值
@@ -60,21 +61,32 @@
  this.standardMax = -1; //监测因子类型对应的标准最大值
  this.legendType = Legend.S_TYPE; //图例模式
  // this.legendType = Legend.D_TYPE; //图例模式
  if (options != undefined) {
    this.datas = options.datas;
    this.heights = options.heights;
    this.min = options.min;
    this.max = options.max;
    this.originMin = options.originMin;
    this.originMax = options.originMax;
  if (typeof options === 'object') {
    for (const key in options) {
      if (Object.prototype.hasOwnProperty.call(options, key)) {
        const value = options[key];
        this[key] = value;
      }
    }
    this.factorName = options.factorName;
    this.factorId = options.factorId;
    this.colors = options.colors;
    this.bottomColor = options.bottomColor;
    this.standardMin = options.standardMin;
    this.standardMax = options.standardMax;
    // this.datas = options.datas;
    // this.heights = options.heights;
    // this.min = options.min;
    // this.max = options.max;
    // this.originMin = options.originMin;
    // this.originMax = options.originMax;
    // this.factorName = options.factorName;
    // this.factorId = options.factorId;
    // this.colors = options.colors;
    // this.bottomColors = options.bottomColors;
    // this.bottomColor = options.bottomColor;
    // this.standardMin = options.standardMin;
    // this.standardMax = options.standardMax;
    // this.legendType = options.legendType;
  }
}
@@ -125,12 +137,12 @@
    this.heights = [];
    this.colors = [];
    this.datas.forEach((d) => {
      var h = getFactorHeight(d.factorId, d.factorData, [this.min, this.max]);
      let h = getFactorHeight(d.factorId, d.factorData, [this.min, this.max]);
      if (d.factorData == -1) {
        h = -1;
      }
      this.heights.push(h);
      var c = Legend.getColor(
      const c = Legend.getColor(
        this.factorName,
        this.legendType,
        d.factorData,
@@ -138,6 +150,8 @@
        this.max
      );
      this.colors.push(c);
      const b = Legend.getPreviousColor(this.factorName, this.legendType, c);
      this.bottomColors.push(b);
      // this.heights.push(d.factorData)
    });
    this.bottomColor = Legend.getColor(
@@ -182,6 +196,7 @@
      originMax: this.originMax,
      factorName: this.factorName,
      colors: this.colors,
      bottomColors: this.bottomColors,
      bottomColor: this.bottomColor,
      standardMin: this.standardMin,
      standardMax: this.standardMax