/// <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); }
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; }
/// <summary> /// The constructor of GOM_Filling_FillPath /// </summary> /// <param name="drawings">A list of drawing operation</param> /// <param name="style">The filling style to fill the path</param> public GOM_Filling_FillPath(GOM_Drawings drawings, GOM_Style_Filling style) { m_points = new GOM_Points(); m_style = style; m_drawings = drawings; }
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); }
/// <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; }
/// <summary> /// The constructor of GOM_Object_Primitive /// </summary> public GOM_Object_Primitive() { m_id = Guid.NewGuid().ToString("D"); m_xOffset = 0; m_yOffset = 0; m_rotation = 0; m_template = null; GOM_Constraint_Set constraintSet; m_boundingBox = new System.Drawing.RectangleF(0, 0, 0, 0); m_Top_Connector = new GOM_Point(); m_Top_Connector.id = GOM_Special_Point_Name.TOP_CONNECTOR; m_Top_Connector.Connectable = true; m_Bottom_Connector = new GOM_Point(); m_Bottom_Connector.id = GOM_Special_Point_Name.BOTTOM_CONNECTOR; m_Bottom_Connector.Connectable = true; m_Left_Connector = new GOM_Point(); m_Left_Connector.id = GOM_Special_Point_Name.LEFT_CONNECTOR; m_Left_Connector.Connectable = true; m_Right_Connector = new GOM_Point(); m_Right_Connector.id = GOM_Special_Point_Name.RIGHT_CONNECTOR; m_Right_Connector.Connectable = true; m_SE_Resize_Point = new GOM_Point(); m_SE_Resize_Point.id = GOM_Special_Point_Name.SE_RESIZING_POINT; constraintSet = new GOM_Constraint_Set(); constraintSet.EditingMode = "default"; constraintSet.Add(new GOM_Resizing_SE_Constraint(this, m_SE_Resize_Point)); m_SE_Resize_Point.Constraints.Add(constraintSet); m_NW_Resize_Point = new GOM_Point(); m_NW_Resize_Point.id = GOM_Special_Point_Name.NW_RESIZING_POINT; constraintSet = new GOM_Constraint_Set(); constraintSet.EditingMode = "default"; constraintSet.Add(new GOM_Resizing_NW_Constraint(this, m_NW_Resize_Point)); m_NW_Resize_Point.Constraints.Add(constraintSet); m_SW_Resize_Point = new GOM_Point(); m_SW_Resize_Point.id = GOM_Special_Point_Name.SW_RESIZING_POINT; constraintSet = new GOM_Constraint_Set(); constraintSet.EditingMode = "default"; constraintSet.Add(new GOM_Resizing_SW_Constraint(this, m_SW_Resize_Point)); m_SW_Resize_Point.Constraints.Add(constraintSet); m_NE_Resize_Point = new GOM_Point(); m_NE_Resize_Point.id = GOM_Special_Point_Name.NE_RESIZING_POINT; constraintSet = new GOM_Constraint_Set(); constraintSet.EditingMode = "default"; constraintSet.Add(new GOM_Resizing_NE_Constraint(this, m_NE_Resize_Point)); m_NE_Resize_Point.Constraints.Add(constraintSet); m_Rotation_Point = new GOM_Point(); m_Rotation_Point.id = GOM_Special_Point_Name.ROTATION_POINT; constraintSet = new GOM_Constraint_Set(); constraintSet.EditingMode = "default"; constraintSet.Add(new GOM_Rotation_Constraint(this, m_Rotation_Point)); m_Rotation_Point.Constraints.Add(constraintSet); innerText = ""; font = new System.Drawing.Font("Tahoma", 10); fontColor = System.Drawing.Color.Black; extScale = false; extRotate = false; extConnect = false; keepAspectRatio = false; rgPoints = new GOM_Points(); rgDrawings = new GOM_Drawings(); rgFillings = new GOM_Fillings(); rgEditingModes = new GOM_Strings(); rgDrawingStyles = new GOM_Drawing_Styles(); rgFillingStyles = new GOM_Filling_Styles(); }