Color getShadedColorForType(int pType, double pSunValue)
  {
    double lBrightness;

    if(pSunValue < 0)
    {
      // The sun is below the horizon.
      lBrightness = fNightSideBrightness / 100;
    } else
    {
      // The sun is above the horizon. The brightness will range from
      // the base to the maximum value.
      lBrightness = (fDaySideValueBase + pSunValue * fDaySideValueRange) / 100;
    }
    if(lBrightness > 1.0)
    {
      lBrightness = 1.0;
    }

    switch(pType)
    {
      case BitGeneratorMap.PixTypeSpace:
        return COLOR_SPACE;

      case BitGeneratorMap.PixTypeStar:
        return COLOR_STAR;

      case BitGeneratorMap.PixTypeGridLand:
        return shade(COLOR_GRID_LAND, lBrightness);

      case BitGeneratorMap.PixTypeGridWater:
        return shade(COLOR_GRID_WATER, lBrightness);

      case BitGeneratorMap.PixTypeLand:
        return shade(COLOR_LAND, lBrightness);

      case BitGeneratorMap.PixTypeWater:
        return shade(COLOR_WATER, lBrightness);
    }

    return null;
  }