private IGxdDocument CreateDocument(ILayoutTemplate template, object p) { IGxdDocument doc = new GxdDocument(new GxdTemplateHost(template)); IGxdDataFrame gxdDf = doc.DataFrames.Count > 0 ? doc.DataFrames[0] : null; return(doc); }
private void TrySetDataFrameEnvelope(IGxdDataFrame gxdDataFrame, IDataFrame dataFrame, ILayout layout) { try { ThemeGraphRegion region = ThemeGraphRegionSetting.GetThemeGraphRegion("FLD"); if (region != null && _region != null) { foreach (PrjEnvelopeItem item in region.PrjEnvelopeItems) { if (item.Name.ToUpper() == _region) { PrjEnvelope env = item.PrjEnvelope; GxdEnvelope gxdEnv = ToPrjEnvelope(env, gxdDataFrame, dataFrame); if (gxdEnv != null) { FitSizeToTemplateWidth(layout, (float)(gxdEnv.MaxX - gxdEnv.MinX), (float)(gxdEnv.MaxY - gxdEnv.MinY)); gxdDataFrame.Envelope = gxdEnv; return; } } } } } catch (Exception ex) { //PrintInfo(ex.Message); } }
private void ApplyAttributesOfDataFrame(IGxdDataFrame gxdDataFrame, IDataFrame iDataFrame, ILayout layout, PrjEnvelope envelope) { Layout.GxdEnvelope gxdEnv = ToPrjEnvelope(envelope, gxdDataFrame, iDataFrame); if (gxdEnv != null) { FitSizeToTemplateWidth(layout, (float)(gxdEnv.MaxX - gxdEnv.MinX), (float)(gxdEnv.MaxY - gxdEnv.MinY)); gxdDataFrame.Envelope = gxdEnv; } }
protected override void ApplyAttributesOfDataFrame(IGxdDataFrame gxdDataFrame, IDataFrame dataFrame, ILayout layout) { string instanceIdentify = _argumentProvider.GetArg("OutFileIdentify") as string; Layout.GxdEnvelope evp = ToPrjEnvelope(_envelope, gxdDataFrame, dataFrame); if (evp != null) { FitSizeToTemplateWidth(layout, (float)(evp.MaxX - evp.MinX), (float)(evp.MaxY - evp.MinY)); gxdDataFrame.Envelope = evp; _envelope = null; } }
/// <summary> /// 设置数据层 /// 栅格数据 /// </summary> /// <param name="gxdDataFrame"></param> /// <param name="dataFrame"></param> protected override void ApplyAttributesOfDataFrame(IGxdDataFrame gxdDataFrame, IDataFrame dataFrame, ILayout layout) { string colorTabelName = null; //if (!string.IsNullOrEmpty(instance.ColorTableName)) // colorTabelName = "colortablename=" + instance.ColorTableName; IGxdRasterItem rst = new GeoDo.RSS.Layout.GDIPlus.GxdRasterItem(dblvFile, colorTabelName);//这里传具体的色标定义标识 gxdDataFrame.GxdRasterItems.Add(rst); base.ApplyAttributesOfDataFrame(gxdDataFrame, dataFrame, layout); }
private IGxdDocument GetDocument(string dataFileName, int[] aoi, ILayoutTemplate t, object options) { IGxdDocument doc = new GxdDocument(new GxdTemplateHost(t)); IGxdDataFrame gxdDf = doc.DataFrames.Count > 0 ? doc.DataFrames[0] : null; if (gxdDf != null) { IGxdRasterItem rst = new GxdRasterItem(dataFileName, options);//这里传具体的色标定义标识 gxdDf.GxdRasterItems.Add(rst); // TryGeneratreAOISecondaryFile(aoi, rst); // TryApplyVars(doc, dataFileName); } return(doc); }
private IGxdDocument GetDocument(ISmartSession session, string rasterFname, string outputFileName, ILayoutTemplate temp, string wndName, params object[] arguments) { IGxdDocument doc = new GxdDocument(new GxdTemplateHost(temp)); IGxdDataFrame gxdDf = doc.DataFrames.Count > 0 ? doc.DataFrames[0] : null; if (string.IsNullOrEmpty(outputFileName)) { return(null); } if (gxdDf != null) { IGxdRasterItem rst = new GxdRasterItem(outputFileName, null);//这里传具体的色标定义标识 gxdDf.GxdRasterItems.Add(rst); } return(doc); }
//设置数据层范围 protected override void ApplyAttributesOfDataFrame(IGxdDataFrame gxdDataFrame, IDataFrame dataFrame, ILayout layout) { try { Layout.GxdEnvelope evp = ToPrjEnvelope(_shpEnvelope, gxdDataFrame, dataFrame); if (evp != null) { FitSizeToTemplateWidth(layout, (float)(evp.MaxX - evp.MinX), (float)(evp.MaxY - evp.MinY)); gxdDataFrame.Envelope = evp; } } catch (Exception ex) { PrintInfo(ex.Message); } base.ApplyAttributesOfDataFrame(gxdDataFrame, dataFrame, layout); }
protected override void ApplyAttributesOfDataFrame(IGxdDataFrame gxdDataFrame, IDataFrame dataFrame, ILayout layout) { string instanceIdentify = _argumentProvider.GetArg("OutFileIdentify") as string; string envelope = null; if (instanceIdentify == "TFRI") { envelope = _argumentProvider.GetArg("OldThemeEnvelope").ToString(); } else { envelope = _argumentProvider.GetArg("ThemeEnvelope").ToString(); } if (string.IsNullOrEmpty(envelope)) { return; } string[] latlon = envelope.Split(','); if (latlon == null || latlon.Length < 4) { return; } ISmartSession session = _argumentProvider.GetArg("SmartSession") as ISmartSession; if (session == null) { return; } double[] geoRange; if (!IsSetRange(session, latlon, out geoRange)) { return; } GxdEnvelope env = new GxdEnvelope(double.Parse(latlon[0]), double.Parse(latlon[1]), double.Parse(latlon[2]), double.Parse(latlon[3])); Layout.GxdEnvelope evp = ToPrjEnvelope(env, gxdDataFrame, dataFrame); if (evp != null) { FitSizeToTemplateWidth(layout, (float)(evp.MaxX - evp.MinX), (float)(evp.MaxY - evp.MinY)); gxdDataFrame.Envelope = evp; } base.ApplyAttributesOfDataFrame(gxdDataFrame, dataFrame, layout); }
private string GenerateRasterThemeGraphy(string dstFile, string drawFName) { string templatName = GetLayoutTheme("0SDI"); string colorTabelName = "colortablename=" + "FLDDBLV"; ILayoutTemplate t = GetTemplateByArg(templatName); if (t == null) { return(null); } ILayout layout = t.Layout; int width, height; GeoDo.RSS.Core.DF.CoordEnvelope envelope = null; using (IRasterDataProvider dataPrd = GeoDataDriver.Open(dstFile) as IRasterDataProvider) { width = dataPrd.Width; height = dataPrd.Height; envelope = dataPrd.CoordEnvelope; } FitSizeToTemplateWidth(layout, width, height); //生成文档,并应用变量 TryApplyVars(t, drawFName); IGxdDocument gxdDoc = CreateDocument(t, string.IsNullOrEmpty(colorTabelName) ? null : colorTabelName); IGxdDataFrame gxdDf = gxdDoc.DataFrames.Count > 0 ? gxdDoc.DataFrames[0] : null; if (gxdDf != null) { string[] arguments = new string[] { string.IsNullOrEmpty(colorTabelName) ? null : colorTabelName }; IGxdRasterItem rst = new GxdRasterItem(dstFile, colorTabelName, arguments, colorTabelName);//这里传具体的色标定义标识 gxdDf.GxdRasterItems.Add(rst); } TrySetAttributesOfElements(gxdDoc); string docFname = GetGxdFilename(dstFile, "0SDI"); gxdDoc.SaveAs(docFname); return(docFname); }
private GxdEnvelope ToPrjEnvelope(GxdEnvelope env, IGxdDataFrame gxdDataFrame, IDataFrame dataFrame) { if (env == null) { return(null); } GeoDo.Project.IProjectionTransform tran = GetProjectionTransform(gxdDataFrame.SpatialRef); if (tran == null) { return(null); } double[] xs = new double[] { env.MinX, env.MaxX }; double[] ys = new double[] { env.MaxY, env.MinY }; try { tran.Transform(xs, ys); return(new Layout.GxdEnvelope(xs[0], xs[1], ys[1], ys[0])); } catch { return(null); } }
private List <IGxdDataFrame> GetGxdDataFrames(XElement xElement) { if (xElement == null) { return(null); } var eles = xElement.Elements("GxdDataFrame"); if (eles == null) { return(null); } List <IGxdDataFrame> dfs = new List <IGxdDataFrame>(); foreach (XElement ele in eles) { IGxdDataFrame df = GetGxdDataFrame(ele); if (df != null) { dfs.Add(df); } } return(dfs); }
protected virtual void ApplyAttributesOfDataFrame(IGxdDataFrame gxdDataFrame, IDataFrame dataFrame, ILayout layout) { TrySetDataFrameEnvelope(gxdDataFrame, dataFrame, layout); }
protected virtual void ApplyAttributesOfDataFrame(IGxdDataFrame gxdDataFrame, IDataFrame dataFrame, ILayout layout) { }