[Gdal-dev] About dgn format
Oleg Melnyk
omelnyk at pacificgeotech.com
Mon Nov 22 12:54:19 EST 2004
Hello ,
Recently I found interesting lib about dgn format .
All information is clear except situation with coordinates .
Can you help me and explain how to restore elements
coordinates.
According Intergraph Standard File Formats lib http://dl1.maptools.org/dl/dgnlib/ref18.pdf
was really easy parse byte order and found elements weight, style ,color ,type ...
I met difficulty with coordinates .
In DGN format documentation coordinates are stored in long integer and
long integers are stored with middle-endian byte ordering . (b0,b1,b2,b3 ==> b2,b3,b0,b1)
In MicroStation was created simple Line (Type 3 ) in level =1,color= 2 ,style=0 ,weight=3 ,
and coordinates [ 1. 000000 ; 3. 500000 ]
[ 7. 000000 ; 3. 500000]
You can see byte order for this component :
[0]= 1 [0x1] [^A] 00000001 level = 1 and not a complex element
[1]= 3 [0x3] [^C] 00000011 Type=3
[2]= 32 [0x20] [ ]
[3]= 0 [0x0] [^@ (NUL)] word 2 WTF = 32 +2 = 34
[4]= 0 [0x0] [^@ (NUL)]
[5]= -128 [128] [0x80] [^À]
[6]= 16 [0x10] [^P]
[7]= 39 [0x27] [']
[8]= 0 [0x0] [^@ (NUL)]
[9]= -128 [128] [0x80] [^À]
[10]= -72 [184] [0xb8] [¸]
[11]= -120 [136] [0x88] [^È]
[12]= 0 [0x0] [^@ (NUL)]
[13]= 0 [0x0] [^@ (NUL)]
[14]= 0 [0x0] [^@ (NUL)]
[15]= 0 [0x0] [^@ (NUL)]
[16]= 1 [0x1] [^A]
[17]= -128 [128] [0x80] [^À]
[18]= 112 [0x70] [p]
[19]= 17 [0x11] [^Q]
[20]= 0 [0x0] [^@ (NUL)]
[21]= -128 [128] [0x80] [^À]
[22]= -72 [184] [0xb8] [¸]
[23]= -120 [136] [0x88] [^È]
[24]= -1 [255] [0xff] [ÿ]
[25]= -1 [255] [0xff] [ÿ]
[26]= -1 [255] [0xff] [ÿ]
[27]= -1 [255] [0xff] [ÿ]
[28]= 0 [0x0] [^@ (NUL)]
[29]= 0 [0x0] [^@ (NUL)]
[30]= 10 [0xa] [^J (LF)]
[31]= 0 [0x0] [^@ (NUL)]
[32]= 0 [0x0] [^@ (NUL)] word 17 class=0 (Primary )
[33]= 14 [0xe] [^N] 00001110 H=0 (Line sigment) , R=0 , A=M=N=1 , L=0
[34]= 24 [0x18] [^X] word 18 00011000 style = 0 ,weight = 3
[35]= 2 [0x2] [^B] 00000010 color =2
[36]= 1 [0x1] [^A] 00000001 start X . If follow the doc ==> 1880162305 = 1110000000100010000000000000001
[37]= 0 [0x0] [^@ (NUL)] 00000000 It looks that no one endian format can change the range
[38]= 112 [0x70] [p] 01110000
[39]= 17 [0x11] [^Q] 0100001
[40]= 0 [0x0] [^@ (NUL)] Y how can I transform this to 3,500000 ?
[41]= 0 [0x0] [^@ (NUL)]
[42]= -72 [184] [0xb8] [¸]
[43]= -120 [136] [0x88] [^È]
[44]= 0 [0x0] [^@ (NUL)]
[45]= 0 [0x0] [^@ (NUL)]
[46]= 16 [0x10] [^P]
[47]= 39 [0x27] [']
[48]= 0 [0x0] [^@ (NUL)]
[49]= 0 [0x0] [^@ (NUL)]
[50]= -72 [184] [0xb8] [¸]
[51]= -120 [136] [0x88] [^È]
[52]= 7 [0x7] [^G]
[53]= 16 [0x10] [^P]
[54]= -87 [169] [0xa9] [©]
[55]= 81 [0x51] [Q]
[56]= 4 [0x4] [^D]
[57]= 0 [0x0] [^@ (NUL)]
[58]= 97 [0x61] [a]
[59]= 54 [0x36] [6]
The same trouble I found with angle and 3D coordinate .
Please explain me how you did this transformation .
Thanks in advance for your time ,
Thanks ,
Oleg Melnyk
More information about the Gdal-dev
mailing list