zjf
2023-03-06 392b76515f40376b6d36f40a114850ef63650384
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
/////////////////////////////////////////////////////////////////////////////// 
// 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 _ODEDUSERIO_H_INCLUDED_
#define _ODEDUSERIO_H_INCLUDED_
 
#include "OdPlatform.h"
#include "DbExport.h"
#include "Gi/GiDrawable.h"
#include "OdString.h"
#include "SharedPtr.h"
#include "RxObject.h"
 
class OdGePoint3d;
 
#include "TD_PackPush.h"
 
/** \details
  
    <group TD_Namespaces>
*/
namespace OdEd
{
  enum CommonInputOptions
  {
    kInpDefault       = 0x00000000,
    kInpDisallowEmpty = kInpDefault,
    kInpDisallowOther = kInpDisallowEmpty,
    kInpThrowEmpty    = (long)0x80000000,
    kInpThrowOther    = 0x40000000,
    kInpNonZero       = 0x20000000, // Disallow zero input 
    kInpNonNeg        = 0x10000000  // Disallow negative input 
  };
 
  enum GetFilePathFlags
  {
    kGfpForOpen         = 0, // For Open.
    kGfpForSave         = 1, // For Save.
    kGfpOverwritePrompt = 2  // Enable overwrite prompt displaying when exist file selected for saving.
  };
 
  enum GetStringOptions
  {
    kGstDefault      = 0, // Spaces disallowed, no KeywordExceptions
    kGstNoSpaces     = 0, // Spaces disallowed
    kGstAllowSpaces  = 1, // The first space character will not terminate the input.
    kGstNoEmpty      = 2  // The first space character will not terminate the input.
  };
 
  enum OdDbInputOptions
  {
    kGptDefault         = 0x00000000,
    kGdsDefault         = kGptDefault,
    kGinDefault         = kGptDefault,
    kGrlDefault         = kGptDefault,
    kGanDefault         = kGptDefault,
    kGptNoLimCheck      = 0x00000001, // Ignore the LIMMIN and LIMMAX system variables
    kGptNoUCS           = 0x00000002, // Do not project result point onto UCS plane (input point in eye plane)
    kGptRubberBand      = 0x00000004,
    kGptRectFrame       = 0x00000008,
    kGptBeginDrag       = 0x00000010,
    kGptEndDrag         = 0x00000020,
    kGptNoOSnap         = 0x00000040, // Disables object snaps
    kGanFromLastPoint   = 0x00000080,
    kGdsFromLastPoint   = kGanFromLastPoint,
    kGanNoAngBase       = 0x00000100,
    kGds2d              = 0x00000200, // Restrict (getDistance) to 2D
    kGdsSignedDist      = 0x00000400,
    kGdsPerpDist        = 0x00000800, // is in perpendicular plane to UCS plane
    kGdsNoZero          = 0x00001000,
    kGinNoZero          = kGdsNoZero,
    kGrlNoZero          = kGdsNoZero,
    kGanNoZero          = kGdsNoZero,
    kGdsNoNeg           = 0x00002000,
    kGinNoNeg           = kGdsNoNeg,
    kGrlNoNeg           = kGdsNoNeg
  };
 
  enum SelectOptions
  {
    kSelDefault         = 0x00000000,
    kSelPickLastPoint   = 0x00000001,
    kSelSingleEntity    = 0x00000002,
    kSelIgnorePickFirst = 0x00000004,
    kSelSinglePass      = 0x00000008,
    kSelAllowEmpty      = 0x00000010,
    kSelRemove          = 0x00000020,
    kSelLeaveHighlighted= 0x00000040,
    kSelAllowInactSpaces= 0x00000080,
    kSelAllowObjects    = 0x00000100,
    kSelAllowPSVP       = 0x00000200,
    kSelAllowSubents    = 0x00000400,
    kSelAllowLocked     = 0x00000800
  };
}
 
class OdGsView;
class OdGsModel;
 
class OdCmColorBase;
 
//
// OdEd_Classes
//
 
/** \details
    This class allows commands to track object
    changes and redraw the entities while user sets parameter values.
 
    Library: TD_Root
    <group OdEd_Classes>
*/
class ODRX_ABSTRACT FIRSTDLL_EXPORT OdEdInputTracker : public OdRxObject
{
public:
  ODRX_DECLARE_MEMBERS(OdEdInputTracker);
 
  virtual int addDrawables(OdGsView* pView) = 0;
  virtual void removeDrawables(OdGsView* pView) = 0;
};
 
typedef OdSmartPtr<OdEdInputTracker> OdEdInputTrackerPtr;
 
 
/** \details
    This notification interface template allows commands to track object
    changes and redraw the entities while user sets parameter values.
 
    Library: TD_Root
    <group OdEd_Classes>
*/
class ODRX_ABSTRACT FIRSTDLL_EXPORT OdEdIntegerTracker : public OdEdInputTracker
{
public:
  ODRX_DECLARE_MEMBERS(OdEdIntegerTracker);
 
  virtual void setValue(int value) = 0;
};
 
typedef OdSmartPtr<OdEdIntegerTracker> OdEdIntegerTrackerPtr;
 
 
/** \details
    This notification interface template allows commands to track object
    changes and redraw the entities while user sets parameter values.
 
    Library: TD_Root
    <group OdEd_Classes>
*/
class ODRX_ABSTRACT FIRSTDLL_EXPORT OdEdRealTracker : public OdEdInputTracker
{
public:
  ODRX_DECLARE_MEMBERS(OdEdRealTracker);
 
  virtual void setValue(double value) = 0;
};
 
typedef OdSmartPtr<OdEdRealTracker> OdEdRealTrackerPtr;
 
 
/** \details
    This notification interface template allows commands to track object
    changes and redraw the entities while user sets parameter values.
 
    Library: TD_Root
    <group OdEd_Classes>
*/
class ODRX_ABSTRACT FIRSTDLL_EXPORT OdEdStringTracker : public OdEdInputTracker
{
protected:
  bool bShowCursor;
public:
  ODRX_DECLARE_MEMBERS(OdEdStringTracker);
 
  virtual void setValue(const OdString& value) = 0;
 
  virtual void setCursor(const bool& bShowCursor)
  {
    this->bShowCursor = bShowCursor;
  }
};
 
typedef OdSmartPtr<OdEdStringTracker> OdEdStringTrackerPtr;
 
 
/** \details
    <group OdEd_Classes>
*/
class ODRX_ABSTRACT FIRSTDLL_EXPORT OdEdPointTracker : public OdEdInputTracker
{
public:
  ODRX_DECLARE_MEMBERS(OdEdPointTracker);
 
  virtual void setValue(const OdGePoint3d& value) = 0;
};
 
typedef OdSmartPtr<OdEdPointTracker> OdEdPointTrackerPtr;
 
 
/** \details
    <group OdEd_Classes>
*/
class ODRX_ABSTRACT FIRSTDLL_EXPORT OdEdPointDefTracker : public OdEdPointTracker
{
public:
  ODRX_DECLARE_MEMBERS(OdEdPointDefTracker);
 
  virtual OdGePoint3d basePoint() const = 0;
};
 
typedef OdSmartPtr<OdEdPointDefTracker> OdEdPointDefTrackerPtr;
 
 
/** \details
    <group OdEd_Classes>
*/
class ODRX_ABSTRACT FIRSTDLL_EXPORT OdEdColorTracker : public OdEdInputTracker
{
public:
  ODRX_DECLARE_MEMBERS(OdEdColorTracker);
 
  virtual void setValue(const OdCmColorBase& value) = 0;
};
 
typedef OdSmartPtr<OdEdColorTracker> OdEdColorTrackerPtr;
 
 
//
// OdEd_Exceptions
//
 
#define OdException OdError
 
 
/** \details
    This class will be thrown whenever the user cancels input from query function of this UserIO object.
 
    Library: TD_Root
    <group OdEd_Exceptions>
*/
class FIRSTDLL_EXPORT OdEdException : public OdException
{
protected:
  OdEdException();
  OdEdException(OdErrorContext* pErrCtx);
};
 
 
/** \details
    This class will be thrown whenever the user cancels input from query function of this UserIO object.
 
    Library: TD_Root
    <group OdEd_Exceptions>
*/
class FIRSTDLL_EXPORT OdEdCancel : public OdEdException
{
public:
  OdEdCancel();
  OdEdCancel(OdErrorContext* pErrCtx);
};
 
 
/** \details
    This class will be thrown whenever a keyword is input to query function of this UserIO object.
 
    Library: TD_Root
    <group OdEd_Exceptions>
*/
class FIRSTDLL_EXPORT OdEdKeyword : public OdEdException
{
public:
  OdEdKeyword(int nKeyword, const OdString& sKeyword);
 
  int keywordIndex() const;
  const OdString& keyword() const;
};
 
 
/** \details
 
    Library: TD_Root
    <group OdEd_Exceptions>
*/
class FIRSTDLL_EXPORT OdEdOtherInput : public OdEdCancel
{
public:
  OdEdOtherInput(const OdString& sInput);
  const OdString& string() const;
};
 
 
/** \details
 
    Library: TD_Root
    <group OdEd_Exceptions>
*/
class FIRSTDLL_EXPORT OdEdEmptyInput : public OdEdCancel
{
public:
  OdEdEmptyInput();
};
 
 
/** \details
    This class implements non-geometric interactive user IO functionality for custom interactive command objects.
    
    Library: TD_Root
    <group OdEd_Classes>
*/
class ODRX_ABSTRACT FIRSTDLL_EXPORT OdEdUserIO : public OdRxObject
public:
  ODRX_DECLARE_MEMBERS(OdEdUserIO);
 
  /** \details
    Returns user input of a keyword.
 
    \param prompt [in]  Prompt output before pausing for user input.
    \param keywords [in]  Keyword list.
    \param options [in]  Bitwise OR combination of OdEd::CommonInputOptions enum.
    \param defVal [in]  Returned if user input nothing.
 
    \remarks
    Returns the index of the entered keyword in the keyword list, or -1 it's not there.
    
    This function uses the underlying OdEdBaseIO functions putString and getString for low
    level output and input.  
    
    \note
    This function does not throw a KeywordException.
  */
  virtual int getKeyword(
    const OdString& prompt,
    const OdString& keywords,
    int defVal = -1,
    int options = OdEd::kInpDefault,
    OdEdIntegerTracker* pTracker = 0) = 0;
 
  /** \details
    Returns user input of an integer.
 
    \param prompt [in]  Prompt output before pausing for user input.
    \param pTracker [in/out] Pointer to an IO Tracker for this user input.
    \param options [in] Bitwise OR combination of OdEd::CommonInputOptions enum.
    \param defVal [in] Returned if user input nothing and OdEd::kInpReturnDefVal flag is set.
    
    \remarks
    If prompt is empty, a default prompt is used.    
    
    This function uses the underlying OdEdBaseIO functions putString and getString for low
    level output and input.  
  */
  virtual int getInt(
    const OdString& prompt,
    int options = OdEd::kInpDefault,
    int defVal = 0,
    const OdString& keywords = OdString::kEmpty,
    OdEdIntegerTracker* pTracker = 0) = 0;
 
  /** \details
    Returns user input of a double.
 
    \param prompt [in]  Prompt output before pausing for user input.
    \param options [in]  Bitwise OR combination of OdEd::CommonInputOptions enum.
    \param defVal [in]  Returned if user input nothing and OdEd::kInpReturnDefVal flag is set.
    \param pTracker [in]  Pointer to an IO Tracker for this user input.
    
    \remarks
    If prompt is empty, a default prompt is used.    
    
    This function uses the underlying OdEdBaseIO functions putString and getString for low
    level output and input.  
  */
  virtual double getReal(
    const OdString& prompt, 
    int options = OdEd::kInpDefault,
    double defVal = 0.0,
    const OdString& keywords = OdString::kEmpty,
    OdEdRealTracker* pTracker = 0) = 0;
 
  /** \details
    Returns user input of a string.
 
    \param options [in]  combination of OdEd::CommonInputOptions and OdEd::GetStringOptions enum values.
    \param prompt [in]  Prompt output before pausing for user input.
    \param pTracker [in]  Pointer to an IO Tracker for this user input.
    \param defValue [in]  Default value.
    \param keywords [in]  Keyword string.
    
    \remarks
    If prompt is empty, a default prompt is used.    
    
    This function uses the underlying OdEdBaseIO functions putString and getString for low
    level output and input.  
  */
  virtual OdString getString(
    const OdString& prompt, 
    int options = OdEd::kInpDefault, 
    const OdString& defValue = OdString::kEmpty,
    const OdString& keywords = OdString::kEmpty,
    OdEdStringTracker* pTracker = 0) = 0;
                                 
  /** \details
    Writes the specified string to the command's output.
    \param string [in]  string to write.
  */
  virtual void putString(const OdString& string) = 0;
 
  /** \details
    Returns user input of a color as wrapped value.
 
    \param prompt [in]  Message displayed to prompt the user.
    \param options [in]  Combination of OdEd::GetPointOptions enum values. 
    \param pDefaultValue [in]  Pointer to a default value to return if an empty string is received as input.
    \param keywords [in]  Keyword string.
    \param pTracker [in]  Pointer to a User IO tracker.
    
    \remarks
    This function uses the underlying OdEdBaseIO functions putString and getString for low
    level output and input.
    
    If prompt is an empty string, a default prompt string is used.  
  */
  virtual OdSharedPtr<OdCmColorBase> getCmColor(
    const OdString& prompt,
    int options = OdEd::kInpDefault,
    const OdCmColorBase* pDefaultValue = 0,
    const OdString& keywords = OdString::kEmpty,
    OdEdColorTracker* pTracker = 0) = 0;
 
  /** \details
    Returns user input of a filename obtained in some manner.
 
    \param options [in]  combination of OdEd::CommonInputOptions and OdEd::GetFilePathFlags enum values.
    \param prompt [in]  Prompt output before pausing for user input.
    \param dialogCaption [in]  Dialog caption.
    \param defExt [in]  Default file extension without "."
    \param fileName [in]  Initial filename to initialize dialog with.
    \param filter [in]  Filter pattern.
    \param pTracker [in/out] File path tracker; may be used to display file preview.
    
    \remarks
    flags must be one of the following:
 
    <table>
    Name                        Value   Description
    OdEd::kGfpForOpen           0       For Open.
    OdEd::kGfpForSave           1       For Save.
    OdEd::kGfpOverwritePrompt   2       Enable overwrite prompt displaying when exist file selected for saving.
    </table>
 
    The default implementation of this function utilizes getString().  
  */
  virtual OdString getFilePath(
      const OdString& prompt, 
      int options = OdEd::kGfpForOpen,
      const OdString& dialogCaption = OdString::kEmpty, 
      const OdString& defExt = OdString::kEmpty,
      const OdString& fileName = OdString::kEmpty,
      const OdString& filter = OdString::kEmpty,
      const OdString& keywords = OdString::kEmpty,
      OdEdStringTracker*  pTracker = 0);
 
  /** \details
    Writes the specified *error message* to the command's error output.
    Override it to distinguish normal output of a command from its error messages.
    \param errmsg [in]  error message to write.
  */
  virtual void putError(const OdString& errmsg) { putString(errmsg); }
};
 
#include "TD_PackPop.h"
 
#endif //#ifndef _ODEDUSERIO_H_INCLUDED_