明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1703|回复: 0

《ObjectARX实用指南——AutoCAD二次开发》第14章协议扩展问题

[复制链接]
发表于 2005-5-30 19:33:00 | 显示全部楼层 |阅读模式
class AdskEntTemperature : public AcRxObject
{
public:
ACRX_DECLARE_MEMBERS( AsdkEntTemperature ); virtual double reflectedEnergy( AcDbEntity * ) const = 0;
}; ACRX_NO_DEFINE_MEMBERS( AsdkEntTemperature, AcRxObject); ////////////////////////////////////// class AdskDefaultTemperature : public AdskEntTemperature
{
public:
virtual double reflectedEnergy(AcDbEntity * pEnt) const; } double AdskDefaultTemperature::reflectedEnergy(AcDbEntity * pEnt) const
{
acutPrintf("\nThis entity has no aarea, and no reflection.\n");
return -1.0; } //////////////////////////////////////
class AdskRegionTemperature : public AdskEntTemperature
{
public:
virtual double reflectedEnergy(AcDbEntity * pEnt) const; } double AdskRegionTemperature::reflectedEnergy(AcDbEntity * pEnt) const
{
AcDbRegion * pRegion = AcDbRegion::cast( pTnt );
if ( pRegion == NULL )
acutPrintf("\nThis impossible has happened!\n"); double retVal;
if (pRegion->getArea( retVal ) != Acad::eOK )
return -1.0;
return retVal*42.0; } //////////////////////////////////////
class AdskCircleTemperature : public AdskEntTemperature
{
public:
virtual double reflectedEnergy(AcDbEntity * pEnt) const; } double AdskCircleTemperature::reflectedEnergy(AcDbEntity * pEnt) const
{
AcDbCircle * pCircle = AcDbCircle::cast( pTnt );
if ( pCircle == NULL )
acutPrintf("\nThis impossible has happened!\n"); return pCircle->radius()*6.21*42.0; }
void energy()
{
AcDbEntity *pEnt;
AcDbObjectId pEntId; ads_name en;
ads_point pt;
if ( acedEntSel("\nSelect an Entity:", en, pt) != RTNORM )
{
acutPrintf("Nothing Selected\n");
return;
} acdbGetObjectId( pEntId, en );
acdbOpenObject( pEnt, pEntId, Acdb::kForRead ); double eTemp = ACRX_X_CALL( pEnt, AsdkEntTemperature ) ->reflectedEnergy( pEnt );
acutPrintf("\nEnergy == %f \n", eTemp );
pEnt->close();
}
为什么我在入口函数文件头中一定义上述头文件,就会出错: d:\AutoCAD二次开发\cascoacds\adskenttemperature.h(8) : error C2143: syntax error : missing ';' before '*'
d:\autocad二次开发\cascoacds\adskenttemperature.h(8) : error C2501: 'cast' : missing storage-class or type specifiers
d:\autocad二次开发\cascoacds\adskenttemperature.h(8) : warning C4183: 'cast': member function definition looks like a ctor, but name does not match enclosing class
d:\autocad二次开发\cascoacds\adskenttemperature.h(13) : error C2065: 'AsdkEntTemperature' : undeclared identifier
d:\autocad二次开发\cascoacds\adskenttemperature.h(13) : error C2275: 'AcRxObject' : illegal use of this type as an expression
c:\objectarx2002\inc\rxobject.h(33) : see declaration of 'AcRxObject'
d:\autocad二次开发\cascoacds\adskenttemperature.h(13) : error C2501: 'ACRX_NO_DEFINE_MEMBERS' : missing storage-class or type specifiers
d:\autocad二次开发\cascoacds\adskenttemperature.h(13) : error C2078: too many initializers 应该是什么地方的设置不对,请做过的各位前辈指点。先谢谢你们了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-26 06:00 , Processed in 0.148939 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表