DgnRaster.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------------------+
2 |
3 | Supplied under applicable software license agreement.
4 |
5 | Copyright (c) 2018 Bentley Systems, Incorporated. All rights reserved.
6 |
7 +---------------------------------------------------------------------------------------*/
8 #pragma once
9 
10 #include "RasterCore.h"
11 
14 
16 
18 
19 
20 /*=================================================================================**/
24  {
27  DGNRASTER_STATUS_InvalidPassword = (-3014), // MDLERR_INVALIDPASSWORD
28  DGNRASTER_STATUS_InvalidAccessMode = (-3005), // MDLERR_INVALIDACCESSMODE
29  DGNRASTER_STATUS_InvalidPageNumber = (-3012), // MDLERR_INVALIDPAGE
30  };
31 
32 
33 //=======================================================================================
36 //=======================================================================================
37 struct DgnRasterOpenParams : public RefCountedBase
38 {
39 public:
40 
44  RASTERCORE_EXPORT static DgnRasterOpenParamsPtr Create(DgnDocumentMonikerPtr& moniker, bool readonly);
45 
46  RASTERCORE_EXPORT DgnRasterOpenParamsPtr Clone() const;
47 
48  RASTERCORE_EXPORT WString GetFilename() const;
49  RASTERCORE_EXPORT WString GetFilespec() const;
50 
53 
56 
58  RASTERCORE_EXPORT bool IsOpenReadOnly() const;
59  RASTERCORE_EXPORT void SetOpenReadOnly(bool readOnly);
60 };
61 
62 /*----------------------------------------------------------------------------+
64 |Class DgnRaster
65 +----------------------------------------------------------------------------*/
66 CLRPUBLIC struct DgnRaster : public RefCountedBase,
67  public NonCopyableClass
68  {
69 public:
70 
72  RASTERCORE_EXPORT static DgnRasterPtr Create(DgnRasterStatus& status, DgnRasterOpenParamsR openParams, DgnModelRefR modelRef);
73 
76  RASTERCORE_EXPORT DgnRasterOpenParamsCR GetOpenParams() const;
77 
80 
82  //@return A refcounted pointer to the raster that was removed or NULL if an error occurs.
83  RASTERCORE_EXPORT DgnRasterPtr DeleteFromModel();
84 
87 
90 
93 
96 
99 
102 
105  RASTERCORE_EXPORT void SetDescription(WCharCP description);
106 
109 
111  RASTERCORE_EXPORT void SetLogicalName(WCharCP logicalName);
112 
114  RASTERCORE_EXPORT static bool IsLogicalNameUnique(WCharCP logicalName, DgnModelRefR dgnModel);
115 
117  RASTERCORE_EXPORT bool GetSnappableState() const;
118 
120  RASTERCORE_EXPORT void SetSnappableState(bool state);
121 
123  RASTERCORE_EXPORT bool GetLockedState() const;
124 
126  RASTERCORE_EXPORT void SetLockedState(bool state);
127 
130 
133 
136 
139 
142 
145 
148 
150  RASTERCORE_EXPORT void SetScanningResolution(DPoint2dCR scanningResolutionDPI);
151 
154  RASTERCORE_EXPORT bool GetViewState(int viewNumber) const;
155 
159  RASTERCORE_EXPORT void SetViewState(int viewNumber, bool state);
160 
162  RASTERCORE_EXPORT bool GetInvertState() const;
163 
165  RASTERCORE_EXPORT void SetInvertState(bool state);
166 
168  RASTERCORE_EXPORT bool GetPrintState() const;
169 
171  RASTERCORE_EXPORT void SetPrintState(bool state);
172 
174  RASTERCORE_EXPORT bool GetClipState() const;
175 
177  RASTERCORE_EXPORT void SetClipState(bool state);
178 
181 
183  RASTERCORE_EXPORT void SetTransparencyState(bool state);
184 
188 
192 
195 
198 
200  RASTERCORE_EXPORT double GetViewGamma() const;
201 
204  RASTERCORE_EXPORT void SetViewGamma(double gamma);
205 
207  RASTERCORE_EXPORT double GetPrintGamma() const;
208 
211  RASTERCORE_EXPORT void SetPrintGamma(double gamma);
212 
216 
220  RASTERCORE_EXPORT void SetTintColor(UInt32 rawColorIndex);
221 
226 
230  RASTERCORE_EXPORT void SetForegroundColor(UInt32 rawColorIndex);
231 
235 
239  RASTERCORE_EXPORT void SetBackgroundColor(UInt32 rawColorIndex);
240 
243 
246  RASTERCORE_EXPORT void SetContrast(Int8 contrast);
247 
250 
253  RASTERCORE_EXPORT void SetBrightness(Int8 brightness);
254 
257 
261 
264 
267 
270 
273 
277  RASTERCORE_EXPORT TransparentColorRgbArray const& GetTransparentColors(TransparentColorRgbArray& transparentColors) const;
278 
281  RASTERCORE_EXPORT void SetTransparentColors(TransparentColorRgbArray const& transparentColors);
282 
285 
288  RASTERCORE_EXPORT void SetDgnGCS(DgnGCSCP RasterDgnGCS);
289 
291  RASTERCORE_EXPORT RasterClipPropertiesCR GetClipProperties() const;
292 
295 
297  RASTERCORE_EXPORT bool IsReadOnly() const;
298 
300  RASTERCORE_EXPORT RasterSourceCP GetRasterSourceCP() const;
301 
302 
303  };
304 
305 //=======================================================================================
308 //=======================================================================================
310  {
311 public:
314  RASTERCORE_EXPORT static StatusInt SetOpenParams(StatusInt* rwStatus, DgnRasterR raster, DgnRasterOpenParamsR newOpenParams);
315 
317  RASTERCORE_EXPORT static DgnRasterStatus ReloadRasterSource(DgnRasterR raster, bool redraw);
318 
320  RASTERCORE_EXPORT static StatusInt CloseRasterSource(DgnRasterR raster, bool redraw);
321 
323  RASTERCORE_EXPORT static void SignalColorTableChange(DgnRasterR raster, byte *colorTable, UInt32 *colorMap, DgnModelRefP modelRef);
324  };
RASTERCORE_EXPORT void SetLogicalName(WCharCP logicalName)
RASTERCORE_EXPORT bool GetPrintState() const
Query if raster must be print.
RASTERCORE_EXPORT StatusInt ReplaceInModel()
Write this DgnRaster definition to the DgnModel. Call this after calling any Set methods.
struct DgnPlatform::DgnDocumentMoniker const & DgnDocumentMonikerCR
Definition: DgnPlatform.h:197
RASTERCORE_EXPORT void SetBackgroundTransparencyLevel(UInt8 transparency)
Set background transparency level. Binary raster only. [0,255], 0 -> Opaque.
Definition: DgnRaster.h:66
RASTERCORE_EXPORT bool IsReadOnly() const
Determine if this raster has read-only access to the source. This is the effective access mode and ma...
RASTERCORE_EXPORT bool GetViewState(int viewNumber) const
Query if the raster is displayed in a specific view.
RASTERCORE_EXPORT bool GetClipState() const
Query if raster clip properties are applied at display time.
RASTERCORE_EXPORT void SetTransform(TransformCR georef)
Change raster attachment transformation matrix (pixel to UOR).
Definition: Bentley.h:212
RASTERCORE_EXPORT RasterSourceCP GetRasterSourceCP() const
Get the RasterSource of this raster. May be NULL.
RASTERCORE_EXPORT void SetClipState(bool state)
Change if raster clip properties are applied at display time.
RASTERCORE_EXPORT UInt32 GetTintColor() const
Query raw color index used to tint raster.
RASTERCORE_EXPORT bool IsOpenReadOnly() const
Access mode initially specified by the user. This access mode can only be change by users by changing...
RASTERCORE_EXPORT DPoint2dCR GetScanningResolution() const
Query scanning resolution (in dot per inches (DPI), in x and y directions).
RASTERCORE_EXPORT void SetSnappableState(bool state)
Change if snap is enable for this raster.
RASTERCORE_EXPORT RasterClipPropertiesCR GetClipProperties() const
Query clipProperties set on this raster attachment.
#define RASTERCORE_EXPORT
Definition: DgnPlatform/ExportMacros.h:91
static RASTERCORE_EXPORT void SignalColorTableChange(DgnRasterR raster, byte *colorTable, UInt32 *colorMap, DgnModelRefP modelRef)
Inform raster of DgnModelRefP color table change.
RASTERCORE_EXPORT bool GetInvertState() const
Query if raster color must be inverted on display.
Definition: RasterCore.h:134
RefCountedPtr< DgnPlatform::DgnDocumentMoniker > DgnDocumentMonikerPtr
Definition: DgnPlatform.h:518
RASTERCORE_EXPORT void SetBrightness(Int8 brightness)
Change brightness apply at display [-128,+127], 0 -> nothing.
UInt32 LevelId
Definition: DgnPlatformBaseType.r.h:85
struct Bentley::WString const & WStringCR
Definition: Bentley.h:239
RASTERCORE_EXPORT void SetScanningResolution(DPoint2dCR scanningResolutionDPI)
Change scanning resolution (in dot per inches (DPI), in x and y directions).
RASTERCORE_EXPORT void SetDgnGCS(DgnGCSCP RasterDgnGCS)
Change the geographic coordinate system (geocoding) for this raster attachment.
struct GeoCoordinates::DgnGCS const * DgnGCSCP
Definition: DgnPlatform.h:499
RASTERCORE_EXPORT bool GetGCSInheritedFromModelState() const
Query if raster Geographic Coordinate System is inherited from the DgnModel raster is attached to...
RefCountedPtr< RasterClipProperties > RasterClipPropertiesPtr
Definition: IRasterAttachment.h:37
RASTERCORE_EXPORT WStringCR GetDescription() const
Gets description.
RASTERCORE_EXPORT StatusInt AddToModel()
Add this DgnRaster to the DgnModel. This DgnRaster will be owned by the modelRef raster collection...
RASTERCORE_EXPORT StatusInt SetClipProperties(RasterClipPropertiesPtr &clipProp)
Change clipProperties set on this raster attachment.
RASTERCORE_EXPORT bool GetLockedState() const
Query if lock is set for this raster.
RASTERCORE_EXPORT Int8 GetContrast() const
Query contrast apply at display [-128, +127], 0 -> nothing.
RASTERCORE_EXPORT DgnPlatform::RasterDisplayPriorityPlane GetDisplayPriorityPlane() const
Query the RasterDisplayPriorityPlane value.
RASTERCORE_EXPORT void SetViewIndependentState(bool state)
Change view independent display state for this attachment.
Definition: DgnRaster.h:37
DgnRasterStatus
Definition: DgnRaster.h:23
Definition: DgnRaster.h:27
RasterDisplayPriorityPlane
Definition: IRasterAttachment.h:43
BEGIN_RASTER_NAMESPACE typedef bvector< TransparentColorRgb > TransparentColorRgbArray
Definition: DgnRaster.h:17
uint8_t UInt8
Definition: Bentley.r.h:116
RASTERCORE_EXPORT void SetGCSInheritedFromModelState(bool state)
Change if raster Geographic Coordinate System is inherited from the DgnModel or not.
RASTERCORE_EXPORT bool GetSnappableState() const
Query if snap is enable for this raster.
RASTERCORE_EXPORT void SetTintColor(UInt32 rawColorIndex)
Change raw color index used to tint raster.
RASTERCORE_EXPORT DgnGCSCP GetDgnGCSCP() const
Query a pointer to the object that describe the geographic coordinate system (geocoding) for this ras...
static RASTERCORE_EXPORT DgnRasterPtr Create(DgnRasterStatus &status, DgnRasterOpenParamsR openParams, DgnModelRefR modelRef)
Create a new DgnRaster with provided open parameters.
wchar_t const * WCharCP
Definition: Bentley.h:224
RASTERCORE_EXPORT bool GetTransparencyState() const
Query if transparency must be displayed.
RASTERCORE_EXPORT void SetPrintGamma(double gamma)
Change gamma value used to print raster.
Definition: DgnRaster.h:26
uint32_t UInt32
Definition: Bentley.r.h:128
RASTERCORE_EXPORT UInt8 GetBackgroundTransparencyLevel() const
Get background transparency level. Binary raster only. [0,255], 0 -> Opaque.
RASTERCORE_EXPORT WString GetFilename() const
RASTERCORE_EXPORT void SetViewGamma(double gamma)
Change gamma value used to display raster in views.
RASTERCORE_EXPORT DgnRasterOpenParamsCR GetOpenParams() const
Query parameters that are used to open the raster source.
RASTERCORE_EXPORT DgnModelRefP GetModelRefP() const
Gets the DgnModelRef to which this DgnRaster applies.
int8_t Int8
Definition: Bentley.r.h:115
RASTERCORE_EXPORT TransformCR GetTransform() const
Query raster attachment transformation matrix (pixel to UOR).
#define END_RASTER_NAMESPACE
Definition: DgnPlatform.h:49
RASTERCORE_EXPORT void SetImageTransparencyLevel(UInt8 transparency)
Change transparency value applied to all raster image at display [0,255], 0 -> Opaque.
RASTERCORE_EXPORT void SetDisplayPriorityPlane(DgnPlatform::RasterDisplayPriorityPlane plane)
Change the RasterDisplayPriorityPlane value.
#define CLRPUBLIC
Definition: DgnPlatform/ExportMacros.h:12
RASTERCORE_EXPORT WStringCR GetLogicalName() const
Gets logical name.
RASTERCORE_EXPORT TransparentColorRgbArray const & GetTransparentColors(TransparentColorRgbArray &transparentColors) const
Query transparent color set on this raster attachment.
Definition: DgnRaster.h:25
RASTERCORE_EXPORT void SetOpenReadOnly(bool readOnly)
#define RASTER_TYPEDEFS(t)
Definition: DgnPlatform.h:95
static RASTERCORE_EXPORT DgnRasterStatus ReloadRasterSource(DgnRasterR raster, bool redraw)
Load or reload the raster source using the current DgnRasterOpenParams.
#define BEGIN_RASTER_NAMESPACE
Definition: DgnPlatform.h:48
struct DPoint2d const & DPoint2dCR
Definition: msgeomstructs_typedefs.h:78
A Bentley supplied implementation std::vector.
Definition: stdcxx/bvector.h:77
RASTERCORE_EXPORT DgnRasterOpenParamsPtr Clone() const
RASTERCORE_EXPORT void SetForegroundColor(UInt32 rawColorIndex)
Change raw color index used as foreground color.
RASTERCORE_EXPORT bool GetBinaryPrintInvertState() const
Query if background and foreground color should be inverted for binary raster file during print...
unsigned char byte
Definition: Bentley.r.h:144
RASTERCORE_EXPORT UInt8 GetImageTransparencyLevel() const
Query transparency value applied to all raster image at display [0, 255], 0 -> Opaque.
RASTERCORE_EXPORT void SetContrast(Int8 contrast)
Change contrast apply at display [-128,+127], 0 -> nothing.
RASTERCORE_EXPORT void SetBinaryPrintInvertState(bool state)
Change if background and foreground color should be inverted for binary raster file during print...
RASTERCORE_EXPORT bool GetViewIndependentState() const
Query if this raster display is view independent.
struct Transform const & TransformCR
Definition: msgeomstructs_typedefs.h:134
RASTERCORE_EXPORT WString GetFilespec() const
int StatusInt
Definition: Bentley.h:222
static RASTERCORE_EXPORT StatusInt SetOpenParams(StatusInt *rwStatus, DgnRasterR raster, DgnRasterOpenParamsR newOpenParams)
Set parameters that are used to open the raster source.
struct DgnPlatform::DgnModelRef & DgnModelRefR
Definition: DgnPlatform.h:223
struct DgnPlatform::ElementRefBase * ElementRefP
Definition: DgnPlatform.h:166
static RASTERCORE_EXPORT StatusInt CloseRasterSource(DgnRasterR raster, bool redraw)
Physically close the raster source of the provided raster and every raster using the same source...
RASTERCORE_EXPORT UInt32 GetForegroundColor() const
Query raw color index used as foreground color.
RASTERCORE_EXPORT void SetLevel(DgnPlatform::LevelId level)
Assign the attachment itself to a level in the parent file.
RASTERCORE_EXPORT double GetViewGamma() const
Query gamma value used to display raster in views. Zero is illegal and no gamma = 1...
RASTERCORE_EXPORT void SetBackgroundColor(UInt32 rawColorIndex)
Change raw color index used as background color.
RASTERCORE_EXPORT void SetDescription(WCharCP description)
Change raster attachment description.
RASTERCORE_EXPORT ElementRefP GetElementRef() const
Gets the ElementRefP of the persistent storage of this DgnRaster. May be NULL.
Definition: Bentley.h:210
static RASTERCORE_EXPORT DgnRasterOpenParamsPtr Create(DgnDocumentMonikerPtr &moniker, bool readonly)
Create an instance of a DgnRasterOpenParams from a DgnDocumentMoniker and a readonly preference...
RASTERCORE_EXPORT void SetViewState(int viewNumber, bool state)
Change if the raster is displayed in a specific view.
static RASTERCORE_EXPORT bool IsLogicalNameUnique(WCharCP logicalName, DgnModelRefR dgnModel)
Validate logical name uniqueness.
RASTERCORE_EXPORT Int8 GetBrightness() const
Query brightness apply at display [-128, +127], 0 -> nothing.
RASTERCORE_EXPORT void SetTransparentColors(TransparentColorRgbArray const &transparentColors)
Change transparent color set on this raster attachment.
RASTER_REF_COUNTED_PTR(DgnRaster)
RASTERCORE_EXPORT void SetTransparencyState(bool state)
Change if transparency must be displayed.
Definition: DgnRaster.h:29
RASTERCORE_EXPORT UInt8 GetForegroundTransparencyLevel() const
Get foreground transparency level. Binary raster only. [0,255], 0 -> Opaque.
RASTERCORE_EXPORT DgnRasterPtr DeleteFromModel()
Delete this DgnRaster from the DgnModel.
struct DgnPlatform::DgnModelRef * DgnModelRefP
Definition: DgnPlatform.h:223
Definition: DgnRaster.h:309
RASTERCORE_EXPORT double GetPrintGamma() const
Query gamma value used to print raster. Zero is illegal and no gamma = 1.0.
RASTERCORE_EXPORT void SetLockedState(bool state)
Change the lock state for this raster.
RASTERCORE_EXPORT void SetForegroundTransparencyLevel(UInt8 transparency)
Set foreground transparency level. Binary raster only. [0,255], 0 -> Opaque.
RASTERCORE_EXPORT DgnPlatform::LevelId GetLevel() const
Get the level of the attachment in the model that contains it.
Definition: DgnRaster.h:28
RASTERCORE_EXPORT void SetAttachMoniker(DgnDocumentMonikerPtr &moniker)
Set the moniker that identifies the raster file.
RASTERCORE_EXPORT DgnDocumentMonikerCR GetAttachMoniker() const
Get the moniker that identifies the raster file.
RASTERCORE_EXPORT void SetInvertState(bool state)
Change if raster color must be inverted on display.
RASTERCORE_EXPORT void SetPrintState(bool state)
Change if raster must be print.
RASTERCORE_EXPORT UInt32 GetBackgroundColor() const
Query raw color index used as background color.

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.