forked from mcneel/opennurbs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
opennurbs_3dm_settings.h
1737 lines (1434 loc) · 52.4 KB
/
opennurbs_3dm_settings.h
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
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* $NoKeywords: $ */
/*
//
// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
// McNeel & Associates.
//
// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
// MERCHANTABILITY ARE HEREBY DISCLAIMED.
//
// For complete openNURBS copyright information see <http://www.opennurbs.org>.
//
////////////////////////////////////////////////////////////////
*/
#if !defined(OPENNURBS_3DM_SETTINGS_INC_)
#define OPENNURBS_3DM_SETTINGS_INC_
///////////////////////////////////////////////////////////////////////
//
// units and tolerances
//
class ON_CLASS ON_3dmUnitsAndTolerances
{
public:
// The default constructor set units to millimeters and tolerance = 0.001mm
ON_3dmUnitsAndTolerances() = default;
~ON_3dmUnitsAndTolerances() = default;
ON_3dmUnitsAndTolerances(const ON_3dmUnitsAndTolerances&) = default;
ON_3dmUnitsAndTolerances& operator=(const ON_3dmUnitsAndTolerances&) = default;
bool Read( ON_BinaryArchive& );
bool Write( ON_BinaryArchive& ) const;
void Dump( ON_TextLog& ) const;
/*
Returns:
True if tolerances (m_absolute_tolerance, m_angle_tolerance, m_relative_tolerance)
are set to valid values.
*/
bool TolerancesAreValid() const;
/*
Description:
If m_absolute_tolerance is not set to a valid value, it is set
to ON_3dmUnitsAndTolerances::DefaultValue.m_absolute_tolerance.
If m_angle_tolerance is not set to a valid value, it is set
to ON_3dmUnitsAndTolerances::DefaultValue.m_angle_tolerance.
If m_relative_tolerance is not set to a valid value, it is set
to ON_3dmUnitsAndTolerances::DefaultValue.m_relative_tolerance.
Returns:
0: all tolerances were valid
0 != (rc & 1):
m_absolute_tolerance was invalid and set to the default value
0 != (rc & 2):
m_angle_tolerance was invalid and set to the default value
0 != (rc & 4):
m_relative_tolerance was invalid and set to the default value
*/
unsigned int SetInvalidTolerancesToDefaultValues();
//////////
// Returns scale factor that needs to be applied to change from
// the argument's unit system to m_unit_system.
// When m_unit_system is not ON::LengthUnitSystem::CustomUnits,
// Scale(us) = ON::UnitScale(us,m_unit_system). When Scale(us)
// When m_unit_system is ON::LengthUnitSystem::CustomUnits,
// Scale(us) = ON::UnitScale(us,ON::LengthUnitSystem::Meters)*m_custom_unit_scale.
double Scale( ON::LengthUnitSystem ) const;
ON_UnitSystem m_unit_system = ON_UnitSystem::Millimeters;
double m_absolute_tolerance = 0.001; // in units > 0.0
double m_angle_tolerance = ON_PI/180.0; // in radians > 0.0 and <= ON_PI
double m_relative_tolerance = 0.01; // fraction > 0.0 and < 1.0
ON::OBSOLETE_DistanceDisplayMode m_distance_display_mode = ON::OBSOLETE_DistanceDisplayMode::Decimal; // decimal or fractional
int m_distance_display_precision = 3; // decimal mode: number of decimal places
// fractional modes:
// denominator = (1/2)^m_distance_display_precision
public:
/*
DefaultValue
m_unit_system ON::LengthUnitSystem::Millimeters
m_absolute_tolerance 0.001
m_angle_tolerance pi/180 = 1 degree
m_relative_tolerance 0.01 = 1%
m_distance_display_mode ON::OBSOLETE_DistanceDisplayMode::Decimal
m_distance_display_precision 3
*/
static const ON_3dmUnitsAndTolerances Millimeters;
};
///////////////////////////////////////////////////////////////////////
//
// Model settings
// render mesh defaults
// viewports
// construction planes
//
class ON_CLASS ON_3dmAnnotationSettings
{
public:
ON_3dmAnnotationSettings() = default;
~ON_3dmAnnotationSettings() = default;
ON_3dmAnnotationSettings(const ON_3dmAnnotationSettings&) = default;
ON_3dmAnnotationSettings& operator=(const ON_3dmAnnotationSettings&) = default;
static const ON_3dmAnnotationSettings Default;
bool Read( ON_BinaryArchive& );
bool Write( ON_BinaryArchive& ) const;
void Dump( ON_TextLog& text_log ) const;
// these are the running defaults for making dimensions
// they are also the things written to the 3dm file as dimension settings
double m_dimscale = 1.0; // model size / plotted size
double m_textheight = 1.0;
double m_dimexe = 1.0;
double m_dimexo = 1.0;
double m_arrowlength = 1.0;
double m_arrowwidth = 1.0;
double m_centermark = 1.0;
/*
Returns:
Value of m_world_view_text_scale;
*/
double WorldViewTextScale() const;
/*
Parameters:
world_view_text_scale - [in]
Sets value of m_world_view_text_scale.
*/
void SetWorldViewTextScale(double world_view_text_scale );
/*
Returns:
Value of m_world_view_hatch_scale;
*/
double WorldViewHatchScale() const;
/*
Parameters:
world_view_hatch_scale - [in]
Sets value of m_world_view_hatch_scale.
*/
void SetWorldViewHatchScale(double world_view_hatch_scale );
/*
Returns:
Value of m_b_V5_EnableAnnotationScaling;
*/
bool Is_V5_AnnotationScalingEnabled() const;
/*
Parameters:
bEnable - [in]
Sets value of m_b_V5_EnableAnnotationScaling.
*/
void Enable_V5_AnnotationScaling(bool bEnable);
/*
Parameters:
bEnable - [in]
Sets value of m_bEnableModelSpaceAnnotationScaling.
*/
void EnableModelSpaceAnnotationScaling(bool bEnable);
/*
Returns:
Value of m_bEnableModelSpaceAnnotationScaling;
*/
bool IsModelSpaceAnnotationScalingEnabled() const;
/*
Parameters:
bEnable - [in]
Sets value of m_bEnableLayoutSpaceAnnotationScaling.
*/
void EnableLayoutSpaceAnnotationScaling(bool bEnable);
/*
Returns:
Value of m_bEnableLayoutSpaceAnnotationScaling;
*/
bool IsLayoutSpaceAnnotationScalingEnabled() const;
/*
Returns:
Value of m_bEnableHatchScaling;
*/
bool IsHatchScalingEnabled() const;
/*
Parameters:
bEnable - [in]
Sets value of m_bEnableHatchScaling.
*/
void EnableHatchScaling( bool bEnable );
// Present but not used in V4 or V5 - removed 5 August 2010 to make room
// for m_world_view_text_scale and m_bEnableAnnotationScaling
//// added 12/28/05 LW
//double m_dimdle;
//double m_dimgap;
private:
// If m_bEnableAnnotationScaling is true,
// and ON_OBSOLETE_V5_Annotation::m_annotative_scale is true,
// and ON_OBSOLETE_V5_Annotation::m_type == ON::dtTextBlock,
// and the text object is being displayed in a world
// view (not a detail view and not a page view),
// then the text will be scaled by m_world_view_text_scale.
// The default is 1.0. Values <= 0.0 are not valid.
float m_world_view_text_scale = 1.0f;
float m_world_view_hatch_scale = 1.0f;
private:
// If m_bEnableAnnotationScaling is false:
// * m_world_view_text_scale is ignored.
// * text is not scaled.
// * ON_DimStyle::DimScale() determines the scale
// applied to all other annotation objects in all
// types of views.
// * The value of ON_DetailView::m_page_per_model_ratio
// is applied to all objects (annotation and geometry)
// in the detail view.
//
// If m_bEnableAnnotationScaling is true:
// * m_world_view_text_scale is used as described above.
// * ON_DimStyle::DimScale() determines the scale
// applied to all non text annotation objects in
// world views.
// * ON_DimStyle::DimScale() is ignored in page and
// detail views.
// * ON_DetailView::m_page_per_model_ratio is ingored
// for annotation objects in detail views, other
// geometry is scaled.
//
// Default is true.
unsigned char m_b_V5_EnableAnnotationScaling = 1;
// [Lowell 3-28-2013] New fields for V6
unsigned char m_bEnableModelSpaceAnnotationScaling = 1;
unsigned char m_bEnableLayoutSpaceAnnotationScaling = 1;
unsigned char m_bEnableHatchScaling = 1;
private:
ON__UINT32 m_reserved1 = 0;
ON__UINT8 m_reserved2 = 0;
ON__UINT8 m_reserved3 = 0;
ON__UINT8 m_reserved4 = 0;
public:
ON::LengthUnitSystem m_dimunits = ON::LengthUnitSystem::None; // units used to measure the dimension
int m_arrowtype = 0; // 0: filled narrow triangular arrow (= ((ON_Arrowhead::arrow_type enum value as int ) - 2))
int m_angularunits = 0; // 0: degrees, 1: radians
int m_lengthformat = 0; // 2 = ON_DimStyle::LengthDisplay::FeetAndInches, treat everything else as ON_DimStyle::LengthDisplay::ModelUnits
int m_angleformat = 0; // 0: decimal degrees, ... ( ON_DimStyle::angle_format enum as int )
//ON_INTERNAL_OBSOLETE::V5_TextDisplayMode m_settings_textalign; // In V2 files - 0: above line, 1: in line, 2: horizontal
// // After V2 files - 0: normal (converts to above_line), 1: horizontal, 2: above_line, 3: in_line
int m_resolution = 0; // depends on m_lengthformat
// for decimal, digits past the decimal point
ON_wString m_facename; // [LF_FACESIZE] // windows font name
};
//////////////////////////////////////////////////////////////////////////////////////////
//
// ON_3dmConstructionPlaneGridDefaults
//
// Default settings used for construction plane grids
class ON_CLASS ON_3dmConstructionPlaneGridDefaults
{
public:
ON_3dmConstructionPlaneGridDefaults() = default;
~ON_3dmConstructionPlaneGridDefaults() = default;
ON_3dmConstructionPlaneGridDefaults(const ON_3dmConstructionPlaneGridDefaults&) = default;
ON_3dmConstructionPlaneGridDefaults& operator=(const ON_3dmConstructionPlaneGridDefaults&) = default;
static const ON_3dmConstructionPlaneGridDefaults Default;
bool Write( ON_BinaryArchive& ) const;
bool Read( ON_BinaryArchive& );
void Dump( ON_TextLog& text_log ) const;
double m_grid_spacing = 1.0; // distance between grid lines
double m_snap_spacing = 1.0; // when "grid snap" is enabled, the
// distance between snap points. Typically
// this is the same distance as grid spacing.
int m_grid_line_count = 70; // number of grid lines in each direction
int m_grid_thick_frequency = 5; // thick line frequency
// 0: none,
// 1: all lines are thick,
// 2: every other is thick, ...
bool m_bShowGrid = true;
bool m_bShowGridAxes = true;
bool m_bShowWorldAxes = true;
};
//////////////////////////////////////////////////////////////////////////////////////////
//
// ON_3dmConstructionPlane
//
class ON_CLASS ON_3dmConstructionPlane
{
public:
ON_3dmConstructionPlane();
~ON_3dmConstructionPlane();
ON_3dmConstructionPlane(const ON_Plane& plane);
// default copy constructor and operator= work fine
//ON_3dmConstructionPlane(const ON_3dmConstructionPlane&);
//ON_3dmConstructionPlane& operator=(const ON_3dmConstructionPlane&);
void Default();
bool Write( ON_BinaryArchive& ) const;
bool Read( ON_BinaryArchive& );
void Dump( ON_TextLog& text_log ) const;
ON_Plane m_plane;
// construction grid appearance
double m_grid_spacing; // distance between grid lines
double m_snap_spacing; // when "grid snap" is enabled, the
// distance between snap points. Typically
// this is the same distance as grid spacing.
int m_grid_line_count; // number of grid lines in each direction
int m_grid_thick_frequency; // thick line frequency
// 0: none,
// 1: all lines are thick,
// 2: every other is thick, ...
bool m_bDepthBuffer; // false=grid is always drawn behind 3d geometry
// true=grid is drawn at its depth as a 3d plane
// and grid lines obscure things behind the grid.
ON_wString m_name;
};
#if defined(ON_DLL_TEMPLATE)
ON_DLL_TEMPLATE template class ON_CLASS ON_ClassArray<ON_3dmConstructionPlane>;
#endif
//////////////////////////////////////////////////////////////////////////////////////////
//
// ON_3dmViewPosition
//
class ON_CLASS ON_3dmViewPosition
{
public:
// view window relative position and state in parent frame
ON_3dmViewPosition();
~ON_3dmViewPosition();
ON_3dmViewPosition(const ON_3dmViewPosition&);
ON_3dmViewPosition& operator=(const ON_3dmViewPosition&);
void Default();
bool Write( ON_BinaryArchive& ) const;
bool Read( ON_BinaryArchive& );
// relative position of view window in main frame
// if m_floating_viewport>0, this is relative position of the view window
// on the virtual screen (union of potentially multiple monitors)
double m_wnd_left; // 0.0 to 1.0
double m_wnd_right;
double m_wnd_top;
double m_wnd_bottom;
bool m_bMaximized; // true if view window is maximized
// m_floating_viewport is used to track floating viewport information.
// 0 = the view is docked in the main application window.
// >0 = the view is floating. When floating, this corresponds to the
// number of monitors on on the user's computer when the file was saved
unsigned char m_floating_viewport;
private:
// reserved for future use
unsigned char m_reserved_1;
unsigned char m_reserved_2;
unsigned char m_reserved_3;
};
//////////////////////////////////////////////////////////////////////////////////////////
//
// ON_3dmViewTraceImage
//
class ON_CLASS ON_3dmViewTraceImage
{
public:
ON_3dmViewTraceImage();
~ON_3dmViewTraceImage();
bool operator==( const ON_3dmViewTraceImage& ) const;
bool operator!=( const ON_3dmViewTraceImage& ) const;
void Default();
bool Write( ON_BinaryArchive& ) const;
bool Read( ON_BinaryArchive& );
// view window relative position and state in parent frame
ON_Plane m_plane;
double m_width;
double m_height;
ON_FileReference m_image_file_reference;
bool m_bGrayScale; // true if image should be black and white
bool m_bHidden; // true if image is currently hidden from view
bool m_bFiltered; // true if image should be filtered (bilinear) before displayed.
};
//////////////////////////////////////////////////////////////////////////////////////////
//
// ON_3dmViewTraceImage
//
class ON_CLASS ON_3dmWallpaperImage
{
public:
ON_3dmWallpaperImage();
~ON_3dmWallpaperImage();
bool operator==( const ON_3dmWallpaperImage& ) const;
bool operator!=( const ON_3dmWallpaperImage& ) const;
void Default();
bool Write( ON_BinaryArchive& ) const;
bool Read( ON_BinaryArchive& );
ON_FileReference m_image_file_reference;
bool m_bGrayScale; // true if image should be black and white
bool m_bHidden; // true if image is currently hidden from view
};
//////////////////////////////////////////////////////////////////////////////////////////
//
// ON_3dmView
//
class ON_CLASS ON_3dmPageSettings
{
public:
ON_3dmPageSettings();
~ON_3dmPageSettings();
bool IsValid( ON_TextLog* text_log = 0 ) const;
void Default();
int m_page_number;
// Overall size of the page in millimeters
double m_width_mm;
double m_height_mm;
// Page margins in millimeters
double m_left_margin_mm;
double m_right_margin_mm;
double m_top_margin_mm;
double m_bottom_margin_mm;
ON_wString m_printer_name;
bool Write(ON_BinaryArchive& archive) const;
bool Read(ON_BinaryArchive& archive);
};
class ON_CLASS ON_StandardDisplayModeId
{
public:
static const ON_UUID Wireframe; // {1311ADCB-D89E-4051-A3F0-F64441FB8EC6}
static const ON_UUID Shaded; // {8BC8DEBE-C83B-4c47-B13C-9DB074510CAC}
static const ON_UUID Rendered; // {CAE60BAE-2D51-4299-ABF7-A339FCA86F3B}
static const ON_UUID Ghosted; // {FF608B97-81D3-4186-831C-41F7DC140881}
static const ON_UUID XrayShade; // {B5C19D5D-0AEC-4ff7-A10E-E052E660263A}
static const ON_UUID RenderedShadows; // {A5545314-9D87-428d-95AE-91052EEAD0FA}
static const ON_UUID Technical; // {63612C72-778F-4afd-B81B-17426FDFE8A6}
static const ON_UUID Artistic; // {B46AB226-05A0-4568-B454-4B1AB721C675}
static const ON_UUID Pen; // {F4616FA5-A831-4620-A97E-9B807D5EC376}
static const ON_UUID AmbientOcclusion; // {C32B72C3-41BD-4ADC-82A8-B7AEF4456A37}
static const ON_UUID Raytraced; // {69E0C7A5-1C6A-46C8-B98B-8779686CD181}
/*
Parameters:
id - [in]
Returns:
True if id is one of the standard display modes listed above.
*/
static bool IsStandardDisplayModeId(
ON_UUID id
);
/*
Parameters:
id - [in]
Returns:
The legacy V3 display mode enum that is the closest match to
the display mode id.
*/
static ON::v3_display_mode ToV3DisplayMode(
ON_UUID id
);
/*
Parameters:
dm - [in]
v3 display mode enum value
Returns:
display mode id that corresponds to the enum value.
*/
static ON_UUID FromV3DisplayMode(
ON::v3_display_mode dm
);
private:
// prohibit instantiation
ON_StandardDisplayModeId(); // no implementation
~ON_StandardDisplayModeId(); // no implementation
};
enum class ON_FocalBlurModes : unsigned int
{
None, // No focal blur.
Automatic, // Autofocus on selected objects.
Manual, // Fully manual focus.
};
class ON_CLASS ON_3dmView
{
public:
ON_3dmView();
~ON_3dmView();
// The C++ default copy constructor and operator= work fine.
// Do not provide customized versions.
// NO // ON_3dmView(const ON_3dmView&);
// NO // ON_3dmView& operator=(const ON_3dmView&);
void Default();
bool Write( ON_BinaryArchive& ) const;
bool Read( ON_BinaryArchive& );
void Dump( ON_TextLog& text_log ) const;
bool IsValid( ON_TextLog* text_log = 0 ) const;
// view projection information
ON_Viewport m_vp;
// clipping planes
// Prior to Dec 14, 2010 m_clipping_planes was not saved with the view.
// After Dec 14, 2010 m_clipping_planes is saved.
ON_SimpleArray<ON_ClippingPlaneInfo> m_clipping_planes;
// If true, the the camera location, camera direction,
// and lens angle should not be changed.
// It is ok to adjust clipping planes.
bool m_bLockedProjection;
///////////////////////////////////////////////////////////////////////
//
// target point
//
/*
Returns:
Target point. This point is saved on m_vp.m_target_point.
The default constructor sets the target point to
ON_3dPoint::UnsetPoint. You must explicitly set the target
point if you want to use it.
Remarks:
The target point is stored on m_vp.m_target_point. The
value ON_3dmView.m_target is obsolete. This function always
returns the value of m_vp.m_target_point.
*/
ON_3dPoint TargetPoint() const;
/*
Description:
Sets the viewport target point.
Parameters:
target_point - [in]
When in doubt, the point m_vp.FrustumCenterPoint(ON_UNSET_VALUE)
is a good choice.
Remarks:
This point is saved on m_vp.m_target_point.
*/
bool SetTargetPoint(ON_3dPoint target_point);
//
///////////////////////////////////////////////////////////////////////
ON_wString m_name; // name on window
// The value of m_display_mode_id can be one of the "standard" ids
// from ON_StandardDisplayModeId, nil, or a custom display mode
// settings on a particular computer. If you encounter a nil id
// or any other id that is not one of the "standard" display mode
// ids, then your application should use a default display mode,
// typically either wireframe or shaded, that is appropriate for
// general model viewing. The function ON::RhinoV3DisplayMode(id)
// will convert a display mode id into a legacy Rhino V3 display
// mode enum value.
ON_UUID m_display_mode_id;
// position of view in parent window
// (relative display device coordinates)
ON_3dmViewPosition m_position;
ON::view_type m_view_type; // model, page, or nested
// If m_view_type == ON::page_view_type, then the m_page_settings
// records the page size. Otherwise, m_page_settings should
// be ignored.
ON_3dmPageSettings m_page_settings;
///////////////////////////////////////////////////////////////////////
//
// Named view information
//
// If this view was created from a named view, then m_named_view_id
// identifies the named view.
//
// The named views are ON_3dmView classes saved in ON_3dmSettings.m_named_views[].
// A named view's id is the value returned by ON_3dmView.m_vp.ViewportId()
// A named view's name is the value returned by ON_3dmView.m_name
//
// If this view is a named view, then m_named_view_id should be equal to
// m_vp.m_viewport_id.
//
// If this view is not a named view and not created from a named view,
// then m_named_view_id is equal to ON_nil_uuid.
ON_UUID m_named_view_id;
///////////////////////////////////////////////////////////////////////
//
// Construction plane
//
ON_3dmConstructionPlane m_cplane;
bool m_bShowConstructionGrid;
bool m_bShowConstructionAxes;
bool m_bShowConstructionZAxis;
// world axes icon
bool m_bShowWorldAxes;
// tracing image
ON_3dmViewTraceImage m_trace_image;
// wallpaper image
ON_3dmWallpaperImage m_wallpaper_image;
public:
double FocalBlurDistance(void) const;
void SetFocalBlurDistance(double d);
double FocalBlurAperture(void) const;
void SetFocalBlurAperture(double d);
double FocalBlurJitter(void) const;
void SetFocalBlurJitter(double d);
unsigned int FocalBlurSampleCount(void) const;
void SetFocalBlurSampleCount(unsigned int count);
ON_FocalBlurModes FocalBlurMode(void) const;
void SetFocalBlurMode(ON_FocalBlurModes m);
ON_2iSize RenderingSize() const;
void SetRenderingSize(const ON_2iSize& size);
//Focal blur settings - per view for renderers.
private:
double m_dFocalBlurDistance = 100.0;
double m_dFocalBlurAperture = 64.0;
double m_dFocalBlurJitter = 0.1;
unsigned int m_uFocalBlurSampleCount = 10;
ON_FocalBlurModes m_FocalBlurMode = ON_FocalBlurModes::None;
ON_2iSize m_sizeRendering = ON_2iSize(640, 480);
private:
ON__INT_PTR reserved = 0;
};
#if defined(ON_DLL_TEMPLATE)
ON_DLL_TEMPLATE template class ON_CLASS ON_ClassArray<ON_3dmView>;
#endif
//////////////////////////////////////////////////////////////////////////////////////////
//
// ON_3dmRenderSettings
//
class ON_CLASS ON_3dmRenderSettings : public ON_Object
{
ON_OBJECT_DECLARE(ON_3dmRenderSettings);
public:
ON_3dmRenderSettings() = default;
~ON_3dmRenderSettings() = default;
ON_3dmRenderSettings(const ON_3dmRenderSettings&) = default;
ON_3dmRenderSettings& operator=(const ON_3dmRenderSettings&) = default;
static const ON_3dmRenderSettings Default;
bool Write( ON_BinaryArchive& ) const override;
bool Read( ON_BinaryArchive& ) override;
void Dump( ON_TextLog& text_log ) const override;
private:
static bool UseV5ReadWrite(const ON_BinaryArchive&);
bool WriteV5( ON_BinaryArchive& ) const;
bool ReadV5( ON_BinaryArchive& );
public:
//New for V6, rendering source (render directly from a NamedView or Snapshot)
//https://mcneel.myjetbrains.com/youtrack/issue/RH-39593
enum class RenderingSources : unsigned int
{
ActiveViewport, // Get the rendering view from the currently active viewport (as in all previous versions of Rhino)
SpecificViewport, // Get the rendering view from the named viewport (see NamedViewport below)
NamedView, // Get the rendering view from a specific named view (see NamedView below)
SnapShot, // Before rendering, restore the Snapshot specified in Snapshot below, then render.
};
RenderingSources RenderingSource(void) const;
void SetRenderingSource(RenderingSources);
ON_wString SpecificViewport(void) const;
void SetSpecificViewport(const ON_wString&);
ON_wString NamedView(void) const;
void SetNamedView(const ON_wString&);
ON_wString Snapshot(void) const;
void SetSnapshot(const ON_wString&);
private:
RenderingSources m_rendering_source = RenderingSources::ActiveViewport;
ON_wString m_specific_viewport;
ON_wString m_named_view;
ON_wString m_snapshot;
public:
bool ScaleBackgroundToFit() const;
void SetScaleBackgroundToFit( bool bScaleBackgroundToFit );
private:
unsigned short m_reserved1 = 0;
public:
//////////////////////////////////////////////////////////////
//
// Force viewport aspect ratio:
// If m_bCustomImageSize is true and m_bForceViewportAspectRatio is true
// then the image height should be calculated by multiplying the m_image_width
// by the viewport aspect ratio. Note that this might be affected by m_rendering_source
// In this case, m_image_height should not be used.
//
bool m_bForceViewportAspectRatio = false;
//////////////////////////////////////////////////////////////
//
// Custom image size:
// If m_bCustomImageSize is true, then the image pixel size
// is m_image_width X m_image_height pixels.
// If m_bCustomImageSize is false, then the image pixel size
// is the size of the viewport being rendered.
//
bool m_bCustomImageSize = false;
int m_image_width = 800; // image width in pixels
int m_image_height = 600; // image height in pixels
private:
unsigned int m_reserved3 = 0;
public:
////////
// Number of dots/inch (dots=pixels) to use when printing and
// saving bitmaps. The default is 72.0 dots/inch.
double m_image_dpi = 72.0;
//////////
// unit system to use when converting image pixel size and dpi
// information into a print size. Default = inches
ON::LengthUnitSystem m_image_us = ON::LengthUnitSystem::Inches;
ON_Color m_ambient_light = ON_Color::Black;
int m_background_style = 0; // 0 = solid color, 1 = "wallpaper" image, 2 = Gradient, 3 = Environment
// m_background_color was changed from ON_Color::Gray160 to ON_Color::White for "white studio" look.
// m_background_color = Top color of gradient...
ON_Color m_background_color = ON_Color::White;
ON_Color m_background_bottom_color = ON_Color::Gray160;
ON_wString m_background_bitmap_filename;
// If m_background_bitmap_filename is not empty, the file cannot be found,
// and m_embedded_file_id identifes an embedded image file in the model,
// then that file will be used as the background bitmap.
ON_UUID m_embedded_image_file_id = ON_nil_uuid;
bool m_bUseHiddenLights = false;
bool m_bDepthCue = false;
bool m_bFlatShade = false;
bool m_bRenderBackfaces = true;
bool m_bRenderPoints = false;
bool m_bRenderCurves = false;
bool m_bRenderIsoparams = false;
bool m_bRenderMeshEdges = false;
bool m_bRenderAnnotation = false;
bool m_bScaleBackgroundToFit = false;
bool m_bTransparentBackground = false;
private:
unsigned char m_reserved4 = 0;
unsigned int m_reserved5 = 0;
public:
int m_antialias_style = 1; // 0 = none, 1 = normal, 2 = medium, 3 = best
int m_shadowmap_style = 1; // 0 = none, 1 = normal, 2 = best
int m_shadowmap_width= 1000;
int m_shadowmap_height = 1000;
double m_shadowmap_offset = 0.75;
// Flags that are used to determine which render settings a render
// plugin uses, and which ones the display pipeline should use.
// Note: Render plugins set these, and they don't need to persist
// in the document...Also, when set, they turn OFF their
// corresponding setting in the Display Attributes Manager's
// UI pages for "Rendered" mode.
bool m_bUsesAmbientAttr = true;
bool m_bUsesBackgroundAttr = true;
bool m_bUsesBackfaceAttr = false;
bool m_bUsesPointsAttr = false;
bool m_bUsesCurvesAttr = true;
bool m_bUsesIsoparmsAttr = true;
bool m_bUsesMeshEdgesAttr = false;
bool m_bUsesAnnotationAttr = true;
bool m_bUsesHiddenLightsAttr = true;
private:
unsigned char m_reserved6 = 0;
unsigned short m_reserved7 = 0;
unsigned short m_reserved8 = 0;
private:
ON__INT_PTR m_reserved9 = 0;
};
//////////////////////////////////////////////////////////////////////////////////////////
//
// ON_EarthAnchorPoint
//
class ON_CLASS ON_EarthAnchorPoint
{
public:
ON_EarthAnchorPoint() = default;
~ON_EarthAnchorPoint() = default;
ON_EarthAnchorPoint(const ON_EarthAnchorPoint&) = default;
ON_EarthAnchorPoint& operator=(const ON_EarthAnchorPoint&) = default;
// Latitude, longitude, and elevation are ON_UNSET_VALUE.
static const ON_EarthAnchorPoint Unset;
// Latitude, longitude, and elevation are the Seattle Space Needle.
static const ON_EarthAnchorPoint SeattleSpaceNeedle;
static
int Compare(
const ON_EarthAnchorPoint*,
const ON_EarthAnchorPoint*
);
static
int CompareEarthLocation(
const ON_EarthAnchorPoint*,
const ON_EarthAnchorPoint*
);
static
int CompareModelDirection(
const ON_EarthAnchorPoint*,
const ON_EarthAnchorPoint*
);
static
int CompareIdentification(
const ON_EarthAnchorPoint*,
const ON_EarthAnchorPoint*
);
bool Read( ON_BinaryArchive& );
bool Write( ON_BinaryArchive& ) const;
/*
Returns:
True if the latitude, longitude, and elevation are set.
*/
bool EarthLocationIsSet() const;
/*
Returns:
True if model basepoint, north and east are set.
*/
bool ModelLocationIsSet() const;
/*
Parameters:
elevation_unit_system - [in]
elevation - [in]
*/
void SetEarthLocation(
ON::EarthCoordinateSystem earth_coordinate_system,
const class ON_UnitSystem& elevation_unit_system,
double latitude_degrees,
double longitude_degrees,
double elevation
);
void SetEarthLocation(
ON::EarthCoordinateSystem earth_coordinate_system,
ON::LengthUnitSystem elevation_unit_system,
double latitude_degrees,
double longitude_degrees,
double elevation
);
void SetLatitudeAndLongitude(
double latitude_degrees,
double longitude_degrees
);
/*
Returns:
A 3d point with coordinates (latitude in degrees, longitude in degrees, elevation in meters).
Remarks:
Some coordinates may be ON_UNSET_VALUE.
*/
ON_3dPoint EarthLocation() const;
/*
Parameters:
unset_location - [in]
Location to return if EarlocationIsSet() is false.
Returns:
A 3d point with coordinates (latitude, longitude, elevation).
*/
ON_3dPoint EarthLocation(
ON_3dPoint unset_location
) const;
/*
Returns:
Earth location latitude in degrees. Can be ON_UNSET_VALUE
*/
double Latitude() const;
/*
Parameters:
unset_latitude - [in]
Value to return if the Earth location latitude is not set.
Returns:
Earth location latitude in degrees.
*/
double Latitude(
double unset_latitude
) const;
void SetLatitude(