zjf
2023-03-10 abac8765bf6a1f400c2377b9999ce7495ba34a3f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
/////////////////////////////////////////////////////////////////////////////// 
// Copyright (C) 2002-2016, Open Design Alliance (the "Alliance"). 
// All rights reserved. 
// 
// This software and its documentation and related materials are owned by 
// the Alliance. The software may only be incorporated into application 
// programs owned by members of the Alliance, subject to a signed 
// Membership Agreement and Supplemental Software License Agreement with the
// Alliance. The structure and organization of this software are the valuable  
// trade secrets of the Alliance and its suppliers. The software is also 
// protected by copyright law and international treaty provisions. Application  
// programs incorporating this software must include the following statement 
// with their copyright notices:
//   
//   This application incorporates Teigha(R) software pursuant to a license 
//   agreement with Open Design Alliance.
//   Teigha(R) Copyright (C) 2002-2016 by Open Design Alliance. 
//   All rights reserved.
//
// By use of this software, its documentation or related materials, you 
// acknowledge and accept the above terms.
///////////////////////////////////////////////////////////////////////////////
 
 
 
 
#ifndef   _ODRX_EVENT_H__
#define   _ODRX_EVENT_H__
 
#include "TD_PackPush.h"
 
#include "RxObject.h"
 
#define ODRX_EVENT_OBJ OD_T("OdRxEvent")
 
class OdDbDatabase;
class OdGeMatrix3d;
class OdDbIdMapping;
class OdGePoint3d;
class OdDbObjectId;
 
/** \details
    This class is the base class for custom classes that receive notification
    of OdRxEvent (application level) events.
    
    \note
    The default implementations of all methods in this class do nothing but return.
 
    \sa
    TD_Db
  
    <group OdRx_Classes> 
*/
class TOOLKIT_EXPORT OdRxEventReactor : public OdRxObject 
public:
  ODRX_DECLARE_MEMBERS(OdRxEventReactor);
  
  /** \details
    Notification function called whenever a .dwg file is being read.
    
    \param pDb [in]  Pointer to the database being created.
    \param filename [in]  Name of the .dwg file.
    
    \remarks
    This function is called during the operation.
    
    \sa
    * databaseConstructed
    * initialDwgFileOpenComplete
  */
  virtual void dwgFileOpened(
    OdDbDatabase* pDb, 
    const OdString& filename);
    
  /** \details
    Notification function called whenever a .dwg file has been read.
    
    \param pDb [in]  Pointer to the database being created.
    
    \remarks
    This function is called after the read operation, but before the database is constructed.
    
    \sa
    * databaseConstructed
    * dwgFileOpened
  */
  virtual void initialDwgFileOpenComplete(
    OdDbDatabase* pDb);
    
  /** \details
    Notification function called whenever a database has been constructed from a file.
    
    \param pDb [in]  Pointer to the database constructed.
    
    \remarks
    This function is called after the operation.
    
    \sa
    * dwgFileOpened
    * initialDwgFileOpenComplete
  */
  virtual void databaseConstructed(
    OdDbDatabase* pDb);
 
  /** \details
    Notification function called whenever a database is about to be deleted from memory.  
 
    \param pDb [in]  Pointer to the database to be destroyed.
    
    \remarks
    This function is called before the operation.
  */
  virtual void databaseToBeDestroyed(
    OdDbDatabase* pDb);
  
  /** \details
    Notification function called whenever a database is about to be saved to a .dwg file.
    
    \param pDb [in]  Pointer to the database to be saved.
    \param intendedName [in]  Intended name of the .dwg file.
    
    \remarks
    This function is called before the operation, and before the user 
    has had a chance to modify the filename. The file may not have the intendedName.
    
    \sa
    * abortSave
    * saveComplete
  */
  virtual void beginSave(
    OdDbDatabase* pDb, 
    const OdString& intendedName);
 
  /** \details
    Notification function called whenever a database has been saved 
    to a .dwg file.
    
    \param pDb [in]  Pointer to the database saved.
    \param actualName [in]  Actual name of the .dwg file.
    
    \remarks
    This function is called after the operation, but before the database is constructed.
    
    \sa
    * abortSave
    * beginSave
  */
  virtual void saveComplete(
    OdDbDatabase* pDb, 
    const OdString& actualName);
    
  /** \details
    Notification function called whenever the save of a database has failed.
    
    \param pDb [in]  Pointer to the database being saved.
    
    \remarks
    This function is called after the operation.
 
    \sa
    * beginSave
    * saveComplete
  */
  virtual void abortSave(
    OdDbDatabase* pDb);
  
  // DXF In/Out Events.
 
  /** \details
    Notification function called whenever a database is about to be modified by a DXF input operation.
    
    \param pDb [in]  Pointer to the database to be modified.
    
    \remarks
    This function is called before the operation.
    
    \sa
    * abortDxfIn
    * dxfInComplete
  */
  virtual void beginDxfIn(
    OdDbDatabase* pDb);
    
  /** \details
    Notification function called whenever the DXF input to a database has failed.
    
    \param pDb [in]  Pointer to the database being modified.
    
    \remarks
    This function is called after the operation.
        
    \sa
    * beginDxfIn
    * dxfInComplete
  */
  virtual void abortDxfIn(
    OdDbDatabase* pDb);
 
  /** \details
    Notification function called whenever a database has been modified by a DXF input operation.
    
    \param pDb [in]  Pointer to the database modified.
    
    \remarks
    This function is called after the operation.
    
    \sa
    * abortDxfIn
    * beginDxfIn
  */
   virtual void dxfInComplete(
    OdDbDatabase* pDb);
 
 
  /** \details
    Notification function called whenever a database is about to be saved to a DXF file.
    
    \param pDb [in]  Pointer to the database to be saved.
    
    \remarks
    This function is called before the operation
    
    \sa
    * abortDxfOut
    * dxfOutComplete
  */
  virtual void beginDxfOut(
    OdDbDatabase* pDb);
    
    
  /** \details
    Notification function called whenever the DXF output from a database has failed.
    
    \param pDb [in]  Pointer to the database being saved.
    
    \remarks
    This function is called after the operation.
        
    \sa
    beginDxfOut
    dxfOutComplete
  */
  virtual void abortDxfOut(
    OdDbDatabase* pDb);
    
    
  /** \details
    Notification function called whenever a database has be saved to a DXF file.
       
    \param pDb [in]  Pointer to the database saved.
    
    \remarks
    This function is called after the operation.
    
    \sa
    * abortDxfOut
    * beginDxfOut
  */
  virtual void dxfOutComplete(
    OdDbDatabase* pDb);
  
  // Insert Events.
  
  /** \details
    Notification function called whenever one database is about to be inserted into another.
    
    \param pToDb [in]  Destination database.
    \param pFromDb [in]  Source database.
    \param blockName [in]  Name of the block.
    \param xfm [in]  Transformation matrix.
    
    \remarks
    This function is called before the operation.
    
    \remarks
    If blockName is specified, pFromDb was inserted into pToDb as a OdDbBlockTableRecord.
    
    If xfm is specified, pFromDb was inserted into pToDb as entities.
    
    \sa
    * abortInsert
    * endInsert
    * otherInsert
  */
  virtual void beginInsert(
    OdDbDatabase* pToDb, 
    const OdString& blockName, 
    OdDbDatabase* pFromDb);
  virtual void beginInsert(
    OdDbDatabase* pToDb, 
    const OdGeMatrix3d& xfm, 
    OdDbDatabase* pFromDb);
    
  /** \details
    Notification function called whenever one database has been inserted into another.
    
    \param pToDb [in]  Destination database.
    \param pFromDb [in]  Source database.
    \param idMap [in]  ID Map source -> destination.
    
    \remarks
    This function is called after the operation, and is sent just before 
    beginDeepCloneXlation. It is called before any Object IDs are translated.
    
    \note
    Object IDs of cloned objects do not point at the cloned objects, and
    must therefore not not be used at this point for any operations on
    those objects.
    
    \sa
    * abortInsert
    * beginInsert
    * endInsert
  */
  virtual void otherInsert(
    OdDbDatabase* pToDb, 
    OdDbIdMapping& idMap, 
    OdDbDatabase* pFromDb);
    
  /** \details
    Notification function called whenever the insertion of a database has failed.
    
    \param pToDb [in]  Destination database.
    
    \remarks
    This function is called after the operation.
        
    \sa
    * beginInsert
    * endInsert
    * otherInsert
  */
  virtual void abortInsert(
    OdDbDatabase* pToDb);
    
  /** \details
    Notification function called whenever the insertion of a database has succeeded.
    
    \param pToDb [in]  Destination database.
    
    \remarks
    This function is called after the operation.
        
    \sa
    * abortInsert
    * beginInsert
    * otherInsert
  */
  virtual void endInsert(
    OdDbDatabase* pToDb);
  
  // Wblock Events.
 
  /** \details
    Notification function called while one database is about to be wblocked to another.
    
    \param pFromDb [in]  Source database.
  */
  virtual void wblockNotice(
    OdDbDatabase* pFromDb);
  
  /** \details
    Notification function called while one database is being wblocked to another.
    
    \param pToDb [in]  Destination database.
    \param pFromDb [in]  Source database.
    \param insertionPoint [in]  INSBASE of pToDb.
    \param blockId [in]  Object ID of OdDbBlockTableRecord being wblocked.
    
    \remarks
    This function is called during the operation.
    
    If insertionPoint is specified, the wblock operation is being performed on a set
    of entities in pFromDb.
    
    If blockId is specified, the wblock operation is being performed on a 
    BlockTableRecord in pFromDb.
    
    If neither insertionPoint nor blockId is specified, the entire pFromDb database is
    wblocked to pToDb.  
    
    \sa
    * abortWblock
    * beginWblockObjects
    * endWblock
    * otherWblock
    * wblockNotice
  */
  virtual void beginWblock(
    OdDbDatabase* pToDb, 
    OdDbDatabase* pFromDb, 
    const OdGePoint3d& insertionPoint);
  virtual void beginWblock(
    OdDbDatabase* pToDb, 
    OdDbDatabase* pFromDb, 
    OdDbObjectId blockId);
  virtual void beginWblock(
    OdDbDatabase* pToDb, 
    OdDbDatabase* pFromDb);
 
     
  /** \details
    Notification function called whenever one database is being wblocked to another.
    
    \param pToDb [in]  Destination database.
    \param pFromDb [in]  Source database.
    \param idMap [in]  ID Map source -> destination.
    
    \remarks
    idMap contains mapping of the original objects in pFromDb to the objects created in pToDb.
 
    This function is called after the operation, and is sent just before 
    beginDeepCloneXlation.
    
    \sa
    * abortWblock
    * beginWblock
    * beginWblockObjects
    * endWblock
    * wblockNotice
  */
  virtual void otherWblock(
    OdDbDatabase* pToDb, 
    OdDbIdMapping& idMap, 
    OdDbDatabase* pFromDb);
    
  /** \details
    Notification function called whenever the wblock of a database has failed.
    
    \param pToDb [in]  Destination database.
    
    \remarks
    This function is called after the operation.
        
    \sa
    beginWblock
    beginWblockObjects
    endWblock
    otherWblock
    wblockNotice
  */
  virtual void abortWblock(
    OdDbDatabase* pToDb);
    
  /** \details
    Notification function called whenever the wblock of a database has succeded.
    
    \param pToDb [in]  Destination database.
    
    \remarks
    This function is called after the operation.
        
    \sa
    * abortWblock
    * beginWblock
    * beginWblockObjects
    * otherWblock
    * wblockNotice
  */
  virtual void endWblock(
    OdDbDatabase* pToDb);
    
  /** \details
    Notification function called whenever one database is being wblocked to another.
    
    \param pFromDb [in]  Source database.
    \param idMap [in]  ID Map source -> destination.
    
    \remarks
    idMap contains mapping of the original objects in pFromDb to the objects created in pToDb.
 
    This notification function gives wblockCloneObjects a method
    of being notified before each pFrom database before the actual cloning begins.
    
    \sa
    * abortWblock
    * beginWblock
    * endWblock
    * otherWblock
    * wblockNotice
  */
  virtual void beginWblockObjects(
    OdDbDatabase* pFromDb, 
    OdDbIdMapping& idMap);
  
  // Deep Clone Events.
  
  /** \details
    Notification function called whenever a subDeepClone operation is about to be started on a database.
    
    \param pToDb [in]  Destination database.
    \param idMap [in]  ID Map source -> destination.
    
    \remarks
    idMap will always be empty.
 
    \sa
    * abortDeepClone
    * beginDeepCloneXlation
    * endDeepClone
  */
  virtual void beginDeepClone(
    OdDbDatabase* pToDb, 
    OdDbIdMapping& idMap);
 
  /** \details
    Notification function called whenever a the translation stage of a subDeepClone 
    operation is about to be started on a database.
    
    \param idMap [in]  ID Map source -> destination.
    
    \remarks
    This function is called after all objects, and their owned objects, have been cloned.
    It is called before any Object IDs are translated 
    
    \note
    Object IDs of cloned objects do not point at the cloned objects, and
    must therefore not not be used at this point for any operations on
    those objects.
    
    \sa
    * abortDeepClone
    * beginDeepClone
    * endDeepClone
  */
  virtual void beginDeepCloneXlation(
    OdDbIdMapping& idMap);
 
  /** \details
    Notification function called whenever a subDeepClone operation has failed.
    
    \param idMap [in]  ID Map source -> destination.
    
    \remarks
    This function is called after the operation.
   
    \note
    The objects involved in the subDeepClone operation are in an indeterminate state 
    and must be cleaned up.
   
    \sa
    * beginDeepClone
    * beginDeepCloneXlation
    * endDeepClone
  */
  virtual void abortDeepClone(
    OdDbIdMapping& idMap);
 
  /** \details
    Notification function called whenever a subDeepClone operation has succeeded.
    
    \param idMap [in]  ID Map source -> destination.
    
    \remarks
    This function is called after the operation.
   
    \sa
    * abortDeepClone
    * beginDeepClone
    * beginDeepCloneXlation
  */
  virtual void endDeepClone(
    OdDbIdMapping& idMap);
  
  // Partial Open Events.
  
  /** \details
    Notification function called before an attempt is made to partially open an OdDbDatabase.
 
    \param pDb [in]  Pointer to the database.
    
    \remarks
    To 
    veto the partial open, an application should override partialOpenNotice, and from it call
    
                pDb->disablePartialOpen()
    
  */
  virtual void partialOpenNotice(
    OdDbDatabase* pDb);
  
};
 
/** \details
    This template class is a specialization of the OdSmartPtr class for OdRxEventReactor object pointers.
*/
typedef OdSmartPtr<OdRxEventReactor> OdRxEventReactorPtr;
 
/** \details
    This class manages OdRxEventReactor instances.
    
    \sa
    TD_Db
    <group OdRx_Classes> 
*/
class TOOLKIT_EXPORT OdRxEvent : public OdRxObject 
public:
  ODRX_DECLARE_MEMBERS(OdRxEvent);
  
  /** \details
    Adds the specified event reactor to the host application's event reactor list.
    \param pReactor [in]  Pointer to the event reactor.
  */
  virtual void addReactor(
    OdRxEventReactor* pReactor) = 0;
 
  /** \details
    Removes the specified event reactor from the host application's event reactor list.
    \param pReactor [in]  Pointer to the event reactor.
  */
  virtual void removeReactor(
    OdRxEventReactor* pReactor) = 0;
};
 
/** \details
    This template class is a specialization of the OdSmartPtr class for OdRxEvent object pointers.
*/
typedef OdSmartPtr<OdRxEvent> OdRxEventPtr;
 
 
TOOLKIT_EXPORT OdRxEventPtr odrxEvent();
 
#include "TD_PackPop.h"
 
#endif //_ODRX_EVENT_H__