Layer3D.SetParentLayer(Layer3D value);设置过了但是其值总是为false,也就是管点和管线不存在父子关系?
bool isParent = false;
Theme3DCustom theme = new Theme3DCustom();
FieldInfos fieldinfos = pipePoint.FieldInfos;
foreach (FieldInfo fieldInfo in fieldinfos)
{
if (fieldInfo.Name.ToString() == "MarkSymbolID")
{
theme.MarkerSymbolIDExpression = fieldInfo.Name.ToString();
}
if (fieldInfo.Name.ToString() == "Mark3DScaleX")
{
theme.Marker3DScaleXExpression = fieldInfo.Name.ToString();
}
if (fieldInfo.Name.ToString() == "Mark3DScaleY")
{
theme.Marker3DScaleYExpression = fieldInfo.Name.ToString();
}
if (fieldInfo.Name.ToString() == "Mark3DScaleZ")
{
theme.Marker3DScaleZExpression = fieldInfo.Name.ToString();
}
if (fieldInfo.Name.ToString() == "AltitudeMode")
{
theme.AltitudeModeExpression = fieldInfo.Name.ToString();
}
}
PrjCoordSys prjCoordSys = new PrjCoordSys(PrjCoordSysType.Xian19803DegreeGk39N);
pipePoint.PrjCoordSys = prjCoordSys;
Layer3DDataset layerPipePoint = m_sceneControl.Scene.Layers.Add(pipePoint, theme, true);
//必须设置透明度才能显示管线数据
m_sceneControl.Scene.GlobalImage.Transparency = 100;
Layer3D ysPoint = layerPipePoint as Layer3D;
Layer3D ysParent = null;
for (int i = 0; i < m_sceneControl.Scene.Layers.Count; i++)
{
Layer3D layer3D = m_sceneControl.Scene.Layers[i];
if (layer3D.Name.ToString().Trim() == "Line3D@data")
{
ysParent = layer3D;
}
}
if (ysPoint != null && ysParent != null)
{
isParent = ysPoint.SetParentLayer(ysParent);
}
if (isParent)
MessageBox.Show("存在父子关系");
else
{
MessageBox.Show("不存在父子关系");
}
layerPipePoint.PipeLayerSetting.MatchSymMatchMode = ModelSymbolMatchMode.AlignPipeLine;
m_sceneControl.Refresh();