+
+
+ /**
+ * @return true if photo list contains correlated photos
+ */
+ public boolean hasCorrelatedPhotos()
+ {
+ int numPhotos = getNumPhotos();
+ boolean hasCorrelated = false;
+ // Loop over photos in list
+ for (int i=0; i<numPhotos && !hasCorrelated; i++)
+ {
+ if (getPhoto(i).getDataPoint() != null)
+ hasCorrelated = true;
+ }
+ return hasCorrelated;
+ }
+
+
+ /**
+ * Remove all correlated photos from the list
+ */
+ public void removeCorrelatedPhotos()
+ {
+ int numPhotos = getNumPhotos();
+ if (numPhotos > 0)
+ {
+ // Construct new list to copy into
+ ArrayList listCopy = new ArrayList();
+ // Loop over photos in list
+ for (int i=0; i<numPhotos; i++)
+ {
+ // Copy photo if it has no point
+ Photo photo = getPhoto(i);
+ if (photo != null)
+ {
+ if (photo.getDataPoint() == null)
+ listCopy.add(photo);
+ else
+ photo.resetCachedData();
+ }
+ }
+ // Switch reference to new list
+ _photos = listCopy;
+ }
+ }
+
+
+ /**
+ * @return clone of photo list contents
+ */
+ public PhotoList cloneList()
+ {
+ if (_photos == null) return this;
+ return new PhotoList((ArrayList) _photos.clone());
+ }
+
+
+ /**
+ * Restore contents from other PhotoList
+ * @param inOther PhotoList with cloned contents
+ */
+ public void restore(PhotoList inOther)
+ {
+ if (inOther.getNumPhotos() == 0)
+ {
+ // List is empty
+ _photos = null;
+ }
+ else
+ {
+ // Clear array and copy over from other one
+ _photos.clear();
+ _photos.addAll(inOther._photos);
+ }
+ }