Пример #1
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);
        }
 public void LoadFromXML(System.Xml.XmlNode node, GOM_ResourceArrays resources)
 {
     // Basic properties
     for (int i = 0; i < node.Attributes.Count; i++)
     {
         if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.ID, true) == 0)
         {
             id = node.Attributes[i].Value;
         }
         if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.X, true) == 0)
         {
             x = float.Parse(node.Attributes[i].Value);
         }
         if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.Y, true) == 0)
         {
             y = float.Parse(node.Attributes[i].Value);
         }
         if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.CONNECTABLE, true) == 0)
         {
             Connectable = bool.Parse(node.Attributes[i].Value);
         }
         if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.CONTROLLABLE, true) == 0)
         {
             Controllable = bool.Parse(node.Attributes[i].Value);
         }
     }
 }
        public void LoadConstraintsFromXML(System.Xml.XmlNode node, GOM_ResourceArrays resources)
        {
            GOM_Interface_Constraint	constraint;
            GOM_Constraint_Set			constraint_set;
            string						editingMode;
            for (int i = 0; i < node.ChildNodes.Count; i++)
            {
                if (System.String.Compare(node.ChildNodes[i].Name, GOM_TAGS.ON_POSITION_CHANGE, true) == 0)
                {
                    editingMode = "default";
                    for (int j = 0; j < node.ChildNodes[i].Attributes.Count; j++)
                    {
                        if (System.String.Compare(node.ChildNodes[i].Attributes[j].Name, GOM_TAGS.EDITING_MODE, true) == 0)
                        {
                            editingMode = node.ChildNodes[i].Attributes[j].Value;
                        }
                    }

                    constraint_set = new GOM_Constraint_Set();
                    constraint_set.EditingMode = editingMode;

                    for (int j = 0; j < node.ChildNodes[i].ChildNodes.Count; j++)
                    {
                        constraint = GOM_Utility.LoadConstraintFromXML(node.ChildNodes[i].ChildNodes[j],resources.Points);
                        if (constraint != null)
                        {
                            constraint_set.Add(constraint);
                        }
                    }

                    Constraints.Add(constraint_set);
                }
            }
        }
 /// <summary>
 /// Load assignment constraint from xml node.
 /// </summary>
 /// <param name="node">The xml node</param>
 public void LoadFromXML(System.Xml.XmlNode node, GOM_ResourceArrays resources)
 {
     // TODO: LoadFromXML
 }
 public void LoadFromXML(System.Xml.XmlNode node, GOM_ResourceArrays resources)
 {
     m_value = float.Parse(node.InnerText);
 }
Пример #6
0
        /// <summary>
        /// Load the link from XmlNode.
        /// </summary>
        /// <param name="node">The XmlNode.</param>
        /// <param name="resources">GOM resource.</param>
        public void LoadFromXML(System.Xml.XmlNode node, GOM_ResourceArrays resources)
        {
            GOM_Utility.VerifyXmlNode(node, GOM_TAGS.CONNECTION);

            for( int i=0; i<node.Attributes.Count; i++ )
            {
            //				if ( string.Compare(node.Attributes[i].Name,GOM_TAGS.DRAWING_STYLE) == 0 )
            //				{
            //					this.m_drawingStyle = resources.DrawingStyles[node.Attributes[i].Value];
            //				}
                if ( string.Compare(node.Attributes[i].Name,GOM_TAGS.LINKING_STYLE) == 0 )
                {
                    this.m_linkingStyle = ConvertStringToLinkingStyle(node.Attributes[i].Value);
                }
            }

            GOM_Utility.VerifyXmlNode(node.ChildNodes[0], GOM_TAGS.POINT);
            GOM_Utility.VerifyXmlNode(node.ChildNodes[1], GOM_TAGS.POINT);
            // 1st pass
            //   objectID
            for( int i=0; i<node.ChildNodes[0].Attributes.Count; i++ )
            {
                if ( string.Compare(node.ChildNodes[0].Attributes[i].Name, GOM_TAGS.OBJECTID) == 0 )
                {
                    this.m_startObj = GOM_Utility.RecursiveFindObject(node.ChildNodes[0].Attributes[i].Value, resources.Objects);
                }
            }
            for( int i=0; i<node.ChildNodes[1].Attributes.Count; i++ )
            {
                if ( string.Compare(node.ChildNodes[1].Attributes[i].Name, GOM_TAGS.OBJECTID) == 0 )
                {
                    this.m_endObj = GOM_Utility.RecursiveFindObject(node.ChildNodes[1].Attributes[i].Value, resources.Objects);
                }
            }
            if ( m_startObj==null || m_endObj==null )
            {
                throw new System.Xml.XmlException("Missing points in the connection.");
            }

            //			if ( !(m_startObj is GOM_Object_Primitive) || !(m_endObj is GOM_Object_Primitive) )
            //			{
            //				throw new System.Xml.XmlException("Terminal points' objects are not all primitives.");
            //			}

            // 2nd pass
            //   pointID
            //   terminalStyle
            for( int i=0; i<node.ChildNodes[0].Attributes.Count; i++ )
            {
                if ( string.Compare(node.ChildNodes[0].Attributes[i].Name, GOM_TAGS.POINTID) == 0 )
                {
                    this.m_startPt = m_startObj.GetPointByName(node.ChildNodes[0].Attributes[i].Value);
                }
                if ( string.Compare(node.ChildNodes[0].Attributes[i].Name, GOM_TAGS.TERMINAL_STYLE) == 0 )
                {
                    this.m_startStyle = ConvertStringToTerminalStyle(node.ChildNodes[0].Attributes[i].Value);
                }
            }
            for( int i=0; i<node.ChildNodes[1].Attributes.Count; i++ )
            {
                if ( string.Compare(node.ChildNodes[1].Attributes[i].Name, GOM_TAGS.POINTID) == 0 )
                {
                    this.m_endPt = m_endObj.GetPointByName(node.ChildNodes[1].Attributes[i].Value);
                }
                if ( string.Compare(node.ChildNodes[1].Attributes[i].Name, GOM_TAGS.TERMINAL_STYLE) == 0 )
                {
                    this.m_endStyle = ConvertStringToTerminalStyle(node.ChildNodes[1].Attributes[i].Value);
                }
            }

            if ( m_startPt==null || m_endPt==null )
            {
                throw new System.Xml.XmlException("Cannot find find terminal points.");
            }

            // Drawing style
            this.m_drawingStyle.LoadFromXML( node.ChildNodes[2], resources );

            // Key points
            GOM_Utility.VerifyXmlNode(node.ChildNodes[3], GOM_TAGS.KEYPOINTS);
            for(int i=0; i<node.ChildNodes[3].ChildNodes.Count; i++ )
            {
                if ( string.Compare(node.ChildNodes[3].ChildNodes[i].Name, GOM_TAGS.POINT, true) == 0 )
                {
                    GOM_Point keyPoint = new GOM_Point();
                    for(int j=0; j<node.ChildNodes[3].ChildNodes[i].Attributes.Count; j++ )
                    {
                        if ( string.Compare(node.ChildNodes[3].ChildNodes[i].Attributes[j].Name, GOM_TAGS.X, true) == 0 )
                        {
                            keyPoint.x = float.Parse(node.ChildNodes[3].ChildNodes[i].Attributes[j].Value);
                        }
                        if ( string.Compare(node.ChildNodes[3].ChildNodes[i].Attributes[j].Name, GOM_TAGS.Y, true) == 0 )
                        {
                            keyPoint.y = float.Parse(node.ChildNodes[3].ChildNodes[i].Attributes[j].Value);
                        }
                    }
                    m_keyPts.Add(keyPoint);
                }
            }
        }
        public void LoadFromXML(System.Xml.XmlNode node, GOM_ResourceArrays resources)
        {
            GOM_Point				leftTop		= null;
            GOM_Point				rightDown	= null;
            GOM_Style_Filling		style;

            style = resources.FillingStyles["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.FillingStyles[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 ((leftTop == null) || (rightDown == null))
            {
                throw new Exception("Missing points in rectangle filling");
            }

            if (style == null)
            {
                throw new Exception("Missing style in rectangle filling");
            }

            this.m_points.Add(leftTop);
            this.m_points.Add(rightDown);
            this.m_style = style;
        }
        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;
        }
        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
        public void LoadFromXML(System.Xml.XmlNode node, GOM_ResourceArrays resources)
        {
            GOM_Utility.VerifyXmlNode(node, GOM_TAGS.GRAPHIC_OBJECT);

            //Load properties of the graphic object
            for (int i = 0; i < node.Attributes.Count; i++)
            {
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.ID, true) == 0)
                {
                    id = node.Attributes[i].Value;
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.TYPE, true) == 0)
                {
                    if (!node.Attributes[i].Value.Equals("group"))
                    {
                        throw new Exception("Invalid input. Not a group object node!");
                    }
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.X_OFFSET, true) == 0)
                {
                    m_xOffset = float.Parse(node.Attributes[i].Value);
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.Y_OFFSET, true) == 0)
                {
                    m_yOffset = float.Parse(node.Attributes[i].Value);
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.ROTATION, true) == 0)
                {
                    m_rotation = float.Parse(node.Attributes[i].Value);
                }
            }

            this.rgObjects.Clear();
            GOM_Utility.LoadObjectsFromXML(node.ChildNodes[0], resources, this.rgObjects);

            CalculateBoundingBox();
            SynchronizeConnectorPosition();
        }
Пример #11
0
        public void LoadFromXML(System.Xml.XmlNode node, GOM_ResourceArrays resources)
        {
            GOM_Utility.VerifyXmlNode(node, GOM_TAGS.SKETCH_POINT);

            for( int i=0; i<node.Attributes.Count; i++ )
            {
                if ( string.Compare(node.Attributes[i].Name, GOM_TAGS.X, true) == 0 )
                {
                    x = int.Parse(node.Attributes[i].Value);
                }
                if ( string.Compare(node.Attributes[i].Name, GOM_TAGS.Y, true) == 0 )
                {
                    y = int.Parse(node.Attributes[i].Value);
                }
                if ( string.Compare(node.Attributes[i].Name, GOM_TAGS.TIME, true) == 0 )
                {
                    time = int.Parse(node.Attributes[i].Value);
                }
            }
        }
Пример #12
0
        public void LoadFromXML(System.Xml.XmlNode node, GOM_ResourceArrays resources)
        {
            // Basic properties
            for( int i=0; i<node.Attributes.Count; i++ )
            {
                if ( string.Compare(node.Attributes[i].Name, GOM_TAGS.ID, true) == 0 )
                {
                    this.id = node.Attributes[i].Value;
                }
                if ( string.Compare(node.Attributes[i].Name, GOM_TAGS.TYPE, true) == 0 )
                {
                    if ( string.Compare(node.Attributes[i].Value, "sketch", true) != 0 )
                    {
                        throw new Exception("Invalid input. Not a sketch object node!");
                    }
                }
            }

            // 1st pass
            //   sketchStrokes
            //   points]
            GOM_Points points = null;
            for( int i=0; i<node.ChildNodes.Count; i++ )
            {
                if ( string.Compare(node.ChildNodes[i].Name, GOM_TAGS.SKETCH_STROKES, true) == 0 )
                {
                    LoadSketchStrokesFromXML(node.ChildNodes[i]);
                }
                if ( string.Compare(node.ChildNodes[i].Name, GOM_TAGS.POINTS, true) == 0 )
                {
                    points = LoadPointsFromXML(node.ChildNodes[i]);
                }
            }

            // 2nd pass
            //   drawings
            rgDrawings.Clear();
            if ( points != null )
            {
                GOM_Drawing_Styles styles = new GOM_Drawing_Styles();
                styles.Add(strokeStyle);
                GOM_ResourceArrays res = new GOM_ResourceArrays(points,styles,null);
                for( int i=0; i<node.ChildNodes.Count; i++ )
                {
                    if ( string.Compare(node.ChildNodes[i].Name, GOM_TAGS.DRAWINGS, true) == 0 )
                    {
                        for ( int j=0; j<node.ChildNodes[i].ChildNodes.Count; j++ )
                        {
                            GOM_Utility.LoadDrawingFromXML(node.ChildNodes[i].ChildNodes[j], rgDrawings, res);
                        }
                    }
                }
            }

            CalculateBoundingBox();
        }
Пример #13
0
        public void LoadFromXML(System.Xml.XmlNode node, GOM_ResourceArrays resources)
        {
            GOM_Utility.VerifyXmlNode(node, GOM_TAGS.GRAPHIC_OBJECT);

            //Load properties of the graphic object
            for (int i = 0; i < node.Attributes.Count; i++)
            {
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.ID, true) == 0)
                {
                    id = node.Attributes[i].Value;
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.TYPE, true) == 0)
                {
                    if (!node.Attributes[i].Value.Equals("primitive"))
                    {
                        throw new Exception("Invalid input. Not a primitive object node!");
                    }
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.X_OFFSET, true) == 0)
                {
                    m_xOffset = float.Parse(node.Attributes[i].Value);
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.Y_OFFSET, true) == 0)
                {
                    m_yOffset = float.Parse(node.Attributes[i].Value);
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.ROTATION, true) == 0)
                {
                    m_rotation = float.Parse(node.Attributes[i].Value);
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.TEMPLATE, true) == 0)
                {
                    for (int j = 0; j < resources.Templates.Count; j++)
                    {
                        if (resources.Templates[j].id.Equals(node.Attributes[i].Value))
                        {
                            m_template = resources.Templates[j];
                        }
                    }

                    if (m_template == null)
                    {
                        throw new Exception("Unknown template");
                    }
                }
            }

            if (m_template == null)
            {
                throw new Exception("Can not find template of the graphic object");
            }
            //Initialize the graphic object according to the template
            InitializeFromTemplate(m_template);
            //Update status of the graphic object
            for (int i = 0; i < node.ChildNodes.Count; i++)
            {
                if (System.String.Compare(node.ChildNodes[i].Name, GOM_TAGS.POINTS, true) == 0)
                {
                    UpdatePoints(node.ChildNodes[i]);
                }
                if (System.String.Compare(node.ChildNodes[i].Name, GOM_TAGS.STYLES, true) == 0)
                {
                    UpdateStyles(node.ChildNodes[i]);
                }
                if (System.String.Compare(node.ChildNodes[i].Name, GOM_TAGS.TEXT, true) == 0)
                {
                    LoadText(node.ChildNodes[i]);
                }
                #region new_modfied
                //Load attribute
                if (System.String.Compare(node.ChildNodes[i].Name, "attribute", true) == 0)
                {
                    for (int j = 0; j < node.ChildNodes[i].ChildNodes.Count; j++)
                    {
                        LoadVarFromXML(node.ChildNodes[i].ChildNodes[j], j);
                    }
                }
                //Load restrictions
                if (System.String.Compare(node.ChildNodes[i].Name, "restrictions", true) == 0)
                {
                    for (int j = 0; j < node.ChildNodes[i].ChildNodes.Count; j++)
                    {
                        LoadRestrictionFromXML(node.ChildNodes[i].ChildNodes[j], j);
                    }
                }
                #endregion
            }

            CalculateBoundingBox();
            SynchronizeConnectorPosition();
        }
Пример #14
0
        public void LoadFromXML(System.Xml.XmlNode node, GOM_ResourceArrays resources)
        {
            GOM_Utility.VerifyXmlNode(node, GOM_TAGS.GRAPHIC_OBJECT);

            //Load properties of the graphic object
            for (int i = 0; i < node.Attributes.Count; i++)
            {
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.ID, true) == 0)
                {
                    id = node.Attributes[i].Value;
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.TYPE, true) == 0)
                {
                    if (!node.Attributes[i].Value.Equals("linkNode"))
                    {
                        throw new Exception("Invalid input. Not a primitive object node!");
                    }
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.X_OFFSET, true) == 0)
                {
                    m_xOffset = float.Parse(node.Attributes[i].Value);
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.Y_OFFSET, true) == 0)
                {
                    m_yOffset = float.Parse(node.Attributes[i].Value);
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.ROTATION, true) == 0)
                {
                    m_rotation = float.Parse(node.Attributes[i].Value);
                }
            }

            //Load m_point
            for (int i = 0; i < node.ChildNodes.Count; i++)
            {
                if (System.String.Compare(node.ChildNodes[i].Name, GOM_TAGS.POINTS, true) == 0)
                {
                    for ( int j=0; j<node.ChildNodes[i].ChildNodes.Count; j++ )
                    {
                        m_point.LoadFromXML(node.ChildNodes[i].ChildNodes[j], resources);
                        // Jump out of the loop, since there is only one point.
                        break;
                    }
                }
            }

            CalculateBoundingBox();
        }
Пример #15
0
        public void LoadFromXML(System.Xml.XmlNode node, GOM_ResourceArrays resources)
        {
            GOM_Drawings			drawings;
            GOM_Style_Filling		style;

            style = resources.FillingStyles["default"];
            drawings = new GOM_Drawings();

            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++)
            {
                GOM_Utility.LoadDrawingFromXML(node.ChildNodes[i], drawings, resources);
            }

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

            this.m_style = style;
            this.m_drawings = drawings;
        }
Пример #16
0
 public GOM_Filling_Polygon(System.Xml.XmlNode node, GOM_ResourceArrays resources)
 {
     LoadFromXML(node, resources);
 }
Пример #17
0
 public GOM_Drawing_Bezier(System.Xml.XmlNode node, GOM_ResourceArrays resources)
 {
     LoadFromXML(node, resources);
 }
Пример #18
0
 public GOM_Filling_Rectangle(System.Xml.XmlNode node, GOM_ResourceArrays resources)
 {
     m_points = new GOM_Points();
     LoadFromXML(node, resources);
 }
Пример #19
0
 public GOM_Drawing_Line( System.Xml.XmlNode node, GOM_ResourceArrays resources)
 {
     m_points = new GOM_Points();
     LoadFromXML(node, resources);
 }
        public void LoadFromXML(System.Xml.XmlNode node, GOM_ResourceArrays resources)
        {
            //Load following attributes for tempalte
            //	id
            //	extScale
            //	extRotate
            //	extConnect
            //	keepAspectRatio
            for (int i = 0; i < node.Attributes.Count; i++)
            {
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.ID, true) == 0)
                {
                    id = node.Attributes[i].Value;
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.EXTERNAL_SCALE, true) == 0)
                {
                    extScale = bool.Parse(node.Attributes[i].Value);
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.EXTERNAL_ROTATE, true) == 0)
                {
                    extRotate= bool.Parse(node.Attributes[i].Value);
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.EXTERNAL_CONNECT, true) == 0)
                {
                    extConnect= bool.Parse(node.Attributes[i].Value);
                }
                if (System.String.Compare(node.Attributes[i].Name, GOM_TAGS.KEEP_ASPECT_RATIO, true) == 0)
                {
                    keepAspectRatio= bool.Parse(node.Attributes[i].Value);
                }
            }

            //1st pass load
            //	Basic properties of points
            //	Editing modes
            //	Drawing and filling styles
            for (int i = 0; i < node.ChildNodes.Count; i++)
            {
                if (System.String.Compare(node.ChildNodes[i].Name, GOM_TAGS.POINTS, true) == 0)
                {
                    for (int j = 0; j < node.ChildNodes[i].ChildNodes.Count; j++)
                    {
                        LoadPointFromXML(node.ChildNodes[i].ChildNodes[j]);
                    }
                }
                if (System.String.Compare(node.ChildNodes[i].Name, GOM_TAGS.EDITING_MODES, true) == 0)
                {
                    for (int j = 0; j < node.ChildNodes[i].ChildNodes.Count; j++)
                    {
                        LoadEditingModeFromXML(node.ChildNodes[i].ChildNodes[j]);
                    }
                }
                if (System.String.Compare(node.ChildNodes[i].Name, GOM_TAGS.STYLES, true) == 0)
                {
                    for (int j = 0; j < node.ChildNodes[i].ChildNodes.Count; j++)
                    {
                        LoadStyleFromXML(node.ChildNodes[i].ChildNodes[j]);
                    }
                }
                #region new_modfied
                if (System.String.Compare(node.ChildNodes[i].Name, "attribute", true) == 0)
                {
                    for (int j = 0; j < node.ChildNodes[i].ChildNodes.Count; j++)
                    {
                        LoadVarFromXML(node.ChildNodes[i].ChildNodes[j], j);
                    }
                }

                if (System.String.Compare(node.ChildNodes[i].Name, "restrictions", true) == 0)
                {
                    for (int j = 0; j < node.ChildNodes[i].ChildNodes.Count; j++)
                    {
                        LoadRestrictionFromXML(node.ChildNodes[i].ChildNodes[j], j);
                    }
                }
                #endregion
            }

            //2nd pass load
            //  Constraints of points
            //	Drawing operations
            //	Filling operations
            GOM_ResourceArrays resourceArrays = new GOM_ResourceArrays(rgPoints, rgDrawingStyles, rgFillingStyles);

            for (int i = 0; i < node.ChildNodes.Count; i++)
            {
                if (System.String.Compare(node.ChildNodes[i].Name, GOM_TAGS.POINTS, true) == 0)
                {
                    for (int j = 0; j < node.ChildNodes[i].ChildNodes.Count; j++)
                    {
                        LoadPointConstraintFromXML(node.ChildNodes[i].ChildNodes[j]);
                    }
                }
                if (System.String.Compare(node.ChildNodes[i].Name, GOM_TAGS.DRAWINGS, true) == 0)
                {
                    for (int j = 0; j < node.ChildNodes[i].ChildNodes.Count; j++)
                    {
                        GOM_Utility.LoadDrawingFromXML(node.ChildNodes[i].ChildNodes[j], rgDrawings, resourceArrays);
                    }
                }
                if (System.String.Compare(node.ChildNodes[i].Name, GOM_TAGS.FILLINGS, true) == 0)
                {
                    for (int j = 0; j < node.ChildNodes[i].ChildNodes.Count; j++)
                    {
                        GOM_Utility.LoadFillingFromXML(node.ChildNodes[i].ChildNodes[j], rgFillings, resourceArrays);
                    }
                }
            }
        }
Пример #21
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;
        }