コード例 #1
0
        /// <summary>
        /// The constructor of GOM_Template
        /// </summary>
        public GOM_Template()
        {
            id				= "";
            extScale		= false;
            extRotate		= false;
            extConnect		= false;
            keepAspectRatio	= false;

            rgPoints		= new GOM_Points();
            rgEditingModes	= new GOM_Strings();
            rgDrawings		= new GOM_Drawings();
            rgFillings		= new GOM_Fillings();
            rgDrawingStyles = new GOM_Drawing_Styles();
            rgFillingStyles = new GOM_Filling_Styles();

            GOM_Style_Drawing	drawing;
            GOM_Style_Filling	filling;

            drawing		= new GOM_Style_Drawing();
            drawing.id	= "default";
            rgDrawingStyles.Add(drawing);

            filling		= new GOM_Style_Filling();
            filling.id	= "default";
            rgFillingStyles.Add(filling);
        }
コード例 #2
0
        public GOM_Link(System.Xml.XmlNode node, GOM_ResourceArrays resources)
        {
            m_startStyle	= GOMLib.GOM_Terminal_Style.None;
            m_endStyle		= GOMLib.GOM_Terminal_Style.Triangle;
            m_drawingStyle	= new GOMLib.GOM_Style_Drawing();
            m_linkingStyle	= GOM_Linking_Style.Line;
            m_keyPts		= new GOM_Points();

            m_drawingStyle.id = "default";

            LoadFromXML(node, resources);
        }
コード例 #3
0
        public GOM_Link(GOM_Interface_Graphic_Object startObj, GOM_Point startPt, GOM_Interface_Graphic_Object endObj, GOM_Point endPt, GOM_Style_Drawing drawingStyle, GOM_Linking_Style linkingStyle, GOM_Terminal_Style startStyle, GOM_Terminal_Style endStyle)
        {
            m_startObj		= startObj;
            m_endObj		= endObj;
            m_startPt		= startPt;
            m_endPt			= endPt;
            m_startStyle	= startStyle;
            m_endStyle		= endStyle;
            m_drawingStyle	= drawingStyle;
            m_linkingStyle	= linkingStyle;
            m_keyPts		= new GOM_Points();

            m_drawingStyle.id = "default";
        }
コード例 #4
0
        /// <summary>
        /// Add a drawing or filling style to current template
        /// </summary>
        /// <param name="node">The XML node that represents a drawing or filling style</param>
        private void LoadStyleFromXML(System.Xml.XmlNode node)
        {
            if (System.String.Compare(node.Name, GOM_TAGS.DRAWING_STYLE, true) == 0)
            {
                GOM_Style_Drawing	style = new GOM_Style_Drawing();

                style.LoadFromXML( node, null );

                rgDrawingStyles.AddAndReplace(style);
            }

            if (System.String.Compare(node.Name, GOM_TAGS.FILLING_STYLE, true) == 0)
            {
                GOM_Style_Filling	style = new GOM_Style_Filling();

                style.LoadFromXML( node, null );

                rgFillingStyles.AddAndReplace(style);
            }
        }
コード例 #5
0
        public void LoadFromXML(System.Xml.XmlNode node, GOM_ResourceArrays resources)
        {
            GOM_Point			startPt	= null;
            GOM_Point			endPt	= null;
            GOM_Style_Drawing	style;

            style = resources.DrawingStyles["default"];

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

            if ((startPt == null) || (endPt == null))
            {
                throw new Exception("Missing points in line drawing");
            }

            if (style == null)
            {
                throw new Exception("Missing style in line drawing");
            }

            this.m_points.Add(startPt);
            this.m_points.Add(endPt);
            m_style = style;
        }
コード例 #6
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;
 }
コード例 #7
0
        public void LoadFromXML(System.Xml.XmlNode node, GOM_ResourceArrays resources)
        {
            GOM_Point			pt;
            GOM_Points			rgPoints;
            GOM_Style_Drawing	style;

            style = resources.DrawingStyles["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.DrawingStyles[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 bezier drawing");
                            }

                            rgPoints.Add(pt);
                        }
                    }
                }
            }

            if (rgPoints.Count < 4)
            {
                throw new Exception("Missing points in bezier drawing");
            }

            if (((rgPoints.Count - 4) % 3) != 0)
            {
                throw new Exception("Incorrect number of points in bezier drawing");
            }

            if (style == null)
            {
                throw new Exception("Missing style in bezier drawing");
            }

            this.m_points = rgPoints;
            this.m_style = style;
        }
コード例 #8
0
 /// <summary>
 /// The constructor of GOM_Drawing_Bezier
 /// </summary>
 /// <param name="points">The points used to define the bezier curve</param>
 /// <param name="style">The drawing style of the bezier curve</param>
 public GOM_Drawing_Bezier(GOM_Points points, GOM_Style_Drawing style)
 {
     m_style = style;
     m_points = points;
 }
コード例 #9
0
        public void LoadFromXML(System.Xml.XmlNode node, GOM_ResourceArrays resources)
        {
            GOM_Point			startPt		= null;
            GOM_Point			endPt		= null;
            GOM_Point			leftTop		= null;
            GOM_Point			rightDown	= null;
            GOM_Style_Drawing	style;

            m_rotateAngle = 0F;
            style = resources.DrawingStyles["default"];

            for (int i = 0; i < node.Attributes.Count; i++)
            {
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.STYLE, true) == 0)
                {
                    style = resources.DrawingStyles[node.Attributes[i].Value];
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.START_POINT, true) == 0)
                {
                    startPt = resources.Points[node.Attributes[i].Value];
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.END_POINT, true) == 0)
                {
                    endPt = resources.Points[node.Attributes[i].Value];
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.LEFT_TOP, true) == 0)
                {
                    leftTop = resources.Points[node.Attributes[i].Value];
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.RIGHT_DOWN, true) == 0)
                {
                    rightDown = resources.Points[node.Attributes[i].Value];
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.ROTATION, true) == 0)
                {
                    m_rotateAngle = float.Parse(node.Attributes[i].Value);
                }
            }

            if ((startPt == null) || (endPt == null) || (leftTop == null) || (rightDown == null))
            {
                throw new Exception("Missing points in arc drawing");
            }

            if (style == null)
            {
                throw new Exception("Missing style in arc drawing");
            }

            m_points.Add(leftTop);
            m_points.Add(rightDown);
            m_points.Add(startPt);
            m_points.Add(endPt);
            m_style = style;
        }
コード例 #10
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;
 }
コード例 #11
0
 public GOM_Object_Sketch()
 {
     m_id			= Guid.NewGuid().ToString("D");
     m_boundingBox	= new System.Drawing.RectangleF(0, 0, 0, 0);
     rgSketchSet		= new System.Collections.ArrayList();
     rgStrokeToSketch= new System.Collections.ArrayList();
     rgDrawings	= new GOM_Drawings();
     strokeStyle	= new GOM_Style_Drawing();
     strokeStyle.id = "default";
     strokeStyle.drawingStyle = new System.Drawing.Pen(System.Drawing.Color.Green, 1);
 }
コード例 #12
0
        /// <summary>
        /// Initialize the graphic object according to a given template
        /// </summary>
        /// <param name="template"></param>
        public void InitializeFromTemplate(GOM_Template template)
        {
            //Initialize property
            this.m_template			= template;
            this.extConnect			= template.extConnect;
            this.extRotate			= template.extRotate;
            this.extScale			= template.extScale;
            this.keepAspectRatio	= template.keepAspectRatio;
            //Clear up existing data
            this.rgPoints.Clear();
            this.rgFillings.Clear();
            this.rgDrawings.Clear();
            this.rgEditingModes.Clear();
            this.rgDrawingStyles.Clear();
            this.rgFillingStyles.Clear();
            //Initialize editing mode
            for (int i = 0; i < template.rgEditingModes.Count; i++)
            {
                this.rgEditingModes.Add(template.rgEditingModes[i]);
            }
            //Initialize drawing styles
            for (int i = 0; i < template.rgDrawingStyles.Count; i++)
            {
                GOM_Style_Drawing	style;

                style = new GOM_Style_Drawing();
                style.id = template.rgDrawingStyles[i].id;
                style.drawingStyle = (System.Drawing.Pen)template.rgDrawingStyles[i].drawingStyle.Clone();

                this.rgDrawingStyles.Add(style);
            }
            //Initialize filling styles
            for (int i = 0; i < template.rgFillingStyles.Count; i++)
            {
                GOM_Style_Filling	style;

                style = new GOM_Style_Filling();
                style.id = template.rgFillingStyles[i].id;
                style.fillingStyle = (System.Drawing.Brush)template.rgFillingStyles[i].fillingStyle.Clone();

                this.rgFillingStyles.Add(style);
            }
            //Initialize basic properties of points
            for (int i = 0; i < template.rgPoints.Count; i++)
            {
                GOM_Point	pt;

                pt = new GOM_Point();
                pt.id = template.rgPoints[i].id;
                pt.x = template.rgPoints[i].x;
                pt.y = template.rgPoints[i].y;
                pt.Connectable = template.rgPoints[i].Connectable;
                pt.Controllable = template.rgPoints[i].Controllable;

                this.rgPoints.Add(pt);
            }
            //Initialize drawing operations
            for (int i = 0; i < template.rgDrawings.Count; i++)
            {
                rgDrawings.Add(CloneDrawing(template.rgDrawings[i]));
            }
            //Initialize filling operations
            for (int i = 0; i < template.rgFillings.Count; i++)
            {
                rgFillings.Add(CloneFilling(template.rgFillings[i]));
            }
            //Initialize constraints of points
            for (int i = 0; i < template.rgPoints.Count; i++)
            {
                for (int j = 0; j < template.rgPoints[i].Constraints.Count; j++)
                {
                    GOM_Constraint_Set	constraintSet;

                    constraintSet = new GOM_Constraint_Set();

                    for (int k = 0; k < template.rgPoints[i].Constraints[j].Count; k++)
                    {
                        constraintSet.Add(CloneConstraint(template.rgPoints[i].Constraints[j][k]));
                    }

                    rgPoints[i].Constraints.Add(constraintSet);
                }
            }

            CalculateBoundingBox();

            //from template
            #region new_modified
            if (template.var_list != null)
            {
                var_list = template.var_list.clone();
            }

            if (template.res_list != null)
            {
                res_list = template.res_list.clone();
            }
            #endregion
        }