We often need to work with a given set of MIcroStation element types when writing an application for locating and scanning elements. For example, we may want to work with lines and line-strings, and therefore want our users to be able to...
Because the MDL APIs for locate logica and scan logic are quite different, it's hard to remember to synchronise our application logic for those two requirements. Since I'm becoming more forgetful I wrote a class that unifies the two APIs and makes it harder to get things wrong.
CSearchTypes is simple: you inherit from it to create your own class, such as CLinearTypes. You initialise your class with a list of MDL element types. Then you call member functions SetLocateSearchMask whenever you want to initialise MicroStation's locate logic, and SetScanCriteria whenever you want to initialise the MDL scanner.
#include <mselems.h> LinearTypes::LinearTypes () { types_.push_back (LINE_ELM); types_.push_back (LINE_STRING_ELM); }
Suppose we want to add arc elements to our list of element types: you need edit only one site in your source code (the constructor of your inherited class CLinearTypes).
#include <mselems.h> LinearTypes::LinearTypes () { types_.push_back (LINE_ELM); types_.push_back (LINE_STRING_ELM); types_.push_back (ARC_ELM); }
For more detail, and the opportunity to download a ZIP file containing the CSearchTypes source code, read this article about CSearchTypes.