예제 #1
0
 public void setHighlighted(
     boolean value, boolean showDirection, boolean asOutgoing, boolean propagateEvent) {
   if (this.highlighted != value) {
     this.highlighted = value;
     PPath ppath = getEdgePPath();
     if (ppath != null) {
       Paint paint;
       if (value) {
         Color color;
         if (showDirection) {
           if (asOutgoing) {
             color = visualFlowMap.getColor(ColorCodes.EDGE_STROKE_HIGHLIGHTED_OUTGOING_PAINT);
           } else {
             color = visualFlowMap.getColor(ColorCodes.EDGE_STROKE_HIGHLIGHTED_INCOMING_PAINT);
           }
         } else {
           color = visualFlowMap.getColor(ColorCodes.EDGE_STROKE_HIGHLIGHTED_PAINT);
         }
         paint = color;
       } else {
         paint = createPaintFor(normalizeForColorScale(getEdgeWeight()));
       }
       ppath.setStrokePaint(paint);
     }
     repaint();
     if (propagateEvent) {
       if (logger.isDebugEnabled()) {
         logger.debug(
             (value ? "H" : "Unh")
                 + "ighlight edge ["
                 + getLabel()
                 + " ("
                 + visualFlowMap.getValueAttr()
                 + " = "
                 + getEdgeWeight()
                 + ")]");
       }
       getVisualFlowMap()
           .firePropertyChange(
               VisualFlowMap.PROPERTY_CODE_HIGHLIGHTED,
               VisualFlowMap.PROPERTY_HIGHLIGHTED,
               Pair.of(edge, !value),
               Pair.of(edge, value));
     }
   }
 }
예제 #2
0
 public double getEdgeWeight() {
   return edge.getDouble(visualFlowMap.getValueAttr());
 }