Example #1
0
 public void WriteTo(TextWriter writer)
 {
     V1.WriteTo(writer);
     writer.Write(" ");
     V2.WriteTo(writer);
     writer.Write(" ");
     V3.WriteTo(writer);
     writer.Write(" ");
     writer.Write(TextureName);
     writer.Write(" ");
     writer.Write(XOffset);
     writer.Write(" ");
     writer.Write(YOffset);
     writer.Write(" ");
     writer.Write(Rotation);
     writer.Write(" ");
     writer.Write(XScale.ToString("F6"));
     writer.Write(" ");
     writer.Write(YScale.ToString("F6"));
     writer.Write(" ");
     writer.Write(Flag1);
     writer.Write(" ");
     writer.Write(Flag2);
     writer.Write(" ");
     writer.Write(Flag3);
     writer.WriteLine();
 }
Example #2
0
        /// <summary>
        /// 속성들을 Xml Attribute로 생성합니다.
        /// </summary>
        /// <param name="writer">Attribute를 쓸 Writer</param>
        public override void GenerateXmlAttributes(System.Xml.XmlWriter writer)
        {
            base.GenerateXmlAttributes(writer);

            writer.WriteAttributeString("type", Type.ToString());

            if (X.HasValue)
            {
                writer.WriteAttributeString("x", X.ToString());
            }
            if (Y.HasValue)
            {
                writer.WriteAttributeString("y", Y.ToString());
            }
            if (Color.IsNotWhiteSpace())
            {
                writer.WriteAttributeString("Color", Color);
            }
            if (Alpha.HasValue)
            {
                writer.WriteAttributeString("Alpha", Alpha.ToString());
            }
            if (Thickness.HasValue)
            {
                writer.WriteAttributeString("Thickness", Thickness.ToString());
            }

            if (XScale.HasValue)
            {
                writer.WriteAttributeString("XScale", XScale.ToString());
            }
            if (YScale.HasValue)
            {
                writer.WriteAttributeString("YScale", YScale.ToString());
            }
            if (Radius.HasValue)
            {
                writer.WriteAttributeString("Radius", Radius.ToString());
            }
            if (YRadius.HasValue)
            {
                writer.WriteAttributeString("YRadius", YRadius.ToString());
            }
            if (InnerRadius.HasValue)
            {
                writer.WriteAttributeString("InnerRadius", InnerRadius.ToString());
            }

            if (ToX.HasValue)
            {
                writer.WriteAttributeString("ToX", ToX.ToString());
            }
            if (ToY.HasValue)
            {
                writer.WriteAttributeString("ToY", ToY.ToString());
            }
        }
        /// <summary>
        /// 속성 중 Attribute Node로 표현해야 한다.
        /// </summary>
        /// <param name="writer"></param>
        public override void GenerateXmlAttributes(System.Xml.XmlWriter writer)
        {
            base.GenerateXmlAttributes(writer);

            if (Id.IsNotWhiteSpace())
            {
                writer.WriteAttributeString("Id", Id);
            }
            if (X.HasValue)
            {
                writer.WriteAttributeString("x", X.ToString());
            }
            if (Y.HasValue)
            {
                writer.WriteAttributeString("y", Y.ToString());
            }
            if (Alpha.HasValue)
            {
                writer.WriteAttributeString("Alpha", Alpha.ToString());
            }
            if (XScale.HasValue)
            {
                writer.WriteAttributeString("XScale", XScale.ToString());
            }
            if (YScale.HasValue)
            {
                writer.WriteAttributeString("YScale", YScale.ToString());
            }
            if (OrigW.HasValue)
            {
                writer.WriteAttributeString("origW", OrigW.ToString());
            }
            if (OrigH.HasValue)
            {
                writer.WriteAttributeString("origH", OrigH.ToString());
            }
            if (AutoScale.HasValue)
            {
                writer.WriteAttributeString("AutoScale", AutoScale.GetHashCode().ToString());
            }
            if (ConstrainedScale.HasValue)
            {
                writer.WriteAttributeString("ConstrainedScale", ConstrainedScale.GetHashCode().ToString());
            }
            if (ScaleImages.HasValue)
            {
                writer.WriteAttributeString("ScaleImages", ScaleImages.GetHashCode().ToString());
            }
            if (ScaleText.HasValue)
            {
                writer.WriteAttributeString("ScaleText", ScaleText.GetHashCode().ToString());
            }
            if (GrpXShift.HasValue)
            {
                writer.WriteAttributeString("GrpXShift", GrpXShift.ToString());
            }
            if (GrpYShift.HasValue)
            {
                writer.WriteAttributeString("GrpXShift", GrpXShift.ToString());
            }

            if (ShowBelow.HasValue)
            {
                writer.WriteAttributeString("ShowBelow", ShowBelow.GetHashCode().ToString());
            }
            if (Visible.HasValue)
            {
                writer.WriteAttributeString("Visible", Visible.GetHashCode().ToString());
            }

            if (ToolText.IsNotWhiteSpace())
            {
                writer.WriteAttributeString("ToolText", ToolText);
            }

            if (_link != null)
            {
                _link.GenerateXmlAttributes(writer);
            }
        }
Example #4
0
        // Prepares the SDF file header section. Respective properties must be set in advance.
        // Constitutes "Record 1" according to ISO 25178-71
        private void PrepareHeaderSection()
        {
            // for single profiles YScale must be 0
            if (NumberOfProfiles == 1)
            {
                YScale = 0;
            }
            if (double.IsNaN(XScale))
            {
                return;
            }
            if (double.IsNaN(YScale))
            {
                return;
            }
            if (double.IsNaN(ZScale))
            {
                return;
            }
            if (!Relaxed)
            {
                // the SDF definition suffers from the historical restriction of 65535 points per profile
                // there is no error message up to now, it is just not possible to create data.
                if (NumberOfPointsPerProfile > ushort.MaxValue)
                {
                    return;
                }
                if (NumberOfProfiles > ushort.MaxValue)
                {
                    return;
                }
            }
            // instantiate the StringBuilder for the header section
            headerSectionSb = new StringBuilder();
            if (ForceIsoFormat)
            {
                headerSectionSb.AppendLine("aISO-1.0");
            }
            else
            {
                headerSectionSb.AppendLine("aBCR-1.0");
            }
            headerSectionSb.AppendLine($"ManufacID   = {TruncateManufacID(ManufacurerId)}"); // just to make sure no "=" is added
            headerSectionSb.AppendLine($"CreateDate  = {CreationDate.ToString("ddMMyyyyHHmm")}");
            headerSectionSb.AppendLine($"ModDate     = {ModificationDate.ToString("ddMMyyyyHHmm")}");
            headerSectionSb.AppendLine($"NumPoints   = {NumberOfPointsPerProfile}");
            headerSectionSb.AppendLine($"NumProfiles = {NumberOfProfiles}");
            headerSectionSb.AppendLine($"Xscale      = {XScale.ToString("G17")}");
            headerSectionSb.AppendLine($"Yscale      = {YScale.ToString("G17")}");
            headerSectionSb.AppendLine($"Zscale      = {ZScale.ToString("G17")}");
            headerSectionSb.AppendLine("Zresolution = -1"); // clause 5.2.8, do not modify!
            headerSectionSb.AppendLine("Compression = 0");  // clause 5.2.9, do not modify!
            switch (zDataType)
            {
            case ZDataType.Double:
                headerSectionSb.AppendLine("DataType    = 7");
                break;

            case ZDataType.Int32:
                headerSectionSb.AppendLine("DataType    = 6");
                break;

            case ZDataType.Int16:
                headerSectionSb.AppendLine("DataType    = 5");
                break;

            default:
                headerSectionSb.AppendLine("DataType    = ?");     // this should not happen!
                break;
            }
            headerSectionSb.AppendLine("CheckType   = 0"); // clause 5.2.11, do not modify!
            headerSectionSb.AppendLine("*");
        }