I
Ian Stanley
Hi,
I have an vector of shapes which I then apply transforms to.
I am trying to use some of the "attributes" of the reulting general path to
detemine what type of shape a mouse click has hit.
example a square has area = side*side.
I hope to use the shape's area to test what type of shape(general path) is
being selected. Part of my method is below.
The problem is that for rotated rectangles and some other shapes the
getbounds width & height cannot be used.
Can anyone please suggest a way this could be resolved. I have looked at the
getpathiterator but can't work out how it works?
Am I on the wrong track?
any help appreciated, thanking you
Ian
public Shape hitTest(int x, int y)
{
for (int i = 0; i < v.size(); i++){
Shape s = (Shape)v.elementAt(i);
if (s.contains(x,y) ){
int wid = s.getBounds().width;
int hei = s.getBounds().height;
... ... ...
return s;
}
}
return null;
}
I have an vector of shapes which I then apply transforms to.
I am trying to use some of the "attributes" of the reulting general path to
detemine what type of shape a mouse click has hit.
example a square has area = side*side.
I hope to use the shape's area to test what type of shape(general path) is
being selected. Part of my method is below.
The problem is that for rotated rectangles and some other shapes the
getbounds width & height cannot be used.
Can anyone please suggest a way this could be resolved. I have looked at the
getpathiterator but can't work out how it works?
Am I on the wrong track?
any help appreciated, thanking you
Ian
public Shape hitTest(int x, int y)
{
for (int i = 0; i < v.size(); i++){
Shape s = (Shape)v.elementAt(i);
if (s.contains(x,y) ){
int wid = s.getBounds().width;
int hei = s.getBounds().height;
... ... ...
return s;
}
}
return null;
}