SkEye Pro天象馆解码jet文件代码

SkEye解码messier_catalog.jet ngc_catalog.jet
ic_catalog.jet的代码,用的是NIO技术 Android NIO(Noblocking I/O非阻塞I/O)
重点是get方法。

  private final String dataFileName = getDataFileName();
  private float labelAlpha = 1.0F;
  private final String labelPrefix = getLabelPrefix();
  private final short[] mags = new short[this.NUM_OBJS];
  private final short[] majorType = new short[this.NUM_OBJS];
  private final short[] minorType = new short[this.NUM_OBJS];
  private final String namePrefix = getNamePrefix();
  private NumberedLabels numberedLabels;
  private final short[] posAngles = new short[this.NUM_OBJS];
  private final float[] positions = new float[this.NUM_OBJS * 2];
  private final String prefPrefix = getPrefPrefix();
  private final short[] sbr = new short[this.NUM_OBJS];
  private IntList selObjList = new IntList(this.NUM_OBJS);
  private final float[] sizeAxes = new float[this.NUM_OBJS * 2];
  private final float[] sizes = new float[this.NUM_OBJS];
  private FloatBuffer texCoordBuffer = null;
  private ShortBuffer texIndexBuffer = null;
  private int themeOrdinal = 0;
  private final boolean useCatalogFilters = true;
  private FloatBuffer vertexTexBuffer = null;
  
  public void init(SkEye paramSkEye)
    throws IOException
  {
    readData(paramSkEye.getAssets().openFd(this.dataFileName).createInputStream());
    this.labelAlpha = getCurrLabelAlpha(paramSkEye);
    setMarkerAlpha(getCurrMarkerAlpha(paramSkEye));
  }
  
  
  private void readData(FileInputStream paramFileInputStream)
  {
    Object localObject2;
    Object localObject1;
    try
    {
      localObject2 = paramFileInputStream.getChannel();
      localObject1 = ByteBuffer.allocate(this.NUM_OBJS * 30 + 2);
      ((FileChannel)localObject2).read((ByteBuffer)localObject1);
      ((ByteBuffer)localObject1).position(0);
      ((ByteBuffer)localObject1).order(ByteOrder.BIG_ENDIAN);
      i = ((ByteBuffer)localObject1).getShort();
      if (i != this.NUM_OBJS) {
        throw new IllegalFormatWidthException(i);
      }
    }
    catch (IOException paramFileInputStream)
    {
      paramFileInputStream.printStackTrace();
    }
    Vector3d localVector3d;
    int j;
    for (;;)
    {
      updateVecPositions();
      this.texCoordBuffer = null;
      this.vertexTexBuffer = null;
      this.vertexTexBuffer = ByteBuffer.allocateDirect(this.NUM_OBJS * 4 * 4 * 3).order(ByteOrder.nativeOrder()).asFloatBuffer();
      this.texCoordBuffer = ByteBuffer.allocateDirect(this.NUM_OBJS * 4 * 8).order(ByteOrder.nativeOrder()).asFloatBuffer();
      paramFileInputStream = new Vector3d();
      localObject1 = new Vector3d();
      localObject2 = new Vector3d();
      localVector3d = new Vector3d(0.0F, 1.0F, 0.0F);
      j = 0;
      if (j < this.NUM_OBJS) {
        break;
      }
      this.vertexTexBuffer.position(0);
      this.texCoordBuffer.position(0);
      return;
      localObject2 = ((ByteBuffer)localObject1).asFloatBuffer();
      ((FloatBuffer)localObject2).get(this.sizes);
      ((FloatBuffer)localObject2).get(this.sizeAxes);
      ((FloatBuffer)localObject2).get(this.positions);
      ((ByteBuffer)localObject1).position(((ByteBuffer)localObject1).position() + this.NUM_OBJS * 20);
      localObject1 = ((ByteBuffer)localObject1).asShortBuffer();
      ((ShortBuffer)localObject1).get(this.posAngles);
      ((ShortBuffer)localObject1).get(this.mags);
      ((ShortBuffer)localObject1).get(this.sbr);
      ((ShortBuffer)localObject1).get(this.majorType);
      ((ShortBuffer)localObject1).get(this.minorType);
      i = ((ShortBuffer)localObject1).remaining();
      if (i != 0) {
        throw new IllegalFormatWidthException(i);
      }
      paramFileInputStream.close();
    }
    double d1 = Math.toRadians(this.sizeAxes[(j * 2)] / 60.0F);
    double d2 = Math.toRadians(this.sizeAxes[(j * 2 + 1)] / 60.0F);
    float f1 = (float)(Math.sqrt(d1 * d1 + d2 * d2) / 2.0D);
    float f2 = (float)Math.acos(d2 / (2.0F * f1)) * 2.0F;
    float f3 = (float)((float)(3.141592653589793D - f2) / 2.0F - Math.toRadians(this.posAngles[j]));
    float[] arrayOfFloat = new float[4];
    arrayOfFloat[0] = f3;
    arrayOfFloat[1] = (f3 + f2);
    arrayOfFloat[2] = (3.1415927F + f3);
    arrayOfFloat[3] = ((float)(f2 - 3.141592653589793D) + f3);
    paramFileInputStream.setXYZ(this.vecPositions, j * 3);
    paramFileInputStream.normalise();
    paramFileInputStream.rotateAwayFrom(-1.0F * f1, localVector3d, (Vector3d)localObject1);
    int k = arrayOfFloat.length;
    int i = 0;
    label535:
    if (i >= k)
    {
      if (this.majorType[j] != 3) {
        break label613;
      }
      i = 0;
    }
    for (;;)
    {
      this.texCoordBuffer.put(texCoordinates, i, 8);
      j += 1;
      break;
      ((Vector3d)localObject1).rotate(arrayOfFloat[i], paramFileInputStream, (Vector3d)localObject2);
      putVectorToBuffer(this.vertexTexBuffer, (Vector3d)localObject2);
      i += 1;
      break label535;
      label613:
      if (this.majorType[j] == 2)
      {
        if (this.minorType[j] == 1) {
          i = 16;
        } else {
          i = 8;
        }
      }
      else {
        i = 24;
      }
    }
  }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值