00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef DGNLIB_H_INCLUDED
00031 #define DGNLIB_H_INCLUDED
00032
00033 #undef STRICT_CPLERRORNUM_TYPE
00034
00035 #include "cpl_conv.h"
00036
00037 CPL_C_START
00038
00039 #define CPLE_DGN_ERROR_BASE
00040 #define CPLE_ElementTooBig CPLE_DGN_ERROR_BASE+1
00041
00056 typedef struct {
00057 double x;
00058 double y;
00059 double z;
00060 } DGNPoint;
00061
00068 typedef struct {
00069 unsigned char level;
00070 unsigned char type;
00071 unsigned char stype;
00072 unsigned char flags;
00073 long offset;
00074 } DGNElementInfo;
00075
00087 typedef struct {
00088 int offset;
00089 int size;
00090
00091 int element_id;
00092 int stype;
00093 int level;
00094 int type;
00095 int complex;
00096 int deleted;
00098 int graphic_group;
00099 int properties;
00100 int color;
00101 int weight;
00102 int style;
00104 int attr_bytes;
00105 unsigned char *attr_data;
00107 int raw_bytes;
00108 unsigned char *raw_data;
00109 } DGNElemCore;
00110
00120 typedef struct {
00121 DGNElemCore core;
00122
00123 int num_vertices;
00124 DGNPoint vertices[2];
00126 } DGNElemMultiPoint;
00127
00136 typedef struct {
00137 DGNElemCore core;
00138
00139 DGNPoint origin;
00141 double primary_axis;
00142 double secondary_axis;
00144 double rotation;
00145 int quat[4];
00146
00147 double startang;
00148 double sweepang;
00150 } DGNElemArc;
00151
00162 typedef struct {
00163 DGNElemCore core;
00164
00165 int font_id;
00166 int justification;
00167 double length_mult;
00168 double height_mult;
00169 double rotation;
00170 DGNPoint origin;
00171 char string[1];
00172 } DGNElemText;
00173
00185 typedef struct {
00186 DGNElemCore core;
00187
00188 int totlength;
00191 int numelems;
00192 int surftype;
00195 int boundelms;
00197 } DGNElemComplexHeader;
00198
00208 typedef struct {
00209 DGNElemCore core;
00210
00211 int screen_flag;
00212 GByte color_info[256][3];
00213 } DGNElemColorTable;
00214
00215 typedef struct {
00216 int flags;
00217 unsigned char levels[8];
00218 DGNPoint origin;
00219 DGNPoint delta;
00220 double transmatrx[9];
00221 double conversion;
00222 unsigned long activez;
00223 } DGNViewInfo;
00224
00239 typedef struct {
00240 DGNElemCore core;
00241
00242 int dimension;
00244 double origin_x;
00245 double origin_y;
00246 double origin_z;
00248 long uor_per_subunit;
00249 char sub_units[3];
00250 long subunits_per_master;
00251 char master_units[3];
00253 DGNViewInfo views[8];
00254
00255 } DGNElemTCB;
00256
00265 typedef struct {
00266 DGNElemCore core;
00267
00268 int totlength;
00271 char name[7];
00272 unsigned short cclass;
00273 unsigned short levels[4];
00275 DGNPoint rnglow;
00276 DGNPoint rnghigh;
00278 double trans[9];
00279 DGNPoint origin;
00281 double xscale;
00282 double yscale;
00283 double rotation;
00284
00285 } DGNElemCellHeader;
00286
00295 typedef struct {
00296 DGNElemCore core;
00297
00298 short celltype;
00299 short attindx;
00300 char name[7];
00302 int numwords;
00304 short dispsymb;
00305 unsigned short cclass;
00306 unsigned short levels[4];
00308 char description[28];
00310 } DGNElemCellLibrary;
00311
00320 typedef struct {
00321 DGNElemCore core;
00322
00323 int totlength;
00326
00327
00328
00329 } DGNElemSharedCellDefn;
00330
00331 typedef union { char *string; GInt32 integer; double real; } tagValueUnion;
00332
00341 typedef struct {
00342 DGNElemCore core;
00343
00344 int tagType;
00345 int tagSet;
00346 int tagIndex;
00347 int tagLength;
00348 tagValueUnion tagValue;
00350 } DGNElemTagValue;
00351
00357 typedef struct _DGNTagDef {
00358 char *name;
00359 int id;
00360 char *prompt;
00361 int type;
00362 tagValueUnion defaultValue;
00363 } DGNTagDef;
00364
00365 #define DGNTT_STRING 1
00366 #define DGNTT_INTEGER 3
00367 #define DGNTT_FLOAT 4
00368
00377 typedef struct {
00378 DGNElemCore core;
00379
00380 int tagCount;
00381 int tagSet;
00382 int flags;
00383 char *tagSetName;
00385 DGNTagDef *tagList;
00387 } DGNElemTagSet;
00388
00396 typedef struct {
00397 DGNElemCore core;
00398
00399 short unknown;
00400 int quat[4];
00401 DGNPoint center_1;
00402 double radius_1;
00403 DGNPoint center_2;
00404 double radius_2;
00406 } DGNElemCone;
00407
00408
00419 typedef struct {
00420 DGNElemCore core;
00421
00422 int totlength;
00424 int numelems;
00425 int node_number;
00426 short max_length;
00427 short max_used;
00428 short font_id;
00429 short justification;
00430 long line_spacing;
00431 double length_mult;
00432 double height_mult;
00433 double rotation;
00434 DGNPoint origin;
00436 } DGNElemTextNode;
00437
00438
00446 typedef struct {
00447 DGNElemCore core;
00448
00449 long desc_words;
00452 unsigned char curve_type;
00453 unsigned char u_order;
00454 unsigned short u_properties;
00456 short num_poles_u;
00457 short num_knots_u;
00458 short rule_lines_u;
00460 unsigned char v_order;
00461 unsigned short v_properties;
00463 short num_poles_v;
00464 short num_knots_v;
00465 short rule_lines_v;
00467 short num_bounds;
00468 } DGNElemBSplineSurfaceHeader;
00469
00477 typedef struct {
00478 DGNElemCore core;
00479
00480 long desc_words;
00483 unsigned char order;
00484 unsigned char properties;
00485 unsigned char curve_type;
00486 short num_poles;
00487 short num_knots;
00488 } DGNElemBSplineCurveHeader;
00489
00497 typedef struct {
00498 DGNElemCore core;
00499
00500 short number;
00501 short numverts;
00502 DGNPoint vertices[1];
00504 } DGNElemBSplineSurfaceBoundary;
00505
00513 typedef struct {
00514 DGNElemCore core;
00515
00516 float array[1];
00519 } DGNElemKnotWeight;
00520
00521
00522
00523
00524
00525
00527 #define DGNST_CORE 1
00528
00530 #define DGNST_MULTIPOINT 2
00531
00533 #define DGNST_COLORTABLE 3
00534
00536 #define DGNST_TCB 4
00537
00539 #define DGNST_ARC 5
00540
00542 #define DGNST_TEXT 6
00543
00545 #define DGNST_COMPLEX_HEADER 7
00546
00548 #define DGNST_CELL_HEADER 8
00549
00551 #define DGNST_TAG_VALUE 9
00552
00554 #define DGNST_TAG_SET 10
00555
00557 #define DGNST_CELL_LIBRARY 11
00558
00560 #define DGNST_CONE 12
00561
00563 #define DGNST_TEXT_NODE 13
00564
00566 #define DGNST_BSPLINE_SURFACE_HEADER 14
00567
00569 #define DGNST_BSPLINE_CURVE_HEADER 15
00570
00572 #define DGNST_BSPLINE_SURFACE_BOUNDARY 16
00573
00575 #define DGNST_KNOT_WEIGHT 17
00576
00578 #define DGNST_SHARED_CELL_DEFN 18
00579
00580
00581
00582
00583
00584 #define DGNT_CELL_LIBRARY 1
00585 #define DGNT_CELL_HEADER 2
00586 #define DGNT_LINE 3
00587 #define DGNT_LINE_STRING 4
00588 #define DGNT_GROUP_DATA 5
00589 #define DGNT_SHAPE 6
00590 #define DGNT_TEXT_NODE 7
00591 #define DGNT_DIGITIZER_SETUP 8
00592 #define DGNT_TCB 9
00593 #define DGNT_LEVEL_SYMBOLOGY 10
00594 #define DGNT_CURVE 11
00595 #define DGNT_COMPLEX_CHAIN_HEADER 12
00596 #define DGNT_COMPLEX_SHAPE_HEADER 14
00597 #define DGNT_ELLIPSE 15
00598 #define DGNT_ARC 16
00599 #define DGNT_TEXT 17
00600 #define DGNT_3DSURFACE_HEADER 18
00601 #define DGNT_3DSOLID_HEADER 19
00602 #define DGNT_BSPLINE_POLE 21
00603 #define DGNT_POINT_STRING 22
00604 #define DGNT_BSPLINE_SURFACE_HEADER 24
00605 #define DGNT_BSPLINE_SURFACE_BOUNDARY 25
00606 #define DGNT_BSPLINE_KNOT 26
00607 #define DGNT_BSPLINE_CURVE_HEADER 27
00608 #define DGNT_BSPLINE_WEIGHT_FACTOR 28
00609 #define DGNT_CONE 23
00610 #define DGNT_SHARED_CELL_DEFN 34
00611 #define DGNT_SHARED_CELL_ELEM 35
00612 #define DGNT_TAG_VALUE 37
00613 #define DGNT_APPLICATION_ELEM 66
00614
00615
00616
00617
00618 #define DGNS_SOLID 0
00619 #define DGNS_DOTTED 1
00620 #define DGNS_MEDIUM_DASH 2
00621 #define DGNS_LONG_DASH 3
00622 #define DGNS_DOT_DASH 4
00623 #define DGNS_SHORT_DASH 5
00624 #define DGNS_DASH_DOUBLE_DOT 6
00625 #define DGNS_LONG_DASH_SHORT_DASH 7
00626
00627
00628
00629
00630 #define DGNSUT_SURFACE_OF_PROJECTION 0
00631 #define DGNSUT_BOUNDED_PLANE 1
00632 #define DGNSUT_BOUNDED_PLANE2 2
00633 #define DGNSUT_RIGHT_CIRCULAR_CYLINDER 3
00634 #define DGNSUT_RIGHT_CIRCULAR_CONE 4
00635 #define DGNSUT_TABULATED_CYLINDER 5
00636 #define DGNSUT_TABULATED_CONE 6
00637 #define DGNSUT_CONVOLUTE 7
00638 #define DGNSUT_SURFACE_OF_REVOLUTION 8
00639 #define DGNSUT_WARPED_SURFACE 9
00640
00641
00642
00643
00644 #define DGNSOT_VOLUME_OF_PROJECTION 0
00645 #define DGNSOT_VOLUME_OF_REVOLUTION 1
00646 #define DGNSOT_BOUNDED_VOLUME 2
00647
00648
00649
00650
00651
00652 #define DGNC_PRIMARY 0
00653 #define DGNC_PATTERN_COMPONENT 1
00654 #define DGNC_CONSTRUCTION_ELEMENT 2
00655 #define DGNC_DIMENSION_ELEMENT 3
00656 #define DGNC_PRIMARY_RULE_ELEMENT 4
00657 #define DGNC_LINEAR_PATTERNED_ELEMENT 5
00658 #define DGNC_CONSTRUCTION_RULE_ELEMENT 6
00659
00660
00661
00662
00663
00664
00665
00666 #define DGN_GDL_COLOR_TABLE 1
00667 #define DGN_GDL_NAMED_VIEW 3
00668 #define DGN_GDL_REF_FILE 9
00669
00670
00671
00672
00673 #define DGNPF_HOLE 0x8000
00674 #define DGNPF_SNAPPABLE 0x4000
00675 #define DGNPF_PLANAR 0x2000
00676 #define DGNPF_ORIENTATION 0x1000
00677 #define DGNPF_ATTRIBUTES 0x0800
00678 #define DGNPF_MODIFIED 0x0400
00679 #define DGNPF_NEW 0x0200
00680 #define DGNPF_LOCKED 0x0100
00681 #define DGNPF_CLASS 0x000f
00682
00683
00684
00685
00686 #define DGNEIF_DELETED 0x01
00687 #define DGNEIF_COMPLEX 0x02
00688
00689
00690
00691
00692 #define DGNJ_LEFT_TOP 0
00693 #define DGNJ_LEFT_CENTER 1
00694 #define DGNJ_LEFT_BOTTOM 2
00695 #define DGNJ_LEFTMARGIN_TOP 3
00696 #define DGNJ_LEFTMARGIN_CENTER 4
00697 #define DGNJ_LEFTMARGIN_BOTTOM 5
00698 #define DGNJ_CENTER_TOP 6
00699 #define DGNJ_CENTER_CENTER 7
00700 #define DGNJ_CENTER_BOTTOM 8
00701 #define DGNJ_RIGHTMARGIN_TOP 9
00702 #define DGNJ_RIGHTMARGIN_CENTER 10
00703 #define DGNJ_RIGHTMARGIN_BOTTOM 11
00704 #define DGNJ_RIGHT_TOP 12
00705 #define DGNJ_RIGHT_CENTER 13
00706 #define DGNJ_RIGHT_BOTTOM 14
00707
00708
00709
00710
00711 #define DGNO_CAPTURE_RAW_DATA 0x01
00712
00713
00714
00715
00716 #define DGNLT_DMRS 0x0000
00717 #define DGNLT_INFORMIX 0x3848
00718 #define DGNLT_ODBC 0x5e62
00719 #define DGNLT_ORACLE 0x6091
00720 #define DGNLT_RIS 0x71FB
00721 #define DGNLT_SYBASE 0x4f58
00722 #define DGNLT_XBASE 0x1971
00723 #define DGNLT_SHAPE_FILL 0x0041
00724 #define DGNLT_ASSOC_ID 0x7D2F
00725
00726
00727
00728
00729
00730 #define DGNCF_USE_SEED_UNITS 0x01
00731 #define DGNCF_USE_SEED_ORIGIN 0x02
00732 #define DGNCF_COPY_SEED_FILE_COLOR_TABLE 0x04
00733 #define DGNCF_COPY_WHOLE_SEED_FILE 0x08
00734
00735
00736
00737
00738 #define DGNBSC_CURVE_DISPLAY 0x10
00739 #define DGNBSC_POLY_DISPLAY 0x20
00740 #define DGNBSC_RATIONAL 0x40
00741 #define DGNBSC_CLOSED 0x80
00742
00743
00744
00745
00746 #define DGNBSS_ARC_SPACING 0x40
00747 #define DGNBSS_CLOSED 0x80
00748
00749
00750
00751
00753 typedef void *DGNHandle;
00754
00755 DGNHandle CPL_DLL DGNOpen( const char *, int );
00756 void CPL_DLL DGNSetOptions( DGNHandle, int );
00757 int CPL_DLL DGNTestOpen( GByte *, int );
00758 const DGNElementInfo CPL_DLL *DGNGetElementIndex( DGNHandle, int * );
00759 int CPL_DLL DGNGetExtents( DGNHandle, double * );
00760 int CPL_DLL DGNGetDimension( DGNHandle );
00761 DGNElemCore CPL_DLL *DGNReadElement( DGNHandle );
00762 void CPL_DLL DGNFreeElement( DGNHandle, DGNElemCore * );
00763 void CPL_DLL DGNRewind( DGNHandle );
00764 int CPL_DLL DGNGotoElement( DGNHandle, int );
00765 void CPL_DLL DGNClose( DGNHandle );
00766 int CPL_DLL DGNLoadTCB( DGNHandle );
00767 int CPL_DLL DGNLookupColor( DGNHandle, int, int *, int *, int * );
00768 int CPL_DLL DGNGetShapeFillInfo( DGNHandle, DGNElemCore *, int * );
00769 int CPL_DLL DGNGetAssocID( DGNHandle, DGNElemCore * );
00770 int CPL_DLL DGNGetElementExtents( DGNHandle, DGNElemCore *,
00771 DGNPoint *, DGNPoint * );
00772
00773 void CPL_DLL DGNDumpElement( DGNHandle, DGNElemCore *, FILE * );
00774 const char CPL_DLL *DGNTypeToName( int );
00775
00776 void CPL_DLL DGNRotationToQuaternion( double, int * );
00777 void CPL_DLL DGNQuaternionToMatrix( int *, float * );
00778 int CPL_DLL DGNStrokeArc( DGNHandle, DGNElemArc *, int, DGNPoint * );
00779 int CPL_DLL DGNStrokeCurve( DGNHandle, DGNElemMultiPoint*, int, DGNPoint * );
00780 void CPL_DLL DGNSetSpatialFilter( DGNHandle hDGN,
00781 double dfXMin, double dfYMin,
00782 double dfXMax, double dfYMax );
00783 int CPL_DLL DGNGetAttrLinkSize( DGNHandle, DGNElemCore *, int );
00784 unsigned char CPL_DLL *
00785 DGNGetLinkage( DGNHandle hDGN, DGNElemCore *psElement,
00786 int iIndex, int *pnLinkageType,
00787 int *pnEntityNum, int *pnMSLink, int *pnLinkSize);
00788
00789
00790
00791 int CPL_DLL DGNWriteElement( DGNHandle, DGNElemCore * );
00792 int CPL_DLL DGNResizeElement( DGNHandle, DGNElemCore *, int );
00793 DGNHandle CPL_DLL
00794 DGNCreate( const char *pszNewFilename, const char *pszSeedFile,
00795 int nCreationFlags,
00796 double dfOriginX, double dfOriginY, double dfOriginZ,
00797 int nMasterUnitPerSubUnit, int nUORPerSubUnit,
00798 const char *pszMasterUnits, const char *pszSubUnits );
00799 DGNElemCore CPL_DLL *DGNCloneElement( DGNHandle hDGNSrc, DGNHandle hDGNDst,
00800 DGNElemCore *psSrcElement );
00801 int CPL_DLL DGNUpdateElemCore( DGNHandle hDGN, DGNElemCore *psElement,
00802 int nLevel, int nGraphicGroup, int nColor,
00803 int nWeight, int nStyle );
00804 int CPL_DLL DGNUpdateElemCoreExtended( DGNHandle hDGN,
00805 DGNElemCore *psElement );
00806
00807 DGNElemCore CPL_DLL *
00808 DGNCreateMultiPointElem( DGNHandle hDGN, int nType,
00809 int nPointCount, DGNPoint*pasVertices );
00810 DGNElemCore CPL_DLL *
00811 DGNCreateArcElem2D( DGNHandle hDGN, int nType,
00812 double dfOriginX, double dfOriginY,
00813 double dfPrimaryAxis, double dfSecondaryAxis,
00814 double dfRotation,
00815 double dfStartAngle, double dfSweepAngle );
00816
00817 DGNElemCore CPL_DLL *
00818 DGNCreateArcElem( DGNHandle hDGN, int nType,
00819 double dfOriginX, double dfOriginY,
00820 double dfOriginZ,
00821 double dfPrimaryAxis, double dfSecondaryAxis,
00822 double dfStartAngle, double dfSweepAngle,
00823 double dfRotation, int *panQuaternion );
00824
00825 DGNElemCore CPL_DLL *
00826 DGNCreateConeElem( DGNHandle hDGN,
00827 double center_1X, double center_1Y,
00828 double center_1Z, double radius_1,
00829 double center_2X, double center_2Y,
00830 double center_2Z, double radius_2,
00831 int *panQuaternion );
00832
00833 DGNElemCore CPL_DLL *
00834 DGNCreateTextElem( DGNHandle hDGN, const char *pszText,
00835 int nFontId, int nJustification,
00836 double dfLengthMult, double dfHeightMult,
00837 double dfRotation, int *panQuaternion,
00838 double dfOriginX, double dfOriginY, double dfOriginZ );
00839
00840 DGNElemCore CPL_DLL *
00841 DGNCreateColorTableElem( DGNHandle hDGN, int nScreenFlag,
00842 GByte abyColorInfo[256][3] );
00843 DGNElemCore CPL_DLL *
00844 DGNCreateComplexHeaderElem( DGNHandle hDGN, int nType,
00845 int nTotLength, int nNumElems );
00846 DGNElemCore CPL_DLL *
00847 DGNCreateComplexHeaderFromGroup( DGNHandle hDGN, int nType,
00848 int nNumElems, DGNElemCore **papsElems );
00849
00850 DGNElemCore CPL_DLL *
00851 DGNCreateSolidHeaderElem( DGNHandle hDGN, int nType, int nSurfType,
00852 int nBoundElems, int nTotLength, int nNumElems );
00853 DGNElemCore CPL_DLL *
00854 DGNCreateSolidHeaderFromGroup( DGNHandle hDGN, int nType, int nSurfType,
00855 int nBoundElems, int nNumElems,
00856 DGNElemCore **papsElems );
00857
00858 DGNElemCore CPL_DLL *
00859 DGNCreateCellHeaderElem( DGNHandle hDGN, int nTotLength, const char *pszName,
00860 short nClass, short *panLevels,
00861 DGNPoint *psRangeLow, DGNPoint *psRangeHigh,
00862 DGNPoint *psOrigin, double dfXScale, double dfYScale,
00863 double dfRotation );
00864
00865 DGNElemCore CPL_DLL *
00866 DGNCreateCellHeaderFromGroup( DGNHandle hDGN, const char *pszName,
00867 short nClass, short *panLevels,
00868 int nNumElems, DGNElemCore **papsElems,
00869 DGNPoint *psOrigin,
00870 double dfXScale, double dfYScale,
00871 double dfRotation );
00872
00873 int CPL_DLL DGNAddMSLink( DGNHandle hDGN, DGNElemCore *psElement,
00874 int nLinkageType, int nEntityNum, int nMSLink );
00875
00876 int CPL_DLL DGNAddRawAttrLink( DGNHandle hDGN, DGNElemCore *psElement,
00877 int nLinkSize, unsigned char *pabyRawLinkData );
00878
00879 int CPL_DLL DGNAddShapeFillInfo( DGNHandle hDGN, DGNElemCore *psElement,
00880 int nColor );
00881
00882 int CPL_DLL DGNElemTypeHasDispHdr( int nElemType );
00883
00884 CPL_C_END
00885
00886 #endif