void WritePointSymDef(PointSymDef symdef) { OcadPointSymbol symbol = new OcadPointSymbol(); FillInCommonSymdef(symbol, symdef); symbol.Otp = 1; symbol.SymTp = 0; symbol.Extent = (short) ToOcadDimensions(symdef.Radius); symbol.symbolElts = SymbolEltsFromGlyph(symdef.Glyph, out symbol.DataSize); if (symdef.AllowRotation) symbol.Flags |= 1; symbol.Write(writer, version); }
PointSymbol CreatePointSymbol(OcadObject obj, PointSymDef symdef) { if (symdef == null) throw new OcadFileFormatException("Object has unknown or inconsistent symbol type {0}", obj.Sym); PointF location = PointFromOcadCoord(obj.coords[0]); // Determine if there are any circle gaps. float[] gaps = null; if (obj.coords.Length > 1) { // The additional coordinates give circle gaps. They are expressed in pairs of OCAD angles, where the X is the start and // the Y is the end. gaps = new float[(obj.coords.Length - 1) * 2]; for (int i = 0; i < obj.coords.Length - 1; ++i) { OcadCoord ocadGap = obj.coords[i + 1]; gaps[i * 2] = AngleToDegrees(ocadGap.x); gaps[i * 2 + 1] = AngleToDegrees(ocadGap.y); } } return new PointSymbol(symdef, location, AngleToDegrees(obj.Ang), gaps); }
float rotation; // angle in dgrees symbol is rotated. #endregion Fields #region Constructors public PointSymbol(PointSymDef def, PointF location, float angle, float[] gaps) { this.def = def; this.location = location; this.rotation = angle; this.gaps = gaps; boundingBox = def.CalcBounds(location, rotation); }