示例#1
0
文件: HatchIndex.cs 项目: twenzel/CGM
        public override void ReadFromBinary(IBinaryReader reader)
        {
            var indexValue = reader.ReadIndex();

            switch (indexValue)
            {
            case 1:
                Type = HatchType.HORIZONTAL_LINES;
                break;

            case 2:
                Type = HatchType.VERTICAL_LINES;
                break;

            case 3:
                Type = HatchType.POSITIVE_SLOPE_LINES;
                break;

            case 4:
                Type = HatchType.NEGATIVE_SLOPE_LINES;
                break;

            case 5:
                Type = HatchType.HORIZONTAL_VERTICAL_CROSSHATCH;
                break;

            case 6:
                Type = HatchType.POSITIVE_NEGATIVE_CROSSHATCH;
                break;

            default:
                reader.Unsupported("hatch style: " + indexValue);
                break;
            }
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <c>HatchPattern</c> class.
 /// </summary>
 /// <param name="name">Pattern name, always stored as uppercase.</param>
 /// <param name="description">Description of the pattern (optional, this information is not saved in the dxf file). By default it will use the supplied name.</param>
 public HatchPattern(string name, string description = null)
 {
     this.name            = name.ToUpper();
     this.description     = string.IsNullOrEmpty(description) ? name : description;
     this.style           = HatchStyle.Normal;
     this.fill            = this.name == PredefinedHatchPatternName.Solid ? FillType.SolidFill : FillType.PatternFill;
     this.type            = HatchType.UserDefined;
     this.angle           = 0.0;
     this.scale           = 1.0;
     this.lineDefinitions = new List <HatchPatternLineDefinition>();
 }
示例#3
0
 public HatchPattern(string name, IEnumerable <HatchPatternLineDefinition> lineDefinitions, string description)
 {
     this.name            = string.IsNullOrEmpty(name) ? string.Empty : name;
     this.description     = string.IsNullOrEmpty(description) ? string.Empty : description;
     this.style           = HatchStyle.Normal;
     this.fill            = this.name == "SOLID" ? HatchFillType.SolidFill : HatchFillType.PatternFill;
     this.type            = HatchType.UserDefined;
     this.origin          = Vector2.Zero;
     this.angle           = 0.0;
     this.scale           = 1.0;
     this.lineDefinitions = lineDefinitions == null ? new List <HatchPatternLineDefinition>() : new List <HatchPatternLineDefinition>(lineDefinitions);
 }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <c>HatchPattern</c> class.
 /// </summary>
 /// <param name="name">Pattern name, always stored as uppercase.</param>
 /// <param name="description">Description of the pattern (optional, this information is not saved in the dxf file). By default it will use the supplied name.</param>
 public HatchPattern(string name, string description = null)
 {
     this.name = name.ToUpper();
     this.description = string.IsNullOrEmpty(description) ? name : description;
     this.style = HatchStyle.Normal;
     this.fill = this.name == "SOLID" ? HatchFillType.SolidFill : HatchFillType.PatternFill;
     this.type = HatchType.UserDefined;
     this.origin = Vector2.Zero;
     this.angle = 0.0;
     this.scale = 1.0;
     this.lineDefinitions = new List<HatchPatternLineDefinition>();
 }
示例#5
0
        /// <summary>
        /// Initializes a new instance of the <c>HatchPattern</c> class.
        /// </summary>
        /// <param name="name">Pattern name, always stored as uppercase.</param>
        /// <param name="lineDefinitions">The definition of the lines that make up the pattern (not applicable in Solid fills).</param>
        /// <param name="description">Description of the pattern (optional, this information is not saved in the dxf file). By default it will use the supplied name.</param>
        public HatchPattern(string name, IEnumerable<HatchPatternLineDefinition> lineDefinitions, string description)
        {
            if (string.IsNullOrEmpty(name))
                throw new ArgumentNullException(nameof(name));

            this.name = name.ToUpper(CultureInfo.CurrentCulture);
            this.description = string.IsNullOrEmpty(description) ? name : description;
            this.style = HatchStyle.Normal;
            this.fill = this.name == "SOLID" ? HatchFillType.SolidFill : HatchFillType.PatternFill;
            this.type = HatchType.UserDefined;
            this.origin = Vector2.Zero;
            this.angle = 0.0;
            this.scale = 1.0;
            this.lineDefinitions = lineDefinitions == null ? new List<HatchPatternLineDefinition>() : new List<HatchPatternLineDefinition>(lineDefinitions);
        }
示例#6
0
文件: HatchIndex.cs 项目: twenzel/CGM
 public HatchIndex(CgmFile container, HatchType type)
     : this(container)
 {
     Type = type;
 }
示例#7
0
 /// <summary>Initialize a new instance of the System.BrushInfo structure that has specific hatch bitmap and color.</summary>
 /// <param name="hatchType">The hatch to apply.<see cref="HatchType"/></param>
 /// <param name="color">The color value.<see cref="X11.TColor"/></param>
 /// <returns>The requested brush info.<see cref="BrushInfo"/></returns>
 /// <remarks>The HatchBrush supports bitmap offset.</remarks>
 public static X11BrushInfo HatchBrush(HatchType hatchType, X11.TColor color)
 {
     return(new X11BrushInfo(BrushType.Hatch, hatchType, color));
 }
示例#8
0
 /// <summary>Initialize a new instance of the System.BrushInfo structure that has specific color.</summary>
 /// <param name="type">The type value.<see cref="System.X11BrushInfo.BrushType"/></param>
 /// <param name="hatchType">The hatch to apply.<see cref="HatchType"/></param>
 /// <param name="color">The color value.<see cref="X11.TColor"/></param>
 private X11BrushInfo(BrushType type, HatchType hatchType, X11.TColor color)
 {
     _brushType = type;
     _hatchType = hatchType;
     _color     = color;
 }