private void GetLayerObjects(CodeCell.AgileMap.Core.ILayer[] layers, ILayerObjecGroup g) { if (layers == null || layers.Length == 0) { return; } foreach (CodeCell.AgileMap.Core.ILayer lyr in layers) { ILayerObject obj = new LayerObject(lyr.Name ?? string.Empty, lyr); g.Children.Add(obj); } }
//调整二级及以上节点顺序 public void AdjustOrder(int insertIndex, ILayerItem item, ILayerItem parentItem) { if (parentItem == null) { return; } (parentItem as ILayerItemGroup).Items.Remove(item); (parentItem as ILayerItemGroup).Items.Insert(insertIndex, item); foreach (IElement ele in _viewer.LayoutHost.LayoutRuntime.Layout.Elements) { if (ele is ILayerObjectContainer) { ILayerObjectContainer container = ele as ILayerObjectContainer; //ILayerObjectBase insertObj = item.Tag as ILayerObjectBase; foreach (ILayerObjectBase obj in container.LayerObjects) { if (obj is ILayerObject) { ILayerObject layerObj = obj as ILayerObject; if (layerObj.Tag.Equals(item.Tag)) { container.LayerObjects.Remove(layerObj); container.LayerObjects.Insert(insertIndex, layerObj); RefreshViewer(); return; } } if (obj is ILayerObjecGroup) { ILayerObjecGroup layerGrp = obj as ILayerObjecGroup; foreach (ILayerObjectBase it in layerGrp.Children) { if ((it as ILayerObject).Tag.Equals(item.Tag)) { layerGrp.Children.Remove(it); layerGrp.Children.Insert(insertIndex, it); RefreshViewer(); return; } } } } } if (ele.Equals(parentItem) && ele is IElementGroup) { IElementGroup group = ele as IElementGroup; group.Elements.Remove(item.Tag as IElement); group.Elements.Insert(insertIndex, item.Tag as IElement); RefreshViewer(); return; } } }
private void GetLayerObjects(GeoDo.RSS.Core.DrawEngine.ILayerGroup layerGroup, ILayerObjecGroup g) { foreach (GeoDo.RSS.Core.DrawEngine.ILayer lyr in layerGroup.Layers) { ILayerObjectBase obj = GetLayerObjects(lyr); if (obj != null) { g.Children.Add(obj); } if (lyr is ILayerGroup) { GetLayerObjects(lyr as ILayerGroup, obj as ILayerObjecGroup); } } }