public void updateEdgeBounds(mxCellState state){
  List<mxPoint> points=state.getAbsolutePoints();
  if (points != null && points.size() > 0) {
    mxPoint p0=points.get(0);
    mxPoint pe=points.get(points.size() - 1);
    if (p0 == null || pe == null) {
      removeState(state.getCell());
    }
 else {
      if (p0.getX() != pe.getX() || p0.getY() != pe.getY()) {
        double dx=pe.getX() - p0.getX();
        double dy=pe.getY() - p0.getY();
        state.setTerminalDistance(Math.sqrt(dx * dx + dy * dy));
      }
 else {
        state.setTerminalDistance(0);
      }
      double length=0;
      double[] segments=new double[points.size() - 1];
      mxPoint pt=p0;
      if (pt != null) {
        double minX=pt.getX();
        double minY=pt.getY();
        double maxX=minX;
        double maxY=minY;
        for (int i=1; i < points.size(); i++) {
          mxPoint tmp=points.get(i);
          if (tmp != null) {
            double dx=pt.getX() - tmp.getX();
            double dy=pt.getY() - tmp.getY();
            double segment=Math.sqrt(dx * dx + dy * dy);
            segments[i - 1]=segment;
            length+=segment;
            pt=tmp;
            minX=Math.min(pt.getX(),minX);
            minY=Math.min(pt.getY(),minY);
            maxX=Math.max(pt.getX(),maxX);
            maxY=Math.max(pt.getY(),maxY);
          }
        }
        state.setLength(length);
        state.setSegments(segments);
        double markerSize=1;
        state.setX(minX);
        state.setY(minY);
        state.setWidth(Math.max(markerSize,maxX - minX));
        state.setHeight(Math.max(markerSize,maxY - minY));
      }
 else {
        state.setLength(0);
      }
    }
  }
}

public void updateEdgeBounds ( mxCellState state ) { List < mxPoint > points = state . getAbsolutePoints ( ) ; if ( points != null && points . size ( ) > 0 ) { mxPoint p0 = points . get ( 0 ) ; mxPoint pe = points . get ( points . size ( ) - 1 ) ; if ( p0 == null || pe == null ) { removeState ( state . getCell ( ) ) ; } else { if ( p0 . getX ( ) != pe . getX ( ) || p0 . getY ( ) != pe . getY ( ) ) { double dx = pe . getX ( ) - p0 . getX ( ) ; double dy = pe . getY ( ) - p0 . getY ( ) ; state . setTerminalDistance ( Math . sqrt ( dx * dx + dy * dy ) ) ; } else { state . setTerminalDistance ( 0 ) ; } double length = 0 ; double [ ] segments = new double [ points . size ( ) - 1 ] ; mxPoint pt = p0 ; if ( pt != null ) { double minX = pt . getX ( ) ; double minY = pt . getY ( ) ; double maxX = minX ; double maxY = minY ; for ( int i = 1 ; i < points . size ( ) ; i ++ ) { mxPoint tmp = points . get ( i ) ; if ( tmp != null ) { double dx = pt . getX ( ) - tmp . getX ( ) ; double dy = pt . getY ( ) - tmp . getY ( ) ; double segment = Math . sqrt ( dx * dx + dy * dy ) ; segments [ i - 1 ] = segment ; length += segment ; pt = tmp ; minX = Math . min ( pt . getX ( ) , minX ) ; minY = Math . min ( pt . getY ( ) , minY ) ; maxX = Math . max ( pt . getX ( ) , maxX ) ; maxY = Math . max ( pt . getY ( ) , maxY ) ; } } state . setLength ( length ) ; state . setSegments ( segments ) ; double markerSize = 1 ; state . setX ( minX ) ; state . setY ( minY ) ; state . setWidth ( Math . max ( markerSize , maxX - minX ) ) ; state . setHeight ( Math . max ( markerSize , maxY - minY ) ) ; } else { state . setLength ( 0 ) ; } } } }
updates the given state using the bounding box of the absolute points . also updates terminal distance , length and segments .
