package org.helioviewer.jhv.data.datatype.event;

import java.util.List;

import org.helioviewer.jhv.base.astronomy.Position;
import org.helioviewer.jhv.base.math.Vec3;

public class JHVPositionInformation {

    private final float[] centralPoint;
    private final float[] boundBox;
    private final Position.Q earthPosition;

    public JHVPositionInformation(Vec3 _centralPoint, List<Vec3> _boundBox, List<Vec3> _boundBoxCC, Position.Q p) {
        centralPoint = new float[] { (float) _centralPoint.x, (float) _centralPoint.y, (float) _centralPoint.z };
        List<Vec3> tempboundBox = _boundBoxCC;
        if (_boundBoxCC == null || _boundBoxCC.isEmpty()) {
            tempboundBox = _boundBox;
        }
        if (tempboundBox != null) {
            int len = tempboundBox.size();
            boundBox = new float[3 * len];

            for (int i = 0; i < len; i++) {
                Vec3 pt = tempboundBox.get(i);
                boundBox[3 * i] = (float) pt.x;
                boundBox[3 * i + 1] = (float) pt.y;
                boundBox[3 * i + 2] = (float) pt.z;

            }
        } else {
            boundBox = new float[0];
        }
        earthPosition = p;
    }

    public Vec3 centralPoint() {
        return new Vec3(centralPoint[0], centralPoint[1], centralPoint[2]);
    }

    public float[] getBoundBox() {
        return boundBox;
    }

    public Position.Q getEarthPosition() {
        return earthPosition;
    }

}

@@ -220,23 +220,20 @@
 e final 
-float%5B%5D
+Vec3
  central
@@ -463,98 +463,23 @@
 t = 
-new float%5B%5D %7B (float) _centralPoint.x, (float) _centralPoint.y, (float) _centralPoint.z %7D;
+_centralPoint;%0A
 %0A   
@@ -1161,17 +1161,8 @@
 urn 
-new Vec3(
 cent
@@ -1173,46 +1173,8 @@
 oint
-%5B0%5D, centralPoint%5B1%5D, centralPoint%5B2%5D)
 ;%0A  

Fix crash