Skip to content

GetClosestShape Is Driving me Crazy #121

Description

@dusko23

I have been struggling for two days to find a cure for a weird problem.
I would be grateful if someone could give me a hint.

Scenario:
SFmap object named mapSAROSmain contains 80 small Shape Files.
image

There are two functions to serve different purposes.
The thing is that the body of each function contains GetClosestShape method call.

I iterate through all Shape Files (80 there are) calling GetClosestShape method.
Here are two calls, one per each function.
image
myPOINTd is mouse cursor.
myCheckDistance is equal in both functions.
mapSAROSmain has raster map drawn.

Time to complete 80 iterations:

  • 53 milliseconds function 1
  • 1714 milliseconds function 2

I have stripped all of the code that might cause an issue. But problem persists.

I have also find one interesting detail in function 2 (the slow one).
If mouse cursor is close enough to a shape (record actually) the time to complete single GetClosestShape is ZERO ticks.
If mouse cursor is out of myCheckDistance the time to complete single GetClosestShape vary from 0.02 seconds to 1 second.
Any hint is highly appretiated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions