示例#1
0
 private void createShapes()
 {
     // disable eventing, otherwise, for each line added the whole panel would get reconfigured
     // which would lead to a poor startup performance
     EventingSuspend();
     // the ground is a lit surface
     if (m_surface == null)
     {
         List <ILArray <double> > mesh = Computation.CreateMesh(-m_max, m_max, m_lowCut, 0, m_res);
         m_surface         = new ILLitSurface(m_panel, mesh[0], mesh[1], mesh[2], new ILColormap(Colormaps.Jet));
         m_surface.Opacity = 190;
         Add(m_surface);
     }
     if (m_lines == null)
     {
         // we create all individual lines and save them (redundantly) for later convenient reference.
         // (the grid is made out of individual line shapes)
         List <ILArray <double> > lines = Computation.CreateLines(-m_max, m_max,
                                                                  m_lowCut, 0, m_res, m_gridSpacing, m_linesPositionOffset);
         m_lines = new List <ILLine>();
         for (int i = 0; i < lines[0].Dimensions[1]; i++)
         {
             // x - grid
             ILLine line = new ILLine(m_panel, lines[0][null, i], lines[1][null, i], lines[2][null, i]);
             line.Properties.Color = m_gridProperties.Color;
             line.Label.Text       = "";
             line.Properties.Width = m_gridProperties.Width;
             line.CustomCenter     = new ILPoint3Df(0, 0, -200);
             m_lines.Add(line);
             Add(line);
             // y - grid
             line = new ILLine(m_panel, lines[1][null, i], lines[0][null, i], lines[2][null, i]);
             line.Properties.Color = m_gridProperties.Color;
             line.Label.Text       = "";
             line.Properties.Width = m_gridProperties.Width;
             line.CustomCenter     = new ILPoint3Df(0, 0, -200);
             m_lines.Add(line);
             Add(line);
         }
     }
     // re-enable eventing, still one shape to be added: the sphere, which will cause a reconfiguration
     // of the whole panel
     EventingResume();
     // lit sphere
     if (m_sphere == null)
     {
         m_sphere = new ILLitSphere(m_panel, new ILPoint3Df(0, 0, 1.4f), 1.8f, Color.FromArgb(190, Color.Gold));
         Add(m_sphere);
         m_sphere.Label.Text = "";
         m_sphere.Opacity    = 190;
     }
 }