using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Drawing;

/*
 * grabbag of shared, plot-related classes
 */
using ms.aq.cview.draw;

namespace ms.aq.cview.util {

    public class AxisInfo {
        public Type AType;
        public float Min = Settings.AXI_UNDEF,Max = Settings.AXI_UNDEF;
        public int Count;
        public string[] Labels;
    }
    public class WebColor {
        public int R, G, B;
        public Color PColor;
        public HSVColor HSVColor;
        
        private string SColor;
        public WebColor(int r, int g, int b) {
            R = r;
            G = g;
            B = b;
            PColor = Color.FromArgb(R, G, B);

            this.HSVColor = new HSVColor();
            rgb2hsv();
        }
        public Color GetColor() {
            //return Color.FromArgb(85, R, G, B);//33% transparency
            //return Color.FromArgb(64, R, G, B);//25% transparency
            //return Color.FromArgb(128,R, G, B);//50% transparency
            //return Color.FromArgb(200,R, G, B);//50% transparency
            return Color.FromArgb(255,R, G, B);
        }
        public void setSColor() {
            string rst = String.Format("{0:x}", ((R << 16) + (G << 8) + B));
            string pad = "";
            for (int i = 0; i < (6 - rst.Length); i++)
                pad += "0";
            SColor = pad+rst;
        }
        public void setV(float v){
            this.HSVColor.V = v;
            hsv2rgb();
        }
        public override string ToString() {
            setSColor();
            return SColor;
        }
        void rgb2hsv() {
            HSVConverter.RGBtoHSV((float)R, (float)G, (float)B, out this.HSVColor.H, out this.HSVColor.S, out this.HSVColor.V);
        }
        void hsv2rgb() {
            float r,g,b;
            HSVConverter.HSVtoRGB(out r, out g, out b, this.HSVColor.H, this.HSVColor.S, this.HSVColor.V);
            R = (int)r;
            G = (int)g;
            B = (int)b;
        }
        
    }
    public class TickVal {
        public DBNumber x0, dx;
        public int n;
    }

    public class Serie {
        public string Name;
        public WebColor WColor;
        public int SCount = 0;
        public Serie(string name, WebColor wcolor) {
            Name = name;
            WColor = wcolor;
        }
    }

    public class ClotTable {
        public string TableName;
        public StringCollection XCols = new StringCollection();
        public StringCollection YCols = new StringCollection();

    }
}
