1 /*******************************************************************************
\r
2 * Copyright (c) 2011 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.diagram.connection;
\r
14 import gnu.trove.map.hash.THashMap;
\r
16 import java.util.Comparator;
\r
18 public abstract class RoutePoint {
\r
20 public static final Comparator<RoutePoint> X_COMPARATOR = new Comparator<RoutePoint>() {
\r
22 public int compare(RoutePoint a, RoutePoint b) {
\r
23 return Double.compare(a.x, b.x);
\r
27 public static final Comparator<RoutePoint> Y_COMPARATOR = new Comparator<RoutePoint>() {
\r
29 public int compare(RoutePoint a, RoutePoint b) {
\r
30 return Double.compare(a.y, b.y);
\r
37 public RoutePoint() {
\r
40 public RoutePoint(double x, double y) {
\r
45 public double getX() {
\r
49 public double getY() {
\r
53 void removeFromOther(RouteLine routeLine) {
\r
56 public boolean isNear(double x2, double y2, double tolerance) {
\r
60 return dx*dx + dy*dy <= tolerance*tolerance;
\r
63 abstract RoutePoint copy(THashMap<Object, Object> map);
\r
66 public void setX(double x) {
\r
70 public void setY(double y) {
\r