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
331 pdf::annots::Annot GetAnnot();
332
344 void SetController(PDF3DController tool_tag);
345
357 void SetRenderMode(PDF3DRenderMode render_mode);
358
366 FX_HWND ActivateCanvas(FX_HWND screen_canvas_parent);
367
378 void UpdateCanvas(RectI rect);
379
390 void OnLButtonDown(int flag, PointF point);
391
402 void OnLButtonUp(int flag, PointF point);
403
414 void OnMouseMove(int flag, PointF point);
415
427 void OnMouseWheel(int flag, int delta, PointF point);
428
439 void OnRButtonDown(int flag, PointF point);
440
451 void OnRButtonUp(int flag, PointF point);
452
460 void ResetDefaultView();
461
469 PDF3DAnnotViewDataArray GetPresetViewList();
470
480 void ApplyPresetView(const PDF3DAnnotViewData& view_data);
481
489 ModelNode GetRootNode();
490
491 // 强烈建议用户不要使用此方法；否则可能发生未知情况。
492 explicit PDF3DAnnotInstance(FS_HANDLE handle);
493 };
495 FSDK_DEFINE_ARRAY(PDF3DAnnotInstanceArray, PDF3DAnnotInstance)
496
497
498 class PDF3DAnnot FS_FINAL : public Base{
499 public:
505 typedef enum _PDF3DType {
507 e_3DTypeArtwork = 0,
509 e_3DTypeRichMedia = 1
510 } PDF3DType;
511
512
514 ~PDF3DAnnot();
515
521 PDF3DAnnot(const PDF3DAnnot& other);
522
530 PDF3DAnnot& operator=(const PDF3DAnnot& other);
531
539 bool operator==(const PDF3DAnnot& other) const;
540
548 bool operator!=(const PDF3DAnnot& other) const;
549
557 bool IsEmpty() const;
558
564 int GetAnnotIndex();
565
571 pdf::annots::Annot GetAnnot();
572
579 PDF3DType Get3DAnnotType();
580
588 PDF3DAnnotInstance Get3DArtworkInstance();
589
597 PDF3DAnnotInstanceArray GetRichMediaInstances();
598
599 // 强烈建议用户不要使用此方法；否则可能发生未知情况。
600 explicit PDF3DAnnot(FS_HANDLE handle);
601 };
602 FSDK_DEFINE_ARRAY(PDF3DAnnotArray, PDF3DAnnot)
603
604
605 class PDF3DLaunchSetting FS_FINAL : public Object {
606 public:
612 typedef enum _PDF3DActivationEnableSetting {
614 e_3DActivationEnableSettingContentClicked = 0,
616 e_3DActivationEnableSettingPageOpened = 1,
618 e_3DActivationEnableSettingPageVisible = 2
619 } PDF3DActivationEnableSetting;
620
626 typedef enum _PDF3DActivationDisableSetting {
628 e_3DActivationDisableSettingContextMenuSelected = 0,
630 e_3DActivationDisableSettingPageClosed = 1,
632 e_3DActivationDisableSettingPageInvisible = 2
633 } PDF3DActivationDisableSetting;
634
640 typedef enum _PDF3DActivationPlaybackStyleSetting {
642 e_3DActivationPlaybackStyleOnPage = 0,
644 e_3DActivationPlaybackStyleInFloatingWindow = 1
645 } PDF3DActivationPlaybackStyleSetting;
646
652 typedef enum _PDF3DAppearanceSettingBorderWidth {
654 e_3DAppearanceSettingBorderWidthNone = 0,
656 e_3DAppearanceSettingBorderWidthThin = 1,
658 e_3DAppearanceSettingBorderWidthMedium = 2,
660 e_3DAppearanceSettingBorderWidthThick = 3
661 } PDF3DAppearanceSettingBorderWidth;
662
668 typedef enum _PDF3DPosterImageSetting {
670 e_3DPosterImageKeepCurrent = 0,
672 e_3DPosterImageRetrieveFromDefaultView = 1,
674 e_3DPosterImageCreateFromFile = 2
675 } PDF3DPosterImageSetting;
676
677
679 PDF3DLaunchSetting()
680 : activation_enable(e_3DActivationEnableSettingContentClicked)
681 , activation_disable(e_3DActivationDisableSettingContextMenuSelected)
682 , activation_playback(e_3DActivationPlaybackStyleOnPage)
683 , window_width(320)
684 , window_height(240)
685 , border_width(e_3DAppearanceSettingBorderWidthNone)
686 , is_transparent_background(false)
687 , poster_image(e_3DPosterImageKeepCurrent)
688 , poster_file_path(L"") {
689 }
690
696 PDF3DLaunchSetting(const PDF3DLaunchSetting& launch_setting)
697 : activation_enable(launch_setting.activation_enable)
698 , activation_disable(launch_setting.activation_disable)
699 , activation_playback(launch_setting.activation_playback)
700 , window_width(launch_setting.window_width)
701 , window_height(launch_setting.window_height)
702 , border_width(launch_setting.border_width)
703 , is_transparent_background(launch_setting.is_transparent_background)
704 , poster_image(launch_setting.poster_image)
705 , poster_file_path(launch_setting.poster_file_path) {
706 }
707
731 PDF3DLaunchSetting(PDF3DActivationEnableSetting activation_enable, PDF3DActivationDisableSetting activation_disable ,
732 PDF3DActivationPlaybackStyleSetting activation_playback, int window_width, int window_height,
733 PDF3DAppearanceSettingBorderWidth border_width, bool is_transparent_background,
734 PDF3DPosterImageSetting poster_image, WString poster_file_path) {
735 this->activation_enable = activation_enable;
736 this->activation_disable = activation_disable;
737 this->activation_playback = activation_playback;
738 this->window_width = window_width;
739 this->window_height = window_height;
740 this->border_width = border_width;
741 this->is_transparent_background = is_transparent_background;
742 this->poster_image = poster_image;
743 this->poster_file_path = poster_file_path;
744 }
745
771 void Set(PDF3DActivationEnableSetting activation_enable, PDF3DActivationDisableSetting activation_disable ,
772 PDF3DActivationPlaybackStyleSetting activation_playback, int window_width, int window_height,
773 PDF3DAppearanceSettingBorderWidth border_width, bool is_transparent_background,
774 PDF3DPosterImageSetting poster_image, WString poster_file_path) {
775 this->activation_enable = activation_enable;
776 this->activation_disable = activation_disable;
777 this->activation_playback = activation_playback;
778 this->window_width = window_width;
779 this->window_height = window_height;
780 this->border_width = border_width;
781 this->is_transparent_background = is_transparent_background;
782 this->poster_image = poster_image;
783 this->poster_file_path = poster_file_path;
784 }
785
793 PDF3DLaunchSetting& operator=(const PDF3DLaunchSetting& launch_setting) {
794 this->activation_enable = launch_setting.activation_enable;
795 this->activation_disable = launch_setting.activation_disable;
796 this->activation_playback = launch_setting.activation_playback;
797 this->window_width = launch_setting.window_width;
798 this->window_height = launch_setting.window_height;
799 this->border_width = launch_setting.border_width;
800 this->is_transparent_background = launch_setting.is_transparent_background;
801 this->poster_image = launch_setting.poster_image;
802 this->poster_file_path = launch_setting.poster_file_path;
803 return *this;
804 }
805
811 PDF3DActivationEnableSetting activation_enable;
812
818 PDF3DActivationDisableSetting activation_disable;
819
825 PDF3DActivationPlaybackStyleSetting activation_playback;
826
830 int window_width;
831
835 int window_height;
836
842 PDF3DAppearanceSettingBorderWidth border_width;
843
848 bool is_transparent_background;
849
855 PDF3DPosterImageSetting poster_image;
856
861 WString poster_file_path;
862 };
863
865 class PDF3DAdvancedSetting FS_FINAL : public Object{
866 public:
872 typedef enum _PDF3DLightingScheme {
874 e_3DLightingSchemeNone = 0,
876 e_3DLightingSchemeFromFile = 1,
878 e_3DLightingSchemeNoLights = 2,
880 e_3DLightingSchemeWhiteLights = 3,
882 e_3DLightingSchemeDayLights = 4,
884 e_3DLightingSchemeHardLights = 5,
886 e_3DLightingSchemePrimaryLights = 6,
888 e_3DLightingSchemeNightLights = 7,
890 e_3DLightingSchemeBlueLights = 8,
892 e_3DLightingSchemeRedLights = 9,
894 e_3DLightingSchemeCubeLights = 10,
896 e_3DLightingSchemeCADLights= 11,
898 e_3DLightingSchemeHeadlamp= 12
899 } PDF3DLightingScheme;
900
906 typedef enum _PDF3DRenderingStyle {
908 e_3DRenderingStyleNone = 0,
910 e_3DRenderingStyleBoundingBox = 1,
912 e_3DRenderingStyleTransparentBoundingBox = 2,
914 e_3DRenderingStyleTransparentBoundingBoxOutline = 3,
916 e_3DRenderingStyleVertices = 4,
918 e_3DRenderingStyleShadedVertices = 5,
920 e_3DRenderingStyleWireframe = 6,
922 e_3DRenderingStyleShadedWireframe = 7,
924 e_3DRenderingStyleSolid = 8,
926 e_3DRenderingStyleTransparent = 9,
928 e_3DRenderingStyleSolidWireframe = 10,
930 e_3DRenderingStyleTransparentWireframe = 11,
932 e_3DRenderingStyleIllustration = 12,
934 e_3DRenderingStyleSolidOutline = 13,
936 e_3DRenderingStyleShadedIllustration = 14,
938 e_3DRenderingStyleHiddenWireframe = 15
939 } PDF3DRenderingStyle;
940
946 typedef enum _PDF3DAnimationStyle {
948 e_3DAnimationStyleNone = 0,
950 e_3DAnimationStyleLoop = 1,
952 e_3DAnimationStyleBounce = 2
953 } PDF3DAnimationStyle;
954
960 typedef enum _PDF3DDefaultViews {
962 e_3DDefaultViewsNoViews = 0,
964 e_3DDefaultViewsLeftTopFrontIsoAllOrtho = 1,
966 e_3DDefaultViewsLeftTopFrontIsoAllPerspective = 2,
968 e_3DDefaultViewsLeftTopFrontOrthoIsoPerspective = 3,
970 e_3DDefaultViewsLeftTopFrontPerspectiveIsoOrtho = 4,
972 e_3DDefaultViewsLeftTopFrontRightBottomBackAllOrtho = 5,
974 e_3DDefaultViewsFromFile = 6
975 } PDF3DDefaultViews;
976
977
979 PDF3DAdvancedSetting()
980 : background_color(0x5E5E5E)
981 , lighting_scheme(e_3DLightingSchemeNone)
982 , rendering_style(e_3DRenderingStyleBoundingBox)
983 , animation_style(e_3DAnimationStyleNone)
984 , default_views(e_3DDefaultViewsNoViews)
985 , is_add_default_views(false)
986 , is_retain_views_and_comments(false)
987 , is_show_tool_bar(true)
988 , is_open_model_tree(false)
989 , script_file_path(L"") {
990 }
991
997 PDF3DAdvancedSetting(const PDF3DAdvancedSetting& advanced_setting)
998 : background_color(advanced_setting.background_color)
999 , lighting_scheme(advanced_setting.lighting_scheme)
1000 , rendering_style(advanced_setting.rendering_style)
1001 , animation_style(advanced_setting.animation_style)
1002 , default_views(advanced_setting.default_views)
1003 , is_add_default_views(advanced_setting.is_add_default_views)
1004 , is_retain_views_and_comments(advanced_setting.is_retain_views_and_comments)
1005 , is_show_tool_bar(advanced_setting.is_show_tool_bar)
1006 , is_open_model_tree(advanced_setting.is_open_model_tree)
1007 , script_file_path(advanced_setting.script_file_path) {
1008 }
1009
1017 PDF3DAdvancedSetting& operator=(const PDF3DAdvancedSetting& advanced_setting) {
1018 this->background_color = advanced_setting.background_color;
1019 this->lighting_scheme = advanced_setting.lighting_scheme;
1020 this->rendering_style = advanced_setting.rendering_style;
1021 this->animation_style = advanced_setting.animation_style;
1022 this->default_views = advanced_setting.default_views;
1023 this->is_add_default_views = advanced_setting.is_add_default_views;
1024 this->is_retain_views_and_comments = advanced_setting.is_retain_views_and_comments;
1025 this->is_show_tool_bar = advanced_setting.is_show_tool_bar;
1026 this->is_open_model_tree = advanced_setting.is_open_model_tree;
1027 this->script_file_path = advanced_setting.script_file_path;
1028 return *this;
1029 }
1030
1053 PDF3DAdvancedSetting(foxit::RGB background_color, PDF3DLightingScheme lighting_scheme ,
1054 PDF3DRenderingStyle rendering_style, PDF3DAnimationStyle animation_style,
1055 PDF3DDefaultViews default_views, bool is_add_default_views, bool is_retain_views_and_comments,
1056 bool is_show_tool_bar, bool is_open_model_tree, WString script_file_path) {
1057 this->background_color = background_color;
1058 this->lighting_scheme = lighting_scheme;
1059 this->rendering_style = rendering_style;
1060 this->animation_style = animation_style;
1061 this->default_views = default_views;
1062 this->is_add_default_views = is_add_default_views;
1063 this->is_retain_views_and_comments = is_retain_views_and_comments;
1064 this->is_show_tool_bar = is_show_tool_bar;
1065 this->is_open_model_tree = is_open_model_tree;
1066 this->script_file_path = script_file_path;
1067 }
1092 void Set(foxit::RGB background_color, PDF3DLightingScheme lighting_scheme ,
1093 PDF3DRenderingStyle rendering_style, PDF3DAnimationStyle animation_style,
1094 PDF3DDefaultViews default_views, bool is_add_default_views, bool is_retain_views_and_comments,
1095 bool is_show_tool_bar, bool is_open_model_tree, WString script_file_path) {
1096 this->background_color = background_color;
1097 this->lighting_scheme = lighting_scheme;
1098 this->rendering_style = rendering_style;
1099 this->animation_style = animation_style;
1100 this->default_views = default_views;
1101 this->is_add_default_views = is_add_default_views;
1102 this->is_retain_views_and_comments = is_retain_views_and_comments;
1103 this->is_show_tool_bar = is_show_tool_bar;
1104 this->is_open_model_tree = is_open_model_tree;
1105 this->script_file_path = script_file_path;
1106 }
1110 foxit::RGB background_color;
1111
1117 PDF3DLightingScheme lighting_scheme;
1118
1124 PDF3DRenderingStyle rendering_style;
1125
1131 PDF3DAnimationStyle animation_style;
1132
1138 PDF3DDefaultViews default_views;
1139
1144 bool is_add_default_views;
1145
1150 bool is_retain_views_and_comments;
1151
1156 bool is_show_tool_bar;
1157
1162 bool is_open_model_tree;
1163
1165 WString script_file_path;
1166 };
1167
1176 class PDF3DContext FS_FINAL : public Base{
1177 public:
1179 explicit PDF3DContext(const pdf::PDFDoc& doc);
1180
1186 PDF3DContext(const PDF3DContext& other);
1187
1189 ~PDF3DContext();
1190
1198 PDF3DContext& operator=(const PDF3DContext& other);
1199
1207 bool operator==(const PDF3DContext& other) const;
1208
1216 bool operator!=(const PDF3DContext& other) const;
1217
1225 bool IsEmpty() const;
1226
1235 PDF3DAnnotInstanceArray GetPage3DAnnotArray(int page_index);
1236
1244 void Invalidate();
1245
1258 PDF3DAnnot Add3DAnnot(const wchar_t* threeD_file_path, int page_index, foxit::RectF rectf, void* screen_canvas_parent,
1259 PDF3DLaunchSetting launch_setting, PDF3DAdvancedSetting advanced_setting);
1260
1274 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);
1275
1276 // 强烈建议用户不要使用此方法；否则可能发生未知情况。
1277 explicit PDF3DContext(FS_HANDLE handle = NULL);
1278 };
1279
1280 } //pdf3d
1281 } //addon
1282 } //foxit
1283 #endif //FS_3DPDF_H_
1284 #endif //defined(_WIN32) || defined(_WIN64)
foxit::FS_HANDLE
void * FS_HANDLE
句柄类型。
Definition: fs_basictypes.h:214
foxit::Object
CFX_Object Object
对象类型。
Definition: fs_basictypes.h:221
fs_common.h
通用定义和类的头文件。
IFX_FileRead
文件读取接口。
Definition: fx_stream.h:587
foxit::RectI
FX_RECT RectI
矩形，整数型。
Definition: fs_basictypes.h:475
operator==
bool operator==(const char *str1, const CFX_ByteString &str2)
检查两个字节字符串是否相等。
Definition: fs_basictypes.h:128
foxit::WString
CFX_WideString WString
宽字符串。
Definition: fs_basictypes.h:223
foxit
Foxit命名空间。
Definition: fs_taggedpdf.h:27
operator!=
bool operator!=(const char *str1, const CFX_ByteString &str2)
检查两个字节字符串是否不相等。
Definition: fs_basictypes.h:140
fs_pdfdoc.h
PDF文档相关定义和类的头文件。
NULL
#define NULL
空指针值。
Definition: fx_system.h:792
CFX_FloatRect
Definition: fx_coordinates.h:771
foxit::RGB
uint32 RGB
RGB 颜色类型，24 位，((b) | ((g) << 8) | ((r) << 16)))
Definition: fs_basictypes.h:212
foxit::PointF
CFX_PointF PointF
点信息，浮点型。
Definition: fs_basictypes.h:469
fs_annot.h
注释相关定义和类的头文件。