@Override
 public boolean isContainedInSelection(Rectangle drawingViewSelection, double scale) {
   FGERectangle drawingViewBounds =
       new FGERectangle(
           drawingViewSelection.getX(),
           drawingViewSelection.getY(),
           drawingViewSelection.getWidth(),
           drawingViewSelection.getHeight(),
           Filling.FILLED);
   boolean isFullyContained = true;
   for (ControlArea<?> ca : getConnector().getControlAreas()) {
     if (ca instanceof ControlPoint) {
       ControlPoint cp = (ControlPoint) ca;
       Point cpInContainerView =
           convertLocalNormalizedPointToRemoteViewCoordinates(
               cp.getPoint(), getDrawingGraphicalRepresentation(), scale);
       FGEPoint preciseCPInContainerView = new FGEPoint(cpInContainerView.x, cpInContainerView.y);
       if (!drawingViewBounds.containsPoint(preciseCPInContainerView)) {
         // System.out.println("Going outside: point="+preciseCPInContainerView+"
         // bounds="+containerViewBounds);
         isFullyContained = false;
       }
     }
   }
   return isFullyContained;
 }
Example #2
0
 public FGEArea getAllowedHorizontalConnectorLocationFromWest2() {
   double maxY = Double.NEGATIVE_INFINITY;
   double minY = Double.POSITIVE_INFINITY;
   for (ControlPoint cp : getControlPoints()) {
     FGEPoint p = cp.getPoint();
     FGEHalfLine hl = new FGEHalfLine(p.x, p.y, p.x - 1, p.y);
     FGEArea inters = getShape().intersect(hl);
     System.out.println("inters=" + inters);
     if (inters instanceof FGEPoint || inters instanceof FGEEmptyArea) {
       // Consider this point
       if (p.y > maxY) {
         maxY = p.y;
       }
       if (p.y < minY) {
         minY = p.y;
       }
     }
   }
   FGEHalfLine north = new FGEHalfLine(0, minY, -1, minY);
   FGEHalfLine south = new FGEHalfLine(0, maxY, -1, maxY);
   /*
    * FGEHalfLine north = new FGEHalfLine(0,0,-1,0); FGEHalfLine south =
    * new FGEHalfLine(0,1,-1,1);
    */
   if (north.overlap(south)) {
     System.out.println("Return a " + north.intersect(south));
     return north.intersect(south);
   }
   return new FGEHalfBand(north, south);
 }