public VObject(AnnotationLayer aLayer, VID aVid, String aType, int aEquivalenceSet, Map<String, String> aFeatures, Map<String, String> aHoverFeatures) { layer = aLayer; vid = aVid; type = aType; features = aFeatures; setHoverFeatures(aHoverFeatures); equivalenceSet = aEquivalenceSet; }
private static String getColor(VObject aVObject, ColoringStrategy aColoringStrategy, String aLabelText) { String color; if (aVObject.getEquivalenceSet() >= 0) { // Every chain is supposed to have a different color color = ColoringStrategy.PALETTE_NORMAL_FILTERED[aVObject.getEquivalenceSet() % ColoringStrategy.PALETTE_NORMAL_FILTERED.length]; } else { color = aColoringStrategy.getColor(aVObject.getVid(), aLabelText); } return color; }
public void add(VComment aComment) { comments.put(aComment.getVid(), aComment); }
@Override public void onRender(TypeAdapter aAdapter, VDocument aResponse, Map<AnnotationFS, VSpan> annoToSpanIdx) { if (aAdapter.getLayer().isCrossSentence()) { return; } // Since we split spans into multiple ranges at sentence boundaries, we can simply check // if there are multiple ranges for a given span. This is cheaper than checking for // every annotation whether the begin/end offset is in the same sentence. for (Entry<AnnotationFS, VSpan> e : annoToSpanIdx.entrySet()) { if (e.getValue().getRanges().size() > 1) { aResponse.add(new VComment(new VID(e.getKey()), ERROR, "Crossing sentence bounardies is not permitted.")); } } }
@OnEvent public void onRenderAnnotations(RenderAnnotationsEvent aEvent) { if (selectedResult != null) { AnnotatorState state = aEvent.getState(); if (state.getWindowBeginOffset() <= selectedResult.getOffsetStart() && selectedResult.getOffsetEnd() <= state.getWindowEndOffset()) { aEvent.getVDocument() .add(new VTextMarker(VMarker.MATCH_FOCUS, selectedResult.getOffsetStart() - state.getWindowBeginOffset(), selectedResult.getOffsetEnd() - state.getWindowBeginOffset())); } } }
default void renderRequiredFeatureErrors(List<AnnotationFeature> aFeatures, FeatureStructure aFS, VDocument aResponse) { for (AnnotationFeature f : aFeatures) { if (isRequiredFeatureMissing(f, aFS)) { aResponse.add(new VComment(new VID(getAddr(aFS)), VCommentType.ERROR, "Required feature [" + f.getName() + "] not set.")); } } } }
public void add(VSpan aSpan) { if (arcs.containsKey(aSpan.getVid()) || spans.containsKey(aSpan.getVid())) { throw new IllegalStateException("Annotation [" + aSpan.getVid() + "] already exists."); } spans.put(aSpan.getVid(), aSpan); annotationLayers.put(aSpan.getLayer().getId(), aSpan.getLayer()); spansByLayer.put(aSpan.getLayer().getId(), aSpan); }
public void add(VArc aArc) { if (arcs.containsKey(aArc.getVid()) || spans.containsKey(aArc.getVid())) { throw new IllegalStateException("Annotation [" + aArc.getVid() + "] already exists."); } arcs.put(aArc.getVid(), aArc); annotationLayers.put(aArc.getLayer().getId(), aArc.getLayer()); arcsByLayer.put(aArc.getLayer().getId(), aArc); }
@Override public void onRender(TypeAdapter aAdapter, VDocument aResponse, Map<AnnotationFS, VSpan> annoToSpanIdx) { if (aAdapter.getLayer().isCrossSentence()) { return; } // Since we split spans into multiple ranges at sentence boundaries, we can simply check // if there are multiple ranges for a given span. This is cheaper than checking for // every annotation whether the begin/end offset is in the same sentence. for (Entry<AnnotationFS, VSpan> e : annoToSpanIdx.entrySet()) { if (e.getValue().getRanges().size() > 1) { aResponse.add(new VComment(new VID(e.getKey()), ERROR, "Crossing sentence bounardies is not permitted.")); } } }
@OnEvent public void onRenderAnnotations(RenderAnnotationsEvent aEvent) { if (selectedResult != null) { AnnotatorState state = aEvent.getState(); if (state.getWindowBeginOffset() <= selectedResult.getOffsetStart() && selectedResult.getOffsetEnd() <= state.getWindowEndOffset()) { aEvent.getVDocument() .add(new VTextMarker(VMarker.MATCH_FOCUS, selectedResult.getOffsetStart() - state.getWindowBeginOffset(), selectedResult.getOffsetEnd() - state.getWindowBeginOffset())); } } }
default void renderRequiredFeatureErrors(List<AnnotationFeature> aFeatures, FeatureStructure aFS, VDocument aResponse) { for (AnnotationFeature f : aFeatures) { if (isRequiredFeatureMissing(f, aFS)) { aResponse.add(new VComment(new VID(getAddr(aFS)), VCommentType.ERROR, "Required feature [" + f.getName() + "] not set.")); } } } }
private static String getColor(VObject aVObject, ColoringStrategy aColoringStrategy, String aLabelText) { String color; if (aVObject.getEquivalenceSet() >= 0) { // Every chain is supposed to have a different color color = ColoringStrategy.PALETTE_NORMAL_FILTERED[aVObject.getEquivalenceSet() % ColoringStrategy.PALETTE_NORMAL_FILTERED.length]; } else { color = aColoringStrategy.getColor(aVObject.getVid(), aLabelText); } return color; }
public void add(VComment aComment) { comments.put(aComment.getVid(), aComment); }
public VObject(AnnotationLayer aLayer, VID aVid, String aType, int aEquivalenceSet, Map<String, String> aFeatures, Map<String, String> aHoverFeatures) { layer = aLayer; vid = aVid; type = aType; features = aFeatures; setHoverFeatures(aHoverFeatures); equivalenceSet = aEquivalenceSet; }
@OnEvent public void onRenderAnnotations(RenderAnnotationsEvent aEvent) { AnnotatorState state = aEvent.getState(); if (selectedResult != null) { if ( // Check if match is in current document selectedResult.getDocumentId() == state.getDocument().getId() && // Check if match is in currently visible part of the document state.getWindowBeginOffset() <= selectedResult.getOffsetStart() && selectedResult.getOffsetEnd() <= state.getWindowEndOffset() ) { aEvent.getVDocument() .add(new VTextMarker(VMarker.MATCH_FOCUS, selectedResult.getOffsetStart() - state.getWindowBeginOffset(), selectedResult.getOffsetEnd() - state.getWindowBeginOffset())); } } }
private static String getColor(VObject aVObject, ColoringStrategy aColoringStrategy, String aLabelText) { String color; if (aVObject.getEquivalenceSet() >= 0) { // Every chain is supposed to have a different color color = ColoringStrategy.PALETTE_NORMAL_FILTERED[aVObject.getEquivalenceSet() % ColoringStrategy.PALETTE_NORMAL_FILTERED.length]; } else { color = aColoringStrategy.getColor(aVObject.getVid(), aLabelText); } return color; } }
private static String getColor(VObject aVObject, ColoringStrategy aColoringStrategy, String aLabelText) { String color; if (aVObject.getEquivalenceSet() >= 0) { // Every chain is supposed to have a different color color = ColoringStrategy.PALETTE_NORMAL_FILTERED[aVObject.getEquivalenceSet() % ColoringStrategy.PALETTE_NORMAL_FILTERED.length]; } else { color = aColoringStrategy.getColor(aVObject.getVid(), aLabelText); } return color; }