CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
DbRasterImageDef.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, 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-2022 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
217 static OdDbObjectId createImageDictionary(OdDbDatabase* pDb);
218
223 static OdDbObjectId imageDictionary(OdDbDatabase* pDb);
224
225 enum
226 {
227 kMaxSuggestNameSize = 2049
228 };
229
237 static OdString suggestName(const OdDbDictionary* pImageDictionary,
238 const OdString& strFilePath, int nMaxLength = kMaxSuggestNameSize);
239
244
252 /* comment this out for a while
253
254 int colorDepth() const;
255 OdGiSentScanLines* makeScanLines(
256 const OdGiRequestScanLines* pReq,
257 const OdGeMatrix2d& pixToScreen,
258 OdGePoint2dArray* pActiveClipBndy = 0, // Data will be modified!
259 bool draftQuality = false,
260 bool isTransparent = false,
261 const double brightness = 50.0,
262 const double contrast = 50.0,
263 const double fade = 0.0
264 ) const;
265 OdString searchForActivePath();
266 void embed(); // this function is not implemented in ARX
267 bool isEmbedded() const;
268 OdString fileType() const;
269 void setUndoStoreSize(unsigned int maxImages = 10);
270 unsigned int undoStoreSize() const;
271 bool imageModified() const;
272 void setImageModified(bool modified);
273 void loadThumbnail(OdUInt16& maxWidth, OdUInt16& maxHeight,
274 OdUInt8* pPalette = 0, int nPaletteEntries = 0);
275 void unloadThumbnail();
276 void* createThumbnailBitmap(BITMAPINFO*& pBitmapInfo,
277 OdUInt8 brightness = 50, OdUInt8 contrast = 50, OdUInt8 fade = 0);
278 IeFileDesc* fileDescCopy() const;
279 void getScanLines(OdGiBitmap& bitmap,
280 double brightness = 50.0,
281 double contrast = 50.0,
282 double fade = 0.0) const;
283 void openImage(IeImg*& pImage);
284 void closeImage();
285
286 */
291 static int classVersion();
292};
293
294
295
296
312{
313public:
315
317
319 OdDbDwgFiler* pFiler);
320
322 OdDbDwgFiler* pFiler) const;
323
325 OdDbDxfFiler* pFiler);
326
328 OdDbDxfFiler* pFiler) const;
329
338 void erased(
339 const OdDbObject* pObject,
340 bool erasing = true);
341
350 const OdDbObject* pObject);
351
353 {
354 kUnload = 1,
355 kErase = 2
356 };
362 static void setEnable(
363 bool enable);
364
387 virtual bool onDeleteImage(
388 const OdDbRasterImageDef* pImageDef,
389 DeleteImageEvent event,
390 bool cancelAllowed);
391
395 static int classVersion();
396};
397
402
409{
410protected:
412public:
414
433 virtual bool onDeleteImage( const OdDbRasterImageDef* pImageDef,
435 bool cancelAllowed ) = 0;
436};
437
438/* comment this for a while */
439
440#if 0
446class TOOLKIT_EXPORT OdDbRasterImageDefFileAccessReactor : public OdDbObjectReactor
447{
448protected:
449 OdDbRasterImageDefFileAccessReactor() {}
450public:
451 ODRX_DECLARE_MEMBERS(OdDbRasterImageDefFileAccessReactor);
452
459 virtual void onAttach(const OdDbRasterImageDef*, const OdString& pPath) = 0;
460
467 virtual void onDetach(const OdDbRasterImageDef*, const OdString& pPath) = 0;
468
478 virtual bool onOpen(const OdDbRasterImageDef*, const OdString& pPath,
479 const OdString& pActivePath, bool& replacePath, OdString& replacementPath) = 0;
480
490 virtual bool onPathChange(const OdDbRasterImageDef*,
491 const OdString& pPath, const OdString& pActivePath,
492 bool& replacePath, OdString& replacementPath) = 0;
493
500 virtual void onClose(const OdDbRasterImageDef*, const OdString& pPath) = 0;
501
509 virtual void onDialog(OdDbRasterImageDef*,
510 const OdString& pCaption, const OdString& pFileExtensions) = 0;
511};
512
513#endif
514
515
516// next 3 functions are static...
518 if (!pDb)
519 throw OdError(eNoDatabase);
521 OdDbObjectId ImgDictId = pRootDict->getAt(ACAD_IMAGE_DICT);
522 if (ImgDictId.isNull()) {
523 OdDbObjectPtr pImgDict = OdDbDictionary::createObject();
524 ImgDictId = pRootDict->setAt(ACAD_IMAGE_DICT, pImgDict);
525 }
526 return ImgDictId;
527}
528
530 if (!pDb)
531 throw OdError(eNoDatabase);
533 return pDict->getAt(ACAD_IMAGE_DICT);
534}
535
536inline OdString OdDbRasterImageDef::suggestName(const OdDbDictionary* pDic, const OdString& strPath, int nMaxLength) {
537 return pDic->suggestName(strPath, nMaxLength);
538}
539
544
545#include "TD_PackPop.h"
546
547#endif // __DBRASTERIMAGEDEF_H
548
#define TOOLKIT_EXPORT
Definition: DbExport.h:40
OdSmartPtr< OdDbRasterImageDef > OdDbRasterImageDefPtr
OdSmartPtr< OdDbRasterImageDefReactor > OdDbRasterImageDefReactorPtr
#define ISM_EXPORT
OdResult
Definition: OdResult.h:29
#define ODRX_DECLARE_MEMBERS(ClassName)
Definition: RxObject.h:112
OdDbObjectId getNamedObjectsDictionaryId() const
OdString suggestName(const OdString &strFilePath, const int nMaxLength=kMaxSuggestNameSize) 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)
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)
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