请问一下,通过ElementPropertiesSetterPtr 如何设置 linestyle?
ElementPropertiesSetterPtr pPropsSetter = ElementPropertiesSetter::Create(); pPropsSetter->SetLinestyle
线型分系统线型(0~7)和自定义线型。如果是前者,直接用整数设置即可。
如果是后者,需要调用LineStyleManager::GetNumberFromName从自定义线型名得到这个对应的UInt32整数,然后再传入pPropsSetter->SetLinestyle中
Answer Verified By: T-kind
你好, 符工,线串生成成功之后设置线型并没有改变,请问什么原因,代码如下:
MSElementDescrP addBPOutPath1(DPoint3d *pathPoins) { //外框1路径 DPoint3d *pathPoint = new DPoint3d[3]; DPoint3d outp3 = pathPoins[0]; pathPoint[0] = outp3; DPoint3d outp4 = pathPoins[1]; pathPoint[1] = outp4; DPoint3d endp = pathPoins[1]; endp.z = pathPoins[0].z; DPoint3d outp5 = zy_pointAsDistance(pathPoins[0], endp, LANGDAO1_W / 2); outp5.z = pathPoins[1].z; pathPoint[2] = outp5; MSElementDescrP edp1; MSElement el1; mdlLineString_create(&el1, NULL, pathPoint, 3); mdlElmdscr_new(&edp1, NULL, &el1); mdlElmdscr_add(edp1); EditElementHandle eeh(edp1, false, false); ElementPropertiesSetterPtr pPropsSetter = ElementPropertiesSetter::Create(); pPropsSetter->SetLinestyle(4, NULL); pPropsSetter->Apply(eeh); eeh.ReplaceInModel(eeh.GetElementRef()); delete[]pathPoint; return edp1; }
请不要在CE下还去调用老的MSElementDescr了。这个只在万不得已时才用到。
可直接调用LineStringHandler::CreateLineStringElement创建LineString的eeh,SetLineStyle后调用AddToModel添加到模型中即可。
明白了,符工,谢谢