﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Windows.UI;
using MilSymUtilities;

namespace MilSymUwp
{


    public class SymbolUtilities : MilSymUtilities.SymbolUtilities
    {

        /**
         * Gets line color used if no line color has been set. The color is specified based on the affiliation of
         * the symbol and whether it is a unit or not.
         * @param symbolID
         * @return
         */
        public static Color getLineColorOfAffiliation(String symbolID)
        {
            Color retColor = Colors.Transparent;
            String basicSymbolID = getBasicSymbolID(symbolID);
            try
            {
                // We can't get the fill color if there is no symbol id, since that also means there is no affiliation
                if ((symbolID == null) || (symbolID.Equals("")))
                {
                    return retColor;
                }

                if (SymbolUtilities.isTacticalGraphic(symbolID))// && !SymbolUtilities.isTGWithFill(symbolID))
                {
                    if (SymbolUtilities.isWeather(symbolID))
                    {
                        retColor = getLineColorOfWeather(symbolID);
                    }
                    else if (SymbolUtilities.isObstacle(symbolID))
                    {
                        retColor = Colors.Green;	// Green
                    }
                    else if ((SymbolUtilities.isNBC(symbolID))
                            && (basicSymbolID.Equals("G*M*NR----****X") == true || //Radioactive Area
                            basicSymbolID.Equals("G*M*NC----****X") == true || //Chemically Contaminated Area
                            basicSymbolID.Equals("G*M*NB----****X") == true)) //Biologically Contaminated Area
                    {
                        retColor = Colors.Black;//0xffff00;
                    }
                    else if (SymbolUtilities.isEMSNaturalEvent(symbolID))
                    {
                        retColor = Colors.Black;//0xffff00;
                    }
                    else
                    {
                        char switchChar = symbolID[1];
                        if (switchChar == 'F'
                                || switchChar == 'A'
                                || switchChar == 'D'
                                || switchChar == 'M')
                        {
                            retColor = Colors.Black;//0x000000;	// Black
                        }
                        else if (switchChar == 'H'
                                || switchChar == 'S'
                                || switchChar == 'J'
                                || switchChar == 'K')
                        {

                            if (SymbolUtilities.getBasicSymbolID(symbolID).Equals("G*G*GLC---****X")) // Line of Contact
                            {
                                retColor = Colors.Black;//0x000000;	// Black
                            }
                            else
                            {
                                retColor = Colors.Red;//0xff0000;	// Red
                            }

                        }
                        else if (switchChar.Equals("N")
                                || switchChar.Equals("L")) // Neutral:
                        {
                            retColor = Colors.Green;//0x00ff00;	// Green

                        }
                        else if (switchChar.Equals("U")
                                || switchChar.Equals("P")
                                || switchChar.Equals("O")
                                || switchChar.Equals("G")
                                || switchChar.Equals("W"))
                        {
                            if (symbolID.Substring(0, 8).Equals("WOS-HDS-"))
                            {
                                retColor = Colors.Gray;//0x808080;	// Gray
                            }
                            else
                            {
                                retColor = Colors.Yellow;//0xffff00;	// Yellow
                            }

                        }
                        else
                        {
                            retColor = Colors.Black;//null;//0;//Color.Empty;

                        }	// End default

                    }	// End else
                }// End if (SymbolUtilities.IsTacticalGraphic(this.SymbolID))
                else
                {
                    //stopped doing check because all warfighting
                    //should have black for line color.
                    retColor = Colors.Black;

                }	// End else
            } // End try
            catch (Exception e)
            {
                // Log Error
                ErrorLogger.LogException("SymbolUtilties", "getLineColorOfAffiliation", e);
                //throw e;
            }	// End catch
            return retColor;
        }   // End get LineColorOfAffiliation


        /**
         * Is the fill color used if no fill color has been set. The color is specified based on the affiliation
          of the symbol and whether it is a unit or not.
         * @param symbolID
         * @return
         */

        public static Color getFillColorOfAffiliation(String symbolID)
        {
            Color retColor = Colors.Transparent;
            String basicSymbolID = getBasicSymbolID(symbolID);

            try
            {
                char switchChar;
                // We can't get the fill color if there is no symbol id, since that also means there is no affiliation
                if ((symbolID == null) || (symbolID.Equals("")))
                {
                    return retColor;
                }

                if (basicSymbolID.Equals("G*M*NZ----****X") ||//ground zero
                                                              //basicSymbolID.Equals("G*M*NF----****X") || //fallout producing
                        basicSymbolID.Equals("G*M*NEB---****X") ||//biological
                        basicSymbolID.Equals("G*M*NEC---****X"))//chemical
                {
                    retColor = AffiliationColors.UnknownUnitFillColor;//  Color.yellow;
                }
                else if (SymbolUtilities.isTacticalGraphic(symbolID) && !SymbolUtilities.isTGSPWithFill(symbolID))
                {
                    if (basicSymbolID.Equals("G*M*NZ----****X") ||//ground zero
                                                                  //basicSymbolID.Equals("G*M*NF----****X") || //fallout producing
                            basicSymbolID.Equals("G*M*NEB---****X") ||//biological
                            basicSymbolID.Equals("G*M*NEC---****X"))//chemical
                    {
                        retColor = Colors.Yellow;
                    }
                    else
                    {
                        switchChar = symbolID[1];
                        if (switchChar == 'F'
                                || switchChar == 'A'
                                || switchChar == 'D'
                                || switchChar == 'M')
                        {
                            retColor = AffiliationColors.FriendlyGraphicFillColor;//0x00ffff;	// Cyan

                        }
                        else if (switchChar == 'H'
                                || switchChar == 'S'
                                || switchChar == 'J'
                                || switchChar == 'K')
                        {
                            retColor = AffiliationColors.HostileGraphicFillColor;//0xfa8072;	// Salmon

                        }
                        else if (switchChar == 'N'
                                || switchChar == 'L')
                        {
                            retColor = AffiliationColors.NeutralGraphicFillColor;//0x7fff00;	// Light Green

                        }
                        else if (switchChar == 'U'
                                || switchChar == 'P'
                                || switchChar == 'O'
                                || switchChar == 'G'
                                || switchChar == 'W')
                        {
                            retColor = Color.FromArgb(255, 255, 250, 205); //0xfffacd;	// LemonChiffon 255 250 205
                        }
                        else
                        {
                            retColor = Colors.Transparent;
                        }
                    }
                } // End if(SymbolUtilities.IsTacticalGraphic(this._strSymbolID))
                else
                {
                    switchChar = symbolID[1];
                    if (switchChar == 'F'
                            || switchChar == 'A'
                            || switchChar == 'D'
                            || switchChar == 'M')
                    {
                        retColor = AffiliationColors.FriendlyUnitFillColor;//0x00ffff;	// Cyan

                    }
                    else if (switchChar == 'H'
                            || switchChar == 'S'
                            || switchChar == 'J'
                            || switchChar == 'K')
                    {
                        retColor = AffiliationColors.HostileUnitFillColor;//0xfa8072;	// Salmon

                    }
                    else if (switchChar == 'N'
                            || switchChar == 'L')
                    {
                        retColor = AffiliationColors.NeutralUnitFillColor;//0x7fff00;	// Light Green

                    }
                    else if (switchChar == 'U'
                            || switchChar == 'P'
                            || switchChar == 'O'
                            || switchChar == 'G'
                            || switchChar == 'W')
                    {
                        retColor = AffiliationColors.UnknownUnitFillColor;//new Color(255,250, 205); //0xfffacd;	// LemonChiffon 255 250 205
                    }
                    else
                    {
                        retColor = AffiliationColors.UnknownUnitFillColor;//null;
                    }

                }	// End else
            } // End try
            catch (Exception e)
            {
                // Log Error
                ErrorLogger.LogException("SymbolUtilties", "getFillColorOfAffiliation", e);
                //throw e;
            }	// End catch

            return retColor;
        }	// End FillColorOfAffiliation


        public static Color getLineColorOfWeather(String symbolID)
        {
            Color retColor = Colors.Black;
            // Get the basic id
            //String symbolID = SymbolUtilities.getBasicSymbolID(symbolID);

            //if(symbolID.Equals(get))
            if (symbolID.Equals("WAS-WSGRL-P----") || // Hail - Light not Associated With Thunder
                symbolID.Equals("WAS-WSGRMHP----") || // Hail - Moderate/Heavy not Associated with Thunder
                symbolID.Equals("WAS-PL----P----") || // Low Pressure Center - Pressure Systems
                symbolID.Equals("WAS-PC----P----") || // Cyclone Center - Pressure Systems
                symbolID.Equals("WAS-WSIC--P----") || // Ice Crystals (Diamond Dust)
                symbolID.Equals("WAS-WSPLL-P----") || // Ice Pellets - Light
                symbolID.Equals("WAS-WSPLM-P----") || // Ice Pellets - Moderate
                symbolID.Equals("WAS-WSPLH-P----") || // Ice Pellets - Heavy
                symbolID.Equals("WAS-WST-NPP----") || // Thunderstorm - No Precipication
                symbolID.Equals("WAS-WSTMR-P----") || // Thunderstorm Light to Moderate with Rain/Snow - No Hail
                symbolID.Equals("WAS-WSTHR-P----") || // Thunderstorm Heavy with Rain/Snow - No Hail
                symbolID.Equals("WAS-WSTMH-P----") || // Thunderstorm Light to Moderate - With Hail
                symbolID.Equals("WAS-WSTHH-P----") || // Thunderstorm Heavy - With Hail
                symbolID.Equals("WAS-WST-FCP----") || // Funnel Cloud (Tornado/Waterspout)
                symbolID.Equals("WAS-WST-SQP----") || // Squall
                symbolID.Equals("WAS-WST-LGP----") || // Lightning
                symbolID.Equals("WAS-WSFGFVP----") || // Fog - Freezing, Sky Visible
                symbolID.Equals("WAS-WSFGFOP----") || // Fog - Freezing, Sky not Visible
                symbolID.Equals("WAS-WSTSD-P----") || // Tropical Depression
                symbolID.Equals("WAS-WSTSS-P----") || // Tropical Storm
                symbolID.Equals("WAS-WSTSH-P----") || // Hurricane/Typhoon
                symbolID.Equals("WAS-WSRFL-P----") || // Freezing Rain - Light
                symbolID.Equals("WAS-WSRFMHP----") || // Freezing Rain - Moderate/Heavy
                symbolID.Equals("WAS-WSDFL-P----") || // Freezing Drizzle - Light
                symbolID.Equals("WAS-WSDFMHP----") || // Freezing Drizzle - Moderate/Heavy
                symbolID.Equals("WOS-HHDMDBP----") || //mine-naval (doubtful)
                symbolID.Equals("WOS-HHDMDFP----") || // mine-naval (definited)
                symbolID.Substring(0, 7).Equals("WA-DPFW") || //warm front
                                                              //symbolID.substring(0,7).Equals("WA-DPFS")//stationary front (actually, it's red & blue)
                symbolID.Equals("WA-DBAIF----A--") || // INSTRUMENT FLIGHT RULE (IFR)
                symbolID.Equals("WA-DBAFP----A--") || // 
                symbolID.Equals("WA-DBAT-----A--") || // 
                symbolID.Equals("WA-DIPIS---L---") || // 
                symbolID.Equals("WA-DIPTH---L---") || // 
                symbolID.Equals("WA-DWJ-----L---") || // Jet Stream  
                symbolID.Equals("WO-DGMSB----A--") || //
                symbolID.Equals("WO-DGMRR----A--") ||
                symbolID.Equals("WO-DGMCH----A--") ||
                symbolID.Equals("WO-DGMIBE---A--") ||
                symbolID.Equals("WO-DGMBCC---A--") ||
                symbolID.Equals("WO-DOBVI----A--"))
            {
                retColor = Colors.Red;//0xff0000;	// Red
            }
            else if (symbolID.Equals("WAS-PH----P----") || // High Pressure Center - Pressure Systems
                    symbolID.Equals("WAS-PA----P----") || // Anticyclone Center - Pressure Systems
                    symbolID.Equals("WA-DBAMV----A--") || // MARGINAL VISUAL FLIGHT RULE (MVFR)
                    symbolID.Equals("WA-DBATB----A--") || // BOUNDED AREAS OF WEATHER / TURBULENCE
                    symbolID.Substring(0, 5).Equals("WAS-T") || // Turbulence
                    symbolID.Substring(0, 7).Equals("WA-DPFC") || //cold front
                    symbolID.Equals("WO-DGMIBA---A--"))
            {
                retColor = Colors.Blue;
            }
            else if (
            symbolID.Equals("WAS-WSFGPSP----") || // Fog - Shallow Patches
            symbolID.Equals("WAS-WSFGCSP----") || // Fog - Shallow Continuous
            symbolID.Equals("WAS-WSFGP-P----") || // Fog - Patchy
            symbolID.Equals("WAS-WSFGSVP----") || // Fog - Sky Visible
            symbolID.Equals("WAS-WSFGSOP----") || // Fog - Sky Obscured
            symbolID.Equals("WA-DBAFG----A--") || // Fog
            symbolID.Equals("WO-DGMRM----A--") ||
            symbolID.Equals("WO-DGMCM----A--") ||
            symbolID.Equals("WO-DGMIBC---A--") ||
            symbolID.Equals("WO-DGMBCB---A--") ||
            symbolID.Equals("WO-DGMBTE---A--") ||
            symbolID.Equals("WAS-WSBR--P----")) // Mist
            {
                retColor = Colors.Yellow;//0xffff00;	// Yellow
            }
            else if (
            symbolID.Equals("WAS-WSFU--P----") || // Smoke
            symbolID.Equals("WAS-WSHZ--P----") || // Haze
            symbolID.Equals("WAS-WSDSLMP----") || // Dust/Sand Storm - Light to Moderate
            symbolID.Equals("WAS-WSDSS-P----") || // Dust/Sand Storm - Severe
            symbolID.Equals("WAS-WSDD--P----") || // Dust Devil
            symbolID.Equals("WA-DBAD-----A--") || // Dust or Sand
            symbolID.Equals("WAS-WSBD--P----")) // Blowing Dust or Sand
            {
                retColor = Color.FromArgb(255, 165, 42, 42);  //165 42 42 //0xa52a2a;	// Brown
            }
            else if (
            symbolID.Equals("WA-DBALPNC--A--") || // 
            symbolID.Equals("WA-DBALPC---A--") || // 
            symbolID.Equals("WA-DIPID---L---") || // 
            symbolID.Equals("WO-DHCF----L---") || // 
            symbolID.Equals("WO-DHCF-----A--") || // 
            symbolID.Equals("WO-DGMSIM---A--") || //
            symbolID.Equals("WO-DGMRS----A--") ||
            symbolID.Equals("WO-DGMCL----A--") ||
            symbolID.Equals("WO-DGMIBB---A--") ||
            symbolID.Equals("WO-DGMBCA---A--") ||
            symbolID.Equals("WAS-WSR-LIP----") || // Rain - Intermittent Light
            symbolID.Equals("WAS-WSR-LCP----") || // Rain - Continuous Light
            symbolID.Equals("WAS-WSR-MIP----") || // Rain - Intermittent Moderate
            symbolID.Equals("WAS-WSR-MCP----") || // Rain - Continuous Moderate
            symbolID.Equals("WAS-WSR-HIP----") || // Rain - Intermittent Heavy
            symbolID.Equals("WAS-WSR-HCP----") || // Rain - Continuous Heavy
            symbolID.Equals("WAS-WSRSL-P----") || // Rain Showers - Light
            symbolID.Equals("WAS-WSRSMHP----") || // Rain Showers - Moderate/Heavy
            symbolID.Equals("WAS-WSRST-P----") || // Rain Showers - Torrential
            symbolID.Equals("WAS-WSD-LIP----") || // Drizzle - Intermittent Light
            symbolID.Equals("WAS-WSD-LCP----") || // Drizzle - Continuous Light
            symbolID.Equals("WAS-WSD-MIP----") || // Drizzle - Intermittent Moderate
            symbolID.Equals("WAS-WSD-MCP----") || // Drizzle - Continuous Moderate
            symbolID.Equals("WAS-WSD-HIP----") || // Drizzle - Intermittent Heavy
            symbolID.Equals("WAS-WSD-HCP----") || // Drizzle - Continuous Heavy
            symbolID.Equals("WAS-WSM-L-P----") || // Rain or Drizzle and Snow - Light
            symbolID.Equals("WAS-WSM-MHP----") || // Rain or Drizzle and Snow - Moderate/Heavy
            symbolID.Equals("WAS-WSMSL-P----") || // Rain and Snow Showers - Light
            symbolID.Equals("WAS-WSMSMHP----") || // Rain and Snow Showers - Moderate/Heavy
            symbolID.Equals("WAS-WSUKP-P----") || // Precipitation of unknown type & intensity
            symbolID.Equals("WAS-WSS-LIP----") || // Snow - Intermittent Light
            symbolID.Equals("WAS-WSS-LCP----") || // Snow - Continuous Light
            symbolID.Equals("WAS-WSS-MIP----") || // Snow - Intermittent Moderate
            symbolID.Equals("WAS-WSS-MCP----") || // Snow - Continuous Moderate
            symbolID.Equals("WAS-WSS-HIP----") || // Snow - Intermittent Heavy
            symbolID.Equals("WAS-WSS-HCP----") || // Snow - Continuous Heavy
            symbolID.Equals("WAS-WSSBLMP----") || // Blowing Snow - Light/Moderate
            symbolID.Equals("WAS-WSSBH-P----") || // Blowing Snow - Heavy
            symbolID.Equals("WAS-WSSG--P----") || // Snow Grains
            symbolID.Equals("WAS-WSSSL-P----") || // Snow Showers - Light
            symbolID.Equals("WAS-WSSSMHP----")) // Snow Showers - Moderate/Heavy
            {
                retColor = Colors.Green;// 0x00ff00;	// Green
            }
            else if (symbolID.StartsWith("WAS-IC") || // Clear Icing
                                        symbolID.StartsWith("WAS-IR") || // Rime Icing
                                        symbolID.StartsWith("WAS-IM")) // Mixed Icing
            {
                retColor = Color.FromArgb(255, 128, 96, 16);
            }
            else if (symbolID.Equals("WOS-HDS---P----") || // Soundings
                symbolID.Equals("WOS-HHDF--P----") ||//foul ground
                symbolID.Equals("WO-DHHDF----A--") ||//foul ground
                symbolID.Equals("WOS-HPFS--P----") ||//fish stakes/traps/weirs
                symbolID.Equals("WOS-HPFS---L---") ||//fish stakes
                symbolID.Equals("WOS-HPFF----A--") ||//fish stakes/traps/weirs
                symbolID.Equals("WO-DHDDL---L---") ||//depth curve
                symbolID.Equals("WO-DHDDC---L---") ||//depth contour
                symbolID.Equals("WO-DHCC----L---") ||//coastline
                symbolID.Equals("WO-DHPBP---L---") ||//ports
                symbolID.Equals("WO-DHPMO---L---") ||//offshore loading
                symbolID.Equals("WO-DHPSPA--L---") ||//sp above water
                symbolID.Equals("WO-DHPSPB--L---") ||//sp below water
                symbolID.Equals("WO-DHPSPS--L---") ||//sp sea wall
                symbolID.Equals("WO-DHHDK--P----") ||//kelp seaweed
                symbolID.Equals("WO-DHHDK----A--") ||//kelp seaweed
                symbolID.Equals("WO-DHHDB---L---") ||//breakers
                symbolID.Equals("WO-DTCCCFE-L---") ||//current flow - ebb
                symbolID.Equals("WO-DTCCCFF-L---") ||//current flow - flood
                symbolID.Equals("WOS-TCCTD-P----") ||//tide data point    
                symbolID.Equals("WO-DHCW-----A--") ||
                symbolID.Equals("WO-DMOA-----A--") ||
                symbolID.Equals("WO-DMPA----L---"))//water
                retColor = Colors.Gray;//0x808080;	// Gray
            else if (
                symbolID.Equals("WO-DBSM-----A--") ||
                symbolID.Equals("WO-DBSF-----A--") ||
                symbolID.Equals("WO-DGMN-----A--")) // 
            {
                retColor = Color.FromArgb(255, 230, 230, 230);//230,230,230;	// light gray
            }
            else if (
                symbolID.Equals("WO-DBSG-----A--")) // 
            {
                retColor = Color.FromArgb(255, 169, 169, 169);//169,169,169;	// dark gray
            }
            else if (
            symbolID.Equals("WAS-WSVE--P----") || // Volcanic Eruption
            symbolID.Equals("WAS-WSVA--P----") || // Volcanic Ash
            symbolID.Equals("WAS-WST-LVP----") || // Tropopause Level
            symbolID.Equals("WAS-WSF-LVP----")) // Freezing Level
            {
                retColor = Colors.Black;//0x000000;	// Black
            }
            else if (
            symbolID.Equals("WOS-HPBA--P----") || // anchorage
            symbolID.Equals("WOS-HPBA---L---") || // anchorage
            symbolID.Equals("WOS-HPBA----A--") || // anchorage
            symbolID.Equals("WOS-HPCP--P----") || // call in point
            symbolID.Equals("WOS-HPFH--P----") || // fishing harbor
            symbolID.Equals("WOS-HPM-FC-L---") || //ferry crossing
            symbolID.Equals("WOS-HABM--P----") || //marker
            symbolID.Equals("WOS-HAL---P----") || //light
            symbolID.Equals("WA-DIPIT---L---") || //ISOTACH
            symbolID.Equals("WOS-TCCTG-P----") || // Tide gauge
            symbolID.Equals("WO-DL-ML---L---") ||
            symbolID.Equals("WOS-HPM-FC-L---") ||
            symbolID.Equals("WO-DL-RA---L---") ||
            symbolID.Equals("WO-DHPBA---L---") ||
            symbolID.Equals("WO-DMCA----L---") ||
            symbolID.Equals("WO-DHPBA----A--") ||
            symbolID.Equals("WO-DL-MA----A--") ||
            symbolID.Equals("WO-DL-SA----A--") ||
            symbolID.Equals("WO-DL-TA----A--") ||
            symbolID.Equals("WO-DGMSR----A--"))
            {
                retColor = Color.FromArgb(255, 255, 0, 255);//magenta
            }
            else if (symbolID.Substring(0, 7).Equals("WA-DPFO")//occluded front
            )
            {
                retColor = Color.FromArgb(255, 226, 159, 255);//light purple
            }
            else if (
            symbolID.Equals("WA-DPXITCZ-L---") || // inter-tropical convergance zone oragne?
            symbolID.Equals("WO-DL-O-----A--") ||
            symbolID.Equals("WA-DPXCV---L---")) // 
            {
                retColor = Color.FromArgb(255, 255, 165, 0);//orange
            }
            else if (
            symbolID.Equals("WA-DBAI-----A--") || //BOUNDED AREAS OF WEATHER / ICING
            symbolID.StartsWith("WAS-IC") || // clear icing
            symbolID.StartsWith("WAS-IR") || // rime icing
            symbolID.StartsWith("WAS-IM")) // mixed icing
            {
                retColor = Color.FromArgb(255, 128, 96, 16);//mud?
            }
            else if (
            symbolID.Equals("WO-DHCI-----A--") || //Island
            symbolID.Equals("WO-DHCB-----A--") || //Beach
            symbolID.Equals("WO-DHPMO---L---") ||//offshore loading
            symbolID.Equals("WO-DHCI-----A--")) // mixed icing
            {
                retColor = Color.FromArgb(255, 210, 176, 106);//light/soft brown
            }
            else if (symbolID.Substring(0, 7).Equals("WO-DOBVA----A--")
            )
            {
                retColor = Color.FromArgb(255, 26, 153, 77);//dark green
            }
            else if (symbolID.Substring(0, 7).Equals("WO-DGMBTI---A--")
            )
            {
                retColor = Color.FromArgb(255, 255, 48, 0);//orange red
            }
            else if (symbolID.Substring(0, 7).Equals("WO-DGMBTH---A--")
            )
            {
                retColor = Color.FromArgb(255, 255, 80, 0);//dark orange
            }
            //255,127,0
            //WO-DGMBTG---A--
            else if (symbolID.Equals("WO-DGMBTG---A--"))
            {
                retColor = Color.FromArgb(255, 255, 127, 0);
            }
            //255,207,0
            //WO-DGMBTF---A--
            else if (symbolID.Equals("WO-DGMBTF---A--"))
            {
                retColor = Color.FromArgb(255, 255, 207, 0);
            }
            //048,255,0
            //WO-DGMBTA---A--
            else if (symbolID.Equals("WO-DGMBTA---A--"))
            {
                retColor = Color.FromArgb(255, 48, 255, 0);
            }
            //220,220,220
            //WO-DGML-----A--
            else if (symbolID.Equals("WO-DGML-----A--"))
            {
                retColor = Color.FromArgb(255, 220, 220, 220);
            }
            //255,220,220
            //WO-DGMS-SH--A--
            else if (symbolID.Equals("WO-DGMS-SH--A--"))
            {
                retColor = Color.FromArgb(255, 255, 220, 220);
            }
            //255,190,190
            //WO-DGMS-PH--A--
            else if (symbolID.Equals("WO-DGMS-PH--A--"))
            {
                retColor = Color.FromArgb(255, 255, 190, 190);
            }
            //lime green 128,255,51
            //WO-DOBVC----A--
            else if (symbolID.Equals("WO-DOBVC----A--"))
            {
                retColor = Color.FromArgb(255, 128, 255, 51);
            }
            //255,255,0
            //WO-DOBVE----A--
            else if (symbolID.Equals("WO-DOBVE----A--"))
            {
                retColor = Color.FromArgb(255, 255, 255, 0);
            }
            //255,150,150
            //WO-DGMS-CO--A--
            else if (symbolID.Equals("WO-DGMS-CO--A--"))
            {
                retColor = Color.FromArgb(255, 255, 150, 150);
            }
            //175,255,0
            //WO-DGMBTC---A--
            else if (symbolID.Equals("WO-DGMBTC---A--"))
            {
                retColor = Color.FromArgb(255, 175, 255, 0);
            }
            //207,255,0
            //WO-DGMBTD---A--
            else if (symbolID.Equals("WO-DGMBTD---A--"))
            {
                retColor = Color.FromArgb(255, 207, 255, 0);
            }
            //127,255,0
            //WO-DGMBTB---A--
            else if (symbolID.Equals("WO-DGMBTB---A--"))
            {
                retColor = Color.FromArgb(255, 127, 255, 0);
            }
            //255,127,0
            //WO-DGMIBD---A--
            else if (symbolID.Equals("WO-DGMIBD---A--"))
            {
                retColor = Color.FromArgb(255, 255, 127, 0);
            }
            else if (symbolID.Equals("WO-DGMSIF---A--"))
            {
                retColor = Color.FromArgb(255, 25, 255, 230);
            }
            //0,215,255
            //WO-DGMSIVF--A--
            else if (symbolID.Equals("WO-DGMSIVF--A--"))
            {
                retColor = Color.FromArgb(255, 0, 215, 255);
            }
            //255,255,220
            //WO-DGMSSVF--A--
            else if (symbolID.Equals("WO-DGMSSVF--A--"))
            {
                retColor = Color.FromArgb(255, 255, 255, 220);
            }
            //255,255,140
            //WO-DGMSSF---A--
            else if (symbolID.Equals("WO-DGMSSF---A--"))
            {
                retColor = Color.FromArgb(255, 255, 255, 140);
            }
            //255,235,0
            //WO-DGMSSM---A--
            else if (symbolID.Equals("WO-DGMSSM---A--"))
            {
                retColor = Color.FromArgb(255, 255, 235, 0);
            }
            //255,215,0
            //WO-DGMSSC---A--
            else if (symbolID.Equals("WO-DGMSSC---A--"))
            {
                retColor = Color.FromArgb(255, 255, 215, 0);
            }
            //255,180,0
            //WO-DGMSSVS--A--
            else if (symbolID.Equals("WO-DGMSSVS--A--"))
            {
                retColor = Color.FromArgb(255, 255, 180, 0);
            }
            //200,255,105
            //WO-DGMSIC---A--
            else if (symbolID.Equals("WO-DGMSIC---A--"))
            {
                retColor = Color.FromArgb(255, 200, 255, 105);
            }
            //100,130,255
            //WO-DGMSC----A--
            else if (symbolID.Equals("WO-DGMSC----A--"))
            {
                retColor = Color.FromArgb(255, 100, 130, 255);
            }
            //255,77,0
            //WO-DOBVH----A--
            else if (symbolID.Equals("WO-DOBVH----A--"))
            {
                retColor = Color.FromArgb(255, 255, 77, 0);
            }
            //255,128,0
            //WO-DOBVG----A--
            else if (symbolID.Equals("WO-DOBVG----A--"))
            {
                retColor = Color.FromArgb(255, 255, 128, 0);
            }
            //255,204,0
            //WO-DOBVF----A--
            else if (symbolID.Equals("WO-DOBVF----A--"))
            {
                retColor = Color.FromArgb(255, 255, 204, 0);
            }
            //204,255,26
            //WO-DOBVD----A--
            else if (symbolID.Equals("WO-DOBVD----A--"))
            {
                retColor = Color.FromArgb(255, 204, 255, 26);
            }
            else
            {
                retColor = Colors.Black;//0x000000;	// Black
            }

            return retColor;
        }


        /**
           * Only for single points at the moment
           * @param symbolID
           * @return 
           */
        public static Color getFillColorOfWeather(String symbolID)
        {
            if (symbolID.Equals("WOS-HPM-R-P----"))//landing ring - brown 148,48,0
                return Color.FromArgb(255, 148, 48, 0);
            else if (symbolID.Equals("WOS-HPD---P----"))//dolphin facilities - brown
                return Color.FromArgb(255, 148, 48, 0);
            else if (symbolID.Equals("WO-DHCB-----A--"))//
                return Color.FromArgb(255, 249, 243, 241);
            else if (symbolID.Equals("WOS-HABB--P----"))//buoy default - 255,0,255
                return Color.FromArgb(255, 255, 0, 255);//magenta
            else if (symbolID.Equals("WOS-HHRS--P----"))//rock submerged - 0,204,255
                return Color.FromArgb(255, 0, 204, 255);//a type of blue
            else if (symbolID.Equals("WOS-HHDS--P----"))//snags/stumps - 0,204,255
                return Color.FromArgb(255, 0, 204, 255);
            else if (symbolID.Equals("WOS-HHDWB-P----"))//wreck - 0,204,255
                return Color.FromArgb(255, 0, 204, 255);
            else if (symbolID.Equals("WOS-TCCTG-P----"))//tide gauge - 210, 176, 106
                return Color.FromArgb(255, 210, 176, 106);
            else if (symbolID.Equals("WO-DHCW-----A--"))//water
                return Color.FromArgb(255, 255, 255, 255);
            else if (symbolID.Equals("WO-DHABP----A--") ||
                symbolID.Equals("WO-DHHD-----A--") ||
                symbolID.Equals("WO-DHHDD----A--") ||
                symbolID.Equals("WO-DMCC-----A--"))
            {
                return Color.FromArgb(255, 0, 0, 255);
            }
            else if (symbolID.Equals("WO-DHPMD----A--"))//drydock
                return Color.FromArgb(255, 188, 153, 58);
            else return Colors.Transparent;
        }



        /**
         *
         * @param hexValue - String representing hex value
         * (formatted "0xRRGGBB" i.e. "0xFFFFFF")
         * OR
         * formatted "0xAARRGGBB" i.e. "0x00FFFFFF" for a color with an alpha value
         * I will also put up with "RRGGBB" and "AARRGGBB" without the starting "0x"
         * @return
         */
        public static Color getColorFromHexString(String hexValue)
        {
            try
            {
                Color returnVal = Colors.Transparent;

                if (hexValue.StartsWith("0x"))//0xRRGGBB or 0xAARRGGBB
                {
                    if (hexValue.Length == 8)
                    {

                        returnVal = Color.FromArgb(255,
                            byte.Parse(hexValue.Substring(2, 2), System.Globalization.NumberStyles.HexNumber),
                            byte.Parse(hexValue.Substring(4, 2), System.Globalization.NumberStyles.HexNumber),
                            byte.Parse(hexValue.Substring(6, 2), System.Globalization.NumberStyles.HexNumber));
                    }
                    else if (hexValue.Length == 10)
                    {
                        returnVal = Color.FromArgb(byte.Parse(hexValue.Substring(2, 2), System.Globalization.NumberStyles.HexNumber),
                            byte.Parse(hexValue.Substring(4, 2), System.Globalization.NumberStyles.HexNumber),
                            byte.Parse(hexValue.Substring(6, 2), System.Globalization.NumberStyles.HexNumber),
                            byte.Parse(hexValue.Substring(8, 2), System.Globalization.NumberStyles.HexNumber));
                    }
                }
                else if (hexValue.StartsWith("#"))//#RRGGBB or #AARRGGBB
                {
                    if (hexValue.Length == 7)
                    {
                        returnVal = Color.FromArgb(255,
                            byte.Parse(hexValue.Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
                            byte.Parse(hexValue.Substring(3, 2), System.Globalization.NumberStyles.HexNumber),
                            byte.Parse(hexValue.Substring(5, 2), System.Globalization.NumberStyles.HexNumber));
                    }
                    else if (hexValue.Length == 9)
                    {
                        returnVal = Color.FromArgb(byte.Parse(hexValue.Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
                            byte.Parse(hexValue.Substring(3, 2), System.Globalization.NumberStyles.HexNumber),
                            byte.Parse(hexValue.Substring(5, 2), System.Globalization.NumberStyles.HexNumber),
                            byte.Parse(hexValue.Substring(7, 2), System.Globalization.NumberStyles.HexNumber));
                    }
                }
                else//just RRGGBB or AARRGGBB without the starting 0x
                {
                    if (hexValue.Length == 6)
                    {
                        returnVal = Color.FromArgb(255,
                            byte.Parse(hexValue.Substring(0, 2), System.Globalization.NumberStyles.HexNumber),
                            byte.Parse(hexValue.Substring(2, 2), System.Globalization.NumberStyles.HexNumber),
                            byte.Parse(hexValue.Substring(4, 2), System.Globalization.NumberStyles.HexNumber));
                    }
                    else if (hexValue.Length == 8)
                    {
                        returnVal = Color.FromArgb(byte.Parse(hexValue.Substring(0, 2), System.Globalization.NumberStyles.HexNumber),
                            byte.Parse(hexValue.Substring(2, 2), System.Globalization.NumberStyles.HexNumber),
                            byte.Parse(hexValue.Substring(4, 2), System.Globalization.NumberStyles.HexNumber),
                            byte.Parse(hexValue.Substring(6, 2), System.Globalization.NumberStyles.HexNumber));
                    }
                }

                return returnVal;
            }
            catch (Exception exc)
            {
                Debug.WriteLine(exc.StackTrace);
                return Colors.Transparent;
            }
        }




    }
}

