--- /dev/null
+package org.simantics.district.route.internal;
+
+import java.util.Objects;
+
+import org.simantics.db.Resource;
+import org.simantics.district.route.Waypoint;
+
+/**
+ * @author Tuukka Lehtonen
+ * @since 6.09
+ */
+public class WaypointImpl implements Waypoint {
+
+ private final Resource element;
+ private String label;
+
+ public WaypointImpl(Resource element, String label) {
+ Objects.requireNonNull(element, "Non-null element required");
+ this.element = element;
+ this.label = label;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getObject() {
+ return (T) element;
+ }
+
+ @Override
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ @Override
+ public String toString() {
+ return label;
+ }
+
+ public Waypoint withLabel(String label) {
+ return new WaypointImpl(element, label);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + element.hashCode();
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ WaypointImpl other = (WaypointImpl) obj;
+ return element.equals(other.element);
+ }
+
+}