コード例 #1
0
 /// <summary>
 /// The constructor of GOM_Filling_Rectangle
 /// </summary>
 /// <param name="leftTop">The top left corner of the rectangle</param>
 /// <param name="righgDown">The right down corner of the rectangle</param>
 /// <param name="style">The filling style to fill the rectangle</param>
 public GOM_Filling_Rectangle(GOM_Point leftTop, GOM_Point righgDown, GOM_Style_Filling style)
 {
     m_points = new GOM_Points();
     m_points.Add(leftTop);
     m_points.Add(righgDown);
     m_style = style;
 }
コード例 #2
0
 /// <summary>
 /// The constructor of GOM_Filling_Pie
 /// </summary>
 /// <param name="leftTop">The top left corner of the bounding box of the ellipse which the pie belongs to</param>
 /// <param name="rightDown">The right down corner of the bounding box of the ellipse which the pie belongs to</param>
 /// <param name="startPoint">The start-point of the pie</param>
 /// <param name="endPoint">The end-point of the pie</param>
 /// <param name="style">The filling style to fill the pie</param>
 public GOM_Filling_Pie(GOM_Point leftTop, GOM_Point rightDown, GOM_Point startPoint, GOM_Point endPoint, GOM_Style_Filling style)
 {
     m_points = new GOM_Points();
     m_points.Add(leftTop);
     m_points.Add(rightDown);
     m_points.Add(startPoint);
     m_points.Add(endPoint);
     m_style = style;
 }
コード例 #3
0
        public void LoadFromXML(System.Xml.XmlNode node, GOM_ResourceArrays resources)
        {
            GOM_Point			pt;
            GOM_Points			rgPoints;
            GOM_Style_Filling	style;

            style = resources.FillingStyles["default"];
            rgPoints = new GOM_Points();

            for (int i = 0; i < node.Attributes.Count; i++)
            {
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.STYLE, true) == 0)
                {
                    style = resources.FillingStyles[node.Attributes[i].Value];
                }
            }

            for (int i = 0; i < node.ChildNodes.Count; i++)
            {
                if (System.String.Compare(node.ChildNodes[i].Name, GOM_TAGS.VERTEX, true) == 0)
                {
                    for (int j = 0; j < node.ChildNodes[i].Attributes.Count; j++)
                    {
                        if (System.String.Compare(node.ChildNodes[i].Attributes[j].Name, GOM_TAGS.POINT, true) == 0)
                        {
                            pt = resources.Points[node.ChildNodes[i].Attributes[j].Value];

                            if (pt == null)
                            {
                                throw new Exception("Missing points in polygon filling");
                            }

                            rgPoints.Add(pt);
                        }
                    }
                }
            }

            if (style == null)
            {
                throw new Exception("Missing style in polygon fillin");
            }

            this.m_points = rgPoints;
            this.m_style  = style;
        }
コード例 #4
0
 /// <summary>
 /// The constructor of GOM_Drawing_Arc
 /// </summary>
 /// <param name="leftTop">The left top corner of the bounding box of the ellipse which the arc belongs to</param>
 /// <param name="rightDown">The right down corner of the bounding box of the ellipse which the arc belongs to</param>
 /// <param name="startPoint">The start-point of the arc</param>
 /// <param name="endPoint">The end-point of the arc</param>
 /// <param name="style">The drawing style of the arc</param>
 public GOM_Drawing_Arc(GOM_Point leftTop, GOM_Point rightDown, GOM_Point startPoint, GOM_Point endPoint, GOM_Style_Drawing style, float rotateAngle)
 {
     m_points = new GOM_Points();
     m_points.Add(leftTop);
     m_points.Add(rightDown);
     m_points.Add(startPoint);
     m_points.Add(endPoint);
     m_style = style;
     m_rotateAngle = rotateAngle;
 }
コード例 #5
0
 /// <summary>
 /// The constructor of GOM_Drawing_Line
 /// </summary>
 /// <param name="startPoint">The start-point of the line</param>
 /// <param name="endPoint">The end-point of the line</param>
 /// <param name="style">The drawing style of line</param>
 public GOM_Drawing_Line(GOM_Point startPoint, GOM_Point endPoint, GOM_Style_Drawing style)
 {
     m_points = new GOM_Points();
     m_points.Add(startPoint);
     m_points.Add(endPoint);
     m_style = style;
 }
コード例 #6
0
 public GOM_Point GetPointByName(string name)
 {
     GOM_Points others = new GOM_Points();
     others.Add(m_Top_Connector);
     others.Add(m_Bottom_Connector);
     others.Add(m_Left_Connector);
     others.Add(m_Right_Connector);
     others.Add(m_Rotation_Point);
     others.Add(m_SW_Resize_Point);
     others.Add(m_NE_Resize_Point);
     others.Add(m_SE_Resize_Point);
     others.Add(m_NW_Resize_Point);
     return others[name];
 }
コード例 #7
0
 private GOM_Points LoadPointsFromXML(System.Xml.XmlNode node)
 {
     GOM_Points points = new GOM_Points();
     for( int i=0; i<node.ChildNodes.Count; i++ )
     {
         if ( string.Compare(node.ChildNodes[i].Name,GOM_TAGS.POINT,true) == 0 )
         {
             GOM_Point pt = new GOM_Point();
             pt.LoadFromXML(node.ChildNodes[i], null);
             points.Add(pt);
         }
     }
     return points;
 }
コード例 #8
0
        private GOM_Points GetDrawingPoints()
        {
            GOM_Points points = new GOM_Points();
            for( int i=0; i<rgDrawings.Count; i++ )
            {
                GOM_Interface_Drawing drawing = rgDrawings[i];
                for( int j=0; j<drawing.Points.Count; j++ )
                {
                    if ( drawing.Points[j].id == null || drawing.Points[j].id.Length<= 0 )
                    {
                        drawing.Points[j].id = Guid.NewGuid().ToString("D");
                    }

                    if ( points[drawing.Points[j].id] == null )
                    {
                        points.Add( drawing.Points[j] );
                    }
                }
            }
            return points;
        }
コード例 #9
0
        /// <summary>
        /// Clone a filling operation
        /// </summary>
        /// <param name="filling">The original filling operation</param>
        /// <returns>If successful, a drawing operation is returned. Otherwise, null is returned.</returns>
        private GOM_Interface_Filling CloneFilling(GOM_Interface_Filling filling)
        {
            if (filling is GOM_Filling_Ellipse)
            {
                return new GOM_Filling_Ellipse(Points(filling.Points[0].id), Points(filling.Points[1].id), FillingStyles(filling.Style.id));
            }

            if (filling is GOM_Filling_FillPath)
            {
                GOM_Drawings	drawings;

                drawings = new GOM_Drawings();

                for (int i = 0; i < ((GOM_Filling_FillPath)filling).Drawings.Count; i++)
                {
                    drawings.Add(CloneDrawing(((GOM_Filling_FillPath)filling).Drawings[i]));
                }

                return new GOM_Filling_FillPath(drawings, FillingStyles(filling.Style.id));
            }

            if (filling is GOM_Filling_Pie)
            {
                return new GOM_Filling_Pie(Points(filling.Points[0].id), Points(filling.Points[1].id), Points(filling.Points[2].id), Points(filling.Points[3].id), FillingStyles(filling.Style.id));
            }

            if (filling is GOM_Filling_Polygon)
            {
                GOM_Points	rgPts;

                rgPts = new GOM_Points();

                for (int i = 0; i < filling.Points.Count; i++)
                {
                    rgPts.Add(Points(filling.Points[i].id));
                }

                return new GOM_Filling_Polygon(rgPts, FillingStyles(filling.Style.id));
            }

            if (filling is GOM_Filling_Rectangle)
            {
                return new GOM_Filling_Rectangle(Points(filling.Points[0].id), Points(filling.Points[1].id), FillingStyles(filling.Style.id));
            }

            return null;
        }
コード例 #10
0
        /// <summary>
        /// Clone a drawing operation
        /// </summary>
        /// <param name="drawing">The original drawing operation</param>
        /// <returns>If successful, a drawing operation is returned. Otherwise, null is returned.</returns>
        private GOM_Interface_Drawing CloneDrawing(GOM_Interface_Drawing drawing)
        {
            if (drawing is GOM_Drawing_Line)
            {
                return new GOM_Drawing_Line(Points(drawing.Points[0].id), Points(drawing.Points[1].id), DrawingStyles(drawing.Style.id));
            }

            if (drawing is GOM_Drawing_Arc)
            {
                return new GOM_Drawing_Arc(Points(drawing.Points[0].id), Points(drawing.Points[1].id), Points(drawing.Points[2].id), Points(drawing.Points[3].id), DrawingStyles(drawing.Style.id), 0);
            }

            if (drawing is GOM_Drawing_Bezier)
            {
                GOM_Points	rgPts;

                rgPts = new GOM_Points();

                for (int i = 0; i < drawing.Points.Count; i++)
                {
                    rgPts.Add(Points(drawing.Points[i].id));
                }

                return new GOM_Drawing_Bezier(rgPts, DrawingStyles(drawing.Style.id));
            }

            return null;
        }