public Magnets createMagnets ( final WiresShape wiresShape , final Direction [ ] requestedCardinals ) { final IPrimitive < ? > primTarget = wiresShape . getGroup ( ) ; final Point2DArray points = getWiresIntersectionPoints ( wiresShape , requestedCardinals ) ; final ControlHandleList list = new ControlHandleList ( primTarget ) ; final BoundingBox box = wiresShape . getPath ( ) . getBoundingBox ( ) ; final Point2D primLoc = primTarget . getComputedLocation ( ) ; final Magnets magnets = new Magnets ( this , list , wiresShape ) ; int i = 0 ; for ( final Point2D p : points ) { final double mx = primLoc . getX ( ) + p . getX ( ) ; final double my = primLoc . getY ( ) + p . getY ( ) ; final WiresMagnet m = new WiresMagnet ( magnets , null , i ++ , p . getX ( ) , p . getY ( ) , getControlPrimitive ( mx , my ) , true ) ; final Direction d = getDirection ( p , box ) ; m . setDirection ( d ) ; list . add ( m ) ; } final String uuid = primTarget . uuid ( ) ; m_magnetRegistry . put ( uuid , magnets ) ; wiresShape . setMagnets ( magnets ) ; return magnets ; }
Right now it only works with provided FOUR or EIGHT cardinals anything else will break WiresConnector autoconnection