Foxit PDF SDK
fs_pdf3d.h
1 #if (defined(_WIN32) || defined(_WIN64)) || defined(__EMSCRIPTEN__)
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 
67 FSDK_DEFINE_ARRAY(PDF3DAnnotViewDataArray, PDF3DAnnotViewData)
68 
69 
74 class ModelNode FS_FINAL : public Base{
75  public:
81  typedef enum _PDF3DModelNodeType {
83  e_TypeModelRoot = 0,
85  e_TypeGroup = 1,
87  e_TypeMesh = 2,
89  e_TypeSprite = 3,
91  e_TypeMarkup = 4,
93  e_TypePunctualLight = 5,
95  e_TypeAmbientLight = 6,
97  e_TypeViewCamera = 7,
99  e_TypeClippingPlane = 8,
101  e_TypeProcedural = 9,
103  e_TypeBone = 10,
105  e_TypeDummy = 11
106  } PDF3DModelNodeType;
107 
109  ModelNode() {}
110 
116  ModelNode(const ModelNode& other);
117 
119  ~ModelNode();
120 
128  bool IsEmpty() const;
129 
137  ModelNode& operator=(const ModelNode& other);
138 
146  bool operator==(const ModelNode& other) const;
147 
155  bool operator!=(const ModelNode& other) const;
156 
163  PDF3DModelNodeType GetNodeType();
164 
170  ModelNode GetFirstChildNode();
171 
177  ModelNode GetNextSiblingNode();
178 
184  ModelNode GetParentNode();
185 
191  WString GetName();
192 
201  void SetVisible(bool is_visible);
202 
208  bool IsVisible();
209 
210  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
211  explicit ModelNode(FS_HANDLE handle);
212 };
213 
219 class PDF3DAnnotInstance FS_FINAL : public Base{
220  public:
226  typedef enum _PDF3DController {
228  e_ControllerRotate = 0,
230  e_ControllerSpin = 1,
232  e_ControllerPan = 2,
234  e_ControllerZoom = 3,
236  e_ControllerWalk = 4,
238  e_ControllerFly = 5
239  } PDF3DController;
240 
246  typedef enum _PDF3DRenderMode {
248  e_RenderModeSolid = 1,
250  e_RenderModeSolidWireframe = 2,
252  e_RenderModeSolidOutline = 3,
254  e_RenderModeTransparent = 4,
256  e_RenderModeTransparentWireframe = 5,
258  e_RenderModeBoundingBox = 6,
260  e_RenderModeTransparentBoundingBox = 7,
262  e_RenderModeTransparentBoundingBoxOutline = 8,
264  e_RenderModeWireframe = 9,
266  e_RenderModeShadedWireframe = 10,
268  e_RenderModeHiddenWireframe = 11,
270  e_RenderModeIllustration = 12,
272  e_RenderModeShadedIllustration = 13,
274  e_RenderModeVertices = 14,
276  e_RenderModeShadedVertices = 15
277  } PDF3DRenderMode;
278 
279 
281  PDF3DAnnotInstance(){}
282 
288  PDF3DAnnotInstance(const PDF3DAnnotInstance& other);
289 
291  ~PDF3DAnnotInstance();
292 
300  PDF3DAnnotInstance& operator=(const PDF3DAnnotInstance& other);
301 
309  bool operator==(const PDF3DAnnotInstance& other) const;
310 
318  bool operator!=(const PDF3DAnnotInstance& other) const;
319 
327  bool IsEmpty() const;
328 
340  void SetController(PDF3DController tool_tag);
341 
353  void SetRenderMode(PDF3DRenderMode render_mode);
354 
362  FX_HWND ActivateCanvas(FX_HWND screen_canvas_parent);
363 
374  void UpdateCanvas(RectI rect);
375 
386  void OnLButtonDown(int flag, PointF point);
387 
398  void OnLButtonUp(int flag, PointF point);
399 
410  void OnMouseMove(int flag, PointF point);
411 
423  void OnMouseWheel(int flag, int delta, PointF point);
424 
435  void OnRButtonDown(int flag, PointF point);
436 
447  void OnRButtonUp(int flag, PointF point);
448 
456  void ResetDefaultView();
457 
465  PDF3DAnnotViewDataArray GetPresetViewList();
466 
476  void ApplyPresetView(const PDF3DAnnotViewData& view_data);
477 
485  ModelNode GetRootNode();
486 
487  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
488  explicit PDF3DAnnotInstance(FS_HANDLE handle);
489 };
491 FSDK_DEFINE_ARRAY(PDF3DAnnotInstanceArray, PDF3DAnnotInstance)
492 
493 
494 class PDF3DAnnot FS_FINAL : public Base{
495  public:
501  typedef enum _PDF3DType {
503  e_3DTypeArtwork = 0,
505  e_3DTypeRichMedia = 1
506  } PDF3DType;
507 
508 
510  ~PDF3DAnnot();
511 
517  PDF3DAnnot(const PDF3DAnnot& other);
518 
526  PDF3DAnnot& operator=(const PDF3DAnnot& other);
527 
535  bool operator==(const PDF3DAnnot& other) const;
536 
544  bool operator!=(const PDF3DAnnot& other) const;
545 
553  bool IsEmpty() const;
554 
560  int GetAnnotIndex();
561 
567  pdf::annots::Annot GetAnnot();
568 
575  PDF3DType Get3DAnnotType();
576 
584  PDF3DAnnotInstance Get3DArtworkInstance();
585 
593  PDF3DAnnotInstanceArray GetRichMediaInstances();
594 
595  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
596  explicit PDF3DAnnot(FS_HANDLE handle);
597 };
598 FSDK_DEFINE_ARRAY(PDF3DAnnotArray, PDF3DAnnot)
599 
600 
601 class PDF3DLaunchSetting FS_FINAL : public Object {
602  public:
608  typedef enum _PDF3DActivationEnableSetting {
610  e_3DActivationEnableSettingContentClicked = 0,
612  e_3DActivationEnableSettingPageOpened = 1,
614  e_3DActivationEnableSettingPageVisible = 2
615  } PDF3DActivationEnableSetting;
616 
622  typedef enum _PDF3DActivationDisableSetting {
624  e_3DActivationDisableSettingContextMenuSelected = 0,
626  e_3DActivationDisableSettingPageClosed = 1,
628  e_3DActivationDisableSettingPageInvisible = 2
629  } PDF3DActivationDisableSetting;
630 
636  typedef enum _PDF3DActivationPlaybackStyleSetting {
638  e_3DActivationPlaybackStyleOnPage = 0,
640  e_3DActivationPlaybackStyleInFloatingWindow = 1
641  } PDF3DActivationPlaybackStyleSetting;
642 
648  typedef enum _PDF3DAppearanceSettingBorderWidth {
650  e_3DAppearanceSettingBorderWidthNone = 0,
652  e_3DAppearanceSettingBorderWidthThin = 1,
654  e_3DAppearanceSettingBorderWidthMedium = 2,
656  e_3DAppearanceSettingBorderWidthThick = 3
657  } PDF3DAppearanceSettingBorderWidth;
658 
664  typedef enum _PDF3DPosterImageSetting {
666  e_3DPosterImageKeepCurrent = 0,
668  e_3DPosterImageRetrieveFromDefaultView = 1,
670  e_3DPosterImageCreateFromFile = 2
671  } PDF3DPosterImageSetting;
672 
673 
675  PDF3DLaunchSetting()
676  : activation_enable(e_3DActivationEnableSettingContentClicked)
677  , activation_disable(e_3DActivationDisableSettingContextMenuSelected)
678  , activation_playback(e_3DActivationPlaybackStyleOnPage)
679  , window_width(320)
680  , window_height(240)
681  , border_width(e_3DAppearanceSettingBorderWidthNone)
682  , is_transparent_background(false)
683  , poster_image(e_3DPosterImageKeepCurrent)
684  , poster_file_path(L"") {
685  }
686 
692  PDF3DLaunchSetting(const PDF3DLaunchSetting& launch_setting)
693  : activation_enable(launch_setting.activation_enable)
694  , activation_disable(launch_setting.activation_disable)
695  , activation_playback(launch_setting.activation_playback)
696  , window_width(launch_setting.window_width)
697  , window_height(launch_setting.window_height)
698  , border_width(launch_setting.border_width)
699  , is_transparent_background(launch_setting.is_transparent_background)
700  , poster_image(launch_setting.poster_image)
701  , poster_file_path(launch_setting.poster_file_path) {
702  }
703 
727  PDF3DLaunchSetting(PDF3DActivationEnableSetting activation_enable, PDF3DActivationDisableSetting activation_disable ,
728  PDF3DActivationPlaybackStyleSetting activation_playback, int window_width, int window_height,
729  PDF3DAppearanceSettingBorderWidth border_width, bool is_transparent_background,
730  PDF3DPosterImageSetting poster_image, WString poster_file_path) {
731  this->activation_enable = activation_enable;
732  this->activation_disable = activation_disable;
733  this->activation_playback = activation_playback;
734  this->window_width = window_width;
735  this->window_height = window_height;
736  this->border_width = border_width;
737  this->is_transparent_background = is_transparent_background;
738  this->poster_image = poster_image;
739  this->poster_file_path = poster_file_path;
740  }
741 
767  void Set(PDF3DActivationEnableSetting activation_enable, PDF3DActivationDisableSetting activation_disable ,
768  PDF3DActivationPlaybackStyleSetting activation_playback, int window_width, int window_height,
769  PDF3DAppearanceSettingBorderWidth border_width, bool is_transparent_background,
770  PDF3DPosterImageSetting poster_image, WString poster_file_path) {
771  this->activation_enable = activation_enable;
772  this->activation_disable = activation_disable;
773  this->activation_playback = activation_playback;
774  this->window_width = window_width;
775  this->window_height = window_height;
776  this->border_width = border_width;
777  this->is_transparent_background = is_transparent_background;
778  this->poster_image = poster_image;
779  this->poster_file_path = poster_file_path;
780  }
781 
789  PDF3DLaunchSetting& operator=(const PDF3DLaunchSetting& launch_setting) {
790  this->activation_enable = launch_setting.activation_enable;
791  this->activation_disable = launch_setting.activation_disable;
792  this->activation_playback = launch_setting.activation_playback;
793  this->window_width = launch_setting.window_width;
794  this->window_height = launch_setting.window_height;
795  this->border_width = launch_setting.border_width;
796  this->is_transparent_background = launch_setting.is_transparent_background;
797  this->poster_image = launch_setting.poster_image;
798  this->poster_file_path = launch_setting.poster_file_path;
799  return *this;
800  }
801 
807  PDF3DActivationEnableSetting activation_enable;
808 
814  PDF3DActivationDisableSetting activation_disable;
815 
821  PDF3DActivationPlaybackStyleSetting activation_playback;
822 
826  int window_width;
827 
831  int window_height;
832 
838  PDF3DAppearanceSettingBorderWidth border_width;
839 
844  bool is_transparent_background;
845 
851  PDF3DPosterImageSetting poster_image;
852 
857  WString poster_file_path;
858 };
859 
861 class PDF3DAdvancedSetting FS_FINAL : public Object{
862  public:
868  typedef enum _PDF3DLightingScheme {
870  e_3DLightingSchemeNone = 0,
872  e_3DLightingSchemeFromFile = 1,
874  e_3DLightingSchemeNoLights = 2,
876  e_3DLightingSchemeWhiteLights = 3,
878  e_3DLightingSchemeDayLights = 4,
880  e_3DLightingSchemeHardLights = 5,
882  e_3DLightingSchemePrimaryLights = 6,
884  e_3DLightingSchemeNightLights = 7,
886  e_3DLightingSchemeBlueLights = 8,
888  e_3DLightingSchemeRedLights = 9,
890  e_3DLightingSchemeCubeLights = 10,
892  e_3DLightingSchemeCADLights= 11,
894  e_3DLightingSchemeHeadlamp= 12
895  } PDF3DLightingScheme;
896 
902  typedef enum _PDF3DRenderingStyle {
904  e_3DRenderingStyleNone = 0,
906  e_3DRenderingStyleBoundingBox = 1,
908  e_3DRenderingStyleTransparentBoundingBox = 2,
910  e_3DRenderingStyleTransparentBoundingBoxOutline = 3,
912  e_3DRenderingStyleVertices = 4,
914  e_3DRenderingStyleShadedVertices = 5,
916  e_3DRenderingStyleWireframe = 6,
918  e_3DRenderingStyleShadedWireframe = 7,
920  e_3DRenderingStyleSolid = 8,
922  e_3DRenderingStyleTransparent = 9,
924  e_3DRenderingStyleSolidWireframe = 10,
926  e_3DRenderingStyleTransparentWireframe = 11,
928  e_3DRenderingStyleIllustration = 12,
930  e_3DRenderingStyleSolidOutline = 13,
932  e_3DRenderingStyleShadedIllustration = 14,
934  e_3DRenderingStyleHiddenWireframe = 15
935  } PDF3DRenderingStyle;
936 
942  typedef enum _PDF3DAnimationStyle {
944  e_3DAnimationStyleNone = 0,
946  e_3DAnimationStyleLoop = 1,
948  e_3DAnimationStyleBounce = 2
949  } PDF3DAnimationStyle;
950 
956  typedef enum _PDF3DDefaultViews {
958  e_3DDefaultViewsNoViews = 0,
960  e_3DDefaultViewsLeftTopFrontIsoAllOrtho = 1,
962  e_3DDefaultViewsLeftTopFrontIsoAllPerspective = 2,
964  e_3DDefaultViewsLeftTopFrontOrthoIsoPerspective = 3,
966  e_3DDefaultViewsLeftTopFrontPerspectiveIsoOrtho = 4,
968  e_3DDefaultViewsLeftTopFrontRightBottomBackAllOrtho = 5,
970  e_3DDefaultViewsFromFile = 6
971  } PDF3DDefaultViews;
972 
973 
975  PDF3DAdvancedSetting()
976  : background_color(0x5E5E5E)
977  , lighting_scheme(e_3DLightingSchemeNone)
978  , rendering_style(e_3DRenderingStyleBoundingBox)
979  , animation_style(e_3DAnimationStyleNone)
980  , default_views(e_3DDefaultViewsNoViews)
981  , is_add_default_views(false)
982  , is_retain_views_and_comments(false)
983  , is_show_tool_bar(true)
984  , is_open_model_tree(false)
985  , script_file_path(L"") {
986  }
987 
993  PDF3DAdvancedSetting(const PDF3DAdvancedSetting& advanced_setting)
994  : background_color(advanced_setting.background_color)
995  , lighting_scheme(advanced_setting.lighting_scheme)
996  , rendering_style(advanced_setting.rendering_style)
997  , animation_style(advanced_setting.animation_style)
998  , default_views(advanced_setting.default_views)
999  , is_add_default_views(advanced_setting.is_add_default_views)
1000  , is_retain_views_and_comments(advanced_setting.is_retain_views_and_comments)
1001  , is_show_tool_bar(advanced_setting.is_show_tool_bar)
1002  , is_open_model_tree(advanced_setting.is_open_model_tree)
1003  , script_file_path(advanced_setting.script_file_path) {
1004  }
1005 
1013  PDF3DAdvancedSetting& operator=(const PDF3DAdvancedSetting& advanced_setting) {
1014  this->background_color = advanced_setting.background_color;
1015  this->lighting_scheme = advanced_setting.lighting_scheme;
1016  this->rendering_style = advanced_setting.rendering_style;
1017  this->animation_style = advanced_setting.animation_style;
1018  this->default_views = advanced_setting.default_views;
1019  this->is_add_default_views = advanced_setting.is_add_default_views;
1020  this->is_retain_views_and_comments = advanced_setting.is_retain_views_and_comments;
1021  this->is_show_tool_bar = advanced_setting.is_show_tool_bar;
1022  this->is_open_model_tree = advanced_setting.is_open_model_tree;
1023  this->script_file_path = advanced_setting.script_file_path;
1024  return *this;
1025  }
1026 
1049  PDF3DAdvancedSetting(foxit::RGB background_color, PDF3DLightingScheme lighting_scheme ,
1050  PDF3DRenderingStyle rendering_style, PDF3DAnimationStyle animation_style,
1051  PDF3DDefaultViews default_views, bool is_add_default_views, bool is_retain_views_and_comments,
1052  bool is_show_tool_bar, bool is_open_model_tree, WString script_file_path) {
1053  this->background_color = background_color;
1054  this->lighting_scheme = lighting_scheme;
1055  this->rendering_style = rendering_style;
1056  this->animation_style = animation_style;
1057  this->default_views = default_views;
1058  this->is_add_default_views = is_add_default_views;
1059  this->is_retain_views_and_comments = is_retain_views_and_comments;
1060  this->is_show_tool_bar = is_show_tool_bar;
1061  this->is_open_model_tree = is_open_model_tree;
1062  this->script_file_path = script_file_path;
1063  }
1088  void Set(foxit::RGB background_color, PDF3DLightingScheme lighting_scheme ,
1089  PDF3DRenderingStyle rendering_style, PDF3DAnimationStyle animation_style,
1090  PDF3DDefaultViews default_views, bool is_add_default_views, bool is_retain_views_and_comments,
1091  bool is_show_tool_bar, bool is_open_model_tree, WString script_file_path) {
1092  this->background_color = background_color;
1093  this->lighting_scheme = lighting_scheme;
1094  this->rendering_style = rendering_style;
1095  this->animation_style = animation_style;
1096  this->default_views = default_views;
1097  this->is_add_default_views = is_add_default_views;
1098  this->is_retain_views_and_comments = is_retain_views_and_comments;
1099  this->is_show_tool_bar = is_show_tool_bar;
1100  this->is_open_model_tree = is_open_model_tree;
1101  this->script_file_path = script_file_path;
1102  }
1106  foxit::RGB background_color;
1107 
1113  PDF3DLightingScheme lighting_scheme;
1114 
1120  PDF3DRenderingStyle rendering_style;
1121 
1127  PDF3DAnimationStyle animation_style;
1128 
1134  PDF3DDefaultViews default_views;
1135 
1140  bool is_add_default_views;
1141 
1146  bool is_retain_views_and_comments;
1147 
1152  bool is_show_tool_bar;
1153 
1158  bool is_open_model_tree;
1159 
1161  WString script_file_path;
1162 };
1163 
1172 class PDF3DContext FS_FINAL : public Base{
1173  public:
1175  explicit PDF3DContext(const pdf::PDFDoc& doc);
1176 
1182  PDF3DContext(const PDF3DContext& other);
1183 
1185  ~PDF3DContext();
1186 
1194  PDF3DContext& operator=(const PDF3DContext& other);
1195 
1203  bool operator==(const PDF3DContext& other) const;
1204 
1212  bool operator!=(const PDF3DContext& other) const;
1213 
1221  bool IsEmpty() const;
1222 
1231  PDF3DAnnotArray GetPage3DAnnotArray(int page_index);
1232 
1240  void Invalidate();
1241 
1254  PDF3DAnnot Add3DAnnot(const wchar_t* threeD_file_path, int page_index, foxit::RectF rectf, void* screen_canvas_parent,
1255  PDF3DLaunchSetting launch_setting, PDF3DAdvancedSetting advanced_setting);
1256 
1270  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);
1271 
1272  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
1273  explicit PDF3DContext(FS_HANDLE handle = NULL);
1274 };
1275 } //pdf3d
1276 } //addon
1277 } //foxit
1278 #endif //FS_3DPDF_H_
1279 #endif //defined(_WIN32) || defined(_WIN64)
CFX_Object Object
Object type.
Definition: fs_basictypes.h:220
Header file for PDF document related definitions and classes.
uint32 RGB
RGB color type, 24 bits, ((b) | ((g) << 8) | ((r) << 16)))
Definition: fs_basictypes.h:211
File reading interface.
Definition: fx_stream.h:587
CFX_WideString WString
Wide string.
Definition: fs_basictypes.h:222
bool operator==(const char *str1, const CFX_ByteString &str2)
Check if two byte strings are equal.
Definition: fs_basictypes.h:128
CFX_PointF PointF
Point information, in float.
Definition: fs_basictypes.h:471
Header file for annotation related definitions and classes.
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:213
Header file for common definitions and classes.
Foxit namespace.
Definition: fs_taggedpdf.h:27
#define NULL
The null-pointer value.
Definition: fx_system.h:792
bool operator!=(const char *str1, const CFX_ByteString &str2)
Check if two byte strings are not equal.
Definition: fs_basictypes.h:140
FX_RECT RectI
Rectangle, in integer.
Definition: fs_basictypes.h:477
Definition: fx_coordinates.h:771