use of org.csstudio.trends.databrowser3.model.AnnotationInfo in project org.csstudio.display.builder by kasemir.
the class WaveformView method updateAnnotation.
private void updateAnnotation(final Instant time, final double value) {
final List<AnnotationInfo> annotations = new ArrayList<AnnotationInfo>(model.getAnnotations());
// Initial annotation offset
Point2D offset = new Point2D(20, -20);
// If already in model, note its offset and remove
for (AnnotationInfo annotation : annotations) {
if (annotation.getText().equals(ANNOTATION_TEXT)) {
// Update offset to where user last placed it
offset = annotation.getOffset();
waveform_annotation = annotation;
annotations.remove(waveform_annotation);
break;
}
}
int i = 0;
int item_index = 0;
for (ModelItem item : model.getItems()) {
if (item == model_item) {
item_index = i;
break;
}
i++;
}
waveform_annotation = new AnnotationInfo(true, item_index, time, value, offset, ANNOTATION_TEXT);
annotations.add(waveform_annotation);
changing_annotations = true;
model.setAnnotations(annotations);
changing_annotations = false;
}
Aggregations