I'm writing a DependencyManager handler and I need to know the RotMatrix of the view where my element modification caused the DependencyManager to act. Specifically, when my Root element alters it's rotation, I need to also modify the rotation of any dependent items. I am trying to use GetCurrentDgnButtonEvent(), but I don't have any type of DgnTool active, so the compiler doesn't like me using it....
Not sure of any other way to obtain the Viewport of the cursor operation. Do I need to set up a view monitor as well in order to get this information? Might it be available from the tcb?
Bruce Reeves SRNS said:Maybe a view substitution class?
In V8i, the function to replace displayed element by another was mdlView_setSubstituteElemFunc(), in CONNECT Edition it was replaces by ViewCallback::SetSubstituteElemFunction().
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Jan Ĺ legr said: isn't the discussed feature more about how to monitor / hook / change how text element is displayed in a particular view than how it's stored?
Yes !
I had not even thought of that - can one control how individual elements are displayed in a view. Wow !! Maybe a view substitution class?
Hi Bruce,
Bruce Reeves SRNS said:as it relates to the view, not the global coordinate system
Because it relates to the view (and its rotation), isn't the discussed feature more about how to monitor / hook / change how text element is displayed in a particular view than how it's stored?
What is the rule when more views are opened, the same line is displayed but the view are rotated differently?
Upon initial text placement, that is no problem. The issue is when a user may decide to modify the root linear element by grabbing a handle and re-locating it. That requires 1) the text be moved (no problem), 2) the text be rotated to the tangent of the modified linear element ( again, no problem), and 3) the text *may* have to be rotated 180 degrees to adhere to our text orientation "rules" (here, I need to get the linear element's tangent as it relates to the view, not the global coordinate system - that;s the issue).
Bruce Reeves SRNS said:2D
To me that makes your assumption that the view will not rotate much more reasonable. To me the easiest solution sounds like: assume no view rotation and orient your text according to slope of line.
Paul Connelly said:Is this intended for use in 2d or 3d?
2D
Paul Connelly said:Short of that you'd have to think about writing your own display handler...
I might look at that if I knew how, or had an example to follow...
Bruce Reeves SRNS said:All this assumes that once the line/text is placed, that the view is not rotated again....
Yes exactly. Not a very safe assumption.Is this intended for use in 2d or 3d? Is there an expected view orientation (e.g. top view) that you can assume when laying out the text?
I am not aware of a way of specifying that a piece of text should be drawn differently based on the current view orientation - though I wouldn't be surprised if such a thing exists.
Short of that you'd have to think about writing your own display handler...
I have text that is placed on top of a line. The text must remain oriented with the line, but additionally must always read from the bottom and/or right side of the view:
Original: Incorrect: Correct:
If you reposition the bottom vertex from the left to the right, the text must follow the tangent of the segment AND be orientated such that "top" (upper 'Y' of text box) of the text is above the "bottom" (lower 'Y' of text box). I suspect one could extract out the boundary of the text and compare the 'Y' values, but What I've been doing is simply taking the segment tangent and rotating it by the view rotation to get the segment tangent in relation to the view instead of the global coordinate system. Once I know that, if the tangent is > 91 and < 269 degrees, I know to additionally rotate the text 180 degrees. All this assumes that once the line/text is placed, that the view is not rotated again....
You can't know what (if any) viewport received the interaction that resulted in a dependency callback. Dependency callbacks are about persistent changes to elements triggering changes to other elements; they cannot be view-dependent.
Why do you think you need a viewport? What are you trying to use it for?