OCAD 11 Dateiformat: Unterschied zwischen den Versionen

Aus OCAD 11 Wiki - Deutsch
Zur Navigation springen Zur Suche springen
Zeile 159: Zeile 159:


== Parameter Strings ==
== Parameter Strings ==
TODO
The Parameter Strings contain all the information about the setup structure, background maps,course setting and database connection.
 
Similar to the symbols and objects there are String Index Blocks which contain the basic information for 256 Parameter Strings and the file position of the strings.
 
TStringIndexBlock contains the basic information for 256 strings
<PRE>
TStringIndexBlock = record
  NextIndexBlock: integer;            // file position of the next StringIndexBlock, 0 if this is the last StringIndexBlock
  Table: array[0..255] of TStringIndex;
end;
</PRE>
 
TStIndex contains the basic information for 1 string:
<PRE>
TStringIndex = packed record
  Pos: integer;                      // file position of string
  Len: integer;                      // length reversed for the string
  RecType: integer;                  // string typ number, if < 0 then deleted string
  ObjIndex: integer;                  // number of the object
end;
</PRE>
 
StringIndexBlk in the FileHeader points to the first StringIndexBlock.
 
The strings (null terminated) have the following structure:
* first field: all characters until the first tab (character 9). The first field can be missing (the string starts with a tab).
* tab (character 9)
* code: this is the first character after the tab
* value: all characters until the next tab
* tab
* code
* value
* ...
 
Some of String Types (number < 1000) may have multiple instances of the same type. They have to be stored as lists.

Version vom 2. April 2012, 13:42 Uhr

Version: 2012-02-09

General

This is a description of the file format of OCAD 11 files.

Be aware that this is an internal format and may change in future versions.

Data types used

OCAD is written in 32-bit Delphi and this description uses the names for the data types as they appear in Delphi. However the same data types are available in other development systems like C++.

Integer 32-bit signed integer
SmallInt 16-bit signed integer
Word 16-bit unsigned integer
WordBool 16-bit boolean
String[x]

Widestring. The first byte contains the number of characters followed by the characters. The string is not zero-terminated. The maximum number of characters is x. It occupies x + 1 bytes in the file.

Double 64-bit floating point number
TDPoly A special data type (64-bit) used for all coordinates and text. It is defined as

TDPoly = record
x, y: integer;
end;

The lowest 8 Bits are used to mark special points:

Marks for the x-coordinate:
1: this point is the first bezier curve point
2: this point is the second bezier curve point
4: for double lines: there is no left line between this point and the next point
8: this point is a area border line or a virtual line gap

Marks for y-coordinate:
1: this point is a corner point
2: this point is the first point of a hole in an area
4: for double lines: there is no right line between this point and the next point
8: this point is a dash point

The upper 24 bits contain the coordinate value measured in units of 0.01 mm.

Note: all file positions are in bytes starting from the beginning of the file.

File Header

OCAD files start with a file header.

TFileHeader = record         // size = 48 Byte 
  OCADMark: SmallInt;        // 3245 (hex 0cad)
  FileType: Byte;            // file type (0: normal map, 1: course setting project, 8: file is saved in Server) 
  FileStatus: Byte;          // not used
  Version: SmallInt;         // 11
  Subversion: Byte;          // number of subversion (0 for 11.0, 1 for 11.1 etc.)
  SubSubversion: Byte;       // number of subsubversion (0 for 11.0.0, 1 for 11.0.1) 
  FirstSymbolIndexBlk: integer;   // file position of the first symbol index block
  ObjectIndexBlock: integer;      // file position of the object index list 
  OfflineSyncSerial: integer;     // serialNumber for offline work in Server mode
  Res1: integer;             // not used
  Res2: longint;         // not used
  Res3: longint;        // not used
  FirstStringIndexBlk: longint;   // file position of the first string index block
  FileNamePos: integer;      // file position of the file name, used for temporary files only
  FileNameSize: integer;     // size of the file name, used for temporary files only
  Res4: integer;			   // not used

Symbols

Each Symbol Index Block contains the position of the next Symbol Index Block and the file position of 256 symbols.

TSymbolIndexBlock= record   // Size: 1028 Bytes
  NextSymbolIndexBlock: integer;
  SymbolPosition: array[0..255] of integer;
end;

Base Symbol

The different types of symbols are defined in different structures. There is an abstract type TBaseSym, which contains the fields common to all symbols types. It is used for programming reasons, but does not exist in real OCAD files.

TBaseSym = packed record
  Size: integer;             // Size of the symbol in bytes. This  depends on the type. Coordinates following the symbol are included.
  SymNum: integer;           // Symbol number. This is 1000 times the symbol number. 
                             // for example:
                             //   203.145 is stored as 203145
  Otp: byte;                 // Object type
                             //   1: Point symbol
                             //   2: Line symbol or Line text symbol
                             //   3: Area symbol
                             //   4: Text symbol
                             //   6: Line text symbol
                             //   7: Rectangle symbol
  Flags: byte;               // 1: rotatable symbol (not oriented to north)
                             // 4: belongs to favorites
  Selected: boolean;         // Symbol is selected in the symbol box
  Status: byte;              // Status of the symbol
                             //   0: Normal
                             //   1: Protected
                             //   2: Hidden
                             // AND 16: selected
  PreferredDrawingTool: byte;// Preferred drawing tool
                             //   0: off
                             //   1: Curve mode
                             //   2: Ellipse mode
                             //   3: Circle mode
                             //   4: Rectangular line mode
                             //   5: Rectangular area mode
                             //   6: Straight line mode
                             //   7: Freehand mode
                             //   8: Numeric mode
                             //   9: Stairway mode                          
  CsMode: byte;              // Course setting mode
                             //   0: not used for course setting
                             //   1: course symbol
                             //   2: control description symbol
  CsObjType: byte;           // Course setting object type
                             //   0: Start symbol
                             //   1: Control symbol
                             //   2: Finish symbol
                             //   3: Marked route
                             //   4: Control description symbol
                             //   5: Course title
                             //   6: Start number
                             //   7: Relay variant
                             //   8: Text block for control description
  CsCdFlags: byte;           // Course setting control description flags
                             //   a combination of the flags
                             //   64: available in column B
                             //   32: available in column C
                             //   16: available in column D
                             //   8: available in column E
                             //   4: available in column F
                             //   2: available in column G
                             //   1: available in column H
  Extent: integer;           // Extent how much the rendered symbols can reach outside the coordinates of an object with
                             // this symbol. For a point object it tells how far away from the coordinates of the object
                             // anything of the point symbol can appear
  FilePos: integer;          // Used internally. Value in the file is not defined.
  notUsed1: Byte;            
  notUsed2: Byte;            
  nColors: SmallInt;         // Number of colors of the symbol max. 14, -1: the number of colors is > 14
  Colors: array[0..13] of SmallInt; // Colors of the symbol
  Description: array[0..63] of char;// Description text                        
  IconBits: array[0..483] of byte;  // Each byte represents a pixel of the icon in a 256 color palette
  SymbolTreeGroup: Array[0..63] of Word; // Symbol is added up to 64 symbol groups 

Point Symbol

Line Symbol

Area Symbol

Text Symbol

Line Text Symbol

Rectangle Symbol

Objects

Object Index Block

OCAD Objets

Parameter Strings

The Parameter Strings contain all the information about the setup structure, background maps,course setting and database connection.

Similar to the symbols and objects there are String Index Blocks which contain the basic information for 256 Parameter Strings and the file position of the strings.

TStringIndexBlock contains the basic information for 256 strings

TStringIndexBlock = record
  NextIndexBlock: integer;            // file position of the next StringIndexBlock, 0 if this is the last StringIndexBlock
  Table: array[0..255] of TStringIndex;
end;

TStIndex contains the basic information for 1 string:

TStringIndex = packed record
  Pos: integer;                       // file position of string
  Len: integer;                       // length reversed for the string
  RecType: integer;                   // string typ number, if < 0 then deleted string
  ObjIndex: integer;                  // number of the object
end;

StringIndexBlk in the FileHeader points to the first StringIndexBlock.

The strings (null terminated) have the following structure:

  • first field: all characters until the first tab (character 9). The first field can be missing (the string starts with a tab).
  • tab (character 9)
  • code: this is the first character after the tab
  • value: all characters until the next tab
  • tab
  • code
  • value
  • ...

Some of String Types (number < 1000) may have multiple instances of the same type. They have to be stored as lists.