예제 #1
0
        //internal void SetOrbitTimes(string[] orbitTimes)
        //{
        //    if (_template == null)
        //        return;
        //    ILayout layout = _template.Layout;
        //    IElement[] dfs = layout.QueryElements((e) => { return e is ILegendElement; });
        //    List<LegendItem> lg = new List<LegendItem>();
        //    for (int i = 0; i < orbitTimes.Length; i++)
        //    {
        //        lg.Add(new LegendItem(orbitTimes[i]));
        //    }
        //    ILegendElement legend = dfs[0] as ILegendElement;
        //    legend.LegendItems = lg.ToArray();
        //}

        public string CreateThematicGraphic(string dataFileName, string theme, string gxdFilename, string extInfos, params object[] options)
        {
            _template = LayoutTemplate.LoadTemplateFrom(theme);
            if (_template == null)
            {
                return(null);
            }
            if (_isNeedFitToTemplateWidth)
            {
                using (IRasterDataProvider prd = GeoDataDriver.Open(dataFileName) as IRasterDataProvider)
                {
                    if (prd != null)
                    {
                        FitTemplateWidth(_template.Layout, prd.Width, prd.Height);
                    }
                }
            }
            IGxdDocument _doc = GetDocument(dataFileName, _aoi, _template, options != null && options.Length > 0 ? options[0] : null);

            if (_doc == null)
            {
                return(null);
            }
            _doc.SaveAs(gxdFilename);
            return(gxdFilename);
        }
예제 #2
0
        public void SaveAsDocument(string gxdfilename)
        {
            IGxdDocument doc = GxdDocument.GenerateFrom(this);

            if (doc != null)
            {
                doc.SaveAs(gxdfilename);
            }
        }
예제 #3
0
 public string Save()
 {
     if (_doc == null)
     {
         return(null);
     }
     _doc.SaveAs(_fname);
     return(_fname);
 }
예제 #4
0
파일: Form1.cs 프로젝트: configare/hispeed
        private void button19_Click(object sender, EventArgs e)
        {
            GxdDocumentParser p     = new GxdDocumentParser();
            string            fname = "f:\\gxd.xml";
            IGxdDocument      doc   = p.Parse(fname);
            GxdRasterItem     it    = new GxdRasterItem("f:\\1.bmp", new PointF());
            XElement          ele   = it.ToXml();

            ele = doc.GxdTemplateHost.ToXml();
            doc.SaveAs("f:\\gxd2.xml");
        }
예제 #5
0
        /// <summary>
        /// 监测示意图显示/多通道合成图
        /// </summary>
        /// <param name="argument">template:沙尘监测示意图,监测示意图,DST,MCSI</param>
        /// <returns>专题图文档,IGxdDocument</returns>
        public string DisplayMonitorBitmap(ISmartSession session, string argument, out string subProductIdentify)
        {
            subProductIdentify = null;
            ICanvasViewer viewer = session.SmartWindowManager.ActiveCanvasViewer;

            if (viewer == null)
            {
                return(null);
            }
            ICanvas canvas = viewer.Canvas;

            if (canvas == null)
            {
                return(null);
            }
            string bitmapFileName = null;
            int    width          = 0;
            int    height         = 0;
            bool   isOk           = GetOrginBmpAndSave(canvas, out bitmapFileName, out width, out height);

            if (!isOk)
            {
                return(null);
            }
            CreatWorldFile(bitmapFileName, canvas, width, height);
            string[] parts = argument.Split(',');
            if (parts == null || parts.Length == 0)
            {
                return(null);
            }
            subProductIdentify = parts[parts.Length - 1];
            object[]        args = new object[] { parts[0] };
            ILayoutTemplate temp = GetTemplateByArg(parts[0]);

            if (temp == null)
            {
                return(null);
            }

            ILayout layout = temp.Layout;

            FitSizeToTemplateWidth(layout, width, height);

            string       rasterFname = (canvas.PrimaryDrawObject as IRasterDrawing).FileName;
            IGxdDocument gxdDoc      = GetDocument(session, rasterFname, bitmapFileName, temp, parts[1]);

            TryApplyVars(gxdDoc.GxdTemplateHost.LayoutTemplate, (canvas.PrimaryDrawObject as IRasterDrawing));

            string fname = GetOutputGxdFileName(rasterFname, parts[2]);

            gxdDoc.SaveAs(fname);
            return(fname);
        }
예제 #6
0
        public string CreateMCSI(ISmartSession session)
        {
            IRasterDrawing drawing = GetRasterDrawingArugment(session);

            if (drawing == null)
            {
                return(null);
            }
            string theme = GetLayoutTheme("MCSI");

            if (string.IsNullOrWhiteSpace(theme))
            {
                return(null);
            }
            int    width, height;
            string bmpFilename = CreateViewBitmap(drawing, session, out width, out height);
            string gxdFilename = GetGxdFilename(drawing.FileName, "MCSI");

            if (string.IsNullOrWhiteSpace(gxdFilename))
            {
                return(null);
            }
            //加载模版
            ILayoutTemplate temp = GetTemplateByArg(theme);

            if (temp == null)
            {
                return(null);
            }
            ILayout layout = temp.Layout;

            FitSizeToTemplateWidth(layout, width, height);
            //生成文档,并应用变量
            IGxdDocument gxdDoc = GetDocument(bmpFilename, temp);

            TryApplyVars(gxdDoc.GxdTemplateHost.LayoutTemplate, drawing);
            TrySetAttributesOfElements(gxdDoc);
            gxdDoc.SaveAs(gxdFilename);
            //IExtractResult er = new FileExtractResult("MCSI", gxdFilename) as IExtractResult;
            return(gxdFilename);
        }
예제 #7
0
        public string CreateThematicGraphic(string dataFileName, string outIdentify, string extInfos, params object[] options)
        {
            if (_isNeedFitToTemplateWidth)
            {
                using (IRasterDataProvider prd = GeoDataDriver.Open(dataFileName) as IRasterDataProvider)
                {
                    if (prd != null)
                    {
                        FitTemplateWidth(_template.Layout, prd.Width, prd.Height);
                    }
                }
            }
            string       _fname = GetOutputGxdFileName(dataFileName, outIdentify, extInfos);
            IGxdDocument _doc   = GetDocument(dataFileName, _aoi, _template, options != null && options.Length > 0 ? options[0] : null);

            if (_doc == null)
            {
                return(null);
            }
            if (options.Length > 1)
            {
                PrjEnvelope envelope = options[1] as PrjEnvelope;
                if (envelope != null)
                {
                    ILayout              layout = _doc.GxdTemplateHost.LayoutTemplate.Layout;
                    IElement[]           dfs    = layout.QueryElements((e) => { return(e is IDataFrame); });
                    List <IGxdDataFrame> list   = _doc.DataFrames;
                    if (dfs != null && list != null && dfs.Length > 0 && list.Count > 0)
                    {
                        for (int i = 0; i < dfs.Length; i++)
                        {
                            ApplyAttributesOfDataFrame(list[i], dfs[i] as IDataFrame, layout, envelope);
                        }
                    }
                }
            }
            _doc.SaveAs(_fname);
            return(_fname);
        }
예제 #8
0
        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);
        }