SpatialSearch not working on 1D shapes

R

rusty.brackett

I am using the Visio2003 Drawing Control in a .NET windows app. I have
some code that will return a shape (actually a Selection object) when
the user right clicks on a shape. I use this to display a custom
context menu for my app.

My issue is that the code works perfectly as long as the shape is a two
dimensional shape (the 'State' shape from the ROOM stencil is the shape
I am using in my app) but returns null when the clicked shape is a one
dimensional shape (the 'Transition' shape from the ROOM stencil). The
code I am using to get the clicked shape follows:

// Return a list of shapes at the clicked location.
Selection foundShapes = currentPage.get_SpatialSearch(clickLocationX,
clickLocationY,
(short)VisSpatialRelationCodes.visSpatialContainedIn, tolerance,
(short)VisSpatialRelationFlags.visSpatialFrontToBack);

I have experimented with the tolerance value (with 2D shapes it works
fine with a value of .0001, but have tried up to .1 for the 1D shape
with no luck) and all the flags in the VisSpatialRelationCodes
constants (tried them all, the only one that works at all is the one
used in the code snippet above).

I have tried with the shapes being selected and not being selected,
being connected and being unconnected and got the same results. The 2D
shape is always returned in the Selection object and a 1D shape is
never returned (i.e. SpatialSearch returns null).

Can anyone see why the 1D Transition shapes wouldn't be returned by the
SpatialSearch method? What am I missing?

FWIW, I am only trying with the shapes I mentioned (i.e. 'State' and
'Transition' shapes from the 'ROOM' stencil). Our application uses
these shapes exclusively.

Any help is greatly appreciated,

Russell
 
A

Al Edlund

there was a recent entry (below : tolerance) that discussed this. the user
discovered that spatialsearch only triggers on the vertex of a 1d shape. I
don't know if it's a bug or not.
al
 
R

R Brackett

Seems reasonable enough, but I can't seem to 'prove' the theory. After
reading your reply, I went into my application and added a 1D
Transition shape to the drawing surface. I zoomed in as far as I could
and made the line as small and as straight as possible (trying to
ensure the vertex would be close enough to trigger a postive result). I
clicked up, down, and all around the miniscule line and still couldn't
get SpatialSearch to return a value other than null.

So, in theory it sounds like a valid supposition, but in actuality, it
still doesn't seem to be accurate. Any other ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top