    001// License: GPL. For details, see LICENSE file.
    002package org.openstreetmap.josm.plugins.streetside;
    003
    004import org.openstreetmap.josm.data.coor.LatLon;
    005import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties;
    006
    007/**
    008 * @author renerr18
    009 *
    010 *
    011 */
    012public class StreetsideCubemap extends StreetsideAbstractImage {
    013
    014        /**
    015        * If two values for field cd differ by less than EPSILON both values are considered equal.
    016        */
    017        @SuppressWarnings("unused")
    018        private static final float EPSILON = 1e-5f;
    019
    020        /**
    021         * Main constructor of the class StreetsideCubemap
    022         *
    023         * @param quadId
    024         *            The Streetside id of the base frontal image of the cubemap
    025         *            in quternary
    026         * @param latLon
    027         *            The latitude and longitude where it is positioned.
    028         * @param he
    029         *            The direction of the images in degrees, meaning 0 north (camera
    030         *            direction is not yet supported in the Streetside plugin).
    031         */
    032   public StreetsideCubemap(String quadId, LatLon latLon, double he) {
    033           super(quadId, latLon, he);
    034         }
    035
    036        /**
    037         * Comparison method for the StreetsideCubemap object.
    038         *
    039         * @param image
    040         *            - a StreetsideAbstract image object
    041         *
    042         *            StreetsideCubemaps are considered equal if they are associated
    043         *            with the same image id - only one cubemap may be displayed at a
    044         *            time. If the image selection changes, the cubemap changes.
    045         *
    046         * @return result of the hashcode comparison.
    047         * @see org.openstreetmap.josm.plugins.streetside.StreetsideAbstractImage
    048         */
    049        @Override
    050        public int compareTo(StreetsideAbstractImage image) {
    051                if (image instanceof StreetsideImage) {
    052                        return id.compareTo(((StreetsideImage) image).getId());
    053                }
    054                return hashCode() - image.hashCode();
    055        }
    056
    057        /**
    058         * HashCode StreetsideCubemap object.
    059         *
    060         * @return int hashCode
    061         * @see org.openstreetmap.josm.plugins.streetside.StreetsideAbstractImage
    062         */
    063    @Override
    064        public int hashCode() {
    065                return id.hashCode();
    066        }
    067
    068        /**
    069         * stops ImageDisplay WalkAction (not currently supported by Streetside)
    070         *
    071         * @see org.openstreetmap.josm.plugins.streetside.actions.StreetsideWalkAction
    072         */
    073        @Override
    074        public void stopMoving() {
    075                super.stopMoving();
    076        }
    077
    078        /**
    079         * turns ImageDisplay WalkAction (not currently supported by Streetside)
    080         *
    081         * @param he - the direction the camera is facing (heading)
    082         *
    083         * @see org.openstreetmap.josm.plugins.streetside.actions.StreetsideWalkAction
    084         */
    085        @Override
    086        public void turn(double he) {
    087                super.turn(he);
    088        }
    089
    090        /**
    091         * @return the height of an assembled cubemap face for 16-tiled or 4-tiled imagery
    092         *
    093         * @see org.openstreetmap.josm.plugins.streetside.actions.StreetsideWalkAction
    094         */
    095        public int getHeight() {
    096                return StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get().booleanValue()?1016:510;
    097        }
    098
    099}