MicroStation V8 XM Edition View Code Updates


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

/*----------------------------------------------------------------------+
| |
+----------------------------------------------------------------------*/
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.