* @see simtools.diagram.gate.ConnectionPath#contains(double, double)
*/
public boolean contains(double ox, double oy){
boolean res = false;
Rectangle2D area;
Point p = new Point(firstPoint);
for(int i=0;i< getSegmentNumber() && !res;i++){
Segment s = getSegment(i);
if (s instanceof HorizontalSegment){
area = new Rectangle2D.Double(
p.x + (s.length<0? s.length : 0) - MAX_DISTANCE_FROM_SEGMENT,
p.y - MAX_DISTANCE_FROM_SEGMENT,
Math.abs(s.length) + 2* MAX_DISTANCE_FROM_SEGMENT,
2 * MAX_DISTANCE_FROM_SEGMENT
);
p.x += s.length;
} else {
area = new Rectangle2D.Double(
p.x - MAX_DISTANCE_FROM_SEGMENT,
p.y + (s.length<0? s.length : 0) - MAX_DISTANCE_FROM_SEGMENT,
2 * MAX_DISTANCE_FROM_SEGMENT,
Math.abs(s.length) + 2* MAX_DISTANCE_FROM_SEGMENT
);
p.y += s.length;
}
if (area.contains(ox, oy)){
res = true;
}
}
return res;
}