+ /**
+ * Add a List of Photos
+ * @param inList List containing Photo objects
+ * @return number of photos added
+ */
+ public int addPhotos(List inList)
+ {
+ // Firstly count number to add to make array
+ int numPhotosToAdd = 0;
+ if (inList != null && !inList.isEmpty())
+ {
+ for (int i=0; i<inList.size(); i++)
+ {
+ try
+ {
+ Photo photo = (Photo) inList.get(i);
+ if (photo != null && !_photoList.contains(photo))
+ {
+ numPhotosToAdd++;
+ }
+ }
+ catch (ClassCastException ce) {}
+ }
+ }
+ // If there are any photos to add, add them
+ if (numPhotosToAdd > 0)
+ {
+ DataPoint[] dataPoints = new DataPoint[numPhotosToAdd];
+ int pointNum = 0;
+ // Add each Photo in turn
+ for (int i=0; i<inList.size(); i++)
+ {
+ try
+ {
+ Photo photo = (Photo) inList.get(i);
+ if (photo != null && !_photoList.contains(photo))
+ {
+ _photoList.addPhoto(photo);
+ dataPoints[pointNum] = photo.getDataPoint();
+ pointNum++;
+ }
+ }
+ catch (ClassCastException ce) {}
+ }
+ _track.appendPoints(dataPoints);
+ }
+ return numPhotosToAdd;
+ }
+
+