void WriteStroke(DebugCurve debugCurve) {
     var color = ValidColor(debugCurve.Color);
     WriteAttribute("stroke", color);
     WriteAttribute("stroke-opacity", debugCurve.Transparency/255.0);
     WriteAttribute("stroke-width", debugCurve.Width);
 }
        void ShowSegment(LongestNudgedSegment segment) {
            // ReSharper restore UnusedMember.Local
            var dd = GetObstacleBoundaries(Obstacles, "black");
            var segtop = segment.Edges.Max(e => Math.Max(e.Source.Y, e.Target.Y));
            var segbottom = segment.Edges.Min(e => Math.Min(e.Source.Y, e.Target.Y));
            var segx = segment.Start.X;
            var seg = new DebugCurve(80, 1, "brown", new LineSegment(new Point(segx, segbottom), new Point(segx, segtop)));

            LayoutAlgorithmSettings.ShowDebugCurvesEnumeration(dd.Concat(new[] { seg }));

        }
 void WriteDebugCurve(DebugCurve debugCurve) {
     WriteStartElement("path");
     WriteAttribute("fill", "none");
     var iCurve = debugCurve.Curve;
     WriteStroke(debugCurve);
     WriteAttribute("d", CurveString(iCurve));
     if (debugCurve.DashArray != null)
         WriteAttribute("style", DashArrayString(debugCurve.DashArray));
     WriteEndElement();            
 }
        static void FillGraph(Graph graph, DebugCurve[] debugCurves) {
            var gg = new GeometryGraph { DebugCurves = debugCurves};
            gg.Margins = 5;
            graph.GeometryGraph = gg;
            
            gg.UpdateBoundingBox();

           
          
        }
        //         ReSharper disable UnusedMember.Local
        internal static void ShowOrderedPaths(IEnumerable<Polyline> obstacles, IEnumerable<Path> paths, Point s, Point e) {
            //           ReSharper restore UnusedMember.Local
            string[] colors = { "red", "green", "blue", "violet", "rose", "black" };

            const double startWidth = 0.001;
            const double endWidth = 0.1;
            var dd = new List<DebugCurve>();
            if (obstacles != null)
                dd.AddRange(GetObstacleBoundaries(obstacles, "grey"));
            int i = 0;
            foreach (var path in paths)
                dd.AddRange(GetTestPathAsDebugCurve(startWidth, endWidth, colors[Math.Min(colors.Length - 1, i++)], path));

            var ell = new DebugCurve(1, "black", new Ellipse(0.01, 0.01, s));
            dd.Add(ell);
            dd.Add(new DebugCurve(1, "black", new Ellipse(0.02, 0.02, e)));
            LayoutAlgorithmSettings.ShowDebugCurvesEnumeration(dd.Concat(GetObstacleBoundaries(obstacles, "lightblue")));
        }
 static void ShowShapesOnGraphWithForm(DebugCurve[] debugCurves, Graph graph, Form f) {
     FillGraph(graph, debugCurves);
     try {
         DisplayGraph(graph, f);
     } catch (Exception e) {
         Console.WriteLine(e);
     }
 }
 static  void ShowDebugCurvesOnForm(DebugCurve[] debugCurves, Form f) {
     var g = new Graph("");
     ShowShapesOnGraphWithForm(debugCurves, g, f);
 }
 static Color GetFillColorFromString(DebugCurve curve) {
     if (curve.FillColor == null || curve.FillColor == "") return Color.Transparent;
     Drawing.Color msaglColor = StringToMsaglColor(curve.FillColor);
     msaglColor.A = curve.Transparency;
     return MsaglColorToDrawingColor(msaglColor);
 }
 static Color GetColorFromString(DebugCurve curve){
     Drawing.Color msaglColor = StringToMsaglColor(curve.Color);
     msaglColor.A = curve.Transparency;
     return MsaglColorToDrawingColor(msaglColor);
 }
Exemplo n.º 10
0
        static void DrawDebugCurve(DGraph graph, DebugCurve debugCurve, Graphics graphics) {

            using (var pen = new Pen(GetColorFromString(debugCurve), (float) debugCurve.Width)) 
            using (var brush=new SolidBrush(GetFillColorFromString(debugCurve))){
                if (debugCurve.DashArray != null) {
                    pen.DashStyle = DashStyle.Dash;
                    pen.DashPattern = CreateDashArray(debugCurve.DashArray);
                    pen.DashOffset = pen.DashPattern[0];
                }
                DrawDebugCurve(graph, debugCurve.Curve, pen, brush, graphics, debugCurve.Label);
            }
        }