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