Search in sources :

Example 31 with OutputElementStyle

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()));
}
Also used : OutputElementStyle(org.eclipse.tracecompass.tmf.core.model.OutputElementStyle) RGBAColor(org.eclipse.tracecompass.tmf.core.presentation.RGBAColor) SubMarker(org.eclipse.tracecompass.internal.tmf.core.markers.SubMarker) ArrayList(java.util.ArrayList) Annotation(org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.Annotation)

Aggregations

OutputElementStyle (org.eclipse.tracecompass.tmf.core.model.OutputElementStyle)31 RGBAColor (org.eclipse.tracecompass.tmf.core.presentation.RGBAColor)12 Nullable (org.eclipse.jdt.annotation.Nullable)11 ArrayList (java.util.ArrayList)9 HashMap (java.util.HashMap)9 NonNull (org.eclipse.jdt.annotation.NonNull)7 LinkedHashMap (java.util.LinkedHashMap)5 Point (org.eclipse.swt.graphics.Point)5 LongPoint (org.eclipse.tracecompass.internal.tmf.ui.widgets.timegraph.TimeGraphRender.LongPoint)5 Color (org.eclipse.swt.graphics.Color)4 TmfModelResponse (org.eclipse.tracecompass.tmf.core.response.TmfModelResponse)4 StyleManager (org.eclipse.tracecompass.tmf.ui.model.StyleManager)4 ITimeEvent (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent)4 Collection (java.util.Collection)3 Stack (java.util.Stack)3 RGB (org.eclipse.swt.graphics.RGB)3 Annotation (org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.Annotation)3 IOutputStyleProvider (org.eclipse.tracecompass.tmf.core.model.IOutputStyleProvider)3 ITimeGraphState (org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphState)3 StateItem (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.StateItem)3