Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HDGNHelper.h
00001 //
00002 // Copyright (c) 2005 by Tech Soft 3D, LLC.
00003 // The information contained herein is confidential and proprietary to
00004 // Tech Soft 3D, LLC., and considered a trade secret as defined under
00005 // civil and criminal statutes.  Tech Soft 3D shall pursue its civil
00006 // and criminal remedies in the event of unauthorized use or misappropriation
00007 // of its trade secrets.  Use of this information by anyone other than
00008 // authorized employees of Tech Soft 3D, LLC. is granted only under a
00009 // written non-disclosure agreement, expressly prescribing the scope and
00010 // manner of such use.
00011 //
00012 // $Id$
00013 //
00014 #ifndef _HDGNHelper_H__02052008_1505__
00015 #define _HDGNHelper_H__02052008_1505__
00016 
00017 #include "HTools.h"
00018 #include "HIOManager.h"
00019 #include "vhash.h"
00020 #include "vlist.h"
00021 
00022 // DGNdirect includes
00023 #include "OdaCommon.h"
00024 #include "DgDatabase.h"
00025 #include "Int32Array.h"
00026 #include "IntArray.h"
00027 #include "Gi/GiWorldGeometry.h"
00028 #include "Gi/GiPolyline.h"
00029 #include "Gi/GiGeometry.h"
00030 #include "Gi/GiCommonDraw.h"
00031 #include "Gi/GiWorldDraw.h"
00032 #include "Ge/geelliparc2d.h"
00033 #include "Ge/geelliparc3d.h"
00034 #include "DgModelerGeometry.h"
00035 #include "Br/BrBrep.h"
00036 #include "Gs/Gs.h"
00037 #include "ModelerDefs.h"
00038 #include "DbObjectId.h"
00039 #include "dbfiler.h"
00040 #include "DgLevelMask.h"
00041 #include "dgmodel.h"
00042 #include "DgModelerGeometry/DgModelerModule.h"
00043 #include "Wr/wrTriangulationParams.h"
00044 
00045 #include "StaticRxObject.h"
00046 #include "DynamicLinker.h"
00047 #include "RxDynamicModule.h"
00048 #include "DgModelerGeometryCreator.h"
00049 #include "ExDgnServices.h"
00050 #include "ExDgnHostAppServices.h"
00051 
00052 #include "Gi/GiDrawable.h"
00053 #include "DgLine.h"
00054 #include "DgLineString.h"
00055 #include "DgText.h"
00056 #include "DgTextNode.h"
00057 #include "DgShape.h"
00058 #include "DgCurve.h"
00059 #include "DgEllipse.h"
00060 #include "DgArc.h"
00061 #include "DgCone.h"
00062 #include "DgComplexString.h"
00063 #include "DgComplexShape.h"
00064 #include "DgPointString.h"
00065 #include "DgDimension.h"
00066 #include "DgMultiline.h"
00067 #include "DgBSplineCurve.h"
00068 #include "Dg3DObject.h"
00069 #include "DgRasterAttach.h"
00070 #include "DgRaster.h"
00071 #include "DgTagElement.h"
00072 #include "DgCellHeader.h"
00073 #include "DgBSplineSurface.h"
00074 #include "DgLevelTableRecord.h"
00075 #include "DgFontTableRecord.h"
00076 #include "DgTextStyleTableRecord.h"
00077 #include "DgDimStyleTableRecord.h"
00078 #include "DgMultilineStyleTableRecord.h"
00079 #include "DgLineStyleTableRecord.h"
00080 #include "DgRegAppTableRecord.h"
00081 #include "DgView.h"
00082 #include "DgSharedCellDefinition.h"
00083 #include "DgSharedCellReference.h"
00084 #include "DgTagSetDefinition.h"
00085 #include "DgReferenceAttach.h"
00086 #include "DgMesh.h"
00087 #include "RxObjectImpl.h"
00088 #include "resbuf.h"
00089 
00090 #include <set>
00091 #include <string>
00092 using namespace std;
00093 
00094 class XRef;
00095 
00096 class TreeNode
00097 {
00098 
00099 private:
00100     
00101     char*            m_pchName;
00102     OdUInt16         m_nNestedDepth;
00103 
00104 public:
00105     //write set function for this
00106     VHash<char*,int> *m_vhashOfImmediateChildXref ;
00107     //VList<char*>   m_vlistOfImmediateChildXref;
00108     VList<TreeNode*> m_ChildNodes;
00109     TreeNode*        m_pParentNode;
00110 
00111     TreeNode(char *pChNode)
00112     {
00113         m_pchName = new char[strlen(pChNode) + 1];
00114         strcpy(m_pchName,pChNode);
00115         m_ChildNodes.Flush();
00116 
00117         m_pParentNode = NULL;
00118         m_nNestedDepth = 0;
00119 
00120         m_vhashOfImmediateChildXref = new VHash<char*,int>;
00121     }
00122 
00123     ~TreeNode()
00124     {
00125         m_ChildNodes.Flush();
00126          
00127         m_vhashOfImmediateChildXref->Flush();
00128 
00129         H_SAFE_DELETE_ARRAY(m_pchName);
00130     }
00131 
00132     void SetNestedDepth(OdUInt16 nNestedDepth){ m_nNestedDepth =  nNestedDepth;}
00133     
00134     OdUInt16 GetNestedDepth(){ return m_nNestedDepth;}
00135 
00136     char *GetName(){ return m_pchName;}
00137     
00138 };
00139 
00140 // This class is the base class for importers of all objects.           
00141 // Every object class has this extension.  
00142 class hRxObject : public OdRxObjectImpl< OdRxObject >
00143 {
00144     
00145 public:
00146 
00147     hRxObject();
00148     ~hRxObject(){};
00149 
00150     virtual void addRef();
00151     virtual void release();
00152     virtual long numRefs() const;
00153     virtual void import( OdRxObjectPtr object ) = 0; //each object class need to describe itself via this method
00154 
00155 private:
00156     long        m_references;     //used by each object separately
00157     ODRX_DECLARE_MEMBERS( hRxObject );
00158     
00159 };
00160 
00161 #define MAX_LEVEL_NAME_LEN 256
00162 
00163 class HDGNImporter : public hRxObject
00164 {
00165 public:
00166 
00167     HDGNImporter(){;};
00168     ~HDGNImporter(){;};
00169 
00170     void setDatabase(OdDgDatabasePtr database){ pDb = database ;};
00171 
00172     inline void OdGePoint2d_2_HPoint(const OdGePoint2d* odg_point, HPoint& h_point)
00173     {
00174         h_point.x = odg_point->x;
00175         h_point.y = odg_point->y;
00176         h_point.z = 0.0f;   
00177     }
00178 
00179     inline void OdGePoint3d_2_HPoint(const OdGePoint3d* odg_point, HPoint& h_point)
00180     {
00181         h_point.x = odg_point->x;
00182         h_point.y = odg_point->y;
00183         h_point.z = odg_point->z;
00184     }
00185 
00186     void setInputHandler(HInputHandler* hand){ m_inputHandler= hand;};
00187 
00188     HFileInputResult FileInputByKey(const char * FileName, HC_KEY model_key, HInputHandlerOptions * options);
00189     bool importDGNFile( const char * FileName, bool isXrefPresent);
00190     OdDgModelPtr getActiveModel(OdDgDatabasePtr pDatabase);
00191 
00192     virtual void import( OdRxObjectPtr object ){;}; 
00193     //In  iterateElm "int CHeaderid=0" is loaded by default as a"0" bby assuming CellHeader id will not be 0. 
00194     void iterateElm( OdDgElementIteratorPtr iterator, bool visibilityProcessing, bool checkProgress,int CHeaderid=0);
00195 
00196     HC_KEY getLevelKey( OdDgGraphicsElementPtr grElm );
00197 
00198     void setLineStyleAndWt(OdDgGraphicsElementPtr grElm);
00199 
00200     void importXData (OdResBufPtr pRb);
00201 
00202     int calculateTotalEntities( OdRxObjectPtr object );
00203 
00204     void importCellheaderWithHoleAttr();    
00205     bool AddGeometryInList(bool);
00206 
00207     bool isAttachedXREF(const char* FileName);
00208     
00209     //Vinit changes
00210     bool createTreeOfXrefs( const char * FileName,TreeNode *ParentNode =0);
00211     void fillTheCurrentXrefNodeValues(const char* FileName,TreeNode *ParentNode = 0);
00212     bool chkOnlySecondLevelXref(const char* FileName);
00213     bool chkXrefFileLevel(const char* FileName);
00214 
00215 
00216 protected:
00217     
00218     //if m_bDGNImportAllModels = true importing all the models available in DGN file.
00219     //default value is m_bDGNImportAllModels = false  - Vinit M
00220 
00221     static bool m_bDGNImportAllModels;
00222     static bool m_bisFromEntity ;
00223     static bool m_bIgnoreOffEntities ;
00224     static char m_cCurrDir[1024] ;
00225     static bool m_bFromCellHeader ;
00226     static double m_coneFactor ;
00227     static bool m_bDGNRebaselineModel ;
00228     static bool m_bNoOffset ;
00229     static OdDgDatabasePtr pDb;
00230     static bool m_bFromSmartSolid ;
00231     static char m_cCellHeaderName[1024];
00232     static int m_totalEntities;
00233     static HInputHandler* m_inputHandler;
00234     static VHash<HC_KEY,int> *m_hashGeomCellID ;
00235     static double m_dMinX, m_dMinY, m_dMinZ;
00236     static OdSmartPtr< XRef > m_obXRef;
00237     static VHash<int,HC_KEY> m_hashLevelIDKey;
00238 
00239     static int m_iCellHeaderId;
00240     static bool m_bCellHeaderHoleFlag ;
00241     static bool m_bWorldDrawEntityFlag ;
00242     static HC_KEY m_hkShellKey;
00243     static HC_KEY m_hkSolidSegKey;
00244     static HC_KEY m_hkHoleSegKey;
00245     static HC_KEY m_hkSegTobeUsed;
00246     
00247     enum {SINGLE_ENTITY_CELLHEADER, BREAK_CELLHEADER, OPT_CELLHEADER};
00248     static int m_iCellHeaderOption ;
00249 
00250 private:
00251 
00252     VStringHash<int> imported_xrefs;
00253     void resetStaticVars();
00254 
00255     
00256     //declare  OdGiGeometry_ as friend of this class
00257     template<class> friend class OdGiGeometry_; 
00258     friend class OdGiGeometry_ <class T>;
00259 
00260 
00261 };
00262 
00263 class XRef : public HDGNImporter
00264 {
00265 
00266 public:
00267     
00268     XRef()
00269     {
00270     };
00271 
00272     ~XRef()
00273     {
00274         m_listOfXRefs.Flush();
00275         m_listOfXRefsOfXRefs.Flush();
00276     };
00277 
00278     void populateXREFs();
00279     VList<char*> m_listOfXRefsOfXRefs;
00280 
00281 private:
00282     VList<char*> m_listOfXRefs;
00283     char* m_cXRefSegName;
00284     void import( OdRxObjectPtr object );
00285     void fillVlistOfXref(OdDgReferenceAttachmentHeaderPtr element);
00286 };
00287 
00288 class Database : public HDGNImporter
00289 {
00290     void import( OdRxObjectPtr object );
00291 };
00292 
00293 
00294 class Model : public HDGNImporter
00295 {
00296 public:
00297     void import( OdRxObjectPtr object );
00298 };
00299 
00300 
00301 class Line2d : public HDGNImporter
00302 {
00303     void import( OdRxObjectPtr object );
00304 };
00305 
00306 
00307 class Line3d : public HDGNImporter
00308 {
00309     void import( OdRxObjectPtr object );
00310 };
00311 
00312 
00313 class LineString2d : public HDGNImporter
00314 {
00315     void import( OdRxObjectPtr object );
00316 };
00317 
00318 
00319 class LineString3d : public HDGNImporter
00320 {
00321     void import( OdRxObjectPtr object );
00322 };
00323 
00324 
00325 class Text2d : public HDGNImporter
00326 {
00327     void import( OdRxObjectPtr object );
00328 };
00329 
00330 
00331 class Text3d : public HDGNImporter
00332 {
00333     void import( OdRxObjectPtr object );
00334 
00335 };
00336 
00337 
00338 class TextNode2d : public HDGNImporter
00339 {
00340     void import( OdRxObjectPtr object );
00341 };
00342 
00343 class TextNode3d : public HDGNImporter
00344 {
00345     void import( OdRxObjectPtr object );
00346 };
00347 
00348 
00349 class Shape2d : public HDGNImporter
00350 {
00351     void import( OdRxObjectPtr object );
00352 };
00353 
00354 
00355 class Shape3d : public HDGNImporter
00356 {
00357     void import( OdRxObjectPtr object );
00358 };
00359 
00360 
00361 class Curve2d : public HDGNImporter
00362 {
00363     void import( OdRxObjectPtr object ){};
00364 };
00365 
00366 
00367 class Curve3d : public HDGNImporter
00368 {
00369     void import( OdRxObjectPtr object ){};
00370 };
00371 
00372 
00373 class Arc2d : public HDGNImporter
00374 {
00375 private:    
00376     void import( OdRxObjectPtr object );
00377 
00378 public:
00379     void importAsEllipticalArc(OdGeEllipArc2d ellipArc, double rot_angle, bool isClosed);
00380 
00381 };
00382 
00383 
00384 class Arc3d : public HDGNImporter
00385 {
00386 private:
00387     void import( OdRxObjectPtr object );
00388 public:
00389     void importAsEllipticalArc(OdGeEllipArc3d ellipArc, bool isClosed);
00390 
00391     //declare  OdGiGeometry_ as friend of this class
00392     template<class> friend class OdGiGeometry_; 
00393     friend class OdGiGeometry_ <class T>;
00394 
00395 };
00396 
00397 
00398 //Case of multilevel inheritence : Mustafa B
00399 class Ellipse2d :public Arc2d
00400 {
00401     void import( OdRxObjectPtr object );
00402 };
00403 
00404 
00405 class Ellipse3d : public Arc3d
00406 {
00407     void import( OdRxObjectPtr object );
00408 };
00409 
00410 class Cone : public HDGNImporter
00411 {
00412 
00413     static double m_dDeviationForCone;
00414     void import( OdRxObjectPtr object );
00415 
00416     //declare  OdGiCommonDraw_ as friend of this class
00417     template<class> friend class OdGiCommonDraw_; 
00418     friend class OdGiCommonDraw_ <class T>;
00419     
00420 };
00421 
00422 
00423 class ComplexString : public HDGNImporter
00424 {
00425     void import( OdRxObjectPtr object ){};
00426 };
00427 
00428 
00429 class ComplexShape : public HDGNImporter
00430 {
00431 
00432     void import( OdRxObjectPtr object );
00433 
00434 };
00435 
00436 
00437 class PointString2d : public HDGNImporter
00438 {
00439     void import( OdRxObjectPtr object ){};
00440 };
00441 
00442 
00443 class PointString3d : public HDGNImporter
00444 {
00445     void import( OdRxObjectPtr object ){};
00446 
00447 };
00448 
00449 
00450 class Dimension : public HDGNImporter
00451 {
00452     void import( OdRxObjectPtr object );
00453 
00454 };
00455 
00456 
00457 class Multiline : public HDGNImporter
00458 {
00459     void import( OdRxObjectPtr object ){};
00460 
00461 };
00462 
00463 
00464 class BSplinePoles2d : public HDGNImporter
00465 {
00466     void import( OdRxObjectPtr object ){};
00467 
00468 };
00469 
00470 
00471 class BSplinePoles3d : public HDGNImporter
00472 {
00473     void import( OdRxObjectPtr object ){};
00474 };
00475 
00476 
00477 class BSplineKnots : public HDGNImporter
00478 {
00479     void import( OdRxObjectPtr object ){};
00480 
00481 };
00482 
00483 class BSplineWeights : public HDGNImporter
00484 {
00485     void import( OdRxObjectPtr object ){};
00486 
00487 };
00488 
00489 
00490 class BSpline : public HDGNImporter
00491 {
00492 public:
00493     void getUniformKnots(bool isClosed, int totalKnots, int order, float*& hKnots);
00494 };
00495 
00496 class BSplineCurve2d : public BSpline
00497 {
00498     void import( OdRxObjectPtr object );
00499 };
00500 
00501 class BSplineCurve3d : public BSpline
00502 {
00503     void import( OdRxObjectPtr object );
00504 };
00505 
00506 
00507 class BSplineSurface : public BSpline
00508 {
00509 
00510     void import( OdRxObjectPtr object );
00511 };
00512 
00513 
00514 class Surface : public HDGNImporter
00515 {
00516 
00517     void import( OdRxObjectPtr object );
00518 
00519 };
00520 
00521 
00522 class Solid : public HDGNImporter
00523 {
00524 
00525     void import( OdRxObjectPtr object );
00526 
00527 };
00528 
00529 
00530 class RasterAttachmentComponentBinary : public HDGNImporter
00531 {
00532 
00533     void import( OdRxObjectPtr object ){};
00534 
00535 };
00536 
00537 
00538 class RasterAttachmentComponentContinuous : public HDGNImporter
00539 {
00540     void import( OdRxObjectPtr object ){};
00541 };
00542 
00543 
00544 
00545 
00546 class RasterAttachmentComponentRGB : public HDGNImporter
00547 {
00548 
00549     void import( OdRxObjectPtr object ){};
00550 
00551 };
00552 
00553 
00554 class RasterAttachmentComponentClip : public HDGNImporter
00555 {
00556 
00557     void import( OdRxObjectPtr object ){};
00558 
00559 };
00560 
00561 
00562 class RasterAttachmentComponentColorTable : public HDGNImporter
00563 {
00564     void import( OdRxObjectPtr object ){};
00565 };
00566 
00567 
00568 class RasterAttachmentComponentGeo : public HDGNImporter
00569 {
00570 
00571     void import( OdRxObjectPtr object ){};
00572 
00573 };
00574 
00575 
00576 class RasterAttachmentComponentRender : public HDGNImporter
00577 {
00578 
00579     void import( OdRxObjectPtr object ){};
00580 
00581 };
00582 
00583 
00584 class RasterAttachmentComponentTransparency : public HDGNImporter
00585 {
00586 
00587     void import( OdRxObjectPtr object ){};
00588 
00589 };
00590 
00591 
00592 class RasterAttachmentComponentRGBTransparency : public HDGNImporter
00593 {
00594 
00595     void import( OdRxObjectPtr object ){};
00596 
00597 
00598 };
00599 
00600 
00601 class RasterAttachmentComponentMask : public HDGNImporter
00602 {
00603 
00604     void import( OdRxObjectPtr object ){};
00605 
00606 };
00607 
00608 
00609 class RasterAttachmentHeader : public HDGNImporter
00610 {
00611 
00612     void import( OdRxObjectPtr object ){};
00613 
00614 };
00615 
00616 
00617 class RasterHeader2d : public HDGNImporter
00618 {
00619 
00620     void import( OdRxObjectPtr object ){};
00621 
00622 };
00623 
00624 
00625 class RasterHeader3d : public HDGNImporter
00626 {
00627     void import( OdRxObjectPtr object ){};
00628 
00629 };
00630 
00631 
00632 class RasterComponent : public HDGNImporter
00633 {
00634 
00635     void import( OdRxObjectPtr object ){};
00636 
00637 };
00638 
00639 
00640 class TagElement : public HDGNImporter
00641 {
00642 
00643     void import( OdRxObjectPtr object ){};
00644 
00645 
00646 };
00647 
00648 
00649 class CellHeader2d : public HDGNImporter
00650 {
00651 
00652     void import( OdRxObjectPtr object );
00653 };
00654 
00655 
00656 class CellHeader3d : public HDGNImporter
00657 {
00658     void import( OdRxObjectPtr object );
00659 };
00660 
00661 class LevelTable : public HDGNImporter
00662 {
00663 
00664     void import( OdRxObjectPtr object ){};
00665 
00666 };
00667 
00668 
00669 class LevelTableRecord : public HDGNImporter
00670 {
00671 
00672     void import( OdRxObjectPtr object ){};
00673 
00674 };
00675 
00676 
00677 class FontTable : public HDGNImporter
00678 {
00679 
00680     void import( OdRxObjectPtr object ){};
00681 
00682 };
00683 
00684 
00685 class FontTableRecord : public HDGNImporter
00686 {
00687     void  import( OdRxObjectPtr object ){};
00688 
00689 };
00690 
00691 
00692 class TextStyleTable : public HDGNImporter
00693 {
00694 
00695     void import( OdRxObjectPtr object ){};
00696 
00697 };
00698 
00699 
00700 class TextStyleTableRecord : public HDGNImporter
00701 {
00702     void import( OdRxObjectPtr object ){};
00703 
00704 };
00705 
00706 
00707 class DimStyleTable : public HDGNImporter
00708 {
00709 
00710     void import( OdRxObjectPtr object ){};
00711 
00712 
00713 };
00714 
00715 
00716 class DimStyleTableRecord : public HDGNImporter
00717 {
00718     void import( OdRxObjectPtr object ){};
00719 
00720 };
00721 
00722 
00723 class MultilineStyleTable : public HDGNImporter
00724 {
00725 
00726     void import( OdRxObjectPtr object ){};
00727 
00728 };
00729 
00730 
00731 class MultilineStyleTableRecord : public HDGNImporter
00732 {
00733 
00734     void import( OdRxObjectPtr object ){};
00735 
00736 
00737 };
00738 
00739 
00740 class LineStyleTable : public HDGNImporter
00741 {
00742 
00743     void import( OdRxObjectPtr object ){};
00744 
00745 
00746 };
00747 
00748 
00749 class LineStyleTableRecord : public HDGNImporter
00750 {
00751 
00752     void import( OdRxObjectPtr object ){};
00753 
00754 
00755 };
00756 
00757 
00758 class RegAppTable : public HDGNImporter
00759 {
00760 
00761     void import( OdRxObjectPtr object ){};
00762 
00763 };
00764 
00765 
00766 class RegAppTableRecord : public HDGNImporter
00767 {
00768 
00769     void import( OdRxObjectPtr object ){};
00770 
00771 };
00772 
00773 
00774 class ViewTable : public HDGNImporter
00775 {
00776 
00777     void import( OdRxObjectPtr object ){};
00778 
00779 };
00780 
00781 
00782 class View : public HDGNImporter
00783 {
00784     void import( OdRxObjectPtr object );
00785 
00786 };
00787 
00788 class ViewGroupTable : public HDGNImporter
00789 {
00790     void import( OdRxObjectPtr object );
00791 };
00792 
00793 class ViewGroup : public HDGNImporter
00794 {
00795 
00796     void import( OdRxObjectPtr object );
00797 };
00798 
00799 class NamedViewTable : public HDGNImporter
00800 {
00801     void import( OdRxObjectPtr object ){};
00802 
00803 };
00804 
00805 
00806 class SharedCellDefinitionTable : public HDGNImporter
00807 {
00808 
00809     void import( OdRxObjectPtr object );
00810 
00811 };
00812 
00813 
00814 class SharedCellDefinition : public HDGNImporter
00815 {
00816 
00817     void import( OdRxObjectPtr object );
00818 
00819 
00820 };
00821 
00822 class SharedCellReference : public HDGNImporter
00823 {
00824 public:
00825     SharedCellReference()
00826     {
00827         m_iSharedCellRefCounter = 0;
00828         m_bSharedCellDefTable = false;
00829     };
00830 
00831 private:
00832     int m_iSharedCellRefCounter;
00833     bool m_bSharedCellDefTable;
00834     void import( OdRxObjectPtr object );
00835 };
00836 
00837 
00838 class TagSetDefinitionTable : public HDGNImporter
00839 {
00840     void import( OdRxObjectPtr object ){};
00841 
00842 };
00843 
00844 
00845 class TagSetDefinition : public HDGNImporter
00846 {
00847     void import( OdRxObjectPtr object ){};
00848 
00849 };
00850 
00851 
00852 class TagDefinition : public HDGNImporter
00853 {
00854     void import( OdRxObjectPtr object ){};
00855 
00856 };
00857 
00858 class TagDefinitionSetTable : public HDGNImporter
00859 {
00860     void import( OdRxObjectPtr object ){};
00861 
00862 };
00863 
00864 class TagDefinitionSet : public HDGNImporter
00865 {
00866     void import( OdRxObjectPtr object ){};
00867 
00868 };
00869 
00870 
00871 class ColorTable : public HDGNImporter
00872 {
00873     void import( OdRxObjectPtr object ){};
00874 
00875 };
00876 
00877 class Mesh : public HDGNImporter
00878 {
00879     void import( OdRxObjectPtr object );
00880 
00881 };
00882 
00883 //worlddraw() callback classes
00884 
00885 class HOdExDgnSystemServices :  public OdExDgnSystemServices, 
00886     public OdExDgnHostAppServices
00887 {
00888     ODRX_USING_HEAP_OPERATORS(OdExDgnSystemServices);
00889 };
00890 
00891 extern OdStaticRxObject< HOdExDgnSystemServices > g_HIO_OdExDgnSystemServices ;
00892 
00893 //worldDraw() class
00894 class sampleTraits : public OdStaticRxObject<OdGiSubEntityTraits>
00895 {
00896     //ODRX_DECLARE_MEMBERS(OdGiSubEntityTraits);
00897 
00898     virtual void setColor(OdUInt16 color) {}
00899 
00900     virtual void setTrueColor(const OdCmEntityColor& cmColor) {}
00901 
00902     virtual void setLayer(OdDbStub* layerId) {}
00903 
00904     virtual void setLineType(OdDbStub* linetypeId) {}
00905 
00906     virtual void setSelectionMarker(OdGsMarker markerId) {}
00907 
00908     virtual void setFillType(OdGiFillType fillType) {}
00909 
00910     virtual void setFillPlane(const OdGeVector3d* /*pNormal*/ = 0) {}
00911 
00912     virtual void setLineWeight(OdDb::LineWeight lw) {}
00913 
00914     virtual void setLineTypeScale(double dScale = 1.0) {}
00915 
00916     virtual void setLineTypeScaleToFit(bool /*doIt*/) /*= 0*/ {};
00917 
00918     virtual void setThickness(double dThickness) {}
00919 
00920     virtual void setPlotStyleName(OdDb::PlotStyleNameType, OdDbStub* = 0) {}
00921 
00922     virtual void setMaterial(OdDbStub* /*materialId*/) {}
00923 
00924     virtual void setMapper(const OdGiMapper * /*pMapper*/) {}
00925 
00926     virtual void setVisualStyle(const OdDbStub* /*visualStyleId*/) {}
00927 
00928     virtual OdUInt16 color() const { return 0; }
00929 
00930     virtual OdCmEntityColor trueColor() const { return OdCmEntityColor(); }
00931 
00932     virtual OdDbStub* layer() const { return 0; }
00933 
00934     virtual OdDbStub* lineType() const { return 0; }
00935 
00936     virtual OdGiFillType fillType() const { return kOdGiFillAlways; }
00937 
00938     virtual bool fillPlane(OdGeVector3d& /*normal*/) { return false; }
00939 
00940     virtual OdDb::LineWeight lineWeight() const { return OdDb::kLnWtByLwDefault; }
00941 
00942     virtual double lineTypeScale() const { return 0.; }
00943 
00944     virtual double thickness() const { return 0.; }
00945 
00946     virtual OdDb::PlotStyleNameType plotStyleNameType() const { return OdDb::kPlotStyleNameByLayer; }
00947 
00948     virtual OdDbStub* plotStyleNameId() const {  return 0; }
00949 
00950     virtual OdDbStub* material() const {  return 0; }
00951 
00952     virtual const OdGiMapper* mapper() const { return 0; }
00953 
00954     virtual OdDbStub* visualStyle() const { return 0; }
00955 
00956     virtual void addLight(const OdDbStub* lightId){}
00957 
00958 };
00959 
00960 //worldDraw() class
00961 class shellStore
00962 {
00963 public:
00964 
00965     OdGePoint3dArray pnts;
00966     OdInt32Array     faces;
00967 
00968     void shell( OdInt32 numVertices, const OdGePoint3d* vertexList, OdInt32 faceListSize, const OdInt32* faceList, const OdGiEdgeData* pEdgeData = 0, const OdGiFaceData* pFaceData = 0, const OdGiVertexData* pVertexData = 0)
00969     {
00970         pnts.resize(numVertices);
00971         memcpy(pnts.asArrayPtr(), vertexList, sizeof(OdGePoint3d)*numVertices);
00972         faces.resize(faceListSize);
00973         memcpy(faces.asArrayPtr(), faceList, sizeof(OdInt32)*faceListSize);
00974     }
00975 };
00976 
00977 //worldDraw() class
00978 template<class T> 
00979 class OdGiGeometry_ : public T
00980 {
00981     
00982 public:
00983     OdArray<shellStore>     &m_WireCache;
00984 
00985     shellStore *appendWire()
00986     {
00987         shellStore *pWire = m_WireCache.append();
00988         return pWire;
00989     }
00990 
00991     OdGiGeometry_(OdArray<shellStore> &pWireCache) 
00992         : m_WireCache(pWireCache)
00993     {
00994     }
00995 
00996     virtual void pline(const OdGiPolyline& pline , OdUInt32 n1 , OdUInt32 n2 );
00997     
00998 
00999     virtual OdGeMatrix3d getModelToWorldTransform() const
01000     {
01001         return OdGeMatrix3d();
01002     };
01003     virtual OdGeMatrix3d getWorldToModelTransform() const
01004     {
01005         return OdGeMatrix3d();
01006     };
01007 
01008     virtual void pushModelTransform(const OdGeVector3d& vNormal){};
01009 
01010     virtual void pushModelTransform(const OdGeMatrix3d& xMat);
01011     
01012     virtual void popModelTransform(){};
01013 
01014 
01015     // For drawing various primitives.
01016     //
01017     virtual void circle(const OdGePoint3d& center, double radius, const OdGeVector3d& normal);
01018 
01019     virtual void circle(const OdGePoint3d& p1, const OdGePoint3d& p2, const OdGePoint3d& p3);
01020     
01021     virtual void circularArc(const OdGePoint3d& center,double radius,
01022         const OdGeVector3d& normal,const OdGeVector3d& startVector,
01023         double sweepAngle,OdGiArcType arcType = kOdGiArcSimple);
01024     
01025 
01026     virtual void circularArc(const OdGePoint3d& start,const OdGePoint3d& point,
01027         const OdGePoint3d& end,OdGiArcType arcType = kOdGiArcSimple);
01028     
01029 
01030     virtual void polyline(OdInt32 nbPoints,const OdGePoint3d* pVertexList,
01031         const OdGeVector3d* pNormal = NULL,OdGsMarker lBaseSubEntMarker = -1) ;
01032     
01033 
01034     virtual void polygon(OdInt32 nbPoints, const OdGePoint3d* pVertexList);
01035     
01036 
01037     virtual void mesh(OdInt32 rows,
01038         OdInt32 columns,
01039         const OdGePoint3d* pVertexList,
01040         const OdGiEdgeData* pEdgeData = NULL,
01041         const OdGiFaceData* pFaceData = NULL,
01042         const OdGiVertexData* pVertexData = NULL);
01043     
01044     virtual void shell(OdInt32 nbVertex,
01045         const OdGePoint3d* pVertexList,
01046         OdInt32 faceListSize,
01047         const OdInt32* pFaceList,
01048         const OdGiEdgeData* pEdgeData,
01049         const OdGiFaceData* pFaceData,
01050         const OdGiVertexData* pVertexData );
01051     
01052     virtual void text(const OdGePoint3d& position,
01053         const OdGeVector3d& normal, const OdGeVector3d& direction,
01054         double height, double width, double oblique, const OdString& msg);
01055     
01056     virtual void text(const OdGePoint3d& position,
01057         const OdGeVector3d& normal, const OdGeVector3d& direction,
01058         const OdChar* msg, OdInt32 length, bool raw, const OdGiTextStyle* pTextStyle);
01059     
01060 
01061     void ray(const OdGePoint3d& first, const OdGePoint3d& second);
01062     
01063     virtual void nurbs(const OdGeNurbCurve3d& nurbs){};
01064 
01065     virtual void xline(const OdGePoint3d& p1, const OdGePoint3d& p2);
01066     
01067     virtual void ellipArc(const OdGeEllipArc3d& arc,
01068         const OdGePoint3d* pEndPointsOverrides = 0,
01069         OdGiArcType arcType = kOdGiArcSimple);
01070     
01071     virtual void draw(const OdGiDrawable* pD)
01072     {
01073         // OdGiDrawable::DrawableType drawable = pD->drawableType();
01074         pD->drawableType();
01075     }
01076 
01077     // If you push a clip boundary onto the stack you must pop it;
01078     //
01079     virtual void pushClipBoundary(OdGiClipBoundary* pBoundary){};
01080     virtual void popClipBoundary(){};
01081 
01082     virtual void worldLine(const OdGePoint3d pnts[2]);
01083     
01084     virtual const OdGiPathNode* currentGiPath() const
01085     {
01086         return 0;
01087     }
01088     
01089 private:
01090     OdGiGeometry_();
01091     OdSmartPtr< HDGNImporter > m_pHDGNImporter;
01092     Arc3d m_arc3d;
01093 };
01094 
01095 
01096 template<class T> 
01097 class OdGiCommonDraw_ : public T
01098 {
01099     OdGiContext* pCtx;
01100 public:
01101 
01102     OdGiCommonDraw_() {}
01103 
01104     virtual double deviation(const OdGiDeviationType t, const OdGePoint3d& p) const ;
01105 
01106     virtual OdGiRegenType regenType() const              { return kOdGiRenderCommand; }
01107     virtual bool regenAbort() const                      { return false;              }
01108     virtual OdGiSubEntityTraits& subEntityTraits() const { return (OdGiSubEntityTraits&)m_traits; }
01109     //virtual OdGiSubEntityTraits& subEntityTraits() const { return (OdGiSubEntityTraits&)*this; }
01110     virtual bool isDragging() const                      { return false;              }
01111     virtual OdUInt32 numberOfIsolines() const            { return 4;                  }
01112     virtual OdGiContext* context() const                 { return pCtx;               }
01113     void    setContext(OdGiContext* pUserContext)            { pCtx = pUserContext;       }
01114 
01115     
01116 private:
01117     Cone m_cone;
01118     sampleTraits m_traits;
01119 };
01120 
01121 //Setting the contex for worlddraw() function.
01122 class OdGiContextDumper : public OdStaticRxObject<OdGiContext>
01123 {
01124     OdDbDatabase* m_pDb;
01125 
01126 public:
01127     OdGiContextDumper(
01128         OdDbDatabase* pDb) : m_pDb(pDb) 
01129     {}
01130 
01131     OdDbBaseDatabase* database() const 
01132     { return (OdDbBaseDatabase*)m_pDb; }
01133 
01134     OdGiDrawablePtr openDrawable(OdDbStub*) { return (OdGiDrawable*)0; }
01135 };
01136 
01137 class OdWiresWorldGeometry : public OdGiGeometry_<OdStaticRxObject<OdGiWorldGeometry> >
01138     , public OdGiCommonDraw_<OdStaticRxObject<OdGiWorldDraw> >
01139 {
01140     ODRX_USING_HEAP_OPERATORS(OdGiGeometry_<OdStaticRxObject<OdGiWorldGeometry> >);
01141 
01142 public:
01143     OdWiresWorldGeometry(OdArray<shellStore> &pWireCache)
01144         : OdGiCommonDraw_<OdStaticRxObject<OdGiWorldDraw> >()
01145         , OdGiGeometry_<OdStaticRxObject<OdGiWorldGeometry> >(pWireCache)
01146     {
01147     }
01148     virtual void draw(const OdGiDrawable* pD) 
01149     {
01150         pD->worldDraw(this);
01151     }
01152     virtual OdGiGeometry& rawGeometry() const            
01153     { 
01154         return (OdGiGeometry&)*this;      
01155     }
01156     virtual OdGiWorldGeometry& geometry() const          
01157     { 
01158         return (OdGiWorldGeometry&)*this; 
01159     }
01160 
01161     virtual void setExtents(const OdGePoint3d *pNewExtents) {  }
01162 };
01163 //Callback code for worldDraw() function ends
01164 
01165 class OdDgImporter
01166 {
01167 private:
01168 
01169     Database                                 m_databaseimporter;
01170     Model                                    m_modelimporter;
01171     CellHeader2d                             m_cellHeader2dimporter;
01172     CellHeader3d                             m_cellHeader3dimporter;
01173     Solid                                    m_solidimporter;
01174     Surface                                  m_surfaceimporter;
01175     Cone                                     m_coneimporter;
01176     Line2d                                   m_line2dimporter;
01177     Line3d                                   m_line3dimporter;
01178     LineString2d                             m_lineString2dimporter;
01179     LineString3d                             m_lineString3dimporter;
01180     Shape2d                                  m_shape2dimporter;
01181     Shape3d                                  m_shape3dimporter;
01182     Ellipse2d                                m_ellipse2dimporter;
01183     Ellipse3d                                m_ellipse3dimporter;
01184     Arc2d                                    m_arc2dimporter;
01185     Arc3d                                    m_arc3dimporter;
01186     ComplexShape                             m_complexShapeimporter;
01187     BSplineCurve2d                           m_bSplineCurve2dimporter;
01188     BSplineCurve3d                           m_bSplineCurve3dimporter;
01189     BSplineSurface                           m_bSplineSurfaceimporter;
01190     Text2d                                   m_bText2dimporter;
01191     Text3d                                   m_bText3dimporter;
01192     XRef                                     m_bReferenceHeaderimporter;    
01193     SharedCellDefinition                     m_bSharedCellDefinitionimporter;
01194     SharedCellDefinitionTable                m_bSharedCellDefinitionTableimporter;
01195     SharedCellReference                      m_bSharedCellReferenceimporter ;        
01196     Mesh                                     m_bMeshimporter;
01197     Dimension                                m_dimensionImporter;
01198     View                                     m_viewImporter;
01199     ViewGroupTable                           m_viewGroupTableImporter;
01200     ViewGroup                                m_viewGroupImporter;
01201     TextNode2d                               m_textNode2dImporter;
01202     TextNode3d                               m_textNode3dImporter;
01203 
01204 
01205 public:
01206     OdDgImporter();
01207     ~OdDgImporter();
01208 };
01209 
01210 #endif //_HDGNHelper_H__02052008_1505__
01211 
01212 
01213