Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: view mode for 360-degree panorama photo #79

Merged
merged 12 commits into from Jul 14, 2018
Expand Up @@ -33,6 +33,9 @@ public abstract class MapillaryAbstractImage implements Comparable<MapillaryAbst
protected double ca;
/** Temporal position of the picture until it is uploaded. */
private LatLon tempLatLon;

private final boolean pano;

/**
* When the object is being dragged in the map, the temporal position is
* stored here.
Expand All @@ -54,13 +57,14 @@ public abstract class MapillaryAbstractImage implements Comparable<MapillaryAbst
* @param latLon The latitude and longitude where the picture was taken.
* @param ca The direction of the picture (0 means north).
*/
protected MapillaryAbstractImage(final LatLon latLon, final double ca) {
protected MapillaryAbstractImage(final LatLon latLon, final double ca, final boolean pano) {
this.latLon = latLon;
this.tempLatLon = this.latLon;
this.movingLatLon = this.latLon;
this.ca = ca;
this.tempCa = ca;
this.movingCa = ca;
this.pano = pano;
this.visible = true;
}

Expand All @@ -82,6 +86,10 @@ public long getCapturedAt() {
return this.capturedAt;
}

public boolean isPanorama() {
return this.pano;
}

/**
* Returns the date the picture was taken in DMY format.
*
Expand Down
Expand Up @@ -35,8 +35,8 @@ public class MapillaryImage extends MapillaryAbstractImage {
* @param latLon The latitude and longitude where it is positioned.
* @param ca The direction of the images in degrees, meaning 0 north.
*/
public MapillaryImage(final String key, final LatLon latLon, final double ca) {
super(latLon, ca);
public MapillaryImage(final String key, final LatLon latLon, final double ca, final boolean pano) {
super(latLon, ca, pano);
this.key = key;
}

Expand Down
Expand Up @@ -89,7 +89,7 @@ private static long parseTimestampElseCurrentTime(final String timestamp) {
}

public MapillaryImportedImage(final LatLon latLon, final double ca, final File file, final long capturedAt) {
super(latLon, ca);
super(latLon, ca, false);
this.file = file;
this.capturedAt = capturedAt;
}
Expand Down
Expand Up @@ -377,7 +377,11 @@ private void drawImageMarker(final Graphics2D g, final MapillaryAbstractImage im

// Paint direction indicator
g.setColor(directionC);
g.fillArc(p.x - CA_INDICATOR_RADIUS, p.y - CA_INDICATOR_RADIUS, 2 * CA_INDICATOR_RADIUS, 2 * CA_INDICATOR_RADIUS, (int) (90 - img.getMovingCa() - CA_INDICATOR_ANGLE / 2d), CA_INDICATOR_ANGLE);
if (img.isPanorama()) {
g.fillOval(p.x - CA_INDICATOR_RADIUS, p.y - CA_INDICATOR_RADIUS, 2 * CA_INDICATOR_RADIUS, 2 * CA_INDICATOR_RADIUS);
} else {
g.fillArc(p.x - CA_INDICATOR_RADIUS, p.y - CA_INDICATOR_RADIUS, 2 * CA_INDICATOR_RADIUS, 2 * CA_INDICATOR_RADIUS, (int) (90 - img.getMovingCa() - CA_INDICATOR_ANGLE / 2d), CA_INDICATOR_ANGLE);
}
// Paint image marker
g.setColor(markerC);
g.fillOval(p.x - IMG_MARKER_RADIUS, p.y - IMG_MARKER_RADIUS, 2 * IMG_MARKER_RADIUS, 2 * IMG_MARKER_RADIUS);
Expand Down