+ _selection.selectPhotoAndPoint(photoIndex, inPointIndex);
+ }
+
+ /**
+ * Select the given Photo and its point if any
+ * @param inPhotoIndex index of photo to select
+ */
+ public void selectPhoto(int inPhotoIndex)
+ {
+ if (_selection.getCurrentPhotoIndex() == inPhotoIndex) {return;}
+ // Photo is primary selection here, not as a result of a point selection
+ // Therefore the photo selection takes priority, deselecting point if necessary
+ // Find Photo object
+ Photo photo = _photoList.getPhoto(inPhotoIndex);
+ if (photo != null)
+ {
+ // Find point object and its index
+ int pointIndex = _track.getPointIndex(photo.getDataPoint());
+ // Check whether to deselect current point or not if photo not correlated
+ if (pointIndex < 0)
+ {
+ int currPointIndex = _selection.getCurrentPointIndex();
+ if (currPointIndex >= 0 && _track.getPoint(currPointIndex).getPhoto() == null)
+ {
+ pointIndex = currPointIndex; // Keep currently selected point
+ }
+ }
+ // give to selection object
+ _selection.selectPhotoAndPoint(inPhotoIndex, pointIndex);
+ }
+ else {
+ // no photo, just reset selection
+ DataPoint currPoint = getCurrentPoint();
+ if (currPoint != null && currPoint.getPhoto() == null) {
+ _selection.selectPhotoAndPoint(-1, _selection.getCurrentPointIndex()); // keep point
+ }
+ else {
+ _selection.selectPhotoAndPoint(-1, -1); // deselect point too
+ }
+ }
+ }
+
+ /**
+ * Extend the current selection to end at the given point, eg by shift-clicking
+ * @param inPointNum index of end point
+ */
+ public void extendSelection(int inPointNum)
+ {
+ // See whether to start selection from current range start or current point
+ int rangeStart = _selection.getStart();
+ if (rangeStart < 0 || _selection.getCurrentPointIndex() != _selection.getEnd()) {
+ rangeStart = _selection.getCurrentPointIndex();
+ }
+ selectPoint(inPointNum);
+ if (rangeStart < inPointNum) {
+ _selection.selectRange(rangeStart, inPointNum);
+ }