Пример #1
0
        SDefEditor CreateFragment(String name,
                                  String title,
                                  String mapName,
                                  String baseDefinition)
        {
            SDefEditor retVal = this.CreateEditor(name,
                                                  title,
                                                  mapName,
                                                  baseDefinition,
                                                  $"Fragment/{name}");

            retVal.SetIsFrag();
            retVal.SDef.Abstract = true;

            retVal.IntroDoc = new IntroDoc();
            retVal.IntroDoc.TryAddUserMacro("FragPath",
                                            FragmentMapMaker.FragmentMapName(retVal.SDef.Url.LastUriPart()));
            retVal.IntroDoc.TryAddUserMacro("TitleArticle", this.Article(title));
            retVal.IntroDoc.TryAddUserMacro("Title", title);
            retVal.IntroDoc.Load("Fragment",
                                 Path.Combine(this.pageDir, $"StructureDefinition-{name}-intro.xml"));

            retVal.SDef.Version = "Fragment"; // this will get stripped out when unfrag'd.

            return(retVal);
        }
        public void D4_BuildGraphics()
        {
            DateTime start = DateTime.Now;

            Trace.WriteLine("Starting D4_BuildGraphics");
            try
            {
                {
                    ResourceMap map = new ResourceMap();
                    map.AddDir(this.acrResourcesDir, "*.json");
                    {
                        ResourceMapMaker resourceMapMaker = new ResourceMapMaker(this.fc, map);
                        resourceMapMaker.AlwaysShowChildren = true;
                        resourceMapMaker.Create(ResourcesMaker.CreateUrl("ImagingContextExtension"),
                                                Path.Combine(this.acrGraphicsDir, "ImagingContextOverview.svg"));
                    }
                    {
                        FocusMapMaker focusMapMaker = new FocusMapMaker(this.fc,
                                                                        map,
                                                                        this.acrGraphicsDir,
                                                                        this.acrPageDir);
                        focusMapMaker.Create();
                    }
                }

                {
                    ResourceMap map = new ResourceMap();
                    map.AddDir(this.acrFragmentsDir, "*.json");

                    FragmentMapMaker fragmentMapMaker = new FragmentMapMaker(this.fc,
                                                                             map,
                                                                             this.acrGraphicsDir,
                                                                             this.pageTemplateDir);
                    fragmentMapMaker.Create(false);
                }
            }
            catch (Exception err)
            {
                Trace.WriteLine(err.Message);
                Assert.IsTrue(false);
            }

            TimeSpan span = DateTime.Now - start;

            Trace.WriteLine($"Ending D4_BuildGraphics [{(Int32)span.TotalSeconds}]");
        }
        public void B4_BuildGraphics()
        {
            DateTime start = DateTime.Now;

            Trace.WriteLine("Starting B4_BuildGraphics");
            try
            {
                {
                    ResourceMap map = new ResourceMap();
                    map.AddDir(this.resourcesDir, "*.json");
                    {
                        FocusMapMaker focusMapMaker = new FocusMapMaker(this.fc,
                                                                        map,
                                                                        this.graphicsDir,
                                                                        this.pageDir);
                        focusMapMaker.Create();
                    }
                    {
                        ResourceMapMaker resourceMapMaker = new ResourceMapMaker(this.fc, map);
                        resourceMapMaker.AlwaysShowChildren = true;
                        // resourceMapMaker.SvgEditor.RenderTestPoint = "Tumor Satellite";
                        String svgPath = Path.Combine(this.graphicsDir, "TotalProfile.svg");
                        resourceMapMaker.Create(ResourcesMaker.CreateUrl("BreastRadComposition"),
                                                svgPath);

                        // Create PNG Image from SVG-File
                        //var svgDoc = Svg.SvgDocument.Open(svgPath);
                        //svgDoc.AspectRatio = new SvgAspectRatio();
                        //svgDoc.ShapeRendering = SvgShapeRendering.Auto;

                        //String pngPath = Path.Combine(this.graphicsDir, "TotalProfile.png");
                        //Int32 dpi = 1;
                        //Int32 width = 2748 * dpi;
                        //Int32 height = 38028 * dpi;

                        //Bitmap bmp = svgDoc.Draw(width, height);
                        //bmp.Save(pngPath, ImageFormat.Png);
                    }
                    {
                        ResourceMapMaker resourceMapMaker = new ResourceMapMaker(this.fc, map);
                        resourceMapMaker.Create(ResourcesMaker.CreateUrl("BreastRadComposition"),
                                                Path.Combine(this.graphicsDir, "ProfileOverview.svg"));
                    }
                    {
                        ResourceMapMaker resourceMapMaker = new ResourceMapMaker(this.fc, map);
                        resourceMapMaker.Create(ResourcesMaker.CreateUrl("MGFinding"),
                                                Path.Combine(this.graphicsDir, "MgFindings.svg"));
                    }
                    {
                        ResourceMapMaker resourceMapMaker = new ResourceMapMaker(this.fc, map);
                        resourceMapMaker.Create(ResourcesMaker.CreateUrl("MRIFinding"),
                                                Path.Combine(this.graphicsDir, "MRIFindings.svg"));
                    }
                    {
                        ResourceMapMaker resourceMapMaker = new ResourceMapMaker(this.fc, map);
                        resourceMapMaker.Create(ResourcesMaker.CreateUrl("NMFinding"),
                                                Path.Combine(this.graphicsDir, "NMFindings.svg"));
                    }
                    {
                        ResourceMapMaker resourceMapMaker = new ResourceMapMaker(this.fc, map);
                        resourceMapMaker.Create(ResourcesMaker.CreateUrl("USFinding"),
                                                Path.Combine(this.graphicsDir, "USFindings.svg"));
                    }
                }

                {
                    ResourceMap map = new ResourceMap();
                    map.AddDir(this.fragmentsDir, "*.json");

                    FragmentMapMaker fragmentMapMaker = new FragmentMapMaker(this.fc,
                                                                             map,
                                                                             this.graphicsDir,
                                                                             this.pageTemplateDir);
                    fragmentMapMaker.Create(true);
                }
            }
            catch (Exception err)
            {
                Trace.WriteLine(err.Message);
                Assert.IsTrue(false);
            }

            TimeSpan span = DateTime.Now - start;

            Trace.WriteLine($"Ending B4_BuildGraphics [{(Int32)span.TotalSeconds}]");
        }