- UID
- 110840
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2004-3-8
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
急求问!调用自定义类画一个图形,编译时出错,fatal error C1010: unexpected end of file while looking for precompiled header directive
出错文件是RectWindow.cpp
This error can be caused by specifying an incorrect file as a header file, or by specifying an include file with the /Yu (Use Precompiled Header) command line option that is not listed in the source file as an include file.
这是MSDN上的提示,我不太明白,望大虾指点!!!!
类头文件和执行文件如下:
//RectWindow.h
#ifndef RECTWINDOW_H
#define RECTWINDOW_H
#include <gept2dar.h>
class RectWindow
{
public:
RectWindow(); // Constructor
~RectWindow(); // Destructor
void drawWindow(AcDbBlockTableRecord* pBlkTableRecord);
void setWindowRows(int rowQty);
void setWindowCols(int colQty);
virtual void setWindowHeight(double windHeight);
void setWindowLength(double windLength);
void setWindowStartPoint(AcGePoint2d lowLeftPoint);
protected:
double getWindowLength() const;
double getWindowHeight() const;
AcGePoint2d getWindowStartPoint() const;
double getIntrFrameThk() const;
double getRectFrameThk() const;
Adesk::Boolean drawIntBar(AcDbBlockTableRecord* pBlkTableRecord,
AcGePoint2dArray intBarAr);
private:
Adesk::Boolean drawRectFrame(AcDbBlockTableRecord* pBlkTableRecord,
AcGePoint2dArray &inrRectFrame);
int getWindowRows() const;
int getWindowCols() const;
int rows;
int cols;
double rectFrameLen;
double rectFrameHt;
double rectFrameThk;
double intrFrameThk;
AcGePoint2d lowLeftPt;
};
#endif
////////执行文件////////////// RectWindow.cpp
#include <acdb.h> // acdb definitions
#include <adslib.h> // ads defs
#include <dbsymtb.h>
#include <adeskabb.h>
#include <dbpl.h> // AcDbPolyline
#include <gepnt2d.h>
#include <gept2dar.h>
#include "RectWindow.h"
RectWindow::RectWindow()
{
rectFrameThk = 2.00;
intrFrameThk = 1.00;
rows = 1;
cols = 1;
rectFrameLen = 0.0;
rectFrameHt = 0.0;
lowLeftPt.set(0.0, 0.00);
}
RectWindow::~RectWindow()
{
}
void RectWindow::drawWindow(AcDbBlockTableRecord* pBlkTableRecord)
{
AcGePoint2dArray inrRectFrame;
AcGePoint2dArray inrTopAr, inrBtmAr, inrLeftAr, inrRtAr;
AcGePoint2dArray barAr;
AcGeLineSeg2d inrTop, inrBtm, inrLeft, inrRt;
AcGeVector2d vec;
AcGePoint2d sp, ep, ll, lr, ul, ur;
double frameThk;
int arSize;
int rowPos, colPos;
int rows, cols;
if(!drawRectFrame(pBlkTableRecord, inrRectFrame))
{
return;
}
rows = getWindowRows();
cols = getWindowCols();
if(rows == 1 && cols == 1)
{
return;
}
arSize = inrRectFrame.length();
if(arSize != 4)
{
acutPrintf("\nInvalid internal rect frame array. ");
return;
}
frameThk = getIntrFrameThk();
barAr.setLogicalLength(0);
inrTop.set(inrRectFrame.at(3), inrRectFrame.at(2));
inrBtm.set(inrRectFrame.at(0), inrRectFrame.at(1));
inrTop.getSamplePoints(cols + 1, inrTopAr);
inrBtm.getSamplePoints(cols + 1, inrBtmAr);
inrRt.getSamplePoints(rows + 1, inrRtAr);
if(cols == 1 && rows > 1)
{
// Draw horizontal bars only
for (rowPos = 1; rowPos < rows; rowPos++)
{
// Get the start point and the end point from the array
sp = inrLeftAr.at(rowPos);
ep = inrRtAr.at(rowPos);
// from sp and ep calculate ll, lr ,ul, ur
vec.set(0, (frameThk / 2));
ll = sp - vec;
lr = ep - vec;
ul = sp + vec;
ur = ep + vec;
barAr.append(ll);
barAr.append(lr);
barAr.append(ur);
barAr.append(ul);
if(!drawIntBar(pBlkTableRecord, barAr))
{
acutPrintf("\nError drawing internal horizontal frame member. ");
}
barAr.setLogicalLength(0);
}// for
}// if
if(rows == 1 && cols > 1)
{
// Draw vertical bars only
for (colPos = 1; colPos < cols; colPos++)
{
// Get the start point and the end point from the array
sp = inrBtmAr.at(colPos);
ep = inrTopAr.at(colPos);
// from sp and ep calculate ll, lr ,ul, ur
vec.set((frameThk / 2), 0);
ll = sp - vec;
lr = sp + vec;
ul = ep - vec;
ur = ep + vec;
barAr.append(ll);
barAr.append(lr);
barAr.append(ur);
barAr.append(ul);
if(!drawIntBar(pBlkTableRecord, barAr))
{
acutPrintf("\nError drawing internal horizontal frame member. ");
}
barAr.setLogicalLength(0);
}// for
}// if
if(rows > 1 && cols > 1)
{
for(rowPos = 1; rowPos < rows; rowPos++)
{
for(colPos = 1; colPos <= cols; colPos++)
{
sp.x = inrBtmAr.at(colPos - 1).x;
sp.y = inrLeftAr.at(rowPos).y;
ep.x = inrBtmAr.at(colPos).x;
ep.y = inrLeftAr.at(rowPos).y;
// Calculate ll, lr, ul, ur
if(colPos == 1)
{
vec.set(0, (frameThk / 2));
ll = sp - vec;
ul = sp + vec;
vec.set( -(frameThk / 2), -(frameThk / 2));
lr = ep + vec;
vec.set( -(frameThk / 2), (frameThk / 2));
ur = ep + vec;
// Add the point to the barAr array
barAr.append(ll);
barAr.append(lr);
barAr.append(ep);
barAr.append(ur);
barAr.append(ul);
if(!drawIntBar(pBlkTableRecord, barAr))
{
acutPrintf("\nError drawing internal horizontal frame member. ");
}
barAr.setLogicalLength(0);
}
else if(colPos == cols)
{
vec.set((frameThk / 2), (frameThk / 2));
ul = sp + vec;
vec.set((frameThk / 2), -(frameThk /2));
ll = sp + vec;
vec.set(0, (frameThk / 2));
lr = ep - vec;
ur = ep + vec;
barAr.append(sp);
barAr.append(ll);
barAr.append(lr);
barAr.append(ur);
barAr.append(ul);
if(!drawIntBar(pBlkTableRecord, barAr))
{
acutPrintf("\nError drawing internal horizontal frame member. ");
}
barAr.setLogicalLength(0);
}
else
{
vec.set((frameThk / 2), (frameThk / 2));
ul = sp + vec;
vec.set((frameThk / 2), -(frameThk /2));
ll = sp + vec;
vec.set( -(frameThk / 2), (frameThk / 2));
ur = ep + vec;
vec.set( -(frameThk / 2), -(frameThk / 2));
lr = ep + vec;
barAr.append(sp);
barAr.append(ll);
barAr.append(lr);
barAr.append(ep);
barAr.append(ur);
barAr.append(ul);
if(!drawIntBar(pBlkTableRecord, barAr))
{
acutPrintf("\nError drawing internal horizontal frame member. ");
}
barAr.setLogicalLength(0);
}
}// for
colPos = 1;
}// for
for(colPos = 1; colPos < cols; colPos++)
{
for(rowPos = 1; rowPos <= rows; rowPos++)
{
sp.x = inrBtmAr.at(colPos).x;
sp.y = inrLeftAr.at(rowPos - 1).y;
ep.x = inrBtmAr.at(colPos).x;
ep.y = inrLeftAr.at(rowPos).y;
if(rowPos == 1)
{
vec.set((frameThk / 2), 0);
ll = sp - vec;
lr = sp + vec;
vec.set( -(frameThk / 2), -(frameThk / 2));
ul = ep + vec;
vec.set((frameThk / 2), -(frameThk / 2));
ur = ep + vec;
// Add the point to the barAr array
barAr.append(ll);
barAr.append(lr);
barAr.append(ur);
barAr.append(ep);
barAr.append(ul);
if(!drawIntBar(pBlkTableRecord, barAr))
{
acutPrintf("\nError drawing internal horizontal frame member. ");
}
barAr.setLogicalLength(0);
}
else if(rowPos == rows)
{
vec.set((frameThk / 2), 0);
ul = ep - vec;
ur = ep + vec;
vec.set ( -(frameThk / 2), (frameThk / 2));
ll = sp + vec;
vec.set ( (frameThk / 2), (frameThk / 2));
lr = sp + vec;
// Add the point to the barAr array
barAr.append(sp);
barAr.append(lr);
barAr.append(ur);
barAr.append(ul);
barAr.append(ll);
if(!drawIntBar(pBlkTableRecord, barAr))
{
acutPrintf("\nError drawing internal horizontal frame member. ");
}
barAr.setLogicalLength(0);
}
else
{
vec.set((frameThk / 2), (frameThk /2));
lr = sp + vec;
ul = ep - vec;
vec.set ( -(frameThk / 2), (frameThk / 2));
ll = sp + vec;
ur = ep - vec;
// Add the point to the barAr array
barAr.append(sp);
barAr.append(lr);
barAr.append(ur);
barAr.append(ep);
barAr.append(ul);
barAr.append(ll);
if(!drawIntBar(pBlkTableRecord, barAr))
{
acutPrintf("\nError drawing internal horizontal frame member. ");
}
barAr.setLogicalLength(0);
}
}// for
rowPos = 1;
}// for
}// if
}
// Get and Set functions
int RectWindow::getWindowRows() const
{
return rows;
}
int RectWindow::getWindowCols() const
{
return cols;
}
double RectWindow::getWindowHeight() const
{
return rectFrameHt;
}
double RectWindow::getWindowLength() const
{
return rectFrameLen;
}
AcGePoint2d RectWindow::getWindowStartPoint() const
{
return lowLeftPt;
}
double RectWindow::getRectFrameThk() const
{
return rectFrameThk;
}
double RectWindow::getIntrFrameThk() const
{
return intrFrameThk;
}
void RectWindow::setWindowRows(int rowQty)
{
rows = rowQty;
}
void RectWindow::setWindowCols(int colQty)
{
cols = colQty;
}
void RectWindow::setWindowHeight(double windHeight)
{
rectFrameHt = windHeight;
}
void RectWindow::setWindowLength(double windLength)
{
rectFrameLen = windLength;
}
void RectWindow::setWindowStartPoint(AcGePoint2d lowLeftPoint)
{
lowLeftPt = lowLeftPoint;
}
Adesk::Boolean RectWindow::drawRectFrame(AcDbBlockTableRecord* pBlkTableRecord,
AcGePoint2dArray intBarAr)
{
AcDbPolyline* pBar;
AcGePoint2d vrtxPt;
AcDbObjectId plineId;
Acad::ErrorStatus es;
pBar = new AcDbPolyline(intBarAr.length());
for(int count = 0; count < intBarAr.length(); count++)
{
vrtxPt = intBarAr.at(count);
pBar->addVertexAt(count, vrtxPt);
}
pBar->setClosed(Adesk::kTrue);
es = pBlkTableRecord->appendAcDbEntity(plineId, pBar);
if(es != Acad::eOk)
{
acutPrintf("\nError in drawing frame member. ");
if(pBar != NULL)
{
delete pBar;
}
return Adesk::kFalse;
}
pBar->close();
return Adesk::kTrue;
} |
|