コード例 #1
0
        private void SetLayerCoordinates(Layer currentLayer, int NodesPerParent, int TotalNodes, double Distance)
        {
            double d_angle = MapMath.FindDiffAngle(TotalNodes);
            double rad     = 0;

            rad = MapMath.FindArcRadius(d_angle, Distance);
            MPoint   currentPoint = null;
            PageNode parent       = null;
            int      i            = 0;

            foreach (PageNode pn in currentLayer.Links)
            {
                if (parent != pn.Parent)
                {
                    parent       = pn.Parent;
                    currentPoint = GetInitialPoint(parent, NodesPerParent, d_angle, rad, ref i);
                }
                else
                {
                    currentPoint = MapMath.TransformPoint(-1 * d_angle, currentPoint);
                }
                pn.Position = currentPoint;
                pn.Index    = i++;
            }
            MapMath.MINRAD = rad;
        }
コード例 #2
0
        public MPoint GetInitialPoint(PageNode Parent, int NodesPerParent, double angle, double Rad, ref int MyIndex)
        {
            MPoint point1 = new MPoint(0, Rad);

            MyIndex = NodesPerParent * Parent.Index;
            //for (int i = 0; i < MyIndex; i++ )
            point1 = MapMath.TransformPoint(-1 * MyIndex * angle, point1);
            return(point1);
        }
コード例 #3
0
 private void txtBox_TextChanged(object sender, EventArgs e)
 {
     if (sender.GetType() == typeof(TextBox))
     {
         TextBox temp = (TextBox)sender;
         if (!MapMath.IsNumeric(temp.Text) && temp.Text != "")
         {
             temp.Text = m_testtext;
         }
     }
 }
コード例 #4
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            InitializeDataStructure(Convert.ToInt32(txtLevels.Text), Convert.ToInt32(txtLeafs.Text));
            MapGenerator mg = new MapGenerator(Convert.ToDouble(txtDMin.Text));

            mg.GenerateMap(m_rootlayer);
            int size = ((int)Math.Ceiling(MapMath.MINRAD)) * 2;

            MapMath.MINRAD = 0;
            ImageGenerator   ig        = new ImageGenerator(size, size, MapMath.FindMiddle(size, size));
            Queue <PageNode> NodeQueue = m_rootlayer.GetAllLinks();

            pbImage.Height = size;
            pbImage.Width  = size;
            pbImage.Image  = ig.GenerateImage(ref NodeQueue);
            pbImage.Refresh();
        }