The Line Style Manager is the root for all line style access. More...
Classes | |
struct | LineStyleNameInfo |
struct | LsEntry |
Represents the defintion of a line style. More... | |
struct | LsMapEntry |
An entry in a LsMap; it contains a pointer to an LsDefinition. More... | |
struct | LsMapIterator |
Helper class used for iterating through the LsMapEntry entries in an LsMap. More... | |
struct | LsMap |
A map used to map from line style number to line style name and vice versa. More... | |
struct | LsResourceFileMap |
An LsResourceFileMap object is used to access line styles and line style resources without going through the LsSystemMap. More... | |
struct | LsSystemMap |
Used to access the line styles that are in the system map. More... | |
struct | LsDgnFileMap |
Used to access the line styles known to a given DgnFile. More... | |
struct | LineStyleManager |
The LineStyleManager class provides access to all line style related services for DgnPlatform. More... | |
Typedefs | |
typedef RefCountedPtr< LsMap > | LsMapPtr |
Smart pointer wrapper for LsMap. More... | |
typedef RefCountedPtr < LsSystemMap > | LsSystemMapPtr |
Smart pointer wrapper for LsSystemMap. More... | |
typedef RefCountedPtr < LsResourceFileMap > | LsResourceFileMapPtr |
Smart pointer wrapper for LsResourceFileMap. More... | |
typedef RefCountedPtr < LsDgnFileMap > | LsDgnFileMapPtr |
Smart pointer wrapper for LsDgnFileMap. More... | |
typedef RefCountedPtr < LineStyleHandle > | LineStyleHandlePtr |
typedef RefCountedPtr < LsComponent > | LsComponentPtr |
typedef RefCountedPtr < LsCompoundComponent > | LsCompoundComponentPtr |
typedef RefCountedPtr < LsPointSymbolComponent > | LsPointSymbolComponentPtr |
typedef RefCountedPtr < LsLineCodeComponent > | LsLineCodeComponentPtr |
typedef RefCountedPtr < LsInternalComponent > | LsInternalComponentPtr |
typedef RefCountedPtr < LsLinePointComponent > | LsLinePointComponentPtr |
typedef RefCountedPtr < LsPointSymbolInfo > | LsPointSymbolInfoPtr |
typedef RefCountedPtr < LsStrokeData > | LsStrokeDataPtr |
typedef RefCountedPtr < LsCompoundInfo > | LsCompoundInfoPtr |
typedef RefCountedPtr < LsRasterImageComponent > | LsRasterImageComponentPtr |
typedef bvector< LsComponentPtr > | LsComponentVector |
Enumerations | |
enum | LsKnownStyleNumber { STYLE_MinLineCode = 0, STYLE_MaxLineCode = 7, STYLE_ByLevel = 0x7fffffff, STYLE_ByCell = 0x7ffffffe, STYLE_Invalid = 0x7fffff00 } |
Special style numbers that form a subset of values that may passed to LineStyleManager::GetNameFromNumber() or returned from LineStyleManager::GetNumberFromName() More... | |
enum | LsElementType { Unknown = 0, PointSymbol = 1, Compound = 2, LineCode = 3, LinePoint = 4, Internal = 6, RasterImage = 7 } |
Values held in line style defintion elements; normally not used by clients of this API. More... | |
enum | LsLocationType { Unknown = 0, ResourceFile = 1, DgnFile = 2, System = 3, LinFile = 4, Importer = 5 } |
Code indicating the source of the component definition. More... | |
enum | LsResourceType { Unknown = 1, Internal = 0, Compound = 'lsLS', LineCode = 'lsLC', LinePoint = 'lsLP', PointSymbol = 'l8PS', PointSymbolV7 = 'lsPS', RasterImage = 'lsRI', NameEntry = 'lsNm' } |
Values held in line style defintion components in resource files. More... | |
enum | LsCapMode { LCCAP_Closed = 0, LCCAP_Open = 1, LCCAP_Extended = 2, LCCAP_Hexagon = 3, LCCAP_Octagon = 4, LCCAP_Decagon = 5, LCCAP_Arc = 30 } |
Returned from GetCapMode() More... | |
enum | LsUnit { Master = 0, Uor = 1, Device = 2 } |
Defines possible values for LsDefinition::GetUnitsType() and LsDefinition::SetUnitsType(). More... | |
The Line Style Manager is the root for all line style access.
A line style can be defined in a resource file or a design file. A design file may also contain references to line styles defined in resource files. A resource file that contains line style definitions contains an LsMap that contains an LsMapEntry for each style. A design file has an LsDgnFileMap that has an LsMapEntry for every line style that it may reference. Some of these entries may be for styles defined in the design file, while others are for styles defined in resource files. A resource file should contain the complete line style definition for every line style named in an LsMapEntry from that file.
An LsMapEntry is just a line style number and name. For an LsMapEntry from a design file, the style number is unique to that entry. A line style is associated with an element by storing that style number on the element. Therefore, the style number must be unique within that design file. For an LsMapEntry in a resource file the style number must be unique if it is greater than STYLE_MaxLineCode. Typically, the style numbers in a resource file are less than or equal to 0 and are meaningless. See the section "Resolving a Line Style" for information on how line style numbers are used.
When the LineStyleManager is initialized, it locates all "known" line styles on the system and creates an instance of LsSystemMap to serve as a system directory of the system line styles. The map entries in LsSystemMap are created from the map entries in resource files. If multiple resource files contain an entry with the same name only the first one is added to the map. In other words, a line style defined in a resource file is ignored if a line style with the same name has already been added to the map.
The LineStyleManager creates an LsDgnFileMap whenever a design file is loaded.
A program may use an LsResourceFileMap to read or create a resource file that contains line styles. See LsResourceFileMap for more information.
A line style can be defined in a resource file or a design file. The file that contains a definition must also contain an LsMapEntry for the definition. The LsMapEntry is used to find the line style definition, exposed in the LineStyleManager API as an LsDefinition. The LsDefinition contains parameters describing the line style, plus the information needed to find the line style components. Each component is represented by a class derived from LsCacheComponent. All of the components required for a line style must be in the same file as the line style definition. Within the file, each component is uniquely identified by a type and ID. Within a design file, the type is one of the values defined in LsElementType and the ID is a standard ElementId. Within a resource file, the type is one of the values defined in LsResourceType and the ID is a resource ID represented by a 32-bit integer. For the most part, it is not important to be aware of the distinction. The line style API always uses 64-bit integer for ID's. LsCacheComponent::GetResourceType returns the appropriate LsResourceType regardless of whether the component is defined in a resource file or design file. LsCacheComponent::GetElementType always returns an appropriate value regardless of where the component is defined.
The component types are:
This section describes how the LineStyleManager uses the line style number from an element to find an LsDefinition.
If the line style number is STYLE_ByLevel, the LineStyleManager uses the element's level to get the line style number to use for the rest of this process.
If the style number is in the range STYLE_MinLineCode to STYLE_MaxLineCode, the LineStyleManager does not retrieve an LsDefinition. Handling of these line styles is strictly defined and does not require an LsDefinition. LineStyleManager does not do any special processing for STYLE_ByCell or STYLE_Invalid. It will treat them like normal style numbers, but it will fail to find the LsDefinition.
If the style number is greater than STYLE_MaxLineCode, the LineStyleManager searches for an LsMapEntry in the LsSystemMap and, if that succeeds, it uses the LsDefinition that the LsMapEntry references. Note that line style numbers greater than STYLE_MaxLineCode are unusual.
If the line style number is less than STYLE_MinLineCode or the search using the LsSystemMap failed, the LineStyleManager searches the design file's LsDgnFileMap to search for the LsMapEntry. If that fails, it is unable to resolve the line style. If it succeeds, it uses the LsDefinition obtained from LsMapEntry::GetLineStyle. The LsDefinition may refer to a line style defined in that design file, or to a line style defined in the resource file.
The lifetime of most objects in the line style system is controlled by reference counting. However, line style objects under control of the system should be treated as if the program has no control over the lifetime of the object. These objects are guaranteed to survive as long as the current context is valid and they provide no useful purpose when the context is no longer valid. Therefore, the client code needs to retrieve references to the objects and immediately extract all of the necessary information.
LsResourceFileMap objects exist until the program releases the last reference. The LsResourceFileMap holds a reference to every object created via CreateLineStyleDefinition. See LsResourceFileMap for a discussion of how it controls the lifetime of objects created via it's Create... methods.
typedef RefCountedPtr<LineStyleHandle> LineStyleHandlePtr |
typedef RefCountedPtr<LsComponent> LsComponentPtr |
typedef bvector<LsComponentPtr> LsComponentVector |
typedef RefCountedPtr<LsCompoundComponent> LsCompoundComponentPtr |
typedef RefCountedPtr<LsCompoundInfo> LsCompoundInfoPtr |
typedef RefCountedPtr<LsDgnFileMap> LsDgnFileMapPtr |
Smart pointer wrapper for LsDgnFileMap.
typedef RefCountedPtr<LsInternalComponent> LsInternalComponentPtr |
typedef RefCountedPtr<LsLineCodeComponent> LsLineCodeComponentPtr |
typedef RefCountedPtr<LsLinePointComponent> LsLinePointComponentPtr |
typedef RefCountedPtr<LsMap> LsMapPtr |
Smart pointer wrapper for LsMap.
typedef RefCountedPtr<LsPointSymbolComponent> LsPointSymbolComponentPtr |
typedef RefCountedPtr<LsPointSymbolInfo> LsPointSymbolInfoPtr |
typedef RefCountedPtr<LsRasterImageComponent> LsRasterImageComponentPtr |
typedef RefCountedPtr<LsResourceFileMap> LsResourceFileMapPtr |
Smart pointer wrapper for LsResourceFileMap.
typedef RefCountedPtr<LsStrokeData> LsStrokeDataPtr |
typedef RefCountedPtr<LsSystemMap> LsSystemMapPtr |
Smart pointer wrapper for LsSystemMap.
|
strong |
Returned from GetCapMode()
|
strong |
enum LsKnownStyleNumber |
Special style numbers that form a subset of values that may passed to LineStyleManager::GetNameFromNumber() or returned from LineStyleManager::GetNumberFromName()
Enumerator | |
---|---|
STYLE_MinLineCode | |
STYLE_MaxLineCode | |
STYLE_ByLevel | |
STYLE_ByCell | |
STYLE_Invalid |
|
strong |
|
strong |
Values held in line style defintion components in resource files.