Example #1
0
 public void WriteToXml(XmlTextWriter xw)
 {
     XmlHelper.WriteIfNotEmpty(xw, "Length", Math.Round(_Length, 0).ToString());
     XmlHelper.WriteIfNotEmpty(xw, "Width", Math.Round(_Width, 0).ToString());
     XmlHelper.WriteIfNotEmpty(xw, "Height", Math.Round(_Height, 0).ToString());
     XmlHelper.WriteIfNotEmpty(xw, "Units", _Units.ToString());
 }
Example #2
0
        public Point ReadPoint(DimensionType dimension)
        {
            if (!canRead())
            {
                return(new Point());
            }

            switch (dimension)
            {
            case DimensionType.XY:
                return(new Point(ReadNextDouble(), ReadNextDouble()));

            case DimensionType.XYZ:
                return(new Point(ReadNextDouble(), ReadNextDouble(), ReadNextDouble()));

            case DimensionType.XYM:
                return(new Point(ReadNextDouble(), ReadNextDouble(), null, ReadNextDouble()));

            case DimensionType.XYZM:
                return(new Point(ReadNextDouble(), ReadNextDouble(), ReadNextDouble(), ReadNextDouble()));

            default:
                throw new NotSupportedException(dimension.ToString());
            }
        }
Example #3
0
        // TODO 1: <whar> Change these to alpha order for easier perusal.
        static public Dimension FromEnum(DimensionType dimension)
        {
            switch (dimension)
            {
            case DimensionType.Dimensionless: return(Dimension.None);

            case DimensionType.Percentage: return(Dimension.Percent);

            case DimensionType.Currency: return(Dimension.Currency);

            case DimensionType.Unitless: return(Dimension.Unitless);

            default:
                // Appears that a lookup or something else of that sort is being built, so we don't want this behavior to change
                // so using invariant culture.
                throw new Exception("Dimension.FromEnum: " + dimension.ToString());     // DO NOT LOCALIZE <ccla>
            }
        }
        /// <summary>
        /// Provides a map between the dimension and associated button
        /// </summary>
        private SimpleButton GetDimensionButton(DimensionType dim)
        {
            switch (dim)
            {
            case DimensionType.Color:
                return(this.colorButton);

            case DimensionType.Size:
                return(this.sizeButton);

            case DimensionType.Style:
                return(this.styleButton);

            case DimensionType.Config:
                return(this.configButton);

            default:
                throw new InvalidEnumArgumentException(dim.ToString());
            }
        }
        /// <summary>
        /// Codification encode for WKT.
        /// </summary>
        /// <param name="dimension"></param>
        /// <returns></returns>
        public static string WktEncode(this DimensionType dimension)
        {
            switch (dimension)
            {
            case DimensionType.XY:
                return("");

            case DimensionType.XYZ:
                return("Z");

            case DimensionType.XYM:
                return("M");

            case DimensionType.XYZM:
                return("ZM");

            default:
                throw new NotImplementedException("WktEncode not implemented for the DimensinoType: " + dimension.ToString());
            }
        }