使用环境:IDesktop 10i 2020 操作系统:win7 x64
开发环境:IDesktop 10i 2020 操作系统:win10 x64
问题详细描述:
在win10中使用.net开发了一个自定义规则自动配图的插件功能,在Win7中使用时,设置了配图规则的layerGroup时,添加到地图的layers中【图层管理器】发生异常,但点击【图层管理器】的【图层控制】时,能看到添加进来的layer,地图中也能正常显示
定义layerGroup的代码段:
IFormMap auto_mapForm = Application.ActiveApplication.MainForm.FormManager.ActiveForm as IFormMap;
Layers layers = auto_mapForm.MapControl.Map.Layers;
foreach (var rule in rulesO.Values) //遍历规则列表
{
LayerGroup le_Group = null;
// 如相同名称的layerGroup已添加 则获取 否则新建一个
if (!string.IsNullOrWhiteSpace(rule.GroupName))
{
if (layers.Contains(rule.GroupName))
{
le_Group = layers.FindLayer(rule.GroupName) as LayerGroup;
}
else
{
le_Group = new LayerGroup(rule.GroupName);
layers.Add(le_Group);
}
}
生成风格化图层代码段:
Layer layer = null;
if (rule.Type == ModelObject.SymbolType.LABELSYMBOLS)
{
TextStyle textStyle = new TextStyle();
textStyle.FromXML(rule.Style);
ThemeLabel themeLabel = new ThemeLabel();
themeLabel.LabelExpression = rule.FieldName;
// themeLabel.LabelSizeExpression = "6";
themeLabel.UniformStyle = textStyle;
themeLabel.IsAllDirectionsOverlappedAvoided = true;
themeLabel.AlongLineDirection = AlongLineDirection.AlongLineNormal;
themeLabel.IsRepeatedLabelAvoided = true;
layer = layers.Add(dataset, themeLabel, true);
}
else
{
GeoStyle style1 = new GeoStyle();
style1.FromXML(rule.Style);
LayerSettingVector layerSettingVector = new LayerSettingVector();
layerSettingVector.Style = style1;
layer = layers.Add(dataset, layerSettingVector, true);
}
layer.Caption = rule.LayerName;
if (rule.MaxScale > 0)
{
layer.MaxVisibleScale = 1 / rule.MaxScale;
}
if (rule.MinScale > 0)
{
layer.MinVisibleScale = 1 / rule.MinScale;
}
if (!string.IsNullOrWhiteSpace(rule.FilterStr))
{
QueryParameter queryParameter = new QueryParameter();
queryParameter.AttributeFilter = rule.FilterStr;
layer.DisplayFilter = queryParameter;
}
if (layerGroup != null)
{
layerGroup.Add(layer);
}
该功能在win10中也有小问题,不能在【图层管理器】中正常显示添加进来的layer,需要点击【图层控制】-【应用】后才能正常显示;
名为测试的layerGroup显示异常,【图层管理器】中第1/2行为空白:
点击应用后:
希望能得到解答,非常感谢!