One of the first things that you will likely notice with MicroStation V8 XM Edition is the change to the display subsystem. This new subsystem was designed and implemented to provide significant benefit to users and developers alike -- both now and in the future. That said, the changes made in this area may have an impact on applications. While most applications will not require any work to run in MicroStation V8 XM Edition, some applications may require rework to take advantage of the new subsystem. The display-related items fall into one of three categories:
The use of mdlElement_display and mdlElmdscr_display
The displaying of "temporary" graphics
There are two categories of temporary graphics -- one being dynamics. Most applications use simple dynamics and require no modifications to existing code. If your application uses complex dynamics, though, there is some impact to the code. Most importantly, if the dynamics requires creating geometry and displaying it based on the drawmode parameter, you no longer need to create the geometry to erase it during the temporary erase draw time.
The other type of temporary graphics are those that require drawing to the screen but not changing the design file, which should not be confused with dynamics in the application. This can be as simple as highlighting an element In MicroStation V8 XM Edition, applications can use the mdlLocate_hiliteElement function to highlight an element. This simulates selecting the element and displaying it in the current highlight color. If the application needs to create graphics that are not going to be written to the design file (i.e. to show to the user but not make them persistent), the traditional way was to create the elements and then use the display functions. This will not work in MicroStation V8 XM Edition, since the display works in a "continual-update" mode. Instead, the geometry only needs to be put into a transient element descriptor, which needs to be managed by the application. If the geometry needs to change during creation, the mdlInput_simulateCursorMotion function will allow the display system to update the display. The prototype for that function is:
Public void mdlInput_simulateCursorMotion (void);
The last category of display-related changes is the use of mdlView_setFunction to catch the UPDATE_EACH_ELEMENT event. For various reasons, that is no longer supported in MicroStation V8 XM Edition. If you need to react to that event (or something similar), you need to use mdlView_setSubstituteElemFunc instead, which takes as its argument a function of type ViewFunc_SubstituteElem.
/*----------------------------------------------------------------------+
| |
+----------------------------------------------------------------------*/
Private void sample_reload
(
int argc,
char *argv[]
)
{
//The following is the old method
//mdlView_setFunction (UPDATE_EACH_ELEMENT, sample_updateElementHook);
//The following is the new method
mdlView_setSubstituteElemFunc ((ViewFunc_SubstituteElem)sample_updateElementHook);
mdlView_setFunction (PLOTUPDATE_FINISHED, sample_postProcess);
}
/*----------------------------------------------------------------------+
| |
+----------------------------------------------------------------------*/
Private SubstituteElemStatus sample_updateElementHook
(
MSElementDescrH newEdPP, // <= output if element being replaced
int* priorityP, // <= priority if element being defered
IMSViewportP viewPortP,
DrawPurpose drawPurpose,
IViewContextP context, // => view context
bool allowDefer, // => whether element can be defered
ElemHandleCP elemIterP // => elem-iter for current element if descriptor is needed
)
{
SubstituteElemStatus retVal = SUBSTELEM_STATUS_Normal;
.
.
.
An important thing to note regarding the use of mdlView_setSubstituteElemFunc is that this function is only available to a native code application compiled with the C++ compiler (information on moving MDL applications to native code has been covered in previous BDNzine articles). The ViewFunc_SubstituteElem function has some new parameter types, IMSViewportP and IViewContextP interfaces, and the ElemHandleCP element handle pointer. IMSViewport can call the GetViewNumber method to return the view number. ElemHandleCP is a constant pointer to the element handle for the element being processed. The end result of calling this function can be to do nothing, block, or defer the display of the element. Additionally, the function can return an element to substitute for the original. In the callback function passed to mdlView_setSubstituteElemFunc, there is a DrawPurpose parameter, which identifies the reason why the callback is being invoked. For a complete list of the draw purposes, look at the DrawPurpose enumeration in mstypes.h. The most draw purposes are Update, Hilight, or Dynamics. However, you should review the entire list to determine which may be most applicable to your application development. In MicroStation V8 XM Edition, there are a number of new times that the update call is made, so this function should be used judiciously as it is called quite often.
These categories should be reviewed as you look to having your applications run on MicroStation V8 XM Edition. Whether you are using MDL or VBA, you may have to deal with the changes in some form.