Ejemplo n.º 1
0
 private void GenerateTagsAfterLinks(StringBuilder sb, GridViewType gridViewType, string title)
 {
     sb.AppendLine("                </ul>");
     sb.AppendLine("            </td>");
     sb.AppendLine("            <td style=\"vertical-align: top;\">");
     this.GenerateFeatures(sb, gridViewType, title);
     sb.AppendLine("            </td>");
     sb.AppendLine("        </tr>");
 }
Ejemplo n.º 2
0
        public void SetPalette(GridViewType type, float min_val, float max_val)
        {
            if (mNeedsPaletteUpdate == false && type == mCurrentType && (AutoScale == false || (MinValue == min_val && MaxValue == max_val)))
            {
                return;
            }

            HasFactors = false;
            int n = 50;

            if (type >= GridViewType.rewerDiv)
            {
                // categorical values...
                HasFactors = true;
                n          = FactorLabels.Count;
                if (FactorLabels.Count == 0)
                {
                    n = (int)max_val;
                    for (int i = 0; i < n; ++i)
                    {
                        FactorLabels.Add("Label " + i);
                    }
                }
            }
            if (type != GridViewType.Custom)
            {
                FactorColors.Clear();
                for (int i = 0; i < n; ++i)
                {
                    if (HasFactors)
                    {
                        FactorColors.Add(ColorFromValue(i, type, 0.0F, 1.0F).ToString());
                    }
                    else
                    {
                        FactorColors.Add(ColorFromValue(1.0F - i / (float)n, type, 0.0F, 1.0F).ToString());
                    }
                }
            }
            Labels = new List <string>()
            {
                min_val.ToString(),
                ((3.0 * min_val + max_val) / 4.0).ToString(),
                ((min_val + max_val) / 2.0).ToString(),
                ((min_val + 3.0 * max_val) / 4.0).ToString(),
                max_val.ToString()
            };
            if (AutoScale)
            {
                MinValue = min_val;
                MaxValue = max_val;
            }
            mCurrentType        = type;
            mNeedsPaletteUpdate = false;
            OnColorsChanged();
        }
        private void BindGridViewType(string search)
        {
            FiltersModel   fm    = Session["FiltersModel"] as FiltersModel;
            List <EmpType> _View = new List <EmpType>();
            QueryBuilder   qb    = new QueryBuilder();
            DataTable      dt    = qb.GetValuesfromDB("select * from EmpType ");

            _View = dt.ToList <EmpType>();
            GridViewType.DataSource = _View.Where(aa => aa.TypeName.ToUpper().Contains(search.ToUpper())).ToList();
            GridViewType.DataBind();
        }
Ejemplo n.º 4
0
 private void WriteLinks(StringBuilder sb, string title, GridViewType gridViewType, string organizeWebFormFolder, string organizeWebFormPrefix)
 {
     this.GenerateTagsBeforeLinks(sb, title);
     foreach (Table selectedTable in (List <Table>) this._selectedTables)
     {
         if (gridViewType == GridViewType.Totals && selectedTable.IsContainsMoneyOrDecimalField || gridViewType != GridViewType.Totals)
         {
             this.GenerateLinks(sb, title, gridViewType, organizeWebFormFolder, organizeWebFormPrefix, selectedTable);
         }
     }
     this.GenerateTagsAfterLinks(sb, gridViewType, title);
 }
Ejemplo n.º 5
0
        public static Color ColorFromPalette(int value, GridViewType view_type)
        {
            if (value < 0)
            {
                return(Color.White);
            }
            int   n = Math.Max(value, 0) % 12;
            Color col;

            switch (view_type)
            {
            case GridViewType.rewerDiv:
                col = mBrewerDiv[n];
                break;

            case GridViewType.BrewerQual:
                col = mBrewerQual[n];
                break;

            case GridViewType.Terrain:
                col = mTerrainCol[n];
                break;

            default:
                return(default);
            }
            if (value < 12)
            {
                return(col);
            }
            n = Math.Max(value, 0) % 60;
            if (n < 12)
            {
                return(col);
            }
            if (n < 24)
            {
                return(col.Darker(200));
            }
            if (n < 36)
            {
                return(col.Lighter(150));
            }
            if (n < 48)
            {
                return(col.Darker(300));
            }
            return(col.Lighter(200));
        }
Ejemplo n.º 6
0
        private void BindGridViewType(string search)
        {
            FiltersModel      fm           = Session["FiltersModel"] as FiltersModel;
            ViewUserEmp       LoggedInUser = HttpContext.Current.Session["LoggedUser"] as ViewUserEmp;
            List <HR_EmpType> _View        = new List <HR_EmpType>();
            QueryBuilder      qb           = new QueryBuilder();
            string            query        = qb.QueryForEmployeeTypeReport(LoggedInUser);
            DataTable         dt           = new DataTable();

            if (query != "where")
            {
                dt = qb.GetValuesfromDB("select * from HR_EmpType " + query);
            }
            _View = dt.ToList <HR_EmpType>();
            GridViewType.DataSource = _View.Where(aa => aa.TypeName.ToUpper().Contains(search.ToUpper())).OrderBy(aa => aa.TypeName).ToList();
            GridViewType.DataBind();
        }
Ejemplo n.º 7
0
    void Awake()
    {
        nodeDiameter = nodeRadius * 2;
        gridSizeX    = Mathf.RoundToInt(gridWorldSize.x / nodeDiameter);
        gridSizeY    = Mathf.RoundToInt(gridWorldSize.y / nodeDiameter);

        blockFlags = StateType.ST_Block | StateType.ST_Wall | StateType.ST_Bomb;

        foreach (TerrainType region in walkableRegions)
        {
            walkableMask.value |= region.terrainMask.value;

            //int v = region.terrainMask.value;

            walkableRegionsDictionary.Add((int)Mathf.Log(region.terrainMask.value, 2), region.teerainPenalty);
        }

        gridViewType = GridViewType.GVT_Binary;
        CreateGrid();
    }
Ejemplo n.º 8
0
 private void WriteFilterByLinks(StringBuilder sb, string title, GridViewType gridViewType, string organizeWebFormFolder, string organizeWebFormPrefix)
 {
     this.GenerateTagsBeforeLinks(sb, title);
     foreach (Table selectedTable in (List <Table>) this._selectedTables)
     {
         if (selectedTable.ForeignKeyCount > 0)
         {
             foreach (Column column in (List <Column>)selectedTable.Columns)
             {
                 if (column.IsForeignKeyAndFKTableIsSelectedAndOnlyOnePK)
                 {
                     this._fkColumn = column;
                     this._fkTable  = column.ForeignKeyTable;
                     this.GenerateLinks(sb, title, gridViewType, organizeWebFormFolder, organizeWebFormPrefix, selectedTable);
                 }
             }
         }
     }
     this.GenerateTagsAfterLinks(sb, GridViewType.FilterBy, title);
 }
Ejemplo n.º 9
0
    //Função foi criada para inicializar atributos do agente após a instanciação. Porque ao usar a instanciação, automaticamente é chamado InitializeAgent e Start.
    public void init(Grid g, int pNumber)
    {
        //Debug.Log("Init foi chamado");
        grid           = g;
        scenarioId     = grid.scenarioId;
        playerNumber   = pNumber;
        stateType      = convertPlayerNumberToStateType(playerNumber);
        myGridViewType = grid.getGridViewType();

        bombCount            = 0;
        isInFire             = false;
        isInDanger           = false;
        areThereDangerAround = false;
        myDistanceRewardList = new List <PlayerManager.DistanceReward>();
        canDropBombs         = true;
        isReady = true;
        lastMan = false;

        localStep = 1;

        ServiceLocator.getManager(scenarioId).GetLogManager().localEpisodePrint(localEpisode++, this);

        //------------------------------------------------------ São atualizadas no Start, que é chamado depois
        initialPosition  = transform.localPosition;
        oldLocalPosition = transform.localPosition;
        oldGridPosition  = GetOldGridPosition();
        // -----------------------------------------------------------------------------------------------------

        playerModel = transform.Find("PlayerModel").gameObject;
        animator    = transform.Find("PlayerModel").GetComponent <Animator>();

        bombermanVillain.Clear();

        actionIdString = "empty";

        wasInitialized = true;

        myPlayerManager = ServiceLocator.getManager(scenarioId).GetPlayerManager();
        myBombManager   = ServiceLocator.getManager(scenarioId).GetBombManager();
    }
Ejemplo n.º 10
0
        private void BindGridViewType(string search)
        {
            FiltersModel       fm        = Session["FiltersModel"] as FiltersModel;
            List <ViewEmpType> _View     = new List <ViewEmpType>();
            List <ViewEmpType> _TempView = new List <ViewEmpType>();
            User         LoggedInUser    = HttpContext.Current.Session["LoggedUser"] as User;
            QueryBuilder qb    = new QueryBuilder();
            string       query = qb.QueryForCompanyViewForLinq(LoggedInUser);
            DataTable    dt    = qb.GetValuesfromDB("select * from ViewEmpType where " + query);

            _View = dt.ToList <ViewEmpType>().AsQueryable().SortBy("TypeName").ToList();
            if (fm.CompanyFilter.Count > 0)
            {
                foreach (var comp in fm.CompanyFilter)
                {
                    short _compID = Convert.ToInt16(comp.ID);
                    _TempView.AddRange(_View.Where(aa => aa.CompanyID == _compID).ToList());
                }
                _View = _TempView.ToList();
            }
            GridViewType.DataSource = _View.Where(aa => aa.TypeName.ToUpper().Contains(search.ToUpper())).ToList();
            GridViewType.DataBind();
        }
Ejemplo n.º 11
0
 public LayerElement(string name, string description, GridViewType type)
 {
     this.Name        = name;
     this.Description = description;
     this.ViewType    = type;
 }
Ejemplo n.º 12
0
        private void GenerateFeatures(StringBuilder sb, GridViewType gridViewType, string title)
        {
            switch (gridViewType)
            {
            case GridViewType.Redirect:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li><b>Can be used in the administration part of your website</b></li>");
                sb.AppendLine("                    <li>Contains a GridView Server Control that has CRUD (Create, Retrieve, Update, Delete) funtionality.</li>");
                sb.AppendLine("                    <li>Adding a new record redirects to another page</li>");
                sb.AppendLine("                    <li>Updating and existing record redirects to another page</li>");
                sb.AppendLine("                    <li>Delete funtionality uses a JQuery UI Pop-up for delete confirmation</li>");
                sb.AppendLine("                    <li>A link to a read-only Web Form is also provided for all Foreign Key columns (for details on the foreign key)</li>");
                sb.AppendLine("                    <li>Uses model binding to retrieve data</li>");
                sb.AppendLine("                    <li>GridView retrieves data on demand using Skip/Take logic</li>");
                sb.AppendLine("                    <li>GridView uses a Sort Direction Image in the header</li>");
                sb.AppendLine("                    <li>GridView uses Numeric Paging in the footer</li>");
                sb.AppendLine("                    <li>One ASP.NET 4.5 Web Form is generated per table</li>");
                sb.AppendLine("                </ul>");
                break;

            case GridViewType.AddEdit:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li><b>Can be used in the administration part of your website</b></li>");
                sb.AppendLine("                    <li>Contains a GridView Server Control that has CRUD (Create, Retrieve, Update, Delete) funtionality.</li>");
                sb.AppendLine("                    <li>Add a new record on the same page with JQuery animation</li>");
                sb.AppendLine("                    <li>Update an existing record on the same page with JQuery animation</li>");
                sb.AppendLine("                    <li>Delete funtionality uses a JQuery UI Pop-up for delete confirmation</li>");
                sb.AppendLine("                    <li>A JQuery Tooltip pop-up link is provided for all Foreign Key columns (for details on the foreign key)</li>");
                sb.AppendLine("                    <li>Uses model binding to retrieve data</li>");
                sb.AppendLine("                    <li>GridView retrieves data on demand using Skip/Take logic</li>");
                sb.AppendLine("                    <li>GridView uses a Sort Direction Image in the header</li>");
                sb.AppendLine("                    <li>GridView uses Numeric Paging in the footer</li>");
                sb.AppendLine("                    <li>One ASP.NET 4.5 Web Form is generated per table</li>");
                sb.AppendLine("                </ul>");
                break;

            case GridViewType.ReadOnly:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li><b>Can be used in the internal facing part of your website</b></li>");
                sb.AppendLine("                    <li>Contains a GridView Server Control. No CRUD funtionality (read-only).</li>");
                if (this._generateFrom == DatabaseObjectToGenerateFrom.Tables)
                {
                    sb.AppendLine("                    <li>A JQuery Tooltip pop-up link is provided for all Foreign Key columns (for details on the foreign key)</li>");
                    sb.AppendLine("                    <li>Uses model binding to retrieve data</li>");
                    sb.AppendLine("                    <li>GridView retrieves data on demand using Skip/Take logic</li>");
                }
                sb.AppendLine("                    <li>GridView uses a Sort Direction Image in the header</li>");
                sb.AppendLine("                    <li>GridView uses Numeric Paging in the footer</li>");
                sb.AppendLine("                    <li>One ASP.NET 4.5 Web Form is generated per table</li>");
                sb.AppendLine("                </ul>");
                break;

            case GridViewType.MoreInfoOnly:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li><b>Can be used in the internal facing part of your website</b></li>");
                sb.AppendLine("                    <li>Contains a GridView Server Control. No CRUD funtionality (read-only).</li>");
                sb.AppendLine("                    <li>Each row can be viewed for more information on click of the respective button (animated)</li>");
                sb.AppendLine("                    <li>Uses model binding to retrieve data</li>");
                sb.AppendLine("                    <li>GridView retrieves data on demand using Skip/Take logic</li>");
                sb.AppendLine("                    <li>GridView uses a Sort Direction Image in the header</li>");
                sb.AppendLine("                    <li>GridView uses Numeric Paging in the footer</li>");
                sb.AppendLine("                    <li>A JQuery Tooltip pop-up link is provided for all Foreign Key columns (for details on the foreign key)</li>");
                sb.AppendLine("                    <li>One ASP.NET 4.5 Web Form is generated per table</li>");
                sb.AppendLine("                </ul>");
                break;

            case GridViewType.Totals:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li><b>Can be used to show Totals (Money and Number of Records)</b></li>");
                sb.AppendLine("                    <li>Contains a GridView Server Control. No CRUD funtionality (read-only).</li>");
                sb.AppendLine("                    <li>Shows total number of records</li>");
                sb.AppendLine("                    <li>Shows sub and grand totals on the footer for money fields</li>");
                sb.AppendLine("                    <li>Uses model binding to retrieve data</li>");
                sb.AppendLine("                    <li>GridView retrieves data on demand using Skip/Take logic</li>");
                sb.AppendLine("                    <li>GridView uses a Sort Direction Image in the header</li>");
                sb.AppendLine("                    <li>GridView uses Numeric Paging in the footer</li>");
                sb.AppendLine("                    <li>A JQuery Tooltip pop-up link is provided for all Foreign Key columns (for details on the foreign key)</li>");
                sb.AppendLine("                    <li>One ASP.NET 4.5 Web Form is generated for tables that have money data fields</li>");
                sb.AppendLine("                </ul>");
                break;

            case GridViewType.FilterBy:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li><b>Can be used to show Filterable data</b></li>");
                sb.AppendLine("                    <li>Contains a GridView Server Control. No CRUD funtionality (read-only).</li>");
                sb.AppendLine("                    <li>Contains a DropDownList Control that filters the GridView's data on index change</li>");
                sb.AppendLine("                    <li>Uses model binding to retrieve data</li>");
                sb.AppendLine("                    <li>GridView retrieves data on demand using Skip/Take logic</li>");
                sb.AppendLine("                    <li>GridView uses a Sort Direction Image in the header</li>");
                sb.AppendLine("                    <li>GridView uses Numeric Paging in the footer</li>");
                sb.AppendLine("                    <li>A JQuery Tooltip pop-up link is provided for all Foreign Key columns (for details on the foreign key)</li>");
                sb.AppendLine("                    <li>One ASP.NET 4.5 Web Form is generated for each foreign key in each table</li>");
                sb.AppendLine("                </ul>");
                break;

            case GridViewType.Grouping:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li><b>Can be used to show Grouped data with count</b></li>");
                sb.AppendLine("                    <li>Contains a JQuery UI Accordion control with GridView within. No CRUD funtionality (read-only).</li>");
                sb.AppendLine("                    <li>Uses model binding to retrieve data</li>");
                sb.AppendLine("                    <li>GridView retrieves data on demand using Skip/Take logic</li>");
                sb.AppendLine("                    <li>Shows grouping by the respective group</li>");
                sb.AppendLine("                    <li>Shows count per respective group</li>");
                sb.AppendLine("                    <li>E.g. Orders by Shipper, Territories by Region</li>");
                sb.AppendLine("                    <li>One ASP.NET 4.5 Web Form is generated for each table referencing the current table</li>");
                sb.AppendLine("                </ul>");
                break;

            case GridViewType.NotAGridView:
                if (title == "Add New & Edit Record")
                {
                    sb.AppendLine("                <ul>");
                    sb.AppendLine("                    <li><b>Use to Add a New Record or Edit an Existing Record</b></li>");
                    sb.AppendLine("                    <li>Contains JQuery Validation or ASP.Net Validation</li>");
                    sb.AppendLine("                    <li>Contains JQuery UI Date Controls for date fields</li>");
                    sb.AppendLine("                    <li>Contains bound DropDownList Web Control for foreign fields</li>");
                    sb.AppendLine("                    <li>You can get here from the \"GridView with Add, Edit Redirect, & Delete\" Web Form when clicking the Add New Record link or the Edit button</li>");
                    sb.AppendLine("                    <li>One ASP.NET 4.5 Web Form is generated per table</li>");
                    sb.AppendLine("                </ul>");
                    break;
                }
                if (title == "Record Details (Read-Only)")
                {
                    sb.AppendLine("                <ul>");
                    sb.AppendLine("                    <li><b>Use to show Read-Only detail of a record</b></li>");
                    sb.AppendLine("                    <li>Shows details of a record (Read-Only)</li>");
                    sb.AppendLine("                    <li>You can get here from the \"GridView with Add, Edit Redirect, & Delete\" Web Form when clicking the foreign key links</li>");
                    sb.AppendLine("                    <li>One ASP.NET 4.5 Web Form is generated per table</li>");
                    sb.AppendLine("                </ul>");
                    break;
                }
                if (!(title == "Unbound Web Form"))
                {
                    break;
                }
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li><b>Use to add your own code in the Code File (Code Behind)</b></li>");
                sb.AppendLine("                    <li>Web Forms that are not bound to the database</li>");
                sb.AppendLine("                    <li>Contains JQuery Validation or ASP.Net Validation</li>");
                sb.AppendLine("                    <li>Contains JQuery UI Date Controls for date fields</li>");
                sb.AppendLine("                    <li>Contains unbound DropDownList Web Control for foreign fields</li>");
                sb.AppendLine("                    <li>One ASP.NET 4.5 Web Form is generated per table</li>");
                sb.AppendLine("                </ul>");
                break;

            case GridViewType.Inline:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li><b>Can be used in the administration part of your website</b></li>");
                sb.AppendLine("                    <li>Contains a GridView Server Control that has CRUD (Create, Retrieve, Update, Delete) funtionality.</li>");
                sb.AppendLine("                    <li>Add a new record on the same page inline the header of the GridView</li>");
                sb.AppendLine("                    <li>Uses server validation</li>");
                sb.AppendLine("                    <li>Update an existing record inline on the same page</li>");
                sb.AppendLine("                    <li>Delete funtionality uses a JQuery UI Pop-up for delete confirmation</li>");
                sb.AppendLine("                    <li>A link to a read-only Web Form is also provided for all Foreign Key columns (for details on the foreign key)</li>");
                sb.AppendLine("                    <li>Uses model binding to retrieve data</li>");
                sb.AppendLine("                    <li>GridView retrieves data on demand using Skip/Take logic</li>");
                sb.AppendLine("                    <li>GridView uses a Sort Direction Image in the header</li>");
                sb.AppendLine("                    <li>GridView uses Numeric Paging in the footer</li>");
                sb.AppendLine("                    <li>One ASP.NET 4.5 Web Form is generated per table</li>");
                sb.AppendLine("                </ul>");
                break;

            case GridViewType.Search:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li><b>Can be used in the administration part of your website</b></li>");
                sb.AppendLine("                    <li>Contains a GridView Server Control that has CRUD (Create, Retrieve, Update, Delete) funtionality.</li>");
                sb.AppendLine("                    <li>Contains search functionality in the header, per column*</li>");
                sb.AppendLine("                    <li>Adding a new record redirects to another page</li>");
                sb.AppendLine("                    <li>Updating and existing record redirects to another page</li>");
                sb.AppendLine("                    <li>Uses server validation</li>");
                sb.AppendLine("                    <li>Delete funtionality uses a JQuery UI Pop-up for delete confirmation</li>");
                sb.AppendLine("                    <li>A link to a read-only Web Form is also provided for all Foreign Key columns (for details on the foreign key)</li>");
                sb.AppendLine("                    <li>GridView uses a Sort Direction Image in the header</li>");
                sb.AppendLine("                    <li>GridView uses Numeric Paging in the footer</li>");
                sb.AppendLine("                    <li>One ASP.NET 4.5 Web Form is generated per table</li>");
                sb.AppendLine("                </ul>");
                break;
            }
        }
Ejemplo n.º 13
0
        private void GenerateLinks(StringBuilder sb, string title, GridViewType gridViewType, string organizeWebFormFolder, string organizeWebFormPrefix, Table table)
        {
            if (table.IsContainsPrimaryAndForeignKeyColumnsOnly)
            {
                return;
            }
            string str1 = MyConstants.WordDotAspx;

            if (this._isUseFriendlyUrls)
            {
                str1 = string.Empty;
            }
            string str2;

            if (this._isOrganizeGeneratedWebForms)
            {
                str2 = organizeWebFormFolder + "/" + table.Name + MyConstants.WordWeb + str1;
                switch (gridViewType)
                {
                case GridViewType.FilterBy:
                    str2 = organizeWebFormFolder + "/" + table.Name + "By" + this._fkColumn.Name + MyConstants.WordWeb + str1;
                    break;

                case GridViewType.Grouping:
                    str2 = organizeWebFormFolder + "/" + this._referencingTable.Name + "By" + table.Name + MyConstants.WordWeb + str1;
                    break;
                }
            }
            else
            {
                string formFileNamePrefix = Functions.GetWebFormFileNamePrefix(gridViewType, this._organizeWebForm);
                str2 = organizeWebFormPrefix + table.Name + str1;
                switch (gridViewType)
                {
                case GridViewType.FilterBy:
                    str2 = formFileNamePrefix + table.Name + "By" + this._fkColumn.Name + str1;
                    break;

                case GridViewType.Grouping:
                    str2 = formFileNamePrefix + this._referencingTable.Name + "By" + table.Name + str1;
                    break;
                }
            }
            if (this._isUseFriendlyUrls)
            {
                if (gridViewType == GridViewType.NotAGridView && title == "Add New & Edit Record")
                {
                    sb.AppendLine("                    <li><a href=\"" + str2 + "/add\">" + str2 + "/add</a></li>");
                }
                else if (gridViewType == GridViewType.NotAGridView && title == "Record Details (Read-Only)")
                {
                    sb.AppendLine("                    <li>" + str2 + "</li>");
                }
                else
                {
                    sb.AppendLine("                    <li><a href=\"" + str2 + "\">" + str2 + "</a></li>");
                }
            }
            else if (gridViewType == GridViewType.NotAGridView && title == "Add New & Edit Record")
            {
                sb.AppendLine("                    <li><a href=\"" + str2 + "?operation=add\">" + str2 + "</a></li>");
            }
            else if (gridViewType == GridViewType.NotAGridView && title == "Record Details (Read-Only)")
            {
                sb.AppendLine("                    <li>" + str2 + "</li>");
            }
            else
            {
                sb.AppendLine("                    <li><a href=\"" + str2 + "\">" + str2 + "</a></li>");
            }
        }
Ejemplo n.º 14
0
        public static Color ColorFromValue(float value, GridViewType view_type, float min_value, float max_value)
        {
            if (view_type == GridViewType.Grey || view_type == GridViewType.GreyReverse)
            {
                return(ColorFromValue(value, min_value, max_value, view_type == GridViewType.GreyReverse, true));
            }

            if (view_type == GridViewType.Rainbow || view_type == GridViewType.RainbowReverse)
            {
                return(ColorFromValue(value, min_value, max_value, view_type == GridViewType.RainbowReverse, false));
            }

            if (view_type == GridViewType.Greens || view_type == GridViewType.Blues || view_type == GridViewType.Reds)
            {
                float rval = value;
                rval = Math.Max(min_value, rval);
                rval = Math.Min(max_value, rval);
                float rel_value = (max_value != min_value) ? (rval - min_value) / (max_value - min_value) : 0;
                int   r, g, b;
                switch (view_type)
                {
                case GridViewType.Greens:      // 11,111,19
                    r = (int)(220 - rel_value * (220 - 11));
                    g = (int)(220 - rel_value * (220 - 111));
                    b = (int)(220 - rel_value * (220 - 19));
                    break;

                case GridViewType.Blues:     //15,67,138
                    r = (int)(220 - rel_value * (220 - 15));
                    g = (int)(220 - rel_value * (220 - 67));
                    b = (int)(220 - rel_value * (220 - 138));
                    break;

                case GridViewType.Reds:     //219,31,72
                    r = (int)(240 - rel_value * (220 - 219));
                    g = (int)(240 - rel_value * (220 - 31));
                    b = (int)(240 - rel_value * (220 - 72));
                    break;

                default:
                    r = g = b = 0;
                    break;
                }
                return(Color.FromArgb(r, g, b));
            }

            if (view_type == GridViewType.Heat)
            {
                float rval = value;
                rval = Math.Max(min_value, rval);
                rval = Math.Min(max_value, rval);
                float rel_value = 1 - (rval - min_value) / (max_value - min_value);
                int   g = 255, b = 0;
                if (rel_value < 0.5)
                {
                    g = (int)(rel_value * 2.0F * 255);
                }
                if (rel_value > 0.5)
                {
                    b = (int)((rel_value - 0.5) * 2.0F * 255);
                }
                return(Color.FromArgb(255, g, b));
            }

            return(ColorFromPalette((int)value, view_type));
        }