import java.util.Comparator;
import java.util.List;
+import org.simantics.g2d.canvas.ICanvasContext;
import org.simantics.g2d.diagram.DiagramUtils;
import org.simantics.g2d.diagram.IDiagram;
import org.simantics.g2d.diagram.handler.PickRequest;
* @param pickAreaTerminals pick terminals that have a shape
* @return terminals in z-order (bottom to top)
*/
- public static List<TerminalInfo> pickTerminals(IDiagram d, Shape pickShape, boolean pickPointTerminals, boolean pickAreaTerminals)
+ public static List<TerminalInfo> pickTerminals(ICanvasContext ctx, IDiagram d, Shape pickShape, boolean pickPointTerminals, boolean pickAreaTerminals)
{
boolean clearElements = false;
List<IElement> elements = null;
elements = ELEMENTS.get();
elements.clear();
clearElements = true;
- PickRequest req = new PickRequest(pickShape);
+ PickRequest req = new PickRequest(pickShape).context(ctx);
DiagramUtils.pick(d, req, elements);
} else {
// Select all terminals
* @param pickShape pick area (in diagram coordinate system)
* @return terminals in z-order (bottom to top)
*/
- public static TerminalInfo pickTerminal(IDiagram diagram, Shape pickShape)
+ public static TerminalInfo pickTerminal(ICanvasContext ctx, IDiagram diagram, Shape pickShape)
{
ArrayList<IElement> elements = ELEMENTS.get();
elements.clear();
- PickRequest req = new PickRequest(pickShape);
+ PickRequest req = new PickRequest(pickShape).context(ctx);
DiagramUtils.pick(diagram, req, elements);
if (elements.isEmpty())
return null;
* @param pickShape
* @return bends or null
*/
- public BendsInfo pickBends(IDiagram diagram, Shape pickShape)
+ public BendsInfo pickBends(ICanvasContext ctx, IDiagram diagram, Shape pickShape)
{
BendsInfo result = null;
double bestShortestDist = Double.MAX_VALUE;
ArrayList<IElement> elements = ELEMENTS.get();
elements.clear();
- PickRequest req = new PickRequest(pickShape);
+ PickRequest req = new PickRequest(pickShape).context(ctx);
DiagramUtils.pick(diagram, req, elements);
ArrayList<Bend> bends = new ArrayList<>();
public static boolean isSameTerminal(TerminalInfo t1, TerminalInfo t2) {
if (t1 == null || t2 == null)
return false;
- return t1.e.equals(t2.e) && t1.t.equals(t2.e);
+ return t1.e.equals(t2.e) && t1.t.equals(t2.t);
}
/**