CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
DbRasterImageDef.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
3// All rights reserved.
4//
5// This software and its documentation and related materials are owned by
6// the Alliance. The software may only be incorporated into application
7// programs owned by members of the Alliance, subject to a signed
8// Membership Agreement and Supplemental Software License Agreement with the
9// Alliance. The structure and organization of this software are the valuable
10// trade secrets of the Alliance and its suppliers. The software is also
11// protected by copyright law and international treaty provisions. Application
12// programs incorporating this software must include the following statement
13// with their copyright notices:
14//
15// This application incorporates Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
18// All rights reserved.
19//
20// By use of this software, its documentation or related materials, you
21// acknowledge and accept the above terms.
23
24
25
26
27#ifndef __DBRASTERIMAGEDEF_H
28#define __DBRASTERIMAGEDEF_H
29
30#include "TD_PackPush.h"
31
32// Forward declarations
33//
34
35class OdDbDictionary;
36
37#include "DbObjectReactor.h"
38#include "DbObject.h"
39#include "Gi/GiRasterImage.h"
40#include "Ge/GeVector2d.h"
41#include "RxObjectImpl.h"
42#include "DbDictionary.h"
43#include "DbSymUtl.h"
44
45#ifdef ISM_EXPORTS
46#define ISM_EXPORT OD_TOOLKIT_EXPORT
47#define ISM_EXPORT_STATIC OD_STATIC_EXPORT
48#else
49#define ISM_EXPORT OD_TOOLKIT_IMPORT
50#define ISM_EXPORT_STATIC OD_STATIC_IMPORT
51#endif
52
66{
67public:
69
71
73
75 bool erasing);
76 virtual void subHandOverTo (
77 OdDbObject* pNewObject);
78 void subClose();
79
81 OdDbDwgFiler* pFiler);
82
84 OdDbDwgFiler* pFiler) const;
85
87 OdDbDxfFiler* pFiler);
88
90 OdDbDxfFiler* pFiler) const;
91
97 virtual OdResult setSourceFileName(const OdString& pathName);
98
108 virtual OdString sourceFileName() const;
109
123 virtual OdResult load(
124 bool modifyDatabase = true);
125
135 virtual void unload(
136 bool modifyDatabase = true);
137
141 virtual bool isLoaded() const;
142
146 virtual OdGeVector2d size() const;
147
148
157
165
171 int entityCount(bool* pbLocked = NULL) const;
172
179 void updateEntities() const;
180
185
193
197 virtual OdGiRasterImagePtr image(bool load = true);
198
207 virtual void setImage(OdGiRasterImage* pImage, bool modifyDatabase = true);
208
218
224
228 static const OdConstString& dictionaryName() { return ACAD_IMAGE_DICT; }
229
230 enum
231 {
233 };
234
242 static OdString suggestName(const OdDbDictionary* pImageDictionary,
243 const OdString& strFilePath, int nMaxLength = kMaxSuggestNameSize);
244
249
257 /* comment this out for a while
258
259 int colorDepth() const;
260 OdGiSentScanLines* makeScanLines(
261 const OdGiRequestScanLines* pReq,
262 const OdGeMatrix2d& pixToScreen,
263 OdGePoint2dArray* pActiveClipBndy = 0, // Data will be modified!
264 bool draftQuality = false,
265 bool isTransparent = false,
266 const double brightness = 50.0,
267 const double contrast = 50.0,
268 const double fade = 0.0
269 ) const;
270 OdString searchForActivePath();
271 void embed(); // this function is not implemented in ARX
272 bool isEmbedded() const;
273 OdString fileType() const;
274 void setUndoStoreSize(unsigned int maxImages = 10);
275 unsigned int undoStoreSize() const;
276 bool imageModified() const;
277 void setImageModified(bool modified);
278 void loadThumbnail(OdUInt16& maxWidth, OdUInt16& maxHeight,
279 OdUInt8* pPalette = 0, int nPaletteEntries = 0);
280 void unloadThumbnail();
281 void* createThumbnailBitmap(BITMAPINFO*& pBitmapInfo,
282 OdUInt8 brightness = 50, OdUInt8 contrast = 50, OdUInt8 fade = 0);
283 IeFileDesc* fileDescCopy() const;
284 void getScanLines(OdGiBitmap& bitmap,
285 double brightness = 50.0,
286 double contrast = 50.0,
287 double fade = 0.0) const;
288 void openImage(IeImg*& pImage);
289 void closeImage();
290
291 */
296 static int classVersion();
297protected:
298 OdDbObjectPtr subWblockClone(OdDbIdMapping& idMap, OdDbObject* owner, bool bPrimary) const override;
299};
300
301
302
303
319{
320public:
322
324
326 OdDbDwgFiler* pFiler);
327
329 OdDbDwgFiler* pFiler) const;
330
332 OdDbDxfFiler* pFiler);
333
335 OdDbDxfFiler* pFiler) const;
336
345 void erased(
346 const OdDbObject* pObject,
347 bool erasing = true);
348
357 const OdDbObject* pObject);
358
360 {
363 };
364
369 static void setEnable(
370 bool enable);
371
394 virtual bool onDeleteImage(
395 const OdDbRasterImageDef* pImageDef,
396 DeleteImageEvent event,
397 bool cancelAllowed);
398
402 static int classVersion();
403};
404
409
444
445/* comment this for a while */
446
447#if 0
448
449
453class TOOLKIT_EXPORT OdDbRasterImageDefFileAccessReactor : public OdDbObjectReactor
454{
455protected:
456 OdDbRasterImageDefFileAccessReactor() {}
457public:
458 ODRX_DECLARE_MEMBERS(OdDbRasterImageDefFileAccessReactor);
459
466 virtual void onAttach(const OdDbRasterImageDef*, const OdString& pPath) = 0;
467
474 virtual void onDetach(const OdDbRasterImageDef*, const OdString& pPath) = 0;
475
485 virtual bool onOpen(const OdDbRasterImageDef*, const OdString& pPath,
486 const OdString& pActivePath, bool& replacePath, OdString& replacementPath) = 0;
487
497 virtual bool onPathChange(const OdDbRasterImageDef*,
498 const OdString& pPath, const OdString& pActivePath,
499 bool& replacePath, OdString& replacementPath) = 0;
500
507 virtual void onClose(const OdDbRasterImageDef*, const OdString& pPath) = 0;
508
516 virtual void onDialog(OdDbRasterImageDef*,
517 const OdString& pCaption, const OdString& pFileExtensions) = 0;
518};
519
520#endif
521
522
523// next 3 functions are static...
525 if (!pDb)
526 throw OdError(eNoDatabase);
528 OdDbObjectId ImgDictId = pRootDict->getAt(ACAD_IMAGE_DICT);
529 if (ImgDictId.isNull()) {
530 OdDbObjectPtr pImgDict = OdDbDictionary::createObject();
531 ImgDictId = pRootDict->setAt(ACAD_IMAGE_DICT, pImgDict);
532 }
533 return ImgDictId;
534}
535
537 if (!pDb)
538 throw OdError(eNoDatabase);
540 return pDict->getAt(ACAD_IMAGE_DICT);
541}
542
543inline OdString OdDbRasterImageDef::suggestName(const OdDbDictionary* pDic, const OdString& strPath, int nMaxLength) {
544 return pDic->suggestName(strPath, nMaxLength);
545}
546
551
552#include "TD_PackPop.h"
553
554#endif // __DBRASTERIMAGEDEF_H
555
OdSmartPtr< OdDbDictionary > OdDbDictionaryPtr
Definition DbDatabase.h:109
#define TOOLKIT_EXPORT
Definition DbExport.h:40
OdSmartPtr< OdGiRasterImage > OdGiRasterImagePtr
Definition DbLayout.h:36
OdSmartPtr< OdDbObject > OdDbObjectPtr
Definition DbObject.h:1750
OdSmartPtr< OdDbRasterImageDef > OdDbRasterImageDefPtr
OdSmartPtr< OdDbRasterImageDefReactor > OdDbRasterImageDefReactorPtr
#define ISM_EXPORT
OdResult
Definition OdResult.h:29
OdString OdString
Definition OdString.h:1258
#define ODRX_DECLARE_MEMBERS(ClassName)
Definition RxObject.h:112
OdDbObjectId getNamedObjectsDictionaryId() const
OdDbObjectId setAt(const OdString &name, OdDbObject *newValue)
OdString suggestName(const OdString &strFilePath, const int nMaxLength=kMaxSuggestNameSize) const
OdDbObjectPtr getAt(const OdString &name, OdDb::OpenMode mode) const
OdDbObjectPtr safeOpenObject(OdDb::OpenMode openMode=OdDb::kForRead, bool openErasedOne=false) const
bool isNull() const
Definition DbObjectId.h:115
OdResult dwgInFields(OdDbDwgFiler *pFiler)
virtual void unload(bool modifyDatabase=true)
virtual void setImage(OdGiRasterImage *pImage, bool modifyDatabase=true)
static const OdConstString & dictionaryName()
virtual OdString sourceFileName() const
void dwgOutFields(OdDbDwgFiler *pFiler) const
virtual void setResolutionUnits(enum OdGiRasterImage::Units)
virtual OdGeVector2d resolutionMMPerPixel() const
virtual void subHandOverTo(OdDbObject *pNewObject)
static int classVersion()
virtual OdGiRasterImage::Units resolutionUnits() const
virtual OdGeVector2d size() const
OdGiRasterImage::Units Units
OdString activeFileName() const
static OdDbObjectId imageDictionary(OdDbDatabase *pDb)
static OdString suggestName(const OdDbDictionary *pImageDictionary, const OdString &strFilePath, int nMaxLength=kMaxSuggestNameSize)
static OdDbObjectId createImageDictionary(OdDbDatabase *pDb)
OdResult setActiveFileName(const OdString &pPathName)
void updateEntities() const
virtual OdGiRasterImagePtr image(bool load=true)
ODDB_DECLARE_MEMBERS(OdDbRasterImageDef)
void dxfOutFields(OdDbDxfFiler *pFiler) const
virtual OdResult setResolutionMMPerPixel(const OdGeVector2d &)
virtual OdResult setSourceFileName(const OdString &pathName)
OdResult subErase(bool erasing)
virtual OdResult load(bool modifyDatabase=true)
virtual bool isLoaded() const
int entityCount(bool *pbLocked=NULL) const
OdResult dxfInFields(OdDbDxfFiler *pFiler)
OdDbObjectPtr subWblockClone(OdDbIdMapping &idMap, OdDbObject *owner, bool bPrimary) const override
void dxfOutFields(OdDbDxfFiler *pFiler) const
void erased(const OdDbObject *pObject, bool erasing=true)
void dwgOutFields(OdDbDwgFiler *pFiler) const
ODDB_DECLARE_MEMBERS(OdDbRasterImageDefReactor)
void modified(const OdDbObject *pObject)
OdResult dwgInFields(OdDbDwgFiler *pFiler)
virtual bool onDeleteImage(const OdDbRasterImageDef *pImageDef, DeleteImageEvent event, bool cancelAllowed)
OdResult dxfInFields(OdDbDxfFiler *pFiler)
static void setEnable(bool enable)
ODRX_DECLARE_MEMBERS(OdDbRasterImageDefTransReactor)
virtual bool onDeleteImage(const OdDbRasterImageDef *pImageDef, OdDbRasterImageDefReactor::DeleteImageEvent event, bool cancelAllowed)=0
@ kForWrite
Definition DbObjectId.h:57