SpatialNeighbours

I

Iwan van Ee

Anybody having problems with the SpatialNeighbours command? When I perform
this command it take a very long time Visio comes with the selection object.
I now use the 'good-old' HitTest, but this is not what a really want.
 
C

Chris Roth [ Visio MVP ]

Is your drawing very large? I imagine it takes a lot of math to do all of
that intersection calculations.
 
I

Iwan van Ee

Nope it's not a complex drawing.

It just has one rectangle Shape that is a group. In that group there are
about 20 ither shapes. When I drop a new Shape on that rectangle I want to
get the SpatialNeighbours to see if it was dropped on that rectangle.

Greetings,
Iwan
 
M

Mark Nelson [MS]

Make sure that you use the default value (0) for the spatial relations that
you are searching for. Grouped shapes and spatial relations are extremely
time-consuming. Remember that Visio has to compare every shape on the page.
If you pass in 0, you can take the resulting shape list and individually ask
what the spatial relation for that shape is (only if you care to know in
more detail). This is 100 to 1000 times faster.

In your case, you may not need SpatialNeighbors at all. If you already know
the shape being dropped and you know the rectangle shape to check against,
use the SpatialRelation method directly. This works if you don't need to
include the rectangle's subshapes in the check.

--
Mark Nelson
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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