Search in sources :

Example 16 with DingAnnotation

use of org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation in project cytoscape-impl by cytoscape.

the class ChangeAnnotationCanvasTaskFactory method createTaskIterator.

@Override
public TaskIterator createTaskIterator(CyNetworkView networkView, Point2D javaPt, Point2D xformPt) {
    CyAnnotator cyAnnotator = ((DGraphView) networkView).getCyAnnotator();
    DingAnnotation annotation = cyAnnotator.getAnnotationAt(javaPt);
    return new TaskIterator(new ChangeAnnotationCanvasTask(networkView, annotation, canvas));
}
Also used : TaskIterator(org.cytoscape.work.TaskIterator) CyAnnotator(org.cytoscape.ding.impl.cyannotator.CyAnnotator) DingAnnotation(org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation) DGraphView(org.cytoscape.ding.impl.DGraphView)

Example 17 with DingAnnotation

use of org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation in project cytoscape-impl by cytoscape.

the class EditAnnotationTaskFactory method createTaskIterator.

@Override
public TaskIterator createTaskIterator(CyNetworkView networkView, Point2D javaPt, Point2D xformPt) {
    CyAnnotator cyAnnotator = ((DGraphView) networkView).getCyAnnotator();
    DingAnnotation annotation = cyAnnotator.getAnnotationAt(javaPt);
    return new TaskIterator(new EditAnnotationTask(networkView, annotation, javaPt));
}
Also used : TaskIterator(org.cytoscape.work.TaskIterator) CyAnnotator(org.cytoscape.ding.impl.cyannotator.CyAnnotator) DingAnnotation(org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation) DGraphView(org.cytoscape.ding.impl.DGraphView)

Example 18 with DingAnnotation

use of org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation in project cytoscape-impl by cytoscape.

the class MoveAnnotationTaskFactory method createTaskIterator.

@Override
public TaskIterator createTaskIterator(CyNetworkView networkView, Point2D javaPt, Point2D xformPt) {
    CyAnnotator cyAnnotator = ((DGraphView) networkView).getCyAnnotator();
    DingAnnotation annotation = cyAnnotator.getAnnotationAt(javaPt);
    return new TaskIterator(new MoveAnnotationTask(networkView, annotation, javaPt));
}
Also used : TaskIterator(org.cytoscape.work.TaskIterator) CyAnnotator(org.cytoscape.ding.impl.cyannotator.CyAnnotator) DingAnnotation(org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation) DGraphView(org.cytoscape.ding.impl.DGraphView)

Example 19 with DingAnnotation

use of org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation in project cytoscape-impl by cytoscape.

the class MoveAnnotationTaskFactory method isReady.

@Override
public boolean isReady(CyNetworkView networkView, Point2D javaPt, Point2D xformPt) {
    CyAnnotator cyAnnotator = ((DGraphView) networkView).getCyAnnotator();
    DingAnnotation annotation = cyAnnotator.getAnnotationAt(javaPt);
    if (annotation != null)
        return true;
    return false;
}
Also used : CyAnnotator(org.cytoscape.ding.impl.cyannotator.CyAnnotator) DingAnnotation(org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation) DGraphView(org.cytoscape.ding.impl.DGraphView)

Example 20 with DingAnnotation

use of org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation in project cytoscape-impl by cytoscape.

the class AnnotationManagerImpl method addAnnotation.

/**
 ********************************************************************************
 *                   AnnotationManager implementation methods                     *
 *********************************************************************************
 */
@Override
public void addAnnotation(final Annotation annotation) {
    if (!(annotation instanceof DingAnnotation))
        return;
    DingAnnotation dAnnotation = (DingAnnotation) annotation;
    CyNetworkView view = annotation.getNetworkView();
    invokeOnEDTAndWait(() -> {
        ((DGraphView) view).getCyAnnotator().addAnnotation(annotation);
        if (dAnnotation.getCanvas() != null) {
            dAnnotation.getCanvas().add(dAnnotation.getComponent());
        } else {
            ((DGraphView) view).getCyAnnotator().getForeGroundCanvas().add(dAnnotation.getComponent());
        }
    });
}
Also used : DingAnnotation(org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation) CyNetworkView(org.cytoscape.view.model.CyNetworkView) DGraphView(org.cytoscape.ding.impl.DGraphView)

Aggregations

DingAnnotation (org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation)34 DGraphView (org.cytoscape.ding.impl.DGraphView)21 CyAnnotator (org.cytoscape.ding.impl.cyannotator.CyAnnotator)19 TaskIterator (org.cytoscape.work.TaskIterator)8 ArrayList (java.util.ArrayList)5 GroupAnnotation (org.cytoscape.view.presentation.annotations.GroupAnnotation)5 AbstractAnnotation (org.cytoscape.ding.impl.cyannotator.annotations.AbstractAnnotation)4 Annotation (org.cytoscape.view.presentation.annotations.Annotation)4 Component (java.awt.Component)3 ArrowAnnotationImpl (org.cytoscape.ding.impl.cyannotator.annotations.ArrowAnnotationImpl)3 GroupAnnotationImpl (org.cytoscape.ding.impl.cyannotator.annotations.GroupAnnotationImpl)3 ShapeAnnotationImpl (org.cytoscape.ding.impl.cyannotator.annotations.ShapeAnnotationImpl)3 Point (java.awt.Point)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 TreeMap (java.util.TreeMap)2 JComponent (javax.swing.JComponent)2 Dimension (java.awt.Dimension)1 Graphics2D (java.awt.Graphics2D)1 Point2D (java.awt.geom.Point2D)1