CRwGRDoc Class Reference

#include <RwGRDoc.h>

Inheritance diagram for CRwGRDoc:
Inheritance graph
[legend]
Collaboration diagram for CRwGRDoc:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual BOOL ReadDataFile (LPCTSTR str)
virtual BOOL MakeViewData ()
virtual CmnHead TranslateData ()
virtual void Serialize (CArchive &ar)
virtual ~CRwGRDoc ()
virtual void AssertValid () const
virtual void Dump (CDumpContext &dc) const

Protected Member Functions

 CRwGRDoc ()

Detailed Description

Definition at line 30 of file RwGRDoc.h.


Constructor & Destructor Documentation

CRwGRDoc (  )  [protected]

Definition at line 28 of file RwGRDoc.cpp.

00029 {
00030 //  multiSliceData = FALSE;
00031 //  nonCmnHead     = FALSE;
00032 }

~CRwGRDoc (  )  [virtual]

Definition at line 36 of file RwGRDoc.cpp.

00037 {
00038 }


Member Function Documentation

void AssertValid (  )  const [virtual]

Reimplemented from CExDocument.

Reimplemented in CvThumbNailDoc.

Definition at line 55 of file RwGRDoc.cpp.

00056 {
00057     CExDocument::AssertValid();
00058 }

void Dump ( CDumpContext &  dc  )  const [virtual]

Reimplemented from CExDocument.

Reimplemented in CvThumbNailDoc.

Definition at line 62 of file RwGRDoc.cpp.

00063 {
00064     CExDocument::Dump(dc);
00065 }

BOOL MakeViewData (  )  [virtual]

Reimplemented from CExDocument.

Definition at line 232 of file RwGRDoc.cpp.

References CExFrame::cancelOperation, CExDocument::cmnHead, CExFrame::doneErrorMessage, IDD_PROGBAR, IDS_STR_CANCEL, IDS_STR_CANCEL_TRNS_DATA, IDS_STR_ERR_MEMORY, IDS_STR_ERR_UNKWN, IDS_STR_ERROR, IDS_STR_TRNS_DISPDATA, CExDocument::msGraph, CExDocument::pFrame, CProgressBarDLG::Start(), CProgressBarDLG::Stop(), CRwGRDoc::TranslateData(), and jbxwl::ts2mbs().

00233 {
00234     CString mesg, noti;
00235 
00236     // カウンタの設定
00237     CProgressBarDLG* counter = NULL;
00238     if (msGraph.zs > 10) { 
00239         //counter = new CProgressBarDLG(IDD_PROGBAR, NULL, NULL, FALSE);
00240         counter = new CProgressBarDLG(IDD_PROGBAR, NULL, TRUE); // ディスパッチャー有効
00241         if (counter!=NULL) {
00242             mesg.LoadString(IDS_STR_TRNS_DISPDATA);
00243             SetGlobalCounter(counter);
00244             char* mbstr = ts2mbs(mesg);
00245             counter->Start(0, mbstr);
00246             ::free(mbstr);
00247         }
00248     }
00249 
00250     // データ変換
00251     cmnHead = TranslateData();
00252 
00253     // カウンタの停止と削除
00254     if (counter!=NULL) {
00255         counter->Stop();
00256         ClearGlobalCounter();
00257         delete counter;
00258     }
00259 
00260     // エラー処理
00261     if (cmnHead.kind==HEADER_NONE) {
00262         if (cmnHead.xsize==JBXL_GRAPH_MEMORY_ERROR) {
00263             mesg.LoadString(IDS_STR_ERR_MEMORY);
00264             noti.LoadString(IDS_STR_ERROR);
00265             MessageBox(pFrame->m_hWnd, _T("CRwGRDoc::MakeViewData():\n\n") + mesg, noti, MB_OK); 
00266         }
00267         else if (cmnHead.xsize==JBXL_GRAPH_CANCEL) {
00268             mesg.LoadString(IDS_STR_CANCEL_TRNS_DATA);
00269             noti.LoadString(IDS_STR_CANCEL);
00270             MessageBox(pFrame->m_hWnd, _T("CRwGRDoc::MakeViewData():\n\n") + mesg, noti,  MB_OK);
00271             pFrame->cancelOperation = TRUE;
00272         }
00273         else {
00274             mesg.LoadString(IDS_STR_ERR_UNKWN);
00275             noti.LoadString(IDS_STR_ERROR);
00276             MessageBox(pFrame->m_hWnd, _T("CRwGRDoc::MakeViewData():\n\n") + mesg, noti,  MB_OK);
00277         }
00278         pFrame->doneErrorMessage = TRUE;
00279         return FALSE;
00280     }
00281 
00282     return  TRUE;
00283 }

Here is the call graph for this function:

BOOL ReadDataFile ( LPCTSTR  str  )  [virtual]

機能: 画像データを読み込む. 引数: ファイル名 戻値: TRUE: 成功,FALSE: 失敗 説明: 読み込んだグラフィックデータ(msGraphメンバ)

Reimplemented from CExDocument.

Definition at line 92 of file RwGRDoc.cpp.

References CExFrame::cancelOperation, CExDocument::colorMode, CExFrame::doneErrorMessage, CExDocument::endNo, CReadFilesDLG::fName, CReadFilesDLG::fromNum, jbxwl::get_file_name_t(), CSetHeaderDLG::getCmnHead(), IDD_PROGBAR, IDS_STR_CANCEL, IDS_STR_CANCEL_OPNFILE, IDS_STR_CNFRM_CNTNUE, IDS_STR_ERR_MEMORY, IDS_STR_ERR_OPEN_FILE, IDS_STR_ERR_UNKWN, IDS_STR_ERROR, IDS_STR_RDNG_FILE, CExDocument::infHead, jbxwl::mbs2ts(), CExDocument::msGraph, CExDocument::multiSliceData, jbxwl::numbering_name_t(), CExDocument::pFrame, jbxwl::SetHeaderDLG, CProgressBarDLG::Start(), CExDocument::startNo, CProgressBarDLG::Stop(), CExDocument::Title, CReadFilesDLG::toNum, and jbxwl::ts2mbs().

00093 {
00094     CString message = _T("");
00095     CString fnm = get_file_name_t(fname);   // ファイル名のみ
00096     CString err_fname = _T("");                     // エラーを起こしたファイル名
00097     CmnHead hd;
00098 
00099     // グローバルカウンタの設定
00100     CProgressBarDLG* counter = NULL;
00101     counter = new CProgressBarDLG(IDD_PROGBAR, NULL, TRUE); // ディスパッチャー有効
00102     if (counter!=NULL) { 
00103         SetGlobalCounter(counter);
00104     }
00105 
00106     init_CmnHead(&hd);
00107 
00108     // マルチスライス読み込み
00109     if (multiSliceData) {
00110         // ファイル読み込み設定
00111         CReadFilesDLG* rsdlg = new CReadFilesDLG(fnm);
00112         if (rsdlg==NULL) return FALSE;
00113         if (rsdlg->DoModal()!=IDOK) {   // キャンセルボタン
00114             pFrame->cancelOperation  = TRUE;
00115             pFrame->doneErrorMessage = TRUE;
00116             delete (rsdlg);
00117             return FALSE;
00118         }
00119         startNo = rsdlg->fromNum;
00120         endNo   = rsdlg->toNum;
00121         CString mfname = rsdlg->fName;
00122         delete (rsdlg);
00123             
00124         if (counter!=NULL) {
00125             CString mesg;
00126             mesg.LoadString(IDS_STR_RDNG_FILE);
00127             char* mbstr = ts2mbs(mesg);
00128             counter->Start(0, mbstr);
00129             ::free(mbstr);
00130         }
00131 
00132         Title = mfname;
00133         char* fname_str = ts2mbs(mfname);
00134 
00135         // データの読み込み
00136         hd = SetHeaderDLG.getCmnHead();
00137 
00138         DEBUG_INFO("CRwGRDoc::ReadDataFile(): Multi Slice: file = %s, start = %d, end = %d\n", fname_str, startNo, endNo);
00139         msGraph = readGraphicSlices<sWord>(fname_str, startNo, endNo, &hd, true);
00140         
00141         if (msGraph.state>=0 && msGraph.state!=Xabs(endNo-startNo)+1) {
00142             char* numf = numbering_name(fname_str, startNo+msGraph.state-1+Sign(endNo-startNo));
00143             err_fname = mbs2ts(numf);
00144             ::free(numf);
00145             
00146             CString mesg, noti;
00147             noti.LoadString(IDS_STR_CNFRM_CNTNUE);
00148             mesg.LoadString(IDS_STR_ERR_OPEN_FILE);
00149             message = _T("CRwGRDoc::ReadDataFile():\n\n") + mesg + _T("  ") + err_fname;
00150             MessageBox(pFrame->m_hWnd, message, noti, MB_OK);
00151         }
00152         if (msGraph.state>0) msGraph.state = 0;
00153 
00154         if (msGraph.isNull() && msGraph.state==JBXL_GRAPH_HEADER_ERROR) {
00155             err_fname = numbering_name_t(mfname, msGraph.zs);
00156         }
00157 
00158         ::free(fname_str);
00159     }
00160 
00161     //  通常の読み込み.    
00162     else {
00163         CString mesg;
00164         mesg.LoadString(IDS_STR_RDNG_FILE);
00165         char* mbstr = ts2mbs(mesg);
00166         if (counter!=NULL) counter->Start(0, mbstr);
00167         ::free(mbstr);
00168         Title = fnm;
00169         hd = SetHeaderDLG.getCmnHead();
00170 
00171         char* fname_str = ts2mbs(fname);
00172         msGraph = readGraphicFile<sWord>(fname_str, &hd, true);
00173         ::free(fname_str);
00174     }
00175 
00176     //
00177     this->infHead   = getinfo_CmnHead(hd);
00178     this->colorMode = msGraph.color;
00179     free_CmnHead(&hd);
00180 
00181     // グローバルカウンタの削除
00182     if (counter!=NULL) {
00183         counter->Stop();
00184         ClearGlobalCounter();
00185         delete counter;
00186     }
00187 
00188     // エラー処理
00189     if (msGraph.isNull()) {
00190         CString mesg, noti;
00191 
00192         if (msGraph.state==JBXL_GRAPH_OPFILE_ERROR) {
00193             mesg.LoadString(IDS_STR_ERR_OPEN_FILE);
00194             noti.LoadString(IDS_STR_ERROR);
00195             if (multiSliceData) {
00196                 message = _T("CRwGRDoc::ReadDataFile():\n\n") + mesg + _T("  ") + err_fname;
00197                 MessageBox(pFrame->m_hWnd, message, noti, MB_OK);
00198             }
00199             else {
00200                 MessageBox(pFrame->m_hWnd, _T("CRwGRDoc::ReadDataFile():\n\n") + mesg, noti, MB_OK);
00201             }
00202         }
00203         else if (msGraph.state==JBXL_GRAPH_MEMORY_ERROR) {
00204             mesg.LoadString(IDS_STR_ERR_MEMORY);
00205             noti.LoadString(IDS_STR_ERROR);
00206             MessageBox(pFrame->m_hWnd, _T("CRwGRDoc::ReadDataFile():\n\n") + mesg, noti,  MB_OK);
00207         }
00208         else if (msGraph.state==JBXL_GRAPH_CANCEL) {
00209             mesg.LoadString(IDS_STR_CANCEL_OPNFILE);
00210             noti.LoadString(IDS_STR_CANCEL);
00211             MessageBox(pFrame->m_hWnd, _T("CRwGRDoc::ReadDataFile():\n\n") + mesg, noti,  MB_OK);
00212             pFrame->cancelOperation = TRUE;
00213         }
00214         else {
00215             mesg.LoadString(IDS_STR_ERR_UNKWN);
00216             noti.LoadString(IDS_STR_ERROR);
00217             MessageBox(pFrame->m_hWnd, _T("CRwGRDoc::ReadDataFile():\n\n") + mesg, noti, MB_OK);
00218         }
00219         pFrame->doneErrorMessage = TRUE;
00220 
00221         return FALSE;
00222     }
00223 
00224     return  TRUE;
00225 }

Here is the call graph for this function:

void Serialize ( CArchive &  ar  )  [virtual]

Reimplemented from CExDocument.

Reimplemented in CvThumbNailDoc.

Definition at line 74 of file RwGRDoc.cpp.

00075 {
00076     if (ar.IsStoring())
00077     {
00078         // TODO: この位置に保存用のコードを追加してください
00079     }
00080     else
00081     {
00082         // TODO: この位置に読み込み用のコードを追加してください
00083     }
00084 }

CmnHead TranslateData (  )  [virtual]

Reimplemented in CvThumbNailDoc.

Definition at line 287 of file RwGRDoc.cpp.

References CExDocument::base, CExDocument::cMax, CExDocument::cMin, CExDocument::ctrlCntrst, CExDocument::msGraph, VIEW_8_MAX, CExDocument::vMax, and CExDocument::vMin.

Referenced by CRwGRDoc::MakeViewData().

00288 {
00289     CmnHead chd;
00290 
00291     int mode = 0;
00292     if (msGraph.color==GRAPH_COLOR_MONO || msGraph.color==GRAPH_COLOR_MONO16 ||  // 表示は 8bit
00293         msGraph.color==GRAPH_COLOR_RGB  || msGraph.color==GRAPH_COLOR_BGR  || 
00294         msGraph.color==GRAPH_COLOR_XRGB || msGraph.color==GRAPH_COLOR_ARGB || msGraph.color==GRAPH_COLOR_RGBA ||
00295         msGraph.color==GRAPH_COLOR_XBGR || msGraph.color==GRAPH_COLOR_ABGR || msGraph.color==GRAPH_COLOR_BGRA) {
00296         // 8bit/pixcel
00297         mode = MG2CH_OCTET;
00298     }
00299     if (ctrlCntrst || msGraph.color==GRAPH_COLOR_MONO16) {
00300         mode |= MG2CH_CONTRAST;
00301     }
00302     //
00303     chd = copyMSGraph2CmnHead(msGraph, mode, true); // msGraphは参照渡し
00304     //
00305     cMax = vMax = msGraph.max;
00306     cMin = vMin = msGraph.min;
00307 
00308     if (msGraph.color==GRAPH_COLOR_RGB16 || msGraph.color==GRAPH_COLOR_ARGB16 
00309                                          || msGraph.color==GRAPH_COLOR_RGBA16) {
00310         // 16bit/pixcel
00311         //vMax = cMax = UWORDMAX;
00312         //vMin = cMin = 0;
00313     }
00314     else if (!ctrlCntrst && cMin>=0 && cMax<=VIEW_8_MAX) {
00315         vMax = cMax = VIEW_8_MAX;
00316         vMin = cMin = 0;
00317     }
00318 
00319     base = msGraph.base;
00320     
00321     return chd;
00322 }

Here is the caller graph for this function:


The documentation for this class was generated from the following files:

Generated on 15 Nov 2023 for JunkBox_Win_Lib by  doxygen 1.6.1