Processfile3.cpp
上传用户:hell82222
上传日期:2013-12-19
资源大小:1872k
文件大小:5k
- #include "stdafx.h"
- #include "FileSwitch.h"
- #include "DwgReader.h"
- #include "KmSection.h"
- #include "Reader.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- extern CStdioFile g_CensorialFile; //监察转换进度的文件
- extern int g_mode;
- BOOL CDwgReader::processobject_mlinestyle(AD_DB_HANDLE dwghandle)
- {
- CMatch4* match=new CMatch4;
- match->m_showmiter=adob->mlstyle.flag&AD_MLSTYLE_FILL_ON;
- match->m_startinner=adob->mlstyle.flag&AD_MLSTYLE_START_INNER_ARC;
- match->m_startline=adob->mlstyle.flag&AD_MLSTYLE_START_SQUARE;
- match->m_startouter=adob->mlstyle.flag&AD_MLSTYLE_START_ROUND;
- match->m_endinner=adob->mlstyle.flag&AD_MLSTYLE_END_INNER_ARC;
- match->m_endline=adob->mlstyle.flag&AD_MLSTYLE_END_SQUARE;
- match->m_endouter=adob->mlstyle.flag&AD_MLSTYLE_END_ROUND;
- match->m_showmiter=adob->mlstyle.flag&AD_MLSTYLE_SHOW_MITERS;
-
- PAD_BLOB_CTRL bcptr;
- //PAD_BLOB_CTRL adStartBlobRead (AD_VMADDR blob);
- bcptr=adStartBlobRead(adob->mlstyle.seginfoblob);
- AD_MLSTYLESEGINFO seginfo;
- for(unsigned short i=0;i<adob->mlstyle.linesinstyle;i++)
- {
- //short adReadMlstyleSeginfo (PAD_BLOB_CTRL bcptr, PAD_MLSTYLESEGINFO seginfo);
- sReturnValue=adReadMlstyleSeginfo(bcptr,&seginfo);
- if(sReturnValue!=1)
- {
- delete match;
- _ERROR;
- return FALSE;
- }
- int icolor;
- try
- {
- if(seginfo.segcolor==AD_COLOR_BYBLOCK)
- {
- icolor=COLOR_BYBLOCK;//随块
- }
- else if(seginfo.segcolor==AD_COLOR_BYLAYER)
- {
- icolor=COLOR_BYLAYER;
- }
- else
- {
- if(seginfo.segcolor>=0 && seginfo.segcolor<m_aColor.GetSize())
- {
- icolor=m_aColor[seginfo.segcolor];
- }
- else
- {
- TRACE("errordata");
- }
- }
- }
- catch(...)
- {
- _WRITE(str="非法的颜色码");
- return FALSE;
- }
- match->segcolor.Add(icolor);
- if(seginfo.ltindex==0x7fff)//随层
- {
- match->segltyle.Add(LTYPE_BYLAYER);
- }
- else if(seginfo.ltindex==0x7ffe)//随块
- {
- match->segltyle.Add(LTYPE_BYBLOCK);
- }
- else
- {
- match->segltyle.Add(m_altype.Get(seginfo.ltindex));
- }
- }
- //short adEndBlobRead (PAD_BLOB_CTRL bcptr);
- sReturnValue=adEndBlobRead(bcptr);
- if(sReturnValue!=1)
- {
- delete match;
- _ERROR;
- return FALSE;
- }
- m_amltype.Add(adobhd->objhandle,match);
- return TRUE;
- }
- BOOL CDwgReader::processobject_layout(AD_DB_HANDLE dwghandle)
- {
- /*
- 页面设置对话框的数据
- typedef struct adplotsettingsobjstru {
- char pagesetupname[AD_MAX_STRLEN]; //页面设置名
- char printerorconfigfilename[AD_MAX_STRLEN]; //打印机配置名称
- char papersize[AD_MAX_STRLEN]; //图纸尺寸
- char plotviewname[AD_MAX_STRLEN]; //打印区域-视图名称
- double leftmargin;bottommargin;rightmargin;topmargin;//图区域
- double paperwidth;paperheight;//纸区域
- double origin[2]; //打印偏移
- double windowmin[2];windowmax[2];
- double realworldunits; //打印比例
- double drawingunits;
- short plotlayoutflag;
- short plotpaperunits;
- short plotrotation;
- short plottype;
- char currentstylesheet[AD_MAX_STRLEN];//打印样式表
- short scaletype;
- double scalefactor;
- double paperimageorigin[2];
- } AD_PLOTSETTINGS, *PAD_PLOTSETTINGS;
- */
- if(m_dplotstyleconvmode==1)
- {
- CString strPlotStyleSheet=adob->layout.plotsettings.currentstylesheet;
- CFileFind filefind;
- if(!filefind.FindFile(strPlotStyleSheet))
- {
- CString strTemp;
- TCHAR szFileName[MAX_PATH];
- ::GetModuleFileName(::GetModuleHandle(_T("FileSwitch.dll")),szFileName,MAX_PATH);
- (*_tcsrchr(szFileName,'\'))=' ';
- CString strPath=szFileName;
- strPath+="\";
- strPath+="SUPPORT";
- strPath+="\";
- strTemp=strPath+"plotstyle.bak";
- strPath+=strPlotStyleSheet;
- if(filefind.FindFile(strPath))
- {
- ::CopyFile(strPath,strTemp,FALSE);//备份
- ::DeleteFile(strPath);
- }
- calculate_DefaultExamineFile(strPlotStyleSheet,"Plot Styles","SUPPORT");
- if(!filefind.FindFile(strPath))
- {
- if(filefind.FindFile(strTemp))
- {
- ::CopyFile(strTemp,strPath,FALSE);//恢复
- ::DeleteFile(strTemp);
- }
- }
- else if(filefind.FindFile(strTemp))
- {
- ::DeleteFile(strTemp);
- }
- strPlotStyleSheet=strPath;
- }
- if(filefind.FindFile(strPlotStyleSheet))
- {
- //extern short ADCDECL adReadPlotStyleTable _((char *pszInputFile, ADPLOTSTYLETABLE **ppTable));
- ADPLOTSTYLETABLE* pPlotStyleTable=NULL;
- sReturnValue=adReadPlotStyleTable((char*)(LPCTSTR)strPlotStyleSheet, &pPlotStyleTable);
- if(pPlotStyleTable)
- {
- if(sReturnValue!=1)
- {
- try
- {
- //extern short ADCDECL adFreePlotStyleTable _((ADPLOTSTYLETABLE *pTable));
- sReturnValue=adFreePlotStyleTable(pPlotStyleTable);
- if(sReturnValue!=1)
- {
- _WRITE2(str="释放打印样式错误");
- }
- }
- catch(...)
- {
- }
- }
- else
- {
- int iCurplotSheet=m_aPlotStyleTable.Add(pPlotStyleTable);
- if(strcmp(adob->layout.name,"Model"))
- {
- m_apaper.Add(adob->layout.pspaceblockrec,adob->layout.name,iCurplotSheet);
- }
- else
- {
- m_iModelPlotStyleTable=iCurplotSheet;
- }
- return TRUE;
- }
- }
- }
- }
- if(strcmp(adob->layout.name,"Model"))
- {
- m_apaper.Add(adob->layout.pspaceblockrec,adob->layout.name,-1);
- }
- return TRUE;
- }