qt中调用mapx地图时,出现QAxBase::qt_metacall: Object is not initialized, or initializatio

白日_焰火 2019-03-15 03:54:18
在Qt里调用mapx控件,想绘制圆形的区域,但是在运行时异常结束。应用程序输出 显示
QAxBase: Error calling IDispatch member GeoSet: Exception thrown by server
Code : 1011
Source : MAPX50
Description: ??: ????????????????????
Help : C:\PROGRA~2\MapInfo\MAPX5~1.0\MAPX50.HLP [400011]
Connect to the exception(int,QString,QString,QString) signal to catch this exception
before : 55
after : 56
QAxBase::qt_metacall: Object is not initialized, or initialization failed
D:\sogou_pinyin\SogouInput\Components\----------------------------------------------
程序异常结束。

调试时,发现程序中断在如下代码中的 qt_metacall(QMetaObject::InvokeMetaMethod, 9, _a);

inline void CMapXPoint::Set(double X, double Y)
{
void *_a[] = {0, (void*)&X, (void*)&Y};
qt_metacall(QMetaObject::InvokeMetaMethod, 9, _a);
}


整个函数的代码如下:

CMapXPoint *pt;
CMapXFeature *drawCircular;
CMapXLayers *layers;
CMapXLayer *layer;
CMapXStyle *style;

pCMapFeaFactory = map->FeatureFactory();
layers = map->Layers();

qDebug()<<"before : "<<map->Layers()->Count();

bool flag = false;
for(int i=1;i<=layers->Count();i++){
layer = layers->Item(i);
if(layer->Name() == "DetectionRange"){
flag = true;
break;
}
}
if(flag == false){
CMapXLayer *lyr = map->Layers()->CreateLayer("DetectionRange");
map->Layers()->SetAnimationLayer(lyr);
}
layer = map->Layers()->Item("DetectionRange");

qDebug()<<"after : "<<map->Layers()->Count();

pt = drawCircular->Point();
pt->Set(104.65,31.5124);

style->SetRegionBackColor(FillPatternConstants::miPatternNoFill);
style->SetRegionBorderColor(ColorConstants::miColorRed);
style->SetRegionBorderStyle(PenStyleConstants::miPenSolid);
style->SetRegionBorderWidth(2);
style->SetRegionPattern(FillPatternConstants::miPatternNoFill);

double v = 10.0;
int vv = 1024;

drawCircular = pCMapFeaFactory->CreateCircularRegion(CircleTypeConstants::miCircleTypeScreen,
pt->asVariant().value<IDispatch*>(),10,
v,vv,style->asVariant());
layer->AddFeature(drawCircular->asVariant().value<IDispatch*>());
layer->Refresh();
...全文
1408 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
superboylin 2021-03-05
  • 打赏
  • 举报
回复
求教怎么解决的
Nie3304 2021-03-01
  • 打赏
  • 举报
回复
您好 您这个问题怎么解决的, 可以告诉下吗?

703

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder ActiveX/COM/DCOM
社区管理员
  • ActiveX/COM/DCOM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧