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
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148 #ifndef _DGNLIB_H_INCLUDED
00149 #define _DGNLIB_H_INCLUDED
00150
00151 #include "cpl_conv.h"
00152
00153 CPL_C_START
00154
00155 #define CPLE_DGN_ERROR_BASE
00156 #define CPLE_ElementTooBig CPLE_DGN_ERROR_BASE+1
00157
00172 typedef struct {
00173 double x;
00174 double y;
00175 double z;
00176 } DGNPoint;
00177
00184 typedef struct {
00185 unsigned char level;
00186 unsigned char type;
00187 unsigned char stype;
00188 unsigned char flags;
00189 long offset;
00190 } DGNElementInfo;
00191
00203 typedef struct {
00204 int offset;
00205 int size;
00206
00207 int element_id;
00208 int stype;
00209 int level;
00210 int type;
00211 int complex;
00212 int deleted;
00214 int graphic_group;
00215 int properties;
00216 int color;
00217 int weight;
00218 int style;
00220 int attr_bytes;
00221 unsigned char *attr_data;
00223 int raw_bytes;
00224 unsigned char *raw_data;
00225 } DGNElemCore;
00226
00236 typedef struct {
00237 DGNElemCore core;
00238
00239 int num_vertices;
00240 DGNPoint vertices[2];
00242 } DGNElemMultiPoint;
00243
00252 typedef struct {
00253 DGNElemCore core;
00254
00255 DGNPoint origin;
00257 double primary_axis;
00258 double secondary_axis;
00260 double rotation;
00261 int quat[4];
00262
00263 double startang;
00264 double sweepang;
00266 } DGNElemArc;
00267
00278 typedef struct {
00279 DGNElemCore core;
00280
00281 int font_id;
00282 int justification;
00283 double length_mult;
00284 double height_mult;
00285 double rotation;
00286 DGNPoint origin;
00287 char string[1];
00288 } DGNElemText;
00289
00299 typedef struct {
00300 DGNElemCore core;
00301
00302 int totlength;
00303 int numelems;
00304 int surftype;
00305 } DGNElemComplexHeader;
00306
00316 typedef struct {
00317 DGNElemCore core;
00318
00319 int screen_flag;
00320 GByte color_info[256][3];
00321 } DGNElemColorTable;
00322
00323 typedef struct {
00324 int flags;
00325 unsigned char levels[8];
00326 DGNPoint origin;
00327 DGNPoint delta;
00328 double transmatrx[9];
00329 double conversion;
00330 unsigned long activez;
00331 } DGNViewInfo;
00332
00347 typedef struct {
00348 DGNElemCore core;
00349
00350 int dimension;
00352 double origin_x;
00353 double origin_y;
00354 double origin_z;
00356 long uor_per_subunit;
00357 char sub_units[3];
00358 long subunits_per_master;
00359 char master_units[3];
00361 DGNViewInfo views[8];
00362
00363 } DGNElemTCB;
00364
00373 typedef struct {
00374 DGNElemCore core;
00375
00376 int totlength;
00377 char name[7];
00378 unsigned short cclass;
00379 unsigned short levels[4];
00381 DGNPoint rnglow;
00382 DGNPoint rnghigh;
00384 double trans[9];
00385 DGNPoint origin;
00387 double xscale;
00388 double yscale;
00389 double rotation;
00390
00391 } DGNElemCellHeader;
00392
00401 typedef struct {
00402 DGNElemCore core;
00403
00404 short celltype;
00405 short attindx;
00406 char name[7];
00408 int numwords;
00410 short dispsymb;
00411 unsigned short cclass;
00412 unsigned short levels[4];
00414 char description[28];
00416 } DGNElemCellLibrary;
00417
00418 typedef union { char *string; GInt32 integer; double real; } tagValueUnion;
00419
00428 typedef struct {
00429 DGNElemCore core;
00430
00431 int tagType;
00432 int tagSet;
00433 int tagIndex;
00434 int tagLength;
00435 tagValueUnion tagValue;
00437 } DGNElemTagValue;
00438
00444 typedef struct _DGNTagDef {
00445 char *name;
00446 int id;
00447 char *prompt;
00448 int type;
00449 tagValueUnion defaultValue;
00450 } DGNTagDef;
00451
00452 #define DGNTT_STRING 1
00453 #define DGNTT_INTEGER 3
00454 #define DGNTT_FLOAT 4
00455
00464 typedef struct {
00465 DGNElemCore core;
00466
00467 int tagCount;
00468 int tagSet;
00469 int flags;
00470 char *tagSetName;
00472 DGNTagDef *tagList;
00474 } DGNElemTagSet;
00475
00483 typedef struct {
00484 DGNElemCore core;
00485
00486 short unknown;
00487 int quat[4];
00488 DGNPoint center_1;
00489 double radius_1;
00490 DGNPoint center_2;
00491 double radius_2;
00493 } DGNElemCone;
00494
00495
00496
00497
00498
00500 #define DGNST_CORE 1
00501
00503 #define DGNST_MULTIPOINT 2
00504
00506 #define DGNST_COLORTABLE 3
00507
00509 #define DGNST_TCB 4
00510
00512 #define DGNST_ARC 5
00513
00515 #define DGNST_TEXT 6
00516
00518 #define DGNST_COMPLEX_HEADER 7
00519
00521 #define DGNST_CELL_HEADER 8
00522
00524 #define DGNST_TAG_VALUE 9
00525
00527 #define DGNST_TAG_SET 10
00528
00530 #define DGNST_CELL_LIBRARY 11
00531
00533 #define DGNST_CONE 12
00534
00535
00536
00537
00538 #define DGNT_CELL_LIBRARY 1
00539 #define DGNT_CELL_HEADER 2
00540 #define DGNT_LINE 3
00541 #define DGNT_LINE_STRING 4
00542 #define DGNT_GROUP_DATA 5
00543 #define DGNT_SHAPE 6
00544 #define DGNT_TEXT_NODE 7
00545 #define DGNT_DIGITIZER_SETUP 8
00546 #define DGNT_TCB 9
00547 #define DGNT_LEVEL_SYMBOLOGY 10
00548 #define DGNT_CURVE 11
00549 #define DGNT_COMPLEX_CHAIN_HEADER 12
00550 #define DGNT_COMPLEX_SHAPE_HEADER 14
00551 #define DGNT_ELLIPSE 15
00552 #define DGNT_ARC 16
00553 #define DGNT_TEXT 17
00554 #define DGNT_3DSURFACE_HEADER 18
00555 #define DGNT_3DSOLID_HEADER 19
00556 #define DGNT_BSPLINE 21
00557 #define DGNT_CONE 23
00558 #define DGNT_SHARED_CELL_DEFN 34
00559 #define DGNT_SHARED_CELL_ELEM 35
00560 #define DGNT_TAG_VALUE 37
00561 #define DGNT_APPLICATION_ELEM 66
00562
00563
00564
00565
00566 #define DGNS_SOLID 0
00567 #define DGNS_DOTTED 1
00568 #define DGNS_MEDIUM_DASH 2
00569 #define DGNS_LONG_DASH 3
00570 #define DGNS_DOT_DASH 4
00571 #define DGNS_SHORT_DASH 5
00572 #define DGNS_DASH_DOUBLE_DOT 6
00573 #define DGNS_LONG_DASH_SHORT_DASH 7
00574
00575
00576
00577
00578 #define DGNSUT_SOLID 0
00579 #define DGNSUT_BOUNDED_PLANE 1
00580 #define DGNSUT_BOUNDED_PLANE2 2
00581 #define DGNSUT_RIGHT_CIRCULAR_CYLINDER 3
00582 #define DGNSUT_RIGHT_CIRCULAR_CONE 4
00583 #define DGNSUT_TABULATED_CYLINDER 5
00584 #define DGNSUT_TABULATED_CONE 6
00585 #define DGNSUT_CONVOLUTE 7
00586 #define DGNSUT_SURFACE_OF_REVOLUTION 8
00587 #define DGNSUT_WARPED_SURFACE 9
00588
00589
00590
00591
00592 #define DGNSOT_VOLUME_OF_PROJECTION 0
00593 #define DGNSOT_VOLUME_OF_REVOLUTION 1
00594 #define DGNSOT_BOUNDED_VOLUME 2
00595
00596
00597
00598
00599
00600 #define DGNC_PRIMARY 0
00601 #define DGNC_PATTERN_COMPONENT 1
00602 #define DGNC_CONSTRUCTION_ELEMENT 2
00603 #define DGNC_DIMENSION_ELEMENT 3
00604 #define DGNC_PRIMARY_RULE_ELEMENT 4
00605 #define DGNC_LINEAR_PATTERNED_ELEMENT 5
00606 #define DGNC_CONSTRUCTION_RULE_ELEMENT 6
00607
00608
00609
00610
00611
00612
00613
00614 #define DGN_GDL_COLOR_TABLE 1
00615 #define DGN_GDL_NAMED_VIEW 3
00616 #define DGN_GDL_REF_FILE 9
00617
00618
00619
00620
00621 #define DGNPF_HOLE 0x8000
00622 #define DGNPF_SNAPPABLE 0x4000
00623 #define DGNPF_PLANAR 0x2000
00624 #define DGNPF_ORIENTATION 0x1000
00625 #define DGNPF_ATTRIBUTES 0x0800
00626 #define DGNPF_MODIFIED 0x0400
00627 #define DGNPF_NEW 0x0200
00628 #define DGNPF_LOCKED 0x0100
00629 #define DGNPF_CLASS 0x000f
00630
00631
00632
00633
00634 #define DGNEIF_DELETED 0x01
00635 #define DGNEIF_COMPLEX 0x02
00636
00637
00638
00639
00640 #define DGNJ_LEFT_TOP 0
00641 #define DGNJ_LEFT_CENTER 1
00642 #define DGNJ_LEFT_BOTTOM 2
00643 #define DGNJ_LEFTMARGIN_TOP 3
00644 #define DGNJ_LEFTMARGIN_CENTER 4
00645 #define DGNJ_LEFTMARGIN_BOTTOM 5
00646 #define DGNJ_CENTER_TOP 6
00647 #define DGNJ_CENTER_CENTER 6
00648 #define DGNJ_CENTER_BOTTOM 8
00649 #define DGNJ_RIGHTMARGIN_TOP 9
00650 #define DGNJ_RIGHTMARGIN_CENTER 10
00651 #define DGNJ_RIGHTMARGIN_BOTTOM 11
00652 #define DGNJ_RIGHT_TOP 12
00653 #define DGNJ_RIGHT_CENTER 13
00654 #define DGNJ_RIGHT_BOTTOM 14
00655
00656
00657
00658
00659 #define DGNO_CAPTURE_RAW_DATA 0x01
00660
00661
00662
00663
00664 #define DGNLT_DMRS 0x0000
00665 #define DGNLT_INFORMIX 0x3848
00666 #define DGNLT_ODBC 0x5e62
00667 #define DGNLT_ORACLE 0x6091
00668 #define DGNLT_RIS 0x71FB
00669 #define DGNLT_SYBASE 0x4f58
00670 #define DGNLT_XBASE 0x1971
00671 #define DGNLT_SHAPE_FILL 0x0041
00672 #define DGNLT_ASSOC_ID 0x7D2F
00673
00674
00675
00676
00677
00678 #define DGNCF_USE_SEED_UNITS 0x01
00679 #define DGNCF_USE_SEED_ORIGIN 0x02
00680 #define DGNCF_COPY_SEED_FILE_COLOR_TABLE 0x04
00681 #define DGNCF_COPY_WHOLE_SEED_FILE 0x08
00682
00683
00684
00685
00687 typedef void *DGNHandle;
00688
00689 DGNHandle CPL_DLL DGNOpen( const char *, int );
00690 void CPL_DLL DGNSetOptions( DGNHandle, int );
00691 int CPL_DLL DGNTestOpen( GByte *, int );
00692 const DGNElementInfo CPL_DLL *DGNGetElementIndex( DGNHandle, int * );
00693 int CPL_DLL DGNGetExtents( DGNHandle, double * );
00694 int CPL_DLL DGNGetDimension( DGNHandle );
00695 DGNElemCore CPL_DLL *DGNReadElement( DGNHandle );
00696 void CPL_DLL DGNFreeElement( DGNHandle, DGNElemCore * );
00697 void CPL_DLL DGNRewind( DGNHandle );
00698 int CPL_DLL DGNGotoElement( DGNHandle, int );
00699 void CPL_DLL DGNClose( DGNHandle );
00700 int CPL_DLL DGNLoadTCB( DGNHandle );
00701 int CPL_DLL DGNLookupColor( DGNHandle, int, int *, int *, int * );
00702 int CPL_DLL DGNGetShapeFillInfo( DGNHandle, DGNElemCore *, int * );
00703 int CPL_DLL DGNGetAssocID( DGNHandle, DGNElemCore * );
00704 int CPL_DLL DGNGetElementExtents( DGNHandle, DGNElemCore *,
00705 DGNPoint *, DGNPoint * );
00706
00707 void CPL_DLL DGNDumpElement( DGNHandle, DGNElemCore *, FILE * );
00708 const char CPL_DLL *DGNTypeToName( int );
00709
00710 void CPL_DLL DGNRotationToQuaternion( double, int * );
00711 void CPL_DLL DGNQuaternionToMatrix( int *, float * );
00712 int CPL_DLL DGNStrokeArc( DGNHandle, DGNElemArc *, int, DGNPoint * );
00713 int CPL_DLL DGNStrokeCurve( DGNHandle, DGNElemMultiPoint*, int, DGNPoint * );
00714 void CPL_DLL DGNSetSpatialFilter( DGNHandle hDGN,
00715 double dfXMin, double dfYMin,
00716 double dfXMax, double dfYMax );
00717 int CPL_DLL DGNGetAttrLinkSize( DGNHandle, DGNElemCore *, int );
00718 unsigned char CPL_DLL *
00719 DGNGetLinkage( DGNHandle hDGN, DGNElemCore *psElement,
00720 int iIndex, int *pnLinkageType,
00721 int *pnEntityNum, int *pnMSLink, int *pnLinkSize);
00722
00723
00724
00725 int CPL_DLL DGNWriteElement( DGNHandle, DGNElemCore * );
00726 int CPL_DLL DGNResizeElement( DGNHandle, DGNElemCore *, int );
00727 DGNHandle CPL_DLL
00728 DGNCreate( const char *pszNewFilename, const char *pszSeedFile,
00729 int nCreationFlags,
00730 double dfOriginX, double dfOriginY, double dfOriginZ,
00731 int nMasterUnitPerSubUnit, int nUORPerSubUnit,
00732 const char *pszMasterUnits, const char *pszSubUnits );
00733 DGNElemCore CPL_DLL *DGNCloneElement( DGNHandle hDGNSrc, DGNHandle hDGNDst,
00734 DGNElemCore *psSrcElement );
00735 int CPL_DLL DGNUpdateElemCore( DGNHandle hDGN, DGNElemCore *psElement,
00736 int nLevel, int nGraphicGroup, int nColor,
00737 int nWeight, int nStyle );
00738 int CPL_DLL DGNUpdateElemCoreExtended( DGNHandle hDGN,
00739 DGNElemCore *psElement );
00740
00741 DGNElemCore CPL_DLL *
00742 DGNCreateMultiPointElem( DGNHandle hDGN, int nType,
00743 int nPointCount, DGNPoint*pasVertices );
00744 DGNElemCore CPL_DLL *
00745 DGNCreateArcElem2D( DGNHandle hDGN, int nType,
00746 double dfOriginX, double dfOriginY,
00747 double dfPrimaryAxis, double dfSecondaryAxis,
00748 double dfRotation,
00749 double dfStartAngle, double dfSweepAngle );
00750
00751 DGNElemCore CPL_DLL *
00752 DGNCreateArcElem( DGNHandle hDGN, int nType,
00753 double dfOriginX, double dfOriginY,
00754 double dfOriginZ,
00755 double dfPrimaryAxis, double dfSecondaryAxis,
00756 double dfStartAngle, double dfSweepAngle,
00757 double dfRotation, int *panQuaternion );
00758
00759 DGNElemCore CPL_DLL *
00760 DGNCreateConeElem( DGNHandle hDGN,
00761 double center_1X, double center_1Y,
00762 double center_1Z, double radius_1,
00763 double center_2X, double center_2Y,
00764 double center_2Z, double radius_2,
00765 int *panQuaternion );
00766
00767 DGNElemCore CPL_DLL *
00768 DGNCreateTextElem( DGNHandle hDGN, const char *pszText,
00769 int nFontId, int nJustification,
00770 double dfLengthMult, double dfHeightMult,
00771 double dfRotation, int *panQuaternion,
00772 double dfOriginX, double dfOriginY, double dfOriginZ );
00773
00774 DGNElemCore CPL_DLL *
00775 DGNCreateColorTableElem( DGNHandle hDGN, int nScreenFlag,
00776 GByte abyColorInfo[256][3] );
00777 DGNElemCore *
00778 DGNCreateComplexHeaderElem( DGNHandle hDGN, int nType, int nSurfType,
00779 int nTotLength, int nNumElems );
00780 DGNElemCore *
00781 DGNCreateComplexHeaderFromGroup( DGNHandle hDGN, int nType, int nSurfType,
00782 int nNumElems, DGNElemCore **papsElems );
00783
00784 DGNElemCore CPL_DLL *
00785 DGNCreateCellHeaderElem( DGNHandle hDGN, int nTotLength, const char *pszName,
00786 short nClass, short *panLevels,
00787 DGNPoint *psRangeLow, DGNPoint *psRangeHigh,
00788 DGNPoint *psOrigin, double dfXScale, double dfYScale,
00789 double dfRotation );
00790
00791 DGNElemCore *
00792 DGNCreateCellHeaderFromGroup( DGNHandle hDGN, const char *pszName,
00793 short nClass, short *panLevels,
00794 int nNumElems, DGNElemCore **papsElems,
00795 DGNPoint *psOrigin,
00796 double dfXScale, double dfYScale,
00797 double dfRotation );
00798
00799 int CPL_DLL DGNAddMSLink( DGNHandle hDGN, DGNElemCore *psElement,
00800 int nLinkageType, int nEntityNum, int nMSLink );
00801
00802 int CPL_DLL DGNAddRawAttrLink( DGNHandle hDGN, DGNElemCore *psElement,
00803 int nLinkSize, unsigned char *pabyRawLinkData );
00804
00805 int CPL_DLL DGNAddShapeFillInfo( DGNHandle hDGN, DGNElemCore *psElement,
00806 int nColor );
00807
00808 int CPL_DLL DGNElemTypeHasDispHdr( int nElemType );
00809
00810 CPL_C_END
00811
00812 #endif