use of org.eclipse.tracecompass.tmf.core.model.OutputElementStyle in project tracecompass by tracecompass.
the class CustomAnnotationProvider method getSubMarkerList.
private void getSubMarkerList(SplitMarker splitMarker, Annotation markerEvent, Map<String, Collection<@NonNull Annotation>> annotationMap, long startTime, long endTime, long minDuration, Long[] times) {
if (markerEvent.getTime() > endTime || markerEvent.getTime() + markerEvent.getDuration() < startTime) {
return;
}
long lower = splitMarker.getRange().lowerEndpoint();
long upper = splitMarker.getRange().upperEndpoint();
long segments = upper - lower + 1;
long start = markerEvent.getTime();
List<@NonNull Annotation> annotationList = new ArrayList<>();
for (int i = 0; i < segments; i++) {
long end = markerEvent.getTime() + Math.round((double) (i + 1) / segments * markerEvent.getDuration());
long duration = end - start;
long labelIndex = lower + i;
if (end >= startTime && duration > minDuration && splitMarker.getIndexRange().contains(labelIndex)) {
RGBAColor color = (labelIndex & 1) == 0 ? getColor(splitMarker) : getOddColor(getColor(splitMarker));
OutputElementStyle outputStyle = getOutputStyle(color);
Annotation subAnnotation = new Annotation(start, end - start, -1, String.format(splitMarker.getLabel(), labelIndex), outputStyle);
for (SubMarker subMarker : splitMarker.getSubMarkers()) {
getSubMarkerList(Objects.requireNonNull(subMarker), subAnnotation, annotationMap, startTime, endTime, minDuration, times);
}
annotationList.add(subAnnotation);
}
if (start >= endTime) {
break;
}
start = end;
}
populateMap(annotationMap, annotationList, Objects.requireNonNull(splitMarker.getName()));
}
Aggregations