package com.tsi.navi.util;

import android.content.Context;
import android.os.Build;

import androidx.annotation.RequiresApi;

import com.naver.maps.map.CameraPosition;

public class CameraInfo {

    private Context context;
    private int width;
    public double zoom;
    public double tilt;
    public double bearing;

    @RequiresApi(api = Build.VERSION_CODES.R)
    public CameraInfo(Context context) {
        this.context = context;
        this.zoom = 0.0D;
        this.tilt = 0.0D;
        this.bearing = 0.0D;
        this.width = context.getResources().getDisplayMetrics().widthPixels;
    }

    public boolean equals(CameraPosition cameraPosition) {
        //Log.e("CameraInfo", "CameraInfo.equals: " + this.width + ", " + this.context.getResources().getDisplayMetrics().widthPixels);
        if (this.zoom != cameraPosition.zoom ||
            this.tilt != cameraPosition.tilt ||
            this.bearing != cameraPosition.bearing ||
            this.width != this.context.getResources().getDisplayMetrics().widthPixels) {

            this.zoom = cameraPosition.zoom;
            this.tilt = cameraPosition.tilt;
            this.bearing = cameraPosition.bearing;
            this.width = this.context.getResources().getDisplayMetrics().widthPixels;

            //Log.e("CameraInfo", "CameraInfo.equals-OK: " + this.width + ", " + this.context.getResources().getDisplayMetrics().widthPixels);
            return false;
        }
        return true;
    }
}
