public GxdDocument(IGxdTemplateHost templateHost) { InitReplace(); _templateHost = templateHost; if (_templateHost != null) { if (_templateHost.LayoutTemplate != null && _templateHost.LayoutTemplate.Layout != null) { IElement[] eles = _templateHost.LayoutTemplate.Layout.QueryElements((e) => { return(e is IDataFrame); }); if (eles == null || eles.Length == 0) { return; } foreach (IDataFrame df in eles) { GxdDataFrame gxddf = new GxdDataFrame( df.Name, GxdEnvelopeGetter(df), GetDfVectorHostFromXml(df), df.SpatialRef, df.GetGridXml(), GetDocumentableLayersXml(df) ); _dataFrames.Add(gxddf); } } } }
/* * GxdTemplateHost template = GetGxdTemplate(doc.Root.Element("GxdLaytouTemplate")); * List<IGxdDataFrame> dataFrames = GetGxdDataFrames(doc.Root.Element("GxdDataFrames")); */ public GxdDocument(IGxdTemplateHost templateHost, List <IGxdDataFrame> dataFrames) { InitReplace(); _templateHost = templateHost; if (dataFrames != null && dataFrames.Count > 0) { _dataFrames.AddRange(dataFrames); } }
public void ApplyGxdDocument(IGxdDocument doc) { if (doc == null) { return; } // Dictionary <string, ILayer> gridLayers = null; IGxdTemplateHost tempHost = doc.GxdTemplateHost; if (tempHost != null) { gridLayers = ApplyTemplate(tempHost.LayoutTemplate, false); } // List <IGxdDataFrame> dfs = doc.DataFrames; if (dfs != null && dfs.Count > 0) { foreach (IGxdDataFrame df in dfs) { if (GxdDocument.GxdAddDataFrameExecutor != null) { GxdDocument.GxdAddDataFrameExecutor(doc.FullPath, df, this); } //将经纬网格添加到最上层 if (gridLayers != null && gridLayers.ContainsKey(df.Name)) { IElement[] eles = _layout.QueryElements((e) => { return(e is IDataFrame && (e as IDataFrame).Name == df.Name); }); if (eles != null && eles.Length > 0) { ((eles[0] as IDataFrame).Provider as IDataFrameDataProvider).Canvas.LayerContainer.Layers.Add(gridLayers[df.Name]); } } } } }