
Jw_cadのデータ形式
The data format of Jw_cad 

ここでは、Jw_cadバージョン5.00aのデータ形式を解説する。データ形式は、将来予告なく変更されることがあるので注意してほしい。
なお、ソースコードは、データ形式を説明するために、出力に相当する部分を抜き出して記述したものである。
バージョンによって異なる部分は原則として解説の部分に記載し、一部を除いてソースコード内には記述していない。
Here, the data format of the Jw_cad version 5.00a is explained. 
A data format may be changed that there will be no preliminary announcement in the future. 
In addition, a source code extracts and describes the portion equivalent to an output, in order to explain a data format. 
The portion which changes with versions is indicated into the portion of description in principle. 


◆ JWWのデータファイルの宣言
Declaration of the data file of JWW 
ar.Write("JwwData.", 8);

◆ バージョンNo.
Version No. 
ar << (DWORD)JW_DATA_VERSION;   //Ver.5.0 の内部バージョンは 420
                                  The internal version of Ver.5.0 is 420. 
                                  
◆ ファイルメモ
File memo 
ar << (CString)m_strMemo;

◆ 図面サイズ
Drawing size 
● 0〜4 ：A0〜A4
● 8    ：2 A
● 9    ：3 A
● 10   ：4 A
● 11   ：5 A
● 12   ：10m
● 13   ：50m
● 14   ：100m

ar << (DWORD)m_nZumen;

◆ レイヤグループ・レイヤ状態
Layer group, layer state 
● 書込レイヤグループ
Write-in layer group 
● レイヤグループ状態(0：非表示、1：表示のみ、2：編集可能、3：書込)
Layer group state(0:Undisplayed  1:Only display  2:Edit is possible 3:Writing )
● レイヤグループの書込レイヤ
The write-in layer of a layer group 
● レイヤグループの縮尺(の分母)
The scale of a layer group (denominator)
● レイヤグループのプロテクト指定
　(0：無指定、1：表示状態変更可能プロテクト指定、2：表示状態固定プロテクト指定)
Protection specification of a layer group 
　(0:Nonappointed 1:A display state change is possible.  2:Display state fixation )
● レイヤ状態(0：非表示、1：表示のみ、2：編集可能、3：書込)
Layer state (0:Undisplayed 1:Only display  2:Edit is possible.  3:Writing )
● レイヤのプロテクト指定
　(0：無指定、1：表示状態変更可能プロテクト指定、2：表示状態固定プロテクト指定)
Protection specification of a layer 
　(0:Nonappointed 1:A display state change is possible.  2:Display state fixation )

ar << (DWORD)m_nWriteGLay;
for(nGLay=0;nGLay<16;nGLay++){
    ar << (DWORD )m_anGLay[nGLay];
    ar << (DWORD )m_anWriteLay[nGLay];
    ar << (double)m_adScale[nGLay];
    ar << (DWORD )m_anGLayProtect[nGLay];
    for(nLay=0;nLay<16;nLay++){
        ar << (DWORD)m_aanLay[nGLay][nLay];
        ar << (DWORD)m_aanLayProtect[nGLay][nLay];
    }
}

◆ ダミー
dummy
for(i=0;i<14;i++){ ar << (DWORD)dummy; }

◆ 寸法関係の設定
A size-related setup 
環境設定ファイルの「S_COMM_8」の③寸法設定が「10」または「11」になっていて、
ファイルへの保存ができる場合に有効になり、
それ以外は「m_lnSunpou1」〜「m_lnSunpou5」は「0」になる。
*Configuration file/S_COMM_8/(3)Size setup = 10 or 11
 And when preservation to a file can be performed : Effective
*Other than this : m_lnSunpou1 - m_lnSunpou5 = 0

ar << (DWORD)m_lnSunpou1;
ar << (DWORD)m_lnSunpou2;
ar << (DWORD)m_lnSunpou3;
ar << (DWORD)m_lnSunpou4;
ar << (DWORD)m_lnSunpou5;

・m_lnSunpou1
GFEDCBA (Decimal number)
A:Dimension line color （1〜9）
B:Leader line color （1〜9）
C:Leader dot color （1〜9）
D:Below a decimal point,digit number（0〜3）
E:Size unit （0:mm 、1:ｍ）
F:Dimension line end （0:Point 、1:Arrow 、2:Reverse arrow ）
G:Size character kind （1〜10）

一位：寸法線色（1〜9）
十位：引出線色（1〜9）
百位：寸法点色（1〜9）
千位：寸法値の少数点以下の桁数（0〜3）
万位：寸法単位（0:mm 、1:ｍ）
十万位：寸法線端部（0:点 、1:矢印 、2:逆矢印）
百万位：寸法文字種（1〜10）

・m_lnSunpou2
GFEDCBA (Decimal number)
DCBA:Distance of a size value and a dimension line 
     Distance（0〜99.9）×１０,  In the case of minus : 1000 is added and integer-ized. 
GFE:The projection length of a dimension line 
     Length（0〜99.9）×１０,  In the case of minus : 1000 is added and integer-ized.(It increases 10000 times. )
     
一位〜千位：寸法値の寸法線との離れ
　　　　　　離れ（0〜99.9）×１０、マイナスの場合は1000をプラスして整数化する
万位〜千万位：寸法線の突出長さ
　　　　　　長さ（0〜99.9）×１０、マイナスの場合は1000をプラスして整数化し、更に10000倍する。

・m_lnSunpou3
IHGFEDCBA (Decimal number)
CBA:Arrow length 
    length（0〜99.9）×１０(It integer-izes. )
FED:Arrow angle 
    angle（0.1〜80.0）×１０(It integer-izes. )
IHG:The appearance size of a reverse arrow 
    size（0〜99.9）×１０(It integer-izes. )
    
一位〜百位：矢印長さ
　　　　　　長さ（0〜99.9）×１０として整数化する
千位〜十万位：矢印角度
　　　　　　角度（0.1〜80.0）×１０として整数化し、1000倍する
百万位〜億位：逆矢印の出寸法
　　　　　　寸法（0〜99.9）×１０として整数化すし、1000000倍する

・m_lnSunpou4
IHGFEDCBA (Decimal number)
A:The size value direction is rectified. (0:ON 1:OFF)
B:A size value is made into full width. (0:Half width 1:full width )
C:The comma of a size value is made into a space. (0:comma 1:space )
D:The comma of a size value is made into full width.  (0:Half width 1:full width )
E:The decimal point of a size value is made into full width.  (0:Half width 1:full width )
F:A unit is displayed on a size value. (0:OFF 1:ON)
G:"R" is displayed on a radius value. (0:OFF 1:Before 2:After )
H:A comma is displayed on a radius value. (0:OFF 1:ON )
I:"0" of a decimal point is displayed on a radius value. (0:OFF 1:ON )

一位：寸法値方向を補正しない（0：補正有 、1：補正無）
十位：寸法値を全角にする（0：半角 、1：全角）
百位：寸法値のカンマをスペースにする（0：カンマ 、1：スペース）
千位：寸法値のカンマを全角にする（0：半角 、1：全角）
万位：寸法値の少数点を全角にする（0：半角 、1：全角）
十万位：寸法値に単位を表示する（0：表示無 、1：表示有）
百万位：半径値に「R」を表示する（0：表示無 、1：前付表示有 、2：後付表示有）
千万位：半径値にカンマを表示する（0：表示無 、1：表示有）
億位：半径値に少数点の「0」を表示する（0：表示無 、1：表示有）

・m_lnSunpou5
IHGFEDCBA (Decimal number)
A:A size value is made into a slanting character. (0:Normal 1:italic face )
B:A size value is made into a bold letter. (0:Normal 1:Bold)
C:Angular unit(0:Degree unit  1:5゜30'45" 2:Degree unit(With no display of ゜))
D:The digit number below the decimal point of an angular unit （0〜6）
E:Dimensional drawing form (The figure which the dimension line and the size value unified )(0:OFF 1:ON )
F:At the time of range selection :A dimensional drawing form is chosen with the attribute of line color and a kind. (0:OFF 1:ON )
G:Processing below a display decimal point (0:Rounding off 1:omit 2:round up )(Ver.4.02 or subsequent ones) 
一位　：寸法値を斜め文字にする（0：通常文字 、1：斜め文字）
十位　：寸法値を太文字にする（0：通常文字 、1：太文字）
百位　：角度単位（0：度単位 、1：度分秒単位 、2：度単位で「゜」の表示なし）
千位　：角度単位の少数点以下の桁数（0〜6）
万位　：寸法図形にする（0：寸法図形にしない 、1：寸法図形にする）
十万位：範囲選択のとき寸法図形を線色・種の属性で選択（0：選択しない 、1：選択する）
百万位：表示小数点以下の処理（0:四捨五入　1:切捨　2:切上）(Ver.4.02以降）

◆ ダミー
dummy
ar << (DWORD)dummy;

◆ 線描画の最大幅
The maximum of line weight (etc. 35 = 0.35mm)
「線幅を1/100mm単位とする」が設定されているときは「-101」
"Let line width be a 1/100-mm unit." = -101

ar<< (DWORD)m_nMaxDrawWid;

◆ プリンタ出力範囲の原点(X,Y)
The starting point of a printer output range (X, Y)

ar << (double)m_DPPrtGenten.x;
ar << (double)m_DPPrtGenten.y;

◆ プリンタ出力倍率
Printer output magnification ratio

ar << (double)m_dPrtBairitsu;

◆ プリンタ90°回転出力、プリンタ出力基準点位置
90-degree rotation printing 
BA(Decimal number)
A:90-degree rotation
B:Reference point(0:Nonappointed)(Ver.3.00 or subsequent ones) 
     7:top left      8:top center 9:top right
     4:middle left   5:           6:
     1:bottom left   2:           3:
●一位：プリンタ90°回転出力
●十位：プリンタ出力基準点位置の指定（0:無指定）（Ver.3.00以降）
 　  7:左上   8:中上  9:右上
  　 4:左中   5:中中  6:右中
   　1:左下   2:中下  3:右下

ar << (DWORD)m_nPrtSet;

◆ 目盛設定モード
Scale setting mode 
BA(Decimal number)
A:(0:Nonappointed 1:Scale display )
B:(0:Size-of-drawings specification  1:Absolute size specification )
Scale reading is impossible at the time of a minus value. 
● 一位(0：無指定、1：目盛表示)
● 十位(0：図面寸法指定、1：実寸指定)
● −値の時、目盛読取り不可

ar << (DWORD)m_nMemoriMode;

◆ 目盛表示最小間隔ドット
ar << (double)m_dMemoriHyoujiMin;

◆ 目盛表示間隔(X,Y)
Scale display interval (X, Y)

ar << (double)m_dMemoriX;
ar << (double)m_dMemoriY;

◆ 目盛基準点(X,Y)
Scale reference point (X, Y)

ar << (double)m_DpMemoriKijunTen.x;
ar << (double)m_DpMemoriKijunTen.y;

◆ レイヤ名
Layer name 

for(n=0; n<=15; n++){
    for(k=0; k<=15; k++){
        ar << (CString)m_aStrLayName[n][k];
    }
}

◆ レイヤグループ名
Layer group name 

for(n=0; n<=15; n++){
    ar << (CString)m_aStrGLayName[n];
}

◆ 日影計算の条件
The conditions of shadow calculation 
● 測定面高さ
Measuring plane height 
● 緯度
Latitude
● 9〜15の測定の指定
Specification of measurement (9-15 / 9:00 - 15:00)
● 壁面日影測定面高さ
Surface-of-a-wall shadow measuring plane height 

ar << (double)m_dKageLevel;     
ar << (double)m_dKageIdo;       
ar << (DWORD )m_nKage9_15JiFlg; 
ar << (double)m_dKabeKageLevel;

◆ 天空図の条件（Ver.3.00以降)
The conditions of a sky figure (Ver.3.00 or subsequent ones )
● 測定面高さ
Measuring plane height 
● 天空図の半径＊２
The radius of a sky figure * 2

ar<< (double)(m_dTenkuuZuLevel    );
ar<< (double)(m_dTenkuuZuEnkoR * 2);

◆ 2.5Dの計算単位(0以外はmm単位で計算)
Unit of account of 2.5D (Not 0 = mm)

ar << (DWORD)m_nMMTani3D;

◆ 保存時の画面倍率(読込むと前画面倍率になる)
Screen magnification at the time of saving(It reappears at the time of loading. )

ar << (double)m_dBairitsu ;
ar << (double)m_DPGenten.x;
ar << (double)m_DPGenten.y;

◆ 範囲記憶倍率と基準点(X,Y)
Range magnification and Reference point(X, Y)

ar << (double)m_dHanniBairitsu;
ar << (double)m_DPHanniGenten.x;
ar << (double)m_DPHanniGenten.y;

◆ マークジャンプ倍率、基準点(X,Y)およびレイヤグループ
Mark jump magnification , Reference point(X, Y) , Layer group 

if( nOldVersionSave >= 300 ){   //Ver.3.00以降(Ver.3.00 or subsequent ones )
    for( n=1; n<=8; n++){
        ar << (double)m_dZoomJumpBairitsu[n];
        ar << (double)m_DPZoomJumpGenten[ n].x;
        ar << (double)m_DPZoomJumpGenten[ n].y;
        ar << (DWORD )m_nZoomJumpGLay[    n];
    }
}else{
    for( n=1; n<=4; n++){
        ar << (double)m_dZoomJumpBairitsu[n];
        ar << (double)m_DPZoomJumpGenten[ n].x;
        ar << (double)m_DPZoomJumpGenten[ n].y;
    }
}

◆ 文字の描画状態(Ver.4.05以降）
Drawing of a character (Ver.4.05 or subsequent ones )

if( nOldVersionSave >= 300 ){   //Ver.3.00以降 (Ver.3.00 or subsequent ones )
    ar<< (double)(dDm11);   //ダミー dummy
    ar<< (double)(dDm12);   //ダミー dummy
    ar<< (double)(dDm13);   //ダミー dummy
    ar<< (DWORD )(lnDm1);   //ダミー dummy
    ar<< (double)(dDm21);   //ダミー dummy
    ar<< (double)(dDm22);   //ダミー dummy
    ar<< (double)(m_dMojiBG);//(Ver.4.04以前はダミー）(It is a dummy before Ver.4.04) 
                             //文字列範囲を背景色で描画するときの範囲増寸法
                             The character string range is drawn with a background color. -> Range increase size 

    ar<< (DWORD )(m_nMojiBG);//(Ver.4.04以前はダミー）(It is a dummy before Ver.4.04) 
                             //十位:文字（寸法図形、ブロック図形）を最後に描画
                               一位:1 :輪郭・範囲を背景色で描画しない
                                    2 :文字の輪郭を背景色で描画する
                                    3 :文字列範囲を背景色で描画する
                                  B:  A character (a dimensional drawing form, a block figure) is drawn at the end. 
                                  A: 1:An outline and the range are not drawn with a background color. 
                                     2:The outline of a character is drawn with a background color. 
                                     3:The character string range is drawn with a background color. 
}



◆ 複線間隔
Parallel lines interval 

for( n=0; n<=9; n++){
    ar << (double)m_adFukusenSuuchi[n];
}

◆ 両側複線の留線出の寸法
Both sides of Parallel lines / It surrounds in specification size. 

ar << (double)m_dRyoygawaFukusenTomeDe;

◆ 色番号ごとの画面表示色、線幅
Every color number : A display color, line weight 
● 画面表示色(0：背景色、1〜8：線色、9：グレー色)
A display color(0:Background color 1-8:Line Color 9:gray)
● 線幅(1〜16)
line weight : 1-16

for( n=0; n<=9; n++){
    ar  << (DWORD)m_aPenColor[n];
    ar  << (DWORD)m_anPenWidth[n];
}

◆ 色番号ごとのプリンタ出力色、線幅、実点半径
Every color number : Printer output color , line weight , Point radius 
● プリンタ出力色(0：背景色、1〜8：線色、9：グレー色)
Printer output color (0:Background color 1-8:Line Color 9:gray)
● 線幅(1〜500)
line weight (1-500)
● 実点半径(0.1〜10)
Point radius (0.1 - 10)

for( n=0; n<=9; n++){
    ar  << (DWORD )m_aPrtPenColor[n];
    ar  << (DWORD )m_anPrtPenWidth[n];
    ar  << (double)m_adPrtTenHankei[n];
}

◆ 線種番号2から9までのパターン、1ユニットのドット数、ピッチ、プリンタ出力ピッチ
Line type 2-9: Pattern, The number of dots of one unit , Pitch, Printer output pitch 

for( n=2; n<=9; n++){
    ar  << (DWORD)m_alLType[n];
    ar  << (DWORD)m_anTokushuSenUintDot[n];
    ar  << (DWORD)m_anTokushuSenPich[n];
    ar  << (DWORD)m_anPrtTokushuSenPich[n];
}

◆ ランダム線1から5までのパターン、画面表示振幅・ピッチ、プリンタ出力振幅・ピッチ
Random line 1-5: Pattern, Display amplitude , Pitch, Printer output amplitude , Pitch

for( n=11; n<=15; n++){
    ar  << (DWORD)m_alLType[n];
    ar  << (DWORD)m_anRandSenWide[n];
    ar  << (DWORD)m_anTokushuSenPich[n];
    ar  << (DWORD)m_anPrtRandSenWide[n];
    ar  << (DWORD)m_anPrtTokushuSenPich[n];
}

◆ 倍長線種番号6から9までのパターン、1ユニットのドット数、ピッチ、プリンタ出力ピッチ
Double length Line : Pattern, The number of dots of a unit ,Pitch, Printer output pitch 

for( n=16; n<=19; n++){
    ar  << (DWORD)m_alLType[n];
    ar  << (DWORD)m_anTokushuSenUintDot[n];
    ar  << (DWORD)m_anTokushuSenPich[n];
    ar  << (DWORD)m_anPrtTokushuSenPich[n];
}

◆ 実点を画面描画時の指定半径で描画
A point is drawn in the specification radius at the time of screen drawing. 

ar << (DWORD)m_nDrawGamenTen;

◆ 実点をプリンタ出力時、指定半径で書く
A point is written in a specification radius at the time of a printer output. 

ar << (DWORD)m_nDrawPrtTen ;

◆ BitMap・ソリッドを最初に描画する
Order of BitMap and solid drawing 
BA(Decimal Number)
ar << (DWORD)m_nBitMapFirstDraw;    //十位：ソリッド描画順
                                        //0:レイヤ順        (+1):色順
                                        //3:レイヤ逆順      (+2):色逆順
                                        //6:印刷出力設定順
                                    //B: Order of solid drawing 
                                        //0:The order of a layer (+1) The order of a Color
                                        //3:Reverse order of a layer (+2)Reverse order of a color
                                    //一位：
                                        //0:BitMap・ソリッドを最初に描画しない
                                        //1:BitMap・ソリッドを最初に描画
                                        //2:ソリッドを最初に描画
                                    //A: 
                                        //0:BitMap and solid drawing : Last
                                        //1:                         : First
                                        //2:solid drawing : First
                                    

◆ 逆描画
Reverse drawing 

ar << (DWORD)m_nGyakuDraw;

◆ 逆サーチ
Reverse search 

ar << (DWORD)m_nGyakuSearch;

◆ カラー印刷
Color printing

ar << (DWORD)m_nColorPrint;

◆ レイヤ順の印刷
Printing of the order of a layer 

ar << (DWORD)m_nLayJunPrint;

◆ 色番号順の印刷
Printing of numerical order of a color 

ar << (DWORD)m_nColJunPrint;

◆ レイヤグループまたはレイヤごとのプリンタ連続出力指定
Printer continuation output specification of "a layer group or a layer" 

ar << (DWORD)m_nPrtRenzoku;

◆ プリンタ共通レイヤ(表示のみレイヤ)のグレー出力指定
Gray output specification of a printer common layer (only a display layer) 

ar << (DWORD)m_nPrtKyoutsuuGray;

◆ プリンタ出力時に表示のみレイヤは出力しない
"The layer of only a display" does not output at the time of a printer output. 

ar << (DWORD)m_nPrtDispOnlyNonDraw;

◆ 作図時間（Ver.2.23以降）
Drawing time (Ver.2.23 or subsequent ones) 

ar << (DWORD)m_lnDrawTime;

◆ 2.5Dの始点位置が設定されている時のフラグ（Ver.2.23以降）
A flag when the starting point position of 2.5D is set up (Ver.2.23 or subsequent ones) 
CBA:(Decimal)
A: The set up flag of the viewpoint position of a perspective 
B: The set up flag of the viewpoint position of a bird's-eye view 
C: The set up flag of the viewpoint position of an isometric projection figure 
● 一位：透視図の視点位置設定済みフラグ
● 十位：鳥瞰図の視点位置設定済みフラグ
● 百位：アイソメ図の視点位置設定済みフラグ

ar << (DWORD)nEyeInit;

◆ 2.5Dの透視図・鳥瞰図・アイソメ図の視点水平角（Ver.2.23以降）
The viewpoint horizontal angle of the perspective, bird's-eye view,
and isometric projection figure of 2.5D (Ver.2.23 or subsequent ones) 

ar << (DWORD)(m_dEye_H_Ichi_1 * 100);
ar << (DWORD)(m_dEye_H_Ichi_2 * 100);
ar << (DWORD)(m_dEye_H_Ichi_3 * 100);

◆ 2.5Dの透視図の視点高さ・視点離れ（Ver.2.23以降）
Viewpoint height and viewpoint distance of the perspective of 2.5D (Ver.2.23 or subsequent ones) 

ar << (double)m_dEye_Z_Ichi_1;
ar << (double)m_dEye_Y_Ichi_1;

◆ 2.5Dの鳥瞰図の視点高さ・視点離れ（Ver.2.23以降）
Viewpoint height and viewpoint distance of the bird's-eye view of 2.5D (Ver.2.23 or subsequent ones) 

ar << (double)m_dEye_Z_Ichi_2;
ar << (double)m_dEye_Y_Ichi_2;

◆ 2.5Dのアイソメ図の視点垂直角（Ver.2.23以降）
The viewpoint perpendicular angle of the isometric projection figure of 2.5D (Ver.2.23 or subsequent ones) 

ar << (double)m_dEye_V_Ichi_3;

◆ 線の長さ指定の最終値（Ver.2.25以降）
The last value of the length specification of a line (Ver.2.25 or subsequent ones )

ar << (double)m_dSenNagasaSnpou;

◆ 矩形寸法横寸法・縦寸法指定の最終値（Ver.2.25以降）
The last value of a rectangle size horizontal size and vertical size specification (Ver.2.25 or subsequent ones) 

ar << (double)m_dBoxSunpouX;
ar << (double)m_dBoxSunpouY;

◆ 円の半径指定の最終値（Ver.2.25以降）
The last value of radius specification of a circle (Ver.2.25 or subsequent ones) 

ar << (double)m_dEnHankeiSnpou ;

◆ ソリッドを任意色で書くフラグ、ソリッドの任意色の既定値（Ver.2.30以降）
The flag which draws solid in an arbitrary color ,
The default of a solid arbitrary color (Ver.2.30 or subsequent ones) 

ar << (DWORD)pGamen->m_nSolidNinniColor; 
ar << (DWORD)pGamen->m_SolidColor;   //RGB

◆ SXF対応拡張線色定義（Ver.4.20以降）
The extended line color definition corresponding to SXF (Ver.4.20 or subsequent ones)
● 画面表示色
● 画面表示線幅
● 線色名
● プリンタ出力色
● プリンタ出力線幅
● 点半径
Display color 
Display line width 
line color name 
Printer output color 
Printer output line width 
Point radius 

for( n=0; n<=256; n++){ //////   画面表示色
    n1 = n+SXCOL_EXT;   //色番号のオフセット = +100
    ar  << (DWORD)m_aPenColor[n1]
        << (DWORD)m_anPenWidth[n1];
}
for( n=0; n<=256; n++){ //////   プリンタ出力色
    ar  << (CString)m_astrUDColorName[n];
    n1 = n+SXCOL_EXT;   //色番号のオフセット = +100
    ar  << (DWORD  )m_aPrtPenColor[n1]
        << (DWORD  )m_anPrtPenWidth[n1]
        << (double )m_adPrtTenHankei[n1] ;
}

◆ SXF対応拡張線種定義（Ver.4.20以降）
The extended line kind definition corresponding to SXF (Ver.4.20 or subsequent ones) 
● パターン
● 1ユニットのドット数
● ピッチ
● プリンタ出力ピッチ
● 線種名
● セグメント数
● ピッチ線分の長さ、空白長さの繰り返し
Pattern
The number of dots of one unit 
Pitch
Printer output pitch 
Line species name 
The number of segments 
The length for a pitch line, blank length (Array)

for( n=0; n<=32; n++){   //////  線種パターン
    n1 = n+SXLTP_EXT;   //線種番号のオフセット = +30
    ar  << (DWORD)m_alLType[n1]
        << (DWORD)m_anTokushuSenUintDot[n1]
        << (DWORD)m_anTokushuSenPich[n1]
        << (DWORD)m_anPrtTokushuSenPich[n1];
}           
for( n=0; n<=32; n++){   //////  線種パラメータ
    ar  << (CString)m_astrUDLTypeName[n]                
        << (DWORD  )m_anUDLTypeSegment[n];  
    for(j=1; j<=10; j++){
        ar  << (double)m_aadUDLTypePitch[n][j]; 
    }
}

◆ 文字種1から10までの文字幅、高さ、間隔、色番号
Up to the character kinds 1-10 :A character width, height, an interval, a color number 

for(i=1; i<=10; i++){
    ar  << (double)m_adMojiX[i] << (double)m_adMojiY[i];
    ar  << (double)m_adMojiD[i] << (DWORD)m_anMojiCol[i];
}

◆ 書込み文字の文字幅、高さ、間隔、色番号、文字番号
A write-in character :A character width, height, an interval, a color number, a character number 

ar << (double)m_dMojiSizeX << (double)m_dMojiSizeY;
ar << (double)m_dMojiKankaku;
ar << (DWORD)m_nMojiColor << (DWORD)m_nMojiShu;

◆ 文字位置整理の行間、文字数
Character position arrangement :Spacing, the number of characters 

ar << (double)m_dMojiSeiriGyouKan << (double)m_dMojiSeiriSuu;

◆ 文字基準点のずれ位置使用のフラグ
Character reference point :The flag of gap position use 

ar << (DWORD)m_nMojiKijunZureOn;

◆ 文字基準点の横方向のずれ位置左、中、右
Character reference point :The gap position of a transverse direction :The left, middle, the right 

ar << (double)m_adMojiKijunZureX[0];
ar << (double)m_adMojiKijunZureX[1];
ar << (double)m_adMojiKijunZureX[2];

◆ 文字基準点の縦方向のずれ位置下、中、上
Character reference point :The gap position of a lengthwise direction :The bottom, middle, top 

ar << (double)m_adMojiKijunZureY[0];
ar << (double)m_adMojiKijunZureY[1];
ar << (double)m_adMojiKijunZureY[2];

◆ 図形データのリストの実体
entity of the list of graphic data 

m_DataList.Serialize(ar);

◆ ブロックデータの定義部のリスト
The list of definition divisions of block data 

m_DataListList.Serialize(ar);





図形データリスト、ブロックデータ定義部リスト、ドキュメントクラスの宣言は以下のとおり。

class CMiniDoc : public CDocument
{
・
・
・
    public:

    CTypedPtrList<CObList,CData*>   m_DataList;    //図形データのリスト
    CTypedPtrList<CObList,CDataList*>m_DataListList;  //ブロックデータ定義部のリスト
・
・
・
};

ブロックデータ定義部リストのクラスの宣言は以下のとおり。

class CDataList : public CData{
・
・
・
    public:
    INT m_nNumber;      //通しNo
    BOOL m_bReffered;   //実際に参照されているか
    CTime m_time;       //作成された時刻を入れる
    CString m_strName;  //ブロックデータの名前

    CTypedPtrList<CObList,CData*>m_DataList;
・
・
・
};

その他の各種図形データクラスは、CDataから派生している。
宣言は省略する。

◆ 各種データクラスシリアライズ関数
各種データクラスのシリアライズ関数は以下のとおり。ただし、出力部分のみを示す。
● 図形データ

図形データの基底クラス
void CData::Serialize(CArchive& ar) {
    if (ar.IsStoring()) {
        ar << (DWORD)m_lGroup;      //曲線属性番号
        ar << (BYTE )m_nPenStyle;   //線種番号
        ar << (WORD )m_nPenColor;   //線色番号
        if( nOldVersionSave >= 351 ){   //Ver.3.51以降
            ar << (WORD )m_nPenWidth;//線色幅
        }
        ar << (WORD )m_nLayer;      //レイヤ番号
        ar << (WORD )m_nGLayer;     //レイヤグループ番号
        ar << (WORD )m_sFlg;        //属性フラグ
    }
}

● 線データ
　　●   曲線属性番号
　　●   線種番号
　　●   線色番号
　　●   線幅
　　●   レイヤ番号
　　●   レイヤグループ番号
　　●   属性フラグ
　　●   始点X座標、Y座標
　　●   終点X座標、Y座標

void CDataSen::Serialize(CArchive& ar)
{
    CData::Serialize(ar);
    if (ar.IsStoring()) {
        ar << (double)m_start.x << (double)m_start.x 
           << (double)m_end.x << (double)m_end.y;
    }
}

● 円弧データ
　　●   曲線属性番号
　　●   線種番号
　　●   線色番号
　　●   線幅
　　●   レイヤ番号
　　●   レイヤグループ番号
　　●   属性フラグ
　　●   中心点X座標、Y座標
　　●   半径
　　●   開始角
　　●   円弧角
　　●   傾き角
　　●   扁平率
　　●   全円フラグ

void CDataEnko::Serialize(CArchive& ar)
{
    CData::Serialize(ar);
    if (ar.IsStoring()) {
        double startX = m_start.x;
        double startY = m_start.y;
        ar << (double)m_start.x<< (double)m_start.y
        << (double)m_dHankei
        << (double)m_radKaishiKaku
        << (double)m_radEnkoKaku
        << (double)m_radKatamukiKaku
        << (double)m_dHenpeiRitsu
        << (DWORD )m_bZenEnFlg;
    }
}

● 点データ
　　●   曲線属性番号
　　●   ダミー
　　●   点色番号
　　●   線幅
　　●   レイヤ番号
　　●   レイヤグループ番号
　　●   属性フラグ
　　●   点X座標、Y座標
　　●   仮点フラグ
　　●   m_nPenStyleが「100」のとき点コード（矢印・ポイントマーカー）、表示角、表示倍率

void CDataTen::Serialize(CArchive& ar)
{
    if (ar.IsStoring()) {
        m_nPenStyle = 1;
        if( nOldVersionSave >= 252 ){   //Ver.2.52以降
            if( 0 != m_nCode ){ m_nPenStyle = 100; }
        }
    }
    CData::Serialize(ar);
    if (ar.IsStoring()) {
        ar << (double)m_start.x << (double)m_start.y;
        ar << (DWORD)m_bKariten;
        if( 100 == m_nPenStyle ){
            ar << (DWORD )m_nCode;
            ar << (double)m_radKaitenKaku;
            ar << (double)m_dBairitsu;
        }
    }
}

● 文字データ
　　●   曲線属性番号
　　●   基点位置
　　●   文字色番号
　　●   寸法値設定のフラグ
　　●   レイヤ番号
　　●   レイヤグループ番号
　　●   属性フラグ
　　●   始点X座標、Y座標
　　●   終点X座標、Y座標
　　●   文字種(斜体文字は20000、ボールド体は10000を加えた数値)
　　●   文字サイズ横、縦、文字間隔
　　●   角度
　　●   フォント名
　　●   文字列

void CDataMoji::Serialize(CArchive& ar)
{
    if (ar.IsStoring()) {
        m_nPenWidth = m_nSunpouFlg; //  (寸法値設定のフラグ)
        CData::Serialize(ar);
        m_nPenWidth = 1;            //文字枠幅を1
        if( m_sMojiFlg & 0x0001 ){ m_nMojiShu += 10000; }  //斜体文字
        if( m_sMojiFlg & 0x0010 ){ m_nMojiShu += 20000; }  //ボールド
        ar << (double)m_start.x << (double)m_start.y 
           << (double)m_end.x << (double)m_end.y
           << (DWORD)m_nMojiShu
           << (double)m_dSizeX << (double)m_dSizeY
           << (double)m_dKankaku
           << (double)m_degKakudo
           << (CString)m_strFontName
           << (CString)m_string ;
        m_nMojiShu = (m_nMojiShu % 10000);
    }
}

「寸法値設定のフラグ」は次のようになる
---------------------------------------------
    0x0002  寸法の文字設定有のフラグ
    0x0008  全角文字
    0x0010  寸法単位
    0x0020  寸法単位追加
    0x0040  ３桁毎のカンマ表示
    0x0080  少数点以下の０表示
    0x0100  少数桁以下  切捨（切捨、切上指定以外は四捨五入）
    0x0200  少数桁以下  切上
    0x0400  "φ" 、"R"  前付
    0x0800  "φ" 、"R"  後付
    0x1000  少数点以下の桁数 1
    0x2000  少数点以下の桁数 2
    0x3000  少数点以下の桁数 3
---------------------------------------------

● 寸法データ
　　●   ダミー
　　●   ダミー
　　●   ダミー
　　●   ダミー
　　●   レイヤ番号
　　●   レイヤグループ番号
　　●   属性フラグ
　　●   線メンバ
　　●   文字メンバ
　　●   SXFのモード
　　●   補助線1,2、矢印（点)1,2、基準点1,2

void CDataSunpou::Serialize(CArchive& ar)
{
    CData::Serialize(ar);
    if (ar.IsStoring()) {
        m_Sen .Serialize(ar);
        m_Moji.Serialize(ar);
        if( theApp.m_nOldVersionSave >= 420 ){  //Ver.4.20以降
            ar << (WORD )m_bSxfMode;
            m_SenHo1 .Serialize(ar);
            m_SenHo2 .Serialize(ar);
            m_Ten1   .Serialize(ar);
            m_Ten2   .Serialize(ar);
            m_TenHo1 .Serialize(ar);
            m_TenHo2 .Serialize(ar);
        }
    }
}

● ソリッドデータ
　　●   ダミー
　　●   ダミー
　　●   ダミー
　　●   色番号
　　●   レイヤ番号
　　●   レイヤグループ番号
　　●   属性フラグ
　　●   第1点X座標、Y座標
　　●   第4点4座標、Y座標
　　●   第2点X座標、Y座標
　　●   第3点X座標、Y座標
　　●   塗潰し色のRGB値(任意色の場合のみ)

void CDataSolid::Serialize(CArchive& ar)
{
    CData::Serialize(ar);
    if (ar.IsStoring()) {
        ar << (double)m_start.x << (double)m_start.y 
           << (double)m_end.x << (double)m_end.y
           << (double)m_DPoint2.x << (double)m_DPoint2.y
           << (double)m_DPoint3.x << (double)m_DPoint3.y;
        if( 10 == m_nPenColor ){
           ar << (DWORD)m_Color;//RGB
        }
    }
}

● 円のソリッド
CDataSolidを流用し、m_nPenStyleが「101」以上のものを円のソリッドとして扱う。変数の対応は以下のとおり。

m_start     = pEnko->m_start;           //中心
m_end.x     = pEnko->GetHankei();       //半径
m_end.y     = pEnko->GetHenpeiRitsu();  //扁平率
m_DPoint2.x = pEnko->GetKatamukiKaku(); //傾き角
m_DPoint2.y = pEnko->GetKaishiKaku();   //開始角
m_DPoint3.x = pEnko->GetEnkoKaku();     //円弧角
m_DPoint3.y = 0;                        //扇形、全円等の指定

・円ソリッド
m_nPenStyle = (101)    --------円ソリッドの指定
m_DPoint3.y = ( -1)    --------外側円弧ソリッド
m_DPoint3.y = (  0)    --------扇形ソリッド
m_DPoint3.y = (  5)    --------弓形ソリッド
m_DPoint3.y = (100)    --------全円ソリッド
（外側円弧ソリッドの円弧角は「PAI/2」以下）
・円環ソリッド
m_nPenStyle = (105)    --------円環ソリッド「1」の指定
m_nPenStyle = (106)    --------円環ソリッド「2」の指定
m_DPoint3.y = (内側の円半径)
（円弧 と 全円 の違いのフラグ無し、円弧角のみでの違い）
（円環ソリッド「2」は楕円のとき、外円と内円の差が長軸と短軸で同じになる）
・円周ソリッド
m_nPenStyle = (111)    --------円周ソリッドの指定
m_DPoint3.y = (  0)    --------円弧
m_DPoint3.y = (100)    --------全円


● ブロックデータ
　　●   ダミー
　　●   ダミー
　　●   ダミー
　　●   ダミー
　　●   レイヤ番号
　　●   レイヤグループ番号
　　●   属性フラグ
　　●   基準点X座標、Y座標
　　●   X方向の倍率
　　●   Y方向の倍率
　　●   回転角
　　●   ブロック定義データの通し番号

void CDataBlock::Serialize(CArchive& ar)
{
    CData::Serialize(ar);
    if (ar.IsStoring()) {
        ar <<(double)m_DPKijunTen.x <<(double)m_DPKijunTen.y
           <<(double)m_dBairitsuX
           <<(double)m_dBairitsuY
           <<(double)m_radKaitenKaku
           <<(DWORD)m_pDataList->m_nNumber;//ポインタでなく通し番号を保存する
    }
}

● ブロック定義データ
　　●   ダミー
　　●   ダミー
　　●   ダミー
　　●   ダミー
　　●   レイヤ番号
　　●   レイヤグループ番号
　　●   属性フラグ
　　●   定義データの通し番号
　　●   参照されているかのフラグ
　　●   定義された時間
　　●   定義データの名前
　　●   定義データの実体のリスト

void CDataList::Serialize(CArchive& ar)
{
    CData::Serialize(ar);
    if (ar.IsStoring()) {
        ar <<(DWORD)m_nNumber
           <<(DWORD)m_bReffered
           <<m_time;
        ar <<m_strName; //Ver.4.10 以降、名前の後ろに
                        //"@@SfigorgFlag@@"に続けて、複合図形種別フラグを付加
                        //1:部分図(数学座標系)、2: 部分図(測地座標系)、
                        //3:作図グループ、4:作図部品
        }
    m_DataList.Serialize(ar);
}


●属性フラグは各ビットごとに次の意味を持つ

データ    線      円      実点    文字          ブロック    寸法     ソリッド
ビット          
(0x0010)          図形    図形    寸法値
(0x0020)ハッチ    ハッチ  ハッチ  縦字                               ハッチ
(0x0040)          寸法    寸法    真北
(0x0080)          建具    建具    日影
(0x0100)                          半径寸法値
(0x0200)                          直径寸法値
(0x0400)                          角度寸法値
(0x0800)図形                      図形属性選択   図形 
(0x1000)建具                      累計寸法値     建具 
(0x2000)寸法                      建具           寸法      寸法
(0x4000)                          寸法
(0x8000)包絡処理対象外の建具      2.5D
