Attempting to mimic C3D's highlight each region as the cursor passes through it during selection of a region to edit. Not seeing how to accomplish this...any hints would be helpful.
Edited to add that I know it will involve using the Editor.PointMonitor event. What I don't know is how to determine which region the cursor is in and then, once I know that, how to get the region boundary in order to highlight it.
Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
Hi jeff.
I would calculate the station (from your alignment) of your cursor, then I would check every region (startregion station and endregion station) if my station is between them to determine the region properly.
Thanks, Joan. That's not quite what I'm looking at doing though. Here's a quick Screencast showing the naitive C3D region selection, and then my attempt at mimicing this selection process. You can see mine does work, but it is painfully slow....
I'd cache the regions of the corridor when the command is first called and then you'd be able to use multithreading to pull the correct region and not get stuck using Civil 3Ds single threaded API to return the value.
Thanks, Christopher. That's what I was doing, but I was using the BoundaryRepresentation managed wrapper to find IsPointInside. It turns out that this process is quite slow, at least in the manner in which I was using it. I've got another method working fairly well, but it is returning some false positives so still need to work on cleaning it up.
But, it's getting closer!
Hi,
Not sure if I can add... but what you mean by 'brute force'? Also, how are you reading the objects inside the PointMonitor event? Maybe we can just improve the current process you have...
Thanks for responding Augusto.
By 'brute force' I meant iterating each baseline->region->applied assembly->link._calculated point to find the boundaries of each region (I do this once at the onset of the command). I then use the PointMonitor RawPoint and check if it lies within one of the polylines formed by the regions. If so, I highlight the region using a TransientGraphic with that polyline and show a small form with the Baseline-Region name.
I actually have a version of this working well now. Would've been nice to be able to tap into what C3D uses internally for this, if, for no other reason, to be able to keep my command looking like a 'normal' C3D command. Would've saved me a few days of research and testing, too.