Esempio n. 1
0
        public void draw(WFCanvas plot, bool isNodeActive, bool isNodeMarked, Color color)
        {
            if (isNodeActive)
            {
                circle.isActive = true;
            }
            else
            {
                circle.isActive = false;
            }

            if (isNodeMarked)
            {
                circle.fillColor = color;
            }
            else
            {
                circle.fillColor = Color.White;
            }

            plot.Circles.addCircle(circle);

            text.Color = Colors.getTextColorByBackground(circle.fillColor);

            plot.Texts.addText(text);
        }
Esempio n. 2
0
 public GraphVisual(WFCanvas _plot, Graph _graph)
 {
     plot  = _plot;
     graph = _graph;
     graph.edgeModified      += onEdgesChanged;
     graph.vertexAdded       += onVertexAdded;
     graph.vertexRemoved     += onVertexRemoved;
     graph.rewrite           += onRewrite;
     graph.isDirectedChanged += (object sender, GraphEventArgs e) => { IsDirected = (sender as Graph).IsDirected; };
     isInited = false;
     init();
 }
Esempio n. 3
0
 public void draw(WFCanvas plot)
 {
     if (isHidden)
     {
         Color = Color.FromArgb(10, Color.Black);
     }
     if (!hasPair || !isDirected)
     {
         Polygon arrow      = getArrowByLine(edge);
         Text    weigthText = getTextByLine(edge, (float)orderInPair / 2.0f);
         if (isDirected)
         {
             plot.Polygons.addPolygon(arrow);
         }
         if (hasWeight && !isHidden)
         {
             plot.Texts.addText(weigthText);
         }
         edge.Color = Color;
         plot.Lines.addLine(edge);
     }
     else
     {
         Polygon arrow      = getArrowByCurve(curve);
         Text    weigthText = getTextByLine(edge, 1.6f * offset);
         if (isDirected)
         {
             plot.Polygons.addPolygon(arrow);
         }
         if (hasWeight && !isHidden)
         {
             plot.Texts.addText(weigthText);
         }
         curve.color = Color;
         plot.Curves.addCurve(curve);
     }
 }