Пример #1
0
        public void join_path(PathStorage vs, uint path_id)
        {
            double x, y;

            vs.Rewind(path_id);
            uint PathAndFlags = vs.Vertex(out x, out y);

            if (!Path.IsStop(PathAndFlags))
            {
                if (Path.IsVertex(PathAndFlags))
                {
                    double x0, y0;
                    uint   PathAndFlags0 = last_vertex(out x0, out y0);
                    if (Path.IsVertex(PathAndFlags0))
                    {
                        if (PictorMath.CalculateDistance(x, y, x0, y0) > PictorMath.vertex_dist_epsilon)
                        {
                            if (Path.IsMoveTo(PathAndFlags))
                            {
                                PathAndFlags = (uint)Path.EPathCommands.LineTo;
                            }
                            m_vertices.add_vertex(x, y, PathAndFlags);
                        }
                    }
                    else
                    {
                        if (Path.IsStop(PathAndFlags0))
                        {
                            PathAndFlags = (uint)Path.EPathCommands.MoveTo;
                        }
                        else
                        {
                            if (Path.IsMoveTo(PathAndFlags))
                            {
                                PathAndFlags = (uint)Path.EPathCommands.LineTo;
                            }
                        }
                        m_vertices.add_vertex(x, y, PathAndFlags);
                    }
                }
                while (!Path.IsStop(PathAndFlags = vs.Vertex(out x, out y)))
                {
                    m_vertices.add_vertex(x, y, Path.IsMoveTo(PathAndFlags) ?
                                          (uint)Path.EPathCommands.LineTo :
                                          PathAndFlags);
                }
            }
        }
Пример #2
0
        //-----------------------------------------------------------BoundingRect
        //template<class VertexSource, class GetId, class CoordT>
        public static bool GetBoundingRect(PathStorage vs, uint[] gi,
						   uint start, uint num,
						   out double x1, out double y1, out double x2, out double y2)
        {
            uint i;
            double x = 0;
            double y = 0;
            bool first = true;

            x1 = (double)(1);
            y1 = (double)(1);
            x2 = (double)(0);
            y2 = (double)(0);

            for (i = 0; i < num; i++)
            {
                vs.Rewind(gi[start + i]);
                uint PathAndFlags;
                while (!Path.IsStop(PathAndFlags = vs.Vertex(out x, out y)))
                {
                    if (Path.IsVertex(PathAndFlags))
                    {
                        if (first)
                        {
                            x1 = (double)(x);
                            y1 = (double)(y);
                            x2 = (double)(x);
                            y2 = (double)(y);
                            first = false;
                        }
                        else
                        {
                            if ((double)(x) < x1) x1 = (double)(x);
                            if ((double)(y) < y1) y1 = (double)(y);
                            if ((double)(x) > x2) x2 = (double)(x);
                            if ((double)(y) > y2) y2 = (double)(y);
                        }
                    }
                }
            }
            return x1 <= x2 && y1 <= y2;
        }
Пример #3
0
 public void Line(double x1, double y1, double x2, double y2, RGBA_Bytes color)
 {
     PathStorage m_LinesToDraw = new PathStorage();
     m_LinesToDraw.RemoveAll();
     m_LinesToDraw.move_to(x1, y1);
     m_LinesToDraw.line_to(x2, y2);
     StrokeConverter StrockedLineToDraw = new StrokeConverter(m_LinesToDraw);
     Render(StrockedLineToDraw, color);
 }
Пример #4
0
        public SliderWidget(double x1, double y1, double x2, double y2)
            : base(x1, y1, x2, y2)
        {
            m_border_width = 1.0;
            m_border_extra = ((y2 - y1) / 2);
            m_text_thickness = (1.0);
            m_pdx = (0.0);
            m_mouse_move = false;
            m_value = (0.5);
            m_preview_value = (0.5);
            m_min = (0.0);
            m_max = (1.0);
            m_num_steps = (0);
            m_descending = (false);
            m_ellipse = new VertexSource.Ellipse();
            m_storage = new PathStorage();
            m_text = new GsvText();
            m_text_poly = new StrokeConverter(m_text);

            CalculateBox();

            m_background_color = (new RGBA_Doubles(1.0, 0.9, 0.8));
            m_triangle_color = (new RGBA_Doubles(0.7, 0.6, 0.6));
            m_text_color = (new RGBA_Doubles(0.0, 0.0, 0.0));
            m_pointer_preview_color = (new RGBA_Doubles(0.6, 0.4, 0.4, 0.4));
            m_pointer_color = (new RGBA_Doubles(0.8, 0.0, 0.0, 0.6));
        }
Пример #5
0
 //--------------------------------------------------------------------
 // Join path. The path is joined with the existing one, that is,
 // it behaves as if the pen of a plotter was always down (drawing)
 //template<class VertexSource>
 public void join_path(PathStorage vs)
 {
     join_path(vs, 0);
 }
Пример #6
0
 public void join_path(PathStorage vs, uint path_id)
 {
     double x, y;
     vs.Rewind(path_id);
     uint PathAndFlags = vs.Vertex(out x, out y);
     if (!Path.IsStop(PathAndFlags))
     {
         if (Path.IsVertex(PathAndFlags))
         {
             double x0, y0;
             uint PathAndFlags0 = last_vertex(out x0, out y0);
             if (Path.IsVertex(PathAndFlags0))
             {
                 if (PictorMath.CalculateDistance(x, y, x0, y0) > PictorMath.vertex_dist_epsilon)
                 {
                     if (Path.IsMoveTo(PathAndFlags)) PathAndFlags = (uint)Path.EPathCommands.LineTo;
                     m_vertices.add_vertex(x, y, PathAndFlags);
                 }
             }
             else
             {
                 if (Path.IsStop(PathAndFlags0))
                 {
                     PathAndFlags = (uint)Path.EPathCommands.MoveTo;
                 }
                 else
                 {
                     if (Path.IsMoveTo(PathAndFlags)) PathAndFlags = (uint)Path.EPathCommands.LineTo;
                 }
                 m_vertices.add_vertex(x, y, PathAndFlags);
             }
         }
         while (!Path.IsStop(PathAndFlags = vs.Vertex(out x, out y)))
         {
             m_vertices.add_vertex(x, y, Path.IsMoveTo(PathAndFlags) ?
                                             (uint)Path.EPathCommands.LineTo :
                                             PathAndFlags);
         }
     }
 }
Пример #7
0
 //--------------------------------------------------------------------
 // Join path. The path is joined with the existing one, that is,
 // it behaves as if the pen of a plotter was always down (drawing)
 //template<class VertexSource>
 public void join_path(PathStorage vs)
 {
     join_path(vs, 0);
 }