X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.diagram.connection%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fconnection%2FRoutePoint.java;fp=bundles%2Forg.simantics.diagram.connection%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fconnection%2FRoutePoint.java;h=532e68012b1731e27fd5e49de21a469d023c9527;hp=70450e9666ab394a7b095d5fc79934796629dd96;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RoutePoint.java b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RoutePoint.java index 70450e966..532e68012 100644 --- a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RoutePoint.java +++ b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RoutePoint.java @@ -1,73 +1,73 @@ -/******************************************************************************* - * Copyright (c) 2011 Association for Decentralized Information Management in - * Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.diagram.connection; - -import gnu.trove.map.hash.THashMap; - -import java.util.Comparator; - -public abstract class RoutePoint { - - public static final Comparator X_COMPARATOR = new Comparator() { - @Override - public int compare(RoutePoint a, RoutePoint b) { - return Double.compare(a.x, b.x); - } - }; - - public static final Comparator Y_COMPARATOR = new Comparator() { - @Override - public int compare(RoutePoint a, RoutePoint b) { - return Double.compare(a.y, b.y); - } - }; - - double x; - double y; - - public RoutePoint() { - } - - public RoutePoint(double x, double y) { - this.x = x; - this.y = y; - } - - public double getX() { - return x; - } - - public double getY() { - return y; - } - - void removeFromOther(RouteLine routeLine) { - } - - public boolean isNear(double x2, double y2, double tolerance) { - double dx = x2-x; - double dy = y2-y; - - return dx*dx + dy*dy <= tolerance*tolerance; - } - - abstract RoutePoint copy(THashMap map); - - - public void setX(double x) { - this.x = x; - } - - public void setY(double y) { - this.y = y; - } -} +/******************************************************************************* + * Copyright (c) 2011 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.diagram.connection; + +import gnu.trove.map.hash.THashMap; + +import java.util.Comparator; + +public abstract class RoutePoint { + + public static final Comparator X_COMPARATOR = new Comparator() { + @Override + public int compare(RoutePoint a, RoutePoint b) { + return Double.compare(a.x, b.x); + } + }; + + public static final Comparator Y_COMPARATOR = new Comparator() { + @Override + public int compare(RoutePoint a, RoutePoint b) { + return Double.compare(a.y, b.y); + } + }; + + double x; + double y; + + public RoutePoint() { + } + + public RoutePoint(double x, double y) { + this.x = x; + this.y = y; + } + + public double getX() { + return x; + } + + public double getY() { + return y; + } + + void removeFromOther(RouteLine routeLine) { + } + + public boolean isNear(double x2, double y2, double tolerance) { + double dx = x2-x; + double dy = y2-y; + + return dx*dx + dy*dy <= tolerance*tolerance; + } + + abstract RoutePoint copy(THashMap map); + + + public void setX(double x) { + this.x = x; + } + + public void setY(double y) { + this.y = y; + } +}