Foxit PDF SDK

fs_pdf3d.h
1 #if (defined(_WIN32) || defined(_WIN64))
2
16 #ifndef FS_3DPDF_H_
17 #define FS_3DPDF_H_
18 #include "common/fs_common.h"
19 #include "pdf/fs_pdfdoc.h"
20 #include "pdf/annots/fs_annot.h"
26 namespace foxit {
28 namespace addon {
30 namespace pdf3d {
32 class PDF3DAnnotViewData FS_FINAL : public Object{
33 public:
35 PDF3DAnnotViewData(){}
36
42 PDF3DAnnotViewData(const PDF3DAnnotViewData& other) {
43 this->display_name = other.display_name;
44 this->name = other.name;
45 }
46
53 PDF3DAnnotViewData& operator = (const PDF3DAnnotViewData& data) {
54 this->display_name = data.display_name;
55 this->name = data.name;
56 return *this;
57 }
58
60 WString display_name;
61
63 WString name;
64 };
65
71 class ModelNode FS_FINAL : public Base{
72 public:
78 typedef enum _PDF3DModelNodeType {
80 e_TypeModelRoot = 0,
82 e_TypeGroup = 1,
84 e_TypeMesh = 2,
86 e_TypeSprite = 3,
88 e_TypeMarkup = 4,
90 e_TypePunctualLight = 5,
92 e_TypeAmbientLight = 6,
94 e_TypeViewCamera = 7,
96 e_TypeClippingPlane = 8,
98 e_TypeProcedural = 9,
100 e_TypeBone = 10,
102 e_TypeDummy = 11
103 } PDF3DModelNodeType;
104
105
107 ModelNode() {}
108
114 ModelNode(const ModelNode& other);
115
117 ~ModelNode();
118
126 bool IsEmpty() const;
127
135 ModelNode& operator=(const ModelNode& other);
136
144 bool operator==(const ModelNode& other) const;
145
153 bool operator!=(const ModelNode& other) const;
154
160 PDF3DModelNodeType GetNodeType();
161
167 ModelNode GetFirstChildNode();
168
174 ModelNode GetNextSiblingNode();
175
181 ModelNode GetParentNode();
182
188 WString GetName();
189
198 void SetVisible(bool is_visible);
199
205 bool IsVisible();
206
207 // 强烈建议用户不要使用此方法；否则可能发生未知情况。
208 explicit ModelNode(FS_HANDLE handle);
209 };
210
216 class PDF3DAnnotInstance FS_FINAL : public Base{
217 public:
223 typedef enum _PDF3DController {
225 e_ControllerRotate = 0,
227 e_ControllerSpin = 1,
229 e_ControllerPan = 2,
231 e_ControllerZoom = 3,
233 e_ControllerWalk = 4,
235 e_ControllerFly = 5
236 } PDF3DController;
237
243 typedef enum _PDF3DRenderMode {
245 e_RenderModeSolid = 1,
247 e_RenderModeSolidWireframe = 2,
249 e_RenderModeSolidOutline = 3,
251 e_RenderModeTransparent = 4,
253 e_RenderModeTransparentWireframe = 5,
255 e_RenderModeBoundingBox = 6,
257 e_RenderModeTransparentBoundingBox = 7,
259 e_RenderModeTransparentBoundingBoxOutline = 8,
261 e_RenderModeWireframe = 9,
263 e_RenderModeShadedWireframe = 10,
265 e_RenderModeHiddenWireframe = 11,
267 e_RenderModeIllustration = 12,
269 e_RenderModeShadedIllustration = 13,
271 e_RenderModeVertices = 14,
273 e_RenderModeShadedVertices = 15
274 } PDF3DRenderMode;
275
276
278 PDF3DAnnotInstance(){}
279
285 PDF3DAnnotInstance(const PDF3DAnnotInstance& other);
286
288 ~PDF3DAnnotInstance();
289
297 PDF3DAnnotInstance& operator=(const PDF3DAnnotInstance& other);
298
306 bool operator==(const PDF3DAnnotInstance& other) const;
307
315 bool operator!=(const PDF3DAnnotInstance& other) const;
316
324 bool IsEmpty() const;
325
337 void SetController(PDF3DController tool_tag);
338
350 void SetRenderMode(PDF3DRenderMode render_mode);
351
359 FX_HWND ActivateCanvas(FX_HWND screen_canvas_parent);
360
371 void UpdateCanvas(RectI rect);
372
383 void OnLButtonDown(int flag, PointF point);
384
395 void OnLButtonUp(int flag, PointF point);
396
407 void OnMouseMove(int flag, PointF point);
408
420 void OnMouseWheel(int flag, int delta, PointF point);
421
432 void OnRButtonDown(int flag, PointF point);
433
444 void OnRButtonUp(int flag, PointF point);
445
453 void ResetDefaultView();
454
462 PDF3DAnnotViewDataArray GetPresetViewList();
463
473 void ApplyPresetView(const PDF3DAnnotViewData& view_data);
474
482 ModelNode GetRootNode();
483
484 // 强烈建议用户不要使用此方法；否则可能发生未知情况。
485 explicit PDF3DAnnotInstance(FS_HANDLE handle);
486 };
488 FSDK_DEFINE_ARRAY(PDF3DAnnotInstanceArray, PDF3DAnnotInstance)
489
490
491 class PDF3DAnnot FS_FINAL : public Base{
492 public:
498 typedef enum _PDF3DType {
500 e_3DTypeArtwork = 0,
502 e_3DTypeRichMedia = 1
503 } PDF3DType;
504
505
507 ~PDF3DAnnot();
508
514 PDF3DAnnot(const PDF3DAnnot& other);
515
523 PDF3DAnnot& operator=(const PDF3DAnnot& other);
524
532 bool operator==(const PDF3DAnnot& other) const;
533
541 bool operator!=(const PDF3DAnnot& other) const;
542
550 bool IsEmpty() const;
551
557 int GetAnnotIndex();
558
564 pdf::annots::Annot GetAnnot();
565
572 PDF3DType Get3DAnnotType();
573
581 PDF3DAnnotInstance Get3DArtworkInstance();
582
590 PDF3DAnnotInstanceArray GetRichMediaInstances();
591
592 // 强烈建议用户不要使用此方法；否则可能发生未知情况。
593 explicit PDF3DAnnot(FS_HANDLE handle);
594 };
595 FSDK_DEFINE_ARRAY(PDF3DAnnotArray, PDF3DAnnot)
596
597
598 class PDF3DLaunchSetting FS_FINAL : public Object {
599 public:
605 typedef enum _PDF3DActivationEnableSetting {
607 e_3DActivationEnableSettingContentClicked = 0,
609 e_3DActivationEnableSettingPageOpened = 1,
611 e_3DActivationEnableSettingPageVisible = 2
612 } PDF3DActivationEnableSetting;
613
619 typedef enum _PDF3DActivationDisableSetting {
621 e_3DActivationDisableSettingContextMenuSelected = 0,
623 e_3DActivationDisableSettingPageClosed = 1,
625 e_3DActivationDisableSettingPageInvisible = 2
626 } PDF3DActivationDisableSetting;
627
633 typedef enum _PDF3DActivationPlaybackStyleSetting {
635 e_3DActivationPlaybackStyleOnPage = 0,
637 e_3DActivationPlaybackStyleInFloatingWindow = 1
638 } PDF3DActivationPlaybackStyleSetting;
639
645 typedef enum _PDF3DAppearanceSettingBorderWidth {
647 e_3DAppearanceSettingBorderWidthNone = 0,
649 e_3DAppearanceSettingBorderWidthThin = 1,
651 e_3DAppearanceSettingBorderWidthMedium = 2,
653 e_3DAppearanceSettingBorderWidthThick = 3
654 } PDF3DAppearanceSettingBorderWidth;
655
661 typedef enum _PDF3DPosterImageSetting {
663 e_3DPosterImageKeepCurrent = 0,
665 e_3DPosterImageRetrieveFromDefaultView = 1,
667 e_3DPosterImageCreateFromFile = 2
668 } PDF3DPosterImageSetting;
669
670
672 PDF3DLaunchSetting()
673 : activation_enable(e_3DActivationEnableSettingContentClicked)
674 , activation_disable(e_3DActivationDisableSettingContextMenuSelected)
675 , activation_playback(e_3DActivationPlaybackStyleOnPage)
676 , window_width(320)
677 , window_height(240)
678 , border_width(e_3DAppearanceSettingBorderWidthNone)
679 , is_transparent_background(false)
680 , poster_image(e_3DPosterImageKeepCurrent)
681 , poster_file_path(L"") {
682 }
683
689 PDF3DLaunchSetting(const PDF3DLaunchSetting& launch_setting)
690 : activation_enable(launch_setting.activation_enable)
691 , activation_disable(launch_setting.activation_disable)
692 , activation_playback(launch_setting.activation_playback)
693 , window_width(launch_setting.window_width)
694 , window_height(launch_setting.window_height)
695 , border_width(launch_setting.border_width)
696 , is_transparent_background(launch_setting.is_transparent_background)
697 , poster_image(launch_setting.poster_image)
698 , poster_file_path(launch_setting.poster_file_path) {
699 }
700
724 PDF3DLaunchSetting(PDF3DActivationEnableSetting activation_enable, PDF3DActivationDisableSetting activation_disable ,
725 PDF3DActivationPlaybackStyleSetting activation_playback, int window_width, int window_height,
726 PDF3DAppearanceSettingBorderWidth border_width, bool is_transparent_background,
727 PDF3DPosterImageSetting poster_image, WString poster_file_path) {
728 this->activation_enable = activation_enable;
729 this->activation_disable = activation_disable;
730 this->activation_playback = activation_playback;
731 this->window_width = window_width;
732 this->window_height = window_height;
733 this->border_width = border_width;
734 this->is_transparent_background = is_transparent_background;
735 this->poster_image = poster_image;
736 this->poster_file_path = poster_file_path;
737 }
738
764 void Set(PDF3DActivationEnableSetting activation_enable, PDF3DActivationDisableSetting activation_disable ,
765 PDF3DActivationPlaybackStyleSetting activation_playback, int window_width, int window_height,
766 PDF3DAppearanceSettingBorderWidth border_width, bool is_transparent_background,
767 PDF3DPosterImageSetting poster_image, WString poster_file_path) {
768 this->activation_enable = activation_enable;
769 this->activation_disable = activation_disable;
770 this->activation_playback = activation_playback;
771 this->window_width = window_width;
772 this->window_height = window_height;
773 this->border_width = border_width;
774 this->is_transparent_background = is_transparent_background;
775 this->poster_image = poster_image;
776 this->poster_file_path = poster_file_path;
777 }
778
786 PDF3DLaunchSetting& operator=(const PDF3DLaunchSetting& launch_setting) {
787 this->activation_enable = launch_setting.activation_enable;
788 this->activation_disable = launch_setting.activation_disable;
789 this->activation_playback = launch_setting.activation_playback;
790 this->window_width = launch_setting.window_width;
791 this->window_height = launch_setting.window_height;
792 this->border_width = launch_setting.border_width;
793 this->is_transparent_background = launch_setting.is_transparent_background;
794 this->poster_image = launch_setting.poster_image;
795 this->poster_file_path = launch_setting.poster_file_path;
796 return *this;
797 }
798
804 PDF3DActivationEnableSetting activation_enable;
805
811 PDF3DActivationDisableSetting activation_disable;
812
818 PDF3DActivationPlaybackStyleSetting activation_playback;
819
823 int window_width;
824
828 int window_height;
829
835 PDF3DAppearanceSettingBorderWidth border_width;
836
841 bool is_transparent_background;
842
848 PDF3DPosterImageSetting poster_image;
849
854 WString poster_file_path;
855 };
856
858 class PDF3DAdvancedSetting FS_FINAL : public Object{
859 public:
865 typedef enum _PDF3DLightingScheme {
867 e_3DLightingSchemeNone = 0,
869 e_3DLightingSchemeFromFile = 1,
871 e_3DLightingSchemeNoLights = 2,
873 e_3DLightingSchemeWhiteLights = 3,
875 e_3DLightingSchemeDayLights = 4,
877 e_3DLightingSchemeHardLights = 5,
879 e_3DLightingSchemePrimaryLights = 6,
881 e_3DLightingSchemeNightLights = 7,
883 e_3DLightingSchemeBlueLights = 8,
885 e_3DLightingSchemeRedLights = 9,
887 e_3DLightingSchemeCubeLights = 10,
889 e_3DLightingSchemeCADLights= 11,
891 e_3DLightingSchemeHeadlamp= 12
892 } PDF3DLightingScheme;
893
899 typedef enum _PDF3DRenderingStyle {
901 e_3DRenderingStyleNone = 0,
903 e_3DRenderingStyleBoundingBox = 1,
905 e_3DRenderingStyleTransparentBoundingBox = 2,
907 e_3DRenderingStyleTransparentBoundingBoxOutline = 3,
909 e_3DRenderingStyleVertices = 4,
911 e_3DRenderingStyleShadedVertices = 5,
913 e_3DRenderingStyleWireframe = 6,
915 e_3DRenderingStyleShadedWireframe = 7,
917 e_3DRenderingStyleSolid = 8,
919 e_3DRenderingStyleTransparent = 9,
921 e_3DRenderingStyleSolidWireframe = 10,
923 e_3DRenderingStyleTransparentWireframe = 11,
925 e_3DRenderingStyleIllustration = 12,
927 e_3DRenderingStyleSolidOutline = 13,
929 e_3DRenderingStyleShadedIllustration = 14,
931 e_3DRenderingStyleHiddenWireframe = 15
932 } PDF3DRenderingStyle;
933
939 typedef enum _PDF3DAnimationStyle {
941 e_3DAnimationStyleNone = 0,
943 e_3DAnimationStyleLoop = 1,
945 e_3DAnimationStyleBounce = 2
946 } PDF3DAnimationStyle;
947
953 typedef enum _PDF3DDefaultViews {
955 e_3DDefaultViewsNoViews = 0,
957 e_3DDefaultViewsLeftTopFrontIsoAllOrtho = 1,
959 e_3DDefaultViewsLeftTopFrontIsoAllPerspective = 2,
961 e_3DDefaultViewsLeftTopFrontOrthoIsoPerspective = 3,
963 e_3DDefaultViewsLeftTopFrontPerspectiveIsoOrtho = 4,
965 e_3DDefaultViewsLeftTopFrontRightBottomBackAllOrtho = 5,
967 e_3DDefaultViewsFromFile = 6
968 } PDF3DDefaultViews;
969
970
972 PDF3DAdvancedSetting()
973 : background_color(0x5E5E5E)
974 , lighting_scheme(e_3DLightingSchemeNone)
975 , rendering_style(e_3DRenderingStyleBoundingBox)
976 , animation_style(e_3DAnimationStyleNone)
977 , default_views(e_3DDefaultViewsNoViews)
978 , is_add_default_views(false)
979 , is_retain_views_and_comments(false)
980 , is_show_tool_bar(true)
981 , is_open_model_tree(false)
982 , script_file_path(L"") {
983 }
984
990 PDF3DAdvancedSetting(const PDF3DAdvancedSetting& advanced_setting)
991 : background_color(advanced_setting.background_color)
992 , lighting_scheme(advanced_setting.lighting_scheme)
993 , rendering_style(advanced_setting.rendering_style)
994 , animation_style(advanced_setting.animation_style)
995 , default_views(advanced_setting.default_views)
996 , is_add_default_views(advanced_setting.is_add_default_views)
997 , is_retain_views_and_comments(advanced_setting.is_retain_views_and_comments)
998 , is_show_tool_bar(advanced_setting.is_show_tool_bar)
999 , is_open_model_tree(advanced_setting.is_open_model_tree)
1000 , script_file_path(advanced_setting.script_file_path) {
1001 }
1002
1010 PDF3DAdvancedSetting& operator=(const PDF3DAdvancedSetting& advanced_setting) {
1011 this->background_color = advanced_setting.background_color;
1012 this->lighting_scheme = advanced_setting.lighting_scheme;
1013 this->rendering_style = advanced_setting.rendering_style;
1014 this->animation_style = advanced_setting.animation_style;
1015 this->default_views = advanced_setting.default_views;
1016 this->is_add_default_views = advanced_setting.is_add_default_views;
1017 this->is_retain_views_and_comments = advanced_setting.is_retain_views_and_comments;
1018 this->is_show_tool_bar = advanced_setting.is_show_tool_bar;
1019 this->is_open_model_tree = advanced_setting.is_open_model_tree;
1020 this->script_file_path = advanced_setting.script_file_path;
1021 return *this;
1022 }
1023
1046 PDF3DAdvancedSetting(foxit::RGB background_color, PDF3DLightingScheme lighting_scheme ,
1047 PDF3DRenderingStyle rendering_style, PDF3DAnimationStyle animation_style,
1048 PDF3DDefaultViews default_views, bool is_add_default_views, bool is_retain_views_and_comments,
1049 bool is_show_tool_bar, bool is_open_model_tree, WString script_file_path) {
1050 this->background_color = background_color;
1051 this->lighting_scheme = lighting_scheme;
1052 this->rendering_style = rendering_style;
1053 this->animation_style = animation_style;
1054 this->default_views = default_views;
1055 this->is_add_default_views = is_add_default_views;
1056 this->is_retain_views_and_comments = is_retain_views_and_comments;
1057 this->is_show_tool_bar = is_show_tool_bar;
1058 this->is_open_model_tree = is_open_model_tree;
1059 this->script_file_path = script_file_path;
1060 }
1085 void Set(foxit::RGB background_color, PDF3DLightingScheme lighting_scheme ,
1086 PDF3DRenderingStyle rendering_style, PDF3DAnimationStyle animation_style,
1087 PDF3DDefaultViews default_views, bool is_add_default_views, bool is_retain_views_and_comments,
1088 bool is_show_tool_bar, bool is_open_model_tree, WString script_file_path) {
1089 this->background_color = background_color;
1090 this->lighting_scheme = lighting_scheme;
1091 this->rendering_style = rendering_style;
1092 this->animation_style = animation_style;
1093 this->default_views = default_views;
1094 this->is_add_default_views = is_add_default_views;
1095 this->is_retain_views_and_comments = is_retain_views_and_comments;
1096 this->is_show_tool_bar = is_show_tool_bar;
1097 this->is_open_model_tree = is_open_model_tree;
1098 this->script_file_path = script_file_path;
1099 }
1103 foxit::RGB background_color;
1104
1110 PDF3DLightingScheme lighting_scheme;
1111
1117 PDF3DRenderingStyle rendering_style;
1118
1124 PDF3DAnimationStyle animation_style;
1125
1131 PDF3DDefaultViews default_views;
1132
1137 bool is_add_default_views;
1138
1143 bool is_retain_views_and_comments;
1144
1149 bool is_show_tool_bar;
1150
1155 bool is_open_model_tree;
1156
1158 WString script_file_path;
1159 };
1160
1169 class PDF3DContext FS_FINAL : public Base{
1170 public:
1172 explicit PDF3DContext(const pdf::PDFDoc& doc);
1173
1179 PDF3DContext(const PDF3DContext& other);
1180
1182 ~PDF3DContext();
1183
1191 PDF3DContext& operator=(const PDF3DContext& other);
1192
1200 bool operator==(const PDF3DContext& other) const;
1201
1209 bool operator!=(const PDF3DContext& other) const;
1210
1218 bool IsEmpty() const;
1219
1228 PDF3DAnnotArray GetPage3DAnnotArray(int page_index);
1229
1237 void Invalidate();
1238
1251 PDF3DAnnot Add3DAnnot(const wchar_t* threeD_file_path, int page_index, foxit::RectF rectf, void* screen_canvas_parent,
1252 PDF3DLaunchSetting launch_setting, PDF3DAdvancedSetting advanced_setting);
1253
1267 PDF3DAnnot Add3DAnnot(foxit::common::file::ReaderCallback* threeD_file_read, int page_index, foxit::RectF rectf, void* screen_canvas_parent, PDF3DLaunchSetting launch_setting, PDF3DAdvancedSetting advanced_setting);
1268
1269 // 强烈建议用户不要使用此方法；否则可能发生未知情况。
1270 explicit PDF3DContext(FS_HANDLE handle = NULL);
1271 };
1272 } //pdf3d
1273 } //addon
1274 } //foxit
1275 #endif //FS_3DPDF_H_
1276 #endif //defined(_WIN32) || defined(_WIN64)
foxit::Object
CFX_Object Object
对象类型。
Definition: fs_basictypes.h:220
fs_pdfdoc.h
PDF文档相关定义和类的头文件。
foxit::RGB
uint32 RGB
RGB 颜色类型，24 位，((b) | ((g) << 8) | ((r) << 16)))
Definition: fs_basictypes.h:211
IFX_FileRead
文件读取接口。
Definition: fx_stream.h:587
foxit::WString
CFX_WideString WString
宽字符串。
Definition: fs_basictypes.h:222
operator==
bool operator==(const char *str1, const CFX_ByteString &str2)
检查两个字节字符串是否相等。
Definition: fs_basictypes.h:128
foxit::PointF
CFX_PointF PointF
点信息，浮点型。
Definition: fs_basictypes.h:485
fs_annot.h
注释相关定义和类的头文件。
foxit::FS_HANDLE
void * FS_HANDLE
句柄类型。
Definition: fs_basictypes.h:213
fs_common.h
通用定义和类的头文件。
foxit
Foxit命名空间。
Definition: fs_taggedpdf.h:27
NULL
#define NULL
空指针值。
Definition: fx_system.h:792
operator!=
bool operator!=(const char *str1, const CFX_ByteString &str2)
检查两个字节字符串是否不相等。
Definition: fs_basictypes.h:140
foxit::RectI
FX_RECT RectI
矩形，整数型。
Definition: fs_basictypes.h:491
CFX_FloatRect
Definition: fx_coordinates.h:771