DWFPackagePublisher.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 1996-2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00008 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00009 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00010 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00011 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00012 //
00013 //  Use, duplication, or disclosure by the U.S. Government is subject to
00014 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00015 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00016 //  Data and Computer Software), as applicable.
00017 //
00018 //  $Header: //DWF/Development/Components/Internal/DWF Toolkit/v7.6/develop/global/src/dwf/publisher/impl/DWFPackagePublisher.h#4 $
00019 //  $DateTime: 2008/12/09 00:24:37 $
00020 //  $Author: gaoje $
00021 //  $Change: 125697 $
00022 //  $Revision: #4 $
00023 //
00024 
00025 #ifndef _DWFTK_DWF_PACKAGE_PUBLISHER_H
00026 #define _DWFTK_DWF_PACKAGE_PUBLISHER_H
00027 
00028 
00033 
00034 
00035 #ifndef DWFTK_READ_ONLY
00036 
00037 #include "dwfcore/File.h"
00038 
00039 using namespace DWFCore;
00040 
00041 #include "dwf/Toolkit.h"
00042 #include "dwf/package/Section.h"
00043 #include "dwf/package/writer/PackageWriter.h"
00044 #include "dwf/publisher/Image.h"
00045 #include "dwf/publisher/Publisher.h"
00046 #include "dwf/publisher/model/Model.h"
00047 #include "dwf/publisher/plot/Plot.h"
00048 #include "dwf/publisher/data/Data.h"
00049 #include "dwf/publisher/impl/DWFResourceVisitor.h"
00050 
00051 namespace DWFToolkit
00052 {
00053 
00054 //
00055 //  fwd declaration
00056 //
00057 class DWFContent;
00058 class DWFPublishedContentElementListener;
00059 
00072 class DWFPackagePublisher : public DWFPublisher
00073                           , public DWFEmbeddedFontVisitor
00074                           _DWFTK_EXPORT_API_MEMORY_CONTROL_BASE_MEMBER
00075 {
00076 
00077 public:
00078 
00082     static const wchar_t* const kz_NamedView_Default;
00086     static const wchar_t* const kz_PropName_PolygonHandedness;
00090     static const wchar_t* const kz_PropName_UseDefaultLighting;
00094     static const wchar_t* const kz_PropName_UseSilhouetteEdges;
00098     static const wchar_t* const kz_PropName_EdgeColor;
00102     static const wchar_t* const kz_PropName_DisplayMode;
00103 
00107     static const wchar_t* const kz_PropSetName_DefaultView;
00111     static const wchar_t* const kz_PropName_CameraProjection;
00115     static const wchar_t* const kz_PropName_CameraPosition;
00119     static const wchar_t* const kz_PropName_CameraTarget;
00123     static const wchar_t* const kz_PropName_CameraUpVector;
00127     static const wchar_t* const kz_PropName_CameraField;
00128 
00132     static const wchar_t* const kz_PropName_ViewCubeShowCompass;
00136     static const wchar_t* const kz_PropName_ViewCubeAngleOfNorth;
00140     static const wchar_t* const kz_PropName_ViewCubeHomeCameraProjection;
00144     static const wchar_t* const kz_PropName_ViewCubeHomeCameraPosition;
00148     static const wchar_t* const kz_PropName_ViewCubeHomeCameraTarget;
00152     static const wchar_t* const kz_PropName_ViewCubeHomeCameraUpVector;
00156     static const wchar_t* const kz_PropName_ViewCubeHomeCameraField;
00160         static const wchar_t* const kz_PropName_FrontView;
00161 
00162 
00163         static const wchar_t* const kz_PropName_FrontViewCameraProjection;
00164         static const wchar_t* const kz_PropName_FrontViewCameraPosition;
00165         static const wchar_t* const kz_PropName_FrontViewCameraTarget;
00166         static const wchar_t* const kz_PropName_FrontViewCameraUpVector;
00167         static const wchar_t* const kz_PropName_FrontViewCameraField;
00168 
00169 public:
00170 
00209     _DWFTK_API
00210     DWFPackagePublisher( const DWFString& zSourceProductVendor     = "",
00211                          const DWFString& zSourceProductName       = "",
00212                          const DWFString& zSourceProductVersion    = "",
00213                          const DWFString& zPublisherProductVendor  = "",
00214                          const DWFString& zPublisherProductVersion = "" )
00215         throw( DWFException );
00216 
00222     _DWFTK_API
00223     virtual ~DWFPackagePublisher()
00224         throw();
00225 
00233     _DWFTK_API
00234     void setVersion( DWFPublisher::teMetadataVersion eVersion )
00235         throw( DWFException );
00236 
00243     _DWFTK_API
00244     DWFPublisher::teMetadataVersion getVersion() const
00245         throw()
00246     {
00247         return _eMetaDataVersion;
00248     }
00249 
00256     _DWFTK_API
00257     void publish()
00258         throw( DWFException );
00259 
00263     _DWFTK_API
00264     DWFPublishedObject::Visitor* getPublishedObjectVisitor()
00265         throw( DWFException )
00266     {
00267         return _pPublishedObjectVisitor;
00268     }
00269 
00273     _DWFTK_API
00274     DWFPropertyVisitor* getPropertyVisitor()
00275         throw( DWFException )
00276     {
00277         return this->_pPropertyVisitor;
00278     }
00279 
00283     _DWFTK_API
00284     DWFEmbeddedFontVisitor* getEmbeddedFontVisitor()
00285         throw( DWFException )
00286     {
00287         return this;
00288     }
00289 
00296     _DWFTK_API
00297     DWFResourceVisitor* getResourceVisitor()
00298         throw( DWFException )
00299     {
00300         return _pResourceVisitor;
00301     }
00302 
00312     _DWFTK_API
00313     DWFContent* getContent()
00314         throw( DWFException );
00315 
00327     _DWFTK_API
00328     void attachContentManager( DWFContentManager* pContentManager, bool bTakeOwnership = true )
00329         throw();
00330 
00340     _DWFTK_API
00341     void addPresentation(DWFContentPresentation* pPresentation)
00342         throw( DWFException )
00343     {
00344         return getPackageWriter()->addPresentation(pPresentation);
00345     }
00346 
00354     _DWFTK_API
00355     void setResourceVisitor( DWFResourceVisitor* pVisitor )
00356         throw()
00357     {
00358         _pResourceVisitor = pVisitor;
00359     }
00360 
00366     _DWFTK_API
00367     void disableContentNavigationPresentation()
00368         throw()
00369     {
00370         _bCreateContentNavigationPresentation = false;
00371     }
00372 
00378     _DWFTK_API
00379     void setContentNavigationPresentationLabel( const DWFString& zLabel)
00380         throw()
00381     {
00382         _zContentNavigationPresentationLabel = zLabel;
00383     }
00384 
00390     _DWFTK_API
00391     void setViewsPresentationLabel( const DWFString& zLabel)
00392         throw()
00393     {
00394         _zContentViewsPresentationLabel = zLabel;
00395     }
00396 
00403     _DWFTK_API
00404     void visitPublishedObject( DWFPublishedObject& rObject )
00405         throw( DWFException );
00406 
00410     _DWFTK_API
00411     void visitProperty( DWFProperty& rProperty )
00412         throw( DWFException );
00413 
00417     _DWFTK_API
00418     void visitPropertyContainer( DWFPropertyContainer& rPropertyContainer )
00419         throw( DWFException );
00420 
00424     _DWFTK_API
00425     void visitEmbeddedFont( const DWFEmbeddedFont& rFont )
00426         throw( DWFException );
00427 
00431     _DWFTK_API
00432     void preprocess( DWFPublishable* pContent )
00433         throw( DWFException ) = 0;
00434 
00438     _DWFTK_API
00439     virtual void postprocess( DWFPublishable* pContent )
00440         throw( DWFException );
00441 
00442 protected:
00443     
00444     virtual DWFPackageWriter* getPackageWriter( )
00445         throw( DWFException ) = 0;
00446 
00447         virtual DWFGraphicResource* getGraphicResource( )
00448                 throw( DWFException ) = 0;
00449 
00450         virtual void preprocessSection( DWFPublishableSection* pSection )
00451         throw( DWFException );
00452 
00453     virtual void postprocessSection( DWFPublishableSection* pSection )
00454         throw( DWFException );
00455 
00456     virtual void preprocessModel( DWFModel* pW3DModel )
00457         throw( DWFException );
00458 
00459     virtual void postprocessModel( DWFModel* pW3DModel )
00460         throw( DWFException );
00461 
00462     virtual void preprocessPlot( DWFPlot* pW2DPlot )
00463         throw( DWFException );
00464 
00465     virtual void postprocessPlot( DWFPlot* pW2DPlot )
00466         throw( DWFException );
00467 
00468     virtual void preprocessData( DWFData* pData )
00469         throw( DWFException );
00470 
00471     virtual void postprocessData( DWFData* pData )
00472         throw( DWFException );
00473 
00474         DWFSection*                         _pCurrentSection;
00475         DWFResource*                        _pCurrentGraphicResource;
00476         size_t                                  _nSections;
00477 
00478 private:
00479 
00480         
00481 
00482     void _createDefaultModelNavigationPresentation( DWFModel* pW3DModel,
00483                                                     DWFSortedVector<DWFInstance*>& oExcluded )
00484         throw( DWFException );
00485 
00486     void _createDefaultViewsPresentation( DWFModel* pW3DModel )
00487         throw( DWFException );
00488 
00489 private:
00490 
00491         DWFString                           _zSourceProductVendor;
00492     DWFString                           _zSourceProductName;
00493     DWFString                           _zSourceProductVersion;
00494     DWFString                           _zPublisherProductVendor;
00495     DWFString                           _zPublisherProductVersion;
00496     DWFEmbeddedFont::tList              _oEmbeddedFonts;
00497     DWFResourceVisitor*                 _pResourceVisitor;
00498     
00499 
00500     //
00501     //  In 7.2.0 the published object visitors are accessed via these pointers.
00502     //  This replaces the DWFPackagePublisher inheriting from the classes as done
00503     //  in 7.1.
00504     //  They are initialized with the appropriate visitor depending on whether
00505     //  we generate metadata for DWF toolkit 7.2 and higher or metadata compatible
00506     //  with version 7.1
00507     //
00508     DWFPublishedObject::Visitor*        _pPublishedObjectVisitor;
00509     DWFPropertyVisitor*                 _pPropertyVisitor;
00510 
00511     DWFPublishedContentElementListener* _pPublishedElementListener;
00512 
00513     //
00514     //  The version determines whether to use the old object definition model using DWFDefinedObjects
00515     //  or the new object definition model using the DWF content and content elements.
00516     //
00517     DWFPublisher::teMetadataVersion     _eMetaDataVersion;
00518 
00519     bool                                _bCreateContentNavigationPresentation;
00520     DWFString                           _zContentNavigationPresentationLabel;
00521     DWFString                           _zContentViewsPresentationLabel;
00522 
00523 private:
00524 
00525     DWFPackagePublisher( const DWFPackagePublisher& );
00526     DWFPackagePublisher& operator=( const DWFPackagePublisher& );
00527 };
00528 
00529     //
00530     // required for win32 dll external linkage
00531     //
00532 #ifdef  _DWFCORE_WIN32_SYSTEM
00533 #ifndef DWFTK_STATIC
00534 
00535 //DNT_Start
00536 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_PolygonHandedness =    L"_PolygonHandedness";
00537 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_UseDefaultLighting =   L"_UseDefaultLighting";
00538 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_UseSilhouetteEdges =   L"_UseSilhouetteEdges";
00539 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_EdgeColor =            L"_EdgeColor";
00540 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_DisplayMode =          L"_DisplayMode";
00541 
00542 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_NamedView_Default =             L"Initial";
00543 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropSetName_DefaultView =       L"_DefaultView";
00544 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_CameraProjection =     L"_CameraProjection";
00545 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_CameraPosition =       L"_CameraPosition";
00546 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_CameraTarget =         L"_CameraTarget";
00547 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_CameraUpVector =       L"_CameraUpVector";
00548 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_CameraField =          L"_CameraField";
00549 
00550 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_ViewCubeShowCompass =            L"_ViewCubeShowCompass";
00551 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_ViewCubeAngleOfNorth =           L"_ViewCubeAngleOfNorth";
00552 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_ViewCubeHomeCameraProjection =   L"_ViewCubeHomeCameraProjection";
00553 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_ViewCubeHomeCameraPosition =     L"_ViewCubeHomeCameraPosition";
00554 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_ViewCubeHomeCameraTarget =       L"_ViewCubeHomeCameraTarget";
00555 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_ViewCubeHomeCameraUpVector =     L"_ViewCubeHomeCameraUpVector";
00556 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_ViewCubeHomeCameraField =        L"_ViewCubeHomeCameraField";
00557 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_FrontView               =            L"_FrontView";
00558 
00559 // front view property
00560 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_FrontViewCameraProjection =   L"_FrontViewCameraProjection";
00561 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_FrontViewCameraPosition =     L"_FrontViewCameraPosition";
00562 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_FrontViewCameraTarget =       L"_FrontViewCameraTarget";
00563 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_FrontViewCameraUpVector =     L"_FrontViewCameraUpVector";
00564 _declspec(selectany) const wchar_t* const DWFPackagePublisher::kz_PropName_FrontViewCameraField =        L"_FrontViewCameraField";
00565 //DNT_End
00566 
00567 #endif
00568 #endif
00569 
00570 }
00571 
00572 
00573 
00574 #endif
00575 #endif
00576 

Generated on Tue Jan 6 22:40:03 2009 for Autodesk DWF Toolkit by  doxygen 1.4.5