Segment.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 
00019 #ifndef _DWFTK_SEGMENT_H
00020 #define _DWFTK_SEGMENT_H
00021 
00022 
00027 
00028 #ifndef DWFTK_READ_ONLY
00029 
00030 
00031 #include "dwfcore/String.h"
00032 using namespace DWFCore;
00033 
00034 #include "dwf/Toolkit.h"
00035 #include "dwf/w3dtk/BStream.h"
00036 #include "dwf/w3dtk/BOpcodeShell.h"
00037 #include "dwf/w3dtk/BOpcodeHandler.h"
00038 #include "dwf/publisher/PublishedObject.h"
00039 #include "dwf/publisher/model/AttributeHandlerBuilder.h"
00040 #include "dwf/publisher/model/GeometryHandlerBuilder.h"
00041 #include "dwf/publisher/model/FeatureHandlerBuilder.h"
00042 #include "dwf/publisher/model/SegmentHandlerBuilder.h"
00043 
00044 
00045 
00046 namespace DWFToolkit
00047 {
00048 
00049 //
00050 // fwd decl
00051 //
00052 class DWFStyleSegment;
00053 class DWFIncludeSegment;
00054 
00055 
00063 class DWFSegment : public DWFAttributeHandlerBuilder
00064                  , public DWFGeometryHandlerBuilder
00065                  , public DWFFeatureHandlerBuilder
00066                  , public DWFPropertyContainer
00067                  _DWFTK_EXPORT_API_MEMORY_CONTROL_BASE_MEMBER
00068 {
00069 
00070 
00071 public:
00072 
00077     static const char* const kz_User_Options_Node;
00081     static const char* const kz_User_Options_Edges;  
00082 
00088     static const char* const kz_User_Options_Hidden;
00089     static const char* const kz_User_Options_Transparent;
00090 
00091     static const char* const kz_User_Options_Hidden_Node;
00092     static const char* const kz_User_Options_Transparent_Node;
00093     
00094     static const char* const kz_User_Options_Node_and_Edges;
00095     static const char* const kz_User_Options_Hidden_Node_and_Edges;
00096     static const char* const kz_User_Options_Transparent_Node_and_Edges;
00097 
00101     typedef DWFPublishedObject::tKey        tKey;
00102 
00103     //
00104     // 
00105     //
00106     typedef enum tePublishedState
00107     {
00108         eDefault,
00109 
00110         eHidden,
00111         eTransparent
00112 
00113     } tePublishedState;
00114 
00115 public:
00116 
00131     _DWFTK_API
00132     DWFSegment( DWFSegmentHandlerBuilder&     rSegmentBuilder,
00133                 DWFGeometryHandlerBuilder&    rGeometryBuilder,
00134                 DWFFeatureHandlerBuilder&     rFeatureBuilder,
00135                 DWFAttributeHandlerBuilder&   rAttributeBuilder,
00136                 DWFPublishedObject::Factory&  rObjectFactory,
00137                 DWFPublishedObject*           pPublishedParent = NULL,
00138                 bool                          bUseOldObjectModel = false )
00139         throw();
00140 
00147     _DWFTK_API
00148     DWFSegment( const DWFSegment& rSegment )
00149         throw( DWFException );
00150 
00157     _DWFTK_API
00158     DWFSegment& operator=( const DWFSegment& rSegment )
00159         throw( DWFException );
00160 
00166     _DWFTK_API
00167     virtual ~DWFSegment()
00168         throw();
00169 
00176     _DWFTK_API
00177     tKey key() const
00178         throw();
00179 
00198     _DWFTK_API
00199     virtual void open( const DWFString* zName = NULL,
00200                        bool             bPublishedEdges = false )
00201         throw( DWFException );
00202 
00221     _DWFTK_API
00222     virtual void open( const DWFString& zName,
00223                        bool             bPublishedEdges = false )
00224         throw( DWFException );
00225 
00235     _DWFTK_API
00236     void close()
00237         throw( DWFException );
00238 
00248     _DWFTK_API
00249     DWFSegment openSegment()
00250         throw( DWFException );
00251 
00261     _DWFTK_API
00262     void style( DWFStyleSegment& rSegment )
00263         throw( DWFException );
00264 
00280     _DWFTK_API
00281     virtual void include( DWFIncludeSegment& rSegment,
00282                           bool bGenerateMetadata = true )
00283         throw( DWFException );
00284 
00300     _DWFTK_API
00301     void include( DWFIncludeSegment& rSegment,
00302                   const DWFString& rInstanceName )
00303         throw( DWFException );
00304 
00320     _DWFTK_API
00321     virtual void include( tKey nSegmentKey,
00322                           bool bGenerateMetadata = true )
00323         throw( DWFException );
00324 
00340     _DWFTK_API
00341     void include( tKey             nSegmentKey,
00342                   const DWFString& rInstanceName )
00343         throw( DWFException );
00344 
00345     _DWFTK_API
00346     void hideFromDefaultModel()
00347         throw( DWFException );
00348 
00362     _DWFTK_API
00363     void setVisibility( bool bVisible )
00364         throw( DWFException );
00365 
00387     _DWFTK_API
00388     virtual void setContentEntity( DWFEntity* pEntity, 
00389                                    const DWFString* pzInstanceName = NULL )
00390         throw( DWFException );
00391 
00419     _DWFTK_API
00420     virtual void setContentObject( DWFObject* pObject )
00421         throw( DWFException );
00422 
00423     _DWFTK_API
00424     virtual void setUsingOldObjectModel( bool bUse = true )
00425         throw();
00426 
00427 public:
00428 
00432     _DWFTK_API
00433     virtual const DWFProperty* const findProperty( const DWFString& zName,
00434                                                    const DWFString& zCategory = /*NOXLATE*/L"" ) const
00435         throw();
00436 
00440     _DWFTK_API
00441     virtual DWFProperty::tMap::Iterator* getProperties( const DWFString& zCategory = /*NOXLATE*/L"" )
00442         throw();
00443 
00451    _DWFTK_API
00452     virtual void addProperty( DWFProperty* pProperty )
00453         throw( DWFException );
00454 
00461     _DWFTK_API
00462     virtual void addProperty( const DWFProperty& rProperty )
00463         throw( DWFException );
00464 
00477     _DWFTK_API
00478     virtual DWFProperty* addProperty( const DWFString& zName,
00479                                       const DWFString& zValue,
00480                                       const DWFString& zCategory = /*NOXLATE*/L"",
00481                                       const DWFString& zType = /*NOXLATE*/L"",
00482                                       const DWFString& zUnits = /*NOXLATE*/L"" )
00483           throw( DWFException );
00484 
00488     _DWFTK_API
00489     virtual void addPropertyContainer( DWFPropertyContainer* pContainer )
00490         throw( DWFException );
00491     
00495     _DWFTK_API
00496     virtual void referencePropertyContainer( const DWFPropertyContainer& rContainer )
00497         throw( DWFException );
00498 
00502     _DWFTK_API
00503     virtual void removeOwnedPropertyContainers( DWFPropertyContainer::tList& rContainerList,
00504                                                 bool                         bMakeReferences = false )
00505         throw( DWFException );
00506 
00510     _DWFTK_API
00511     virtual void removeReferencedPropertyContainers( DWFPropertyContainer::tList& rContainerList )
00512         throw( DWFException );
00513 
00517     _DWFTK_API
00518     virtual void removeAllPropertyContainers( DWFPropertyContainer::tList& rContainerList )
00519         throw( DWFException );
00520 
00524     _DWFTK_API
00525     virtual void copyProperties( DWFPropertyContainer& rContainer,
00526                                  bool                  bRemoveOwnership = false,
00527                                  bool                  bMakeReferences = false)
00528         throw( DWFException );
00529 
00530 public:
00531 
00535     _DWFTK_API
00536     TK_Area_Light& getAreaLightHandler()
00537         throw( DWFException );
00538 
00542     _DWFTK_API
00543     TK_Circle& getCircleHandler()
00544         throw( DWFException );
00545 
00549     _DWFTK_API
00550     TK_Circle& getCircularArcHandler()
00551         throw( DWFException );
00552 
00556     _DWFTK_API
00557     TK_Circle& getCircularChordHandler()
00558         throw( DWFException );
00559 
00563     _DWFTK_API
00564     TK_Circle& getCircularWedgeHandler()
00565         throw( DWFException );
00566 
00570     _DWFTK_API
00571     TK_Clip_Rectangle& getClipRectangleHandler()
00572         throw( DWFException );
00573 
00577     _DWFTK_API
00578     TK_Clip_Region& getClipRegionHandler()
00579         throw( DWFException );
00580 
00584     _DWFTK_API
00585     TK_Cutting_Plane& getCuttingPlaneHandler()
00586         throw( DWFException );
00587 
00591     _DWFTK_API
00592     TK_Cylinder& getCylinderHandler()
00593         throw( DWFException );
00594 
00598     _DWFTK_API
00599     TK_Point& getDistantLightHandler()
00600         throw( DWFException );
00601 
00605     _DWFTK_API
00606     TK_Ellipse& getEllipseHandler()
00607         throw( DWFException );
00608 
00612     _DWFTK_API
00613     TK_Ellipse& getEllipticalArcHandler()
00614         throw( DWFException );
00615 
00619     _DWFTK_API
00620     TK_Glyph_Definition& getGlyphDefinitionHandler()
00621         throw( DWFException );
00622 
00626     _DWFTK_API
00627     TK_Grid& getGridHandler()
00628         throw( DWFException );
00629 
00633     _DWFTK_API
00634     TK_Image& getImageHandler()
00635         throw( DWFException );
00636 
00640     _DWFTK_API
00641     TK_Line& getLineHandler()
00642         throw( DWFException );
00643 
00647     _DWFTK_API
00648     TK_Point& getLocalLightHandler()
00649         throw( DWFException );
00650 
00654     _DWFTK_API
00655     TK_Point& getMarkerHandler()
00656         throw( DWFException );
00657 
00661     _DWFTK_API
00662     TK_Mesh& getMeshHandler()
00663         throw( DWFException );
00664 
00668     _DWFTK_API
00669     TK_NURBS_Curve& getNURBSCurveHandler()
00670         throw( DWFException );
00671 
00675     _DWFTK_API
00676     TK_NURBS_Surface& getNURBSSurfaceHandler()
00677         throw( DWFException );
00678 
00682     _DWFTK_API
00683     TK_PolyCylinder& getPolyCylinderHandler()
00684         throw( DWFException );
00685 
00689     _DWFTK_API
00690     TK_Polypoint& getPolygonHandler()
00691         throw( DWFException );
00692 
00696     _DWFTK_API
00697     TK_Polypoint& getPolylineHandler()
00698         throw( DWFException );
00699 
00703     _DWFTK_API
00704     TK_Shell& getShellHandler( bool bTriStripsOnly = false,
00705                                bool bDisableOptimization = false )
00706         throw( DWFException );
00707 
00711     _DWFTK_API
00712     TK_Sphere& getSphereHandler()
00713         throw( DWFException );
00714 
00718     _DWFTK_API
00719     TK_Spot_Light& getSpotLightHandler()
00720         throw( DWFException );
00721 
00725     _DWFTK_API
00726     TK_Text& getTextHandler()
00727         throw( DWFException );
00728 
00732     _DWFTK_API
00733     TK_Text& getTextWithEncodingHandler()
00734         throw( DWFException );
00735 
00739     _DWFTK_API
00740     TK_Texture& getTextureHandler()
00741         throw( DWFException );
00742 
00746     _DWFTK_API
00747     TK_Matrix& getTextureMatrixHandler()
00748         throw( DWFException );
00749 
00753     _DWFTK_API
00754     TK_Camera& getCameraHandler()
00755         throw( DWFException );
00756 
00760     _DWFTK_API
00761     TK_Color& getColorHandler()
00762         throw( DWFException );
00763 
00767     _DWFTK_API
00768     TK_Color_Map& getColorMapHandler()
00769         throw( DWFException );
00770 
00774     _DWFTK_API
00775     TK_Color_RGB& getColorRGBHandler()
00776         throw( DWFException );
00777 
00778     _DWFTK_API
00779     TK_Named& getEdgePatternHandler()
00780         throw( DWFException );
00781 
00785     _DWFTK_API
00786     TK_Size& getEdgeWeightHandler()
00787         throw( DWFException );
00788 
00792     _DWFTK_API
00793     TK_Enumerated& getFacePatternHandler()
00794         throw( DWFException );
00795 
00799     _DWFTK_API
00800     TK_Enumerated& getHandednessHandler()
00801         throw( DWFException );
00802 
00806     _DWFTK_API
00807     TK_Heuristics& getHeuristicsHandler()
00808         throw( DWFException );
00809 
00813     _DWFTK_API
00814     TK_Named& getLinePatternHandler()
00815         throw( DWFException );
00816 
00820     _DWFTK_API
00821     TK_Line_Style& getLineStyleHandler()
00822         throw( DWFException );
00823 
00827     _DWFTK_API
00828     TK_Size& getLineWeightHandler()
00829         throw( DWFException );
00830 
00834     _DWFTK_API
00835     TK_Size& getMarkerSizeHandler()
00836         throw( DWFException );
00837 
00841     _DWFTK_API
00842     TK_Enumerated& getMarkerSymbolHandler()
00843         throw( DWFException );
00844 
00848     _DWFTK_API
00849     TK_Matrix& getModellingMatrixHandler()
00850         throw( DWFException );
00851 
00855     _DWFTK_API
00856     TK_Rendering_Options& getRenderingOptionsHandler()
00857         throw( DWFException );
00858 
00862     _DWFTK_API
00863     TK_Selectability& getSelectabilityHandler()
00864         throw( DWFException );
00865 
00869     _DWFTK_API
00870     TK_Enumerated& getTextAlignmentHandler()
00871         throw( DWFException );
00872 
00876     _DWFTK_API
00877     TK_Text_Font& getTextFontHandler()
00878         throw( DWFException );
00879 
00883     _DWFTK_API
00884     TK_Point& getTextPathHandler()
00885         throw( DWFException );
00886 
00890     _DWFTK_API
00891     TK_Size& getTextSpacingHandler()
00892         throw( DWFException );
00893 
00897     _DWFTK_API
00898     TK_User_Options& getUserOptionsHandler()
00899         throw( DWFException );
00900 
00904     _DWFTK_API
00905     TK_Unicode_Options& getUnicodeOptionsHandler()
00906         throw( DWFException );
00907 
00911     _DWFTK_API
00912     TK_Visibility& getVisibilityHandler()
00913         throw( DWFException );
00914 
00918     _DWFTK_API
00919     TK_Window& getWindowHandler()
00920         throw( DWFException );
00921 
00925     _DWFTK_API
00926     TK_Enumerated& getWindowFrameHandler()
00927         throw( DWFException );
00928 
00932     _DWFTK_API
00933     TK_Enumerated& getWindowPatternHandler()
00934         throw( DWFException );
00935 
00939     _DWFTK_API
00940     void openLocalLightAttributes()
00941         throw( DWFException );
00942 
00946     _DWFTK_API
00947     void closeLocalLightAttributes()
00948         throw( DWFException );
00949 
00950 private:
00951 
00952     //
00953     //  When including a segment, use this to serialize the segment into the 
00954     //  hoops stream. This is called from the include menthods.
00955     //
00956     _DWFTK_API
00957     void _serializeIncludeSegment( DWFPublishedObject* pIncludeObject )
00958         throw( DWFException );
00959 
00960     //
00961     //  When including a segment, use this to update the associated published
00962     //  objects to ensure the reference information is gathered by the published
00963     //  object for metadata generation later.
00964     //
00965     _DWFTK_API
00966     void _updatePublishedObjects( DWFPublishedObject* pPubObject,
00967                                   const DWFString* pInstanceName )
00968         throw( DWFException );
00969 
00970 private:
00971 
00972     //
00973     //  Use this enum to set the flag signifying which call was made on the segment
00974     //  This needs to be declared before the _testContentIncludeIsAllowed method
00975     //
00976     typedef enum _teContentIncludeCalls
00977     {
00978         eNoContentIncludeCalls  = 0,
00979         eIncludeCall            = 1,
00980         eSetEntityCall          = 2,
00981         eSetObjectCall          = 3
00982 
00983     } _teContentIncludeCalls;
00984 
00985 private:
00986 
00987     //
00988     //  This tests if any of the three mutually exclusive methods have been 
00989     //  called already, and if so throws an appropriate exception. Otherwise
00990     //  it sets the flag for subsequent tests.
00991     //
00992     _DWFTK_API
00993     void _testContentIncludeIsAllowed( _teContentIncludeCalls eCallType )
00994         throw( DWFException );
00995 
00996 protected:
00997 
00998     DWFSegmentHandlerBuilder&       _rSegmentBuilder;
00999     DWFGeometryHandlerBuilder&      _rGeometryBuilder;
01000     DWFFeatureHandlerBuilder&       _rFeatureBuilder;
01001     DWFAttributeHandlerBuilder&     _rAttributeBuilder;
01002     DWFPublishedObject::Factory&    _rObjectFactory;
01003     
01004     DWFPublishedObject*             _pPublishedObject;
01005     DWFPublishedObject*             _pPublishedParent;
01006 
01007     DWFString*                      _pLibrary;
01008 
01009 
01010 private:
01011 
01012     bool                            _bOpen;
01013 
01014     bool                            _bUsingOldObjectModel;
01015 
01016     //
01017     //  This is a bit mask the points out which of the three methods,
01018     //  include, setEntity and setObject have been applied on the
01019     //  segment. Since the calls are mutually exclusive, if any one
01020     //  the is called, this flag should become non-zero, indicating
01021     //  that further calls are not allowed.
01022     //
01023     _teContentIncludeCalls          _eContentIncludeFlag;
01024 
01025     DWFPublishedObject::tKey        _nKey;
01026     static unsigned int             _knNextKey;
01027 
01028 private:
01029 
01030     //
01031     // Not Implemented
01032     //
01033 
01034     DWFSegment();
01035 };
01036 
01037 
01038 
01039     //
01040     // required for win32 dll external linkage
01041     //
01042 #ifdef  _DWFCORE_WIN32_SYSTEM
01043 #ifndef DWFTK_STATIC
01044 
01045 //DNT_Start
01046 _declspec(selectany) const char* const DWFSegment::kz_User_Options_Node                         = "node";
01047 _declspec(selectany) const char* const DWFSegment::kz_User_Options_Edges                        = "edges";
01048 _declspec(selectany) const char* const DWFSegment::kz_User_Options_Hidden                       = "hidden";
01049 _declspec(selectany) const char* const DWFSegment::kz_User_Options_Transparent                  = "transparent";
01050 
01051 _declspec(selectany) const char* const DWFSegment::kz_User_Options_Hidden_Node                  = "node,hidden";
01052 _declspec(selectany) const char* const DWFSegment::kz_User_Options_Transparent_Node             = "node,transparent";
01053 
01054 _declspec(selectany) const char* const DWFSegment::kz_User_Options_Node_and_Edges               = "node,edges";
01055 _declspec(selectany) const char* const DWFSegment::kz_User_Options_Hidden_Node_and_Edges        = "node,edges,hidden";
01056 _declspec(selectany) const char* const DWFSegment::kz_User_Options_Transparent_Node_and_Edges   = "node,edges,transparent";
01057 //DNT_End
01058 
01059 #endif
01060 #endif
01061 
01062 
01063 }
01064 
01065 
01066 #endif  
01067 #endif
01068 

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