示例#1
0
        public static IGxdDocument GenerateFrom(ILayoutHost host)
        {
            if (host == null || host.LayoutRuntime == null || host.LayoutRuntime.Layout == null)
            {
                return(null);
            }
            //
            ILayoutTemplate template    = new LayoutTemplate(host.LayoutRuntime.Layout);
            GxdTemplateHost gxdTemplate = new GxdTemplateHost(template);
            //
            IGxdDocument gxdoc = new GxdDocument(gxdTemplate);

            //
            IElement[] dfs = host.LayoutRuntime.QueryElements((ele) => { return(ele is IDataFrame); }, false);
            if (dfs != null)
            {
                gxdoc.DataFrames.Clear();
                foreach (IDataFrame df in dfs)
                {
                    GxdDataFrame gxdDf = new GxdDataFrame(df.Name, GetDfEnvelope(df),
                                                          GetDfVectorHost(df), df.SpatialRef, df.GetGridXml(), df.GetDocumentableLayersHostXml());
                    if (GxDataFrameRasterItemsSetter != null)
                    {
                        GxDataFrameRasterItemsSetter(df, gxdDf);
                    }
                    gxdoc.DataFrames.Add(gxdDf);
                }
            }
            return(gxdoc);
        }
示例#2
0
        public IGxdDocument Parse(string fname)
        {
            XDocument            doc        = XDocument.Load(fname);
            GxdTemplateHost      template   = GetGxdTemplate(doc.Root.Element("GxdLaytouTemplate"));
            List <IGxdDataFrame> dataFrames = GetGxdDataFrames(doc.Root.Element("GxdDataFrames"));
            IGxdDocument         gxdDoc     = new GxdDocument(template, dataFrames);

            gxdDoc.FullPath = fname;
            return(gxdDoc);
        }
示例#3
0
        private GxdTemplateHost GetGxdTemplate(XElement ele)
        {
            if (ele == null)
            {
                return(null);
            }
            string name        = GetStringAttribute(ele, "name");
            string fullname    = GetStringAttribute(ele, "fullname");
            string tempContent = null;

            if (ele.Element("Layout") != null)
            {
                tempContent = ele.Element("Layout").ToString();
            }
            ILayoutTemplate temp = LayoutTemplate.CreateFrom(tempContent);

            if (temp != null)
            {
                GxdTemplateHost host = new GxdTemplateHost(temp);
                return(host);
            }
            return(null);
        }