예제 #1
0
		internal static void generatePalettes(Palette.Kind Kind, int Size)
		{
			palettes.Clear();
			if (Kind == Palette.Kind.Diverging)
			{
				palettes.Add(ColorBrewer.BrewerPalettes.Spectral(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.RdYlGn(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.RdBu(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.PiYG(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.PRGn(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.RdYlBu(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.BrBG(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.RdGy(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.PuOr(Size));
			}
			else if (Kind == Palette.Kind.Qualitative)
			{
				palettes.Add(ColorBrewer.BrewerPalettes.Set2(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.Accent(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.Set1(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.Set3(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.Dark2(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.Paired(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.Pastel2(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.Pastel1(Size));

			}
			else if (Kind == Palette.Kind.Sequential)
			{
				palettes.Add(ColorBrewer.BrewerPalettes.OrRd(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.BuPu(Size));
				//palettes.Add(ColorBrewer.BrewerPalettes.Oranges(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.BuGn(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.YlOrBr(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.YlGn(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.Reds(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.RdPu(Size));
				//palettes.Add(ColorBrewer.BrewerPalettes.Greens(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.YlGnBu(Size));
				//palettes.Add(ColorBrewer.BrewerPalettes.Purples(Size));
				//palettes.Add(ColorBrewer.BrewerPalettes.GnBu(Size));
				//palettes.Add(ColorBrewer.BrewerPalettes.Greys(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.YlOrRd(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.PuRd(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.Blues(Size));
				palettes.Add(ColorBrewer.BrewerPalettes.PuBuGn(Size));
			}
			else if (Kind == Palette.Kind.Fixed)
			{
				palettes.Add(defaultPalette);
				palettes.Add(FixedColors.FixedColorPalettes.blackForest());
				palettes.Add(FixedColors.FixedColorPalettes.mars());
				palettes.Add(FixedColors.FixedColorPalettes.departure());
				palettes.Add(FixedColors.FixedColorPalettes.northRhine());
				palettes.Add(FixedColors.FixedColorPalettes.wiki2());
				palettes.Add(FixedColors.FixedColorPalettes.plumbago());
				palettes.Add(FixedColors.FixedColorPalettes.cw1_013());
				palettes.Add(FixedColors.FixedColorPalettes.arctic());
			}
		}
예제 #2
0
파일: Palettes.cs 프로젝트: DBT85/SCANsat
		internal _Palettes (Palette[] p, Palette.Kind pK, int i)
		{
			availablePalettes = p;
			int j = 0;
			for (int d = 0; i < availablePalettes.Length; i++ )
			{
				availablePalettes[d].index = j;
				j++;
			}
			paletteType = pK;
			size = i;
			generateSwatches();
		}
예제 #3
0
		internal SCANterrainConfig(SCANterrainConfig copy)
		{
			minHeightRange = copy.minHeightRange;
			maxHeightRange = copy.maxHeightRange;
			clampTerrain = copy.clampTerrain;
			clampHeight = copy.clampHeight;
			colorPal = copy.colorPal;
			paletteName = copy.paletteName;
			paletteSize = copy.paletteSize;
			paletteReverse = copy.paletteReverse;
			paletteDiscrete = copy.paletteDiscrete;
			body = copy.body;
			name = copy.name;
		}
예제 #4
0
		internal Texture2D getLegend(float min, float max, int scheme, SCANdata data)
		{
			if (legend != null && legendMin == min && legendMax == max && legendScheme == scheme && data.TerrainConfig.ColorPal.hash == dataPalette.hash)
				return legend;
			legend = new Texture2D(256, 1, TextureFormat.RGB24, false);
			legendMin = min;
			legendMax = max;
			legendScheme = scheme;
			dataPalette = data.TerrainConfig.ColorPal;
			Color[] pix = legend.GetPixels();
			for (int x = 0; x < 256; ++x)
			{
				float val = (x * (max - min)) / 256f + min;
				pix[x] = palette.heightToColor(val, scheme, data);
			}
			legend.SetPixels(pix);
			legend.Apply();
			return legend;
		}
예제 #5
0
		internal SCANterrainConfig(float min, float max, float? clamp, Palette color, int size, bool reverse, bool discrete, CelestialBody b)
		{
			minHeightRange = min;
			maxHeightRange = max;
			clampTerrain = clamp;
			if (clampTerrain == null)
				clampHeight = "Null";
			else
				clampHeight = clampTerrain.Value.ToString("F0");
			colorPal = color;
			paletteName = colorPal.name;
			paletteSize = size;
			paletteReverse = reverse;
			paletteDiscrete = discrete;
			body = b;
			name = body.name;
			index = body.flightGlobalsIndex;

			setDefaultValues();
		}
예제 #6
0
		//Change the max range on the palette size slider based on palette type
		private void setSizeSlider(Palette.Kind k)
		{
			int max = 11;
			switch (k)
			{
				case Palette.Kind.Diverging:
					{
						max = 11;
						break;
					}
				case Palette.Kind.Qualitative:
					{
						max = 12;
						break;
					}
				case Palette.Kind.Sequential:
					{
						max = 9;
						break;
					}
				case Palette.Kind.Fixed:
					{
						break;
					}
			}

			paletteSizeSlider.MaxValue = max;
			if (pSize > paletteSizeSlider.MaxValue)
				pSize = paletteSizeSlider.MaxValue;
			
		}
예제 #7
0
		public override void OnDecodeFromConfigNode()
		{
			body = FlightGlobals.Bodies.FirstOrDefault(b => b.flightGlobalsIndex == index);
			if (body != null)
				name = body.name;

			colorPal = SCANUtil.paletteLoader(paletteName, paletteSize);

			float tempClamp = 0;
			if (clampHeight == "Null" || clampHeight == "null" || string.IsNullOrEmpty(clampHeight))
				clampTerrain = null;
			else if (float.TryParse(clampHeight, out tempClamp))
				clampTerrain = tempClamp;
			else
				clampTerrain = null;

			setDefaultValues();

			SCANUtil.SCANdebugLog("SCANsat Terrain Config Decode");
			SCANUtil.SCANdebugLog("-------->Body Name             =>   {0}", name);
			SCANUtil.SCANdebugLog("-------->Body Index            =>   {0}", index);
			SCANUtil.SCANdebugLog("-------->Min Height Range      =>   {0}", minHeightRange);
			SCANUtil.SCANdebugLog("-------->Max Height Range      =>   {0}", maxHeightRange);
			SCANUtil.SCANdebugLog("-------->Clamp Height          =>   {0}", clampHeight);
			SCANUtil.SCANdebugLog("-------->Palette Name          =>   {0}", paletteName);
			SCANUtil.SCANdebugLog("-------->Palette Size          =>   {0}", paletteSize);
			SCANUtil.SCANdebugLog("-------->Palette Reverse       =>   {0}", paletteReverse);
			SCANUtil.SCANdebugLog("-------->Palette Discrete      =>   {0}", paletteDiscrete);
		}
예제 #8
0
		private void setDefaultValues()
		{
			defaultMinHeight = minHeightRange;
			defaultMaxHeight = maxHeightRange;
			defaultClamp = clampTerrain;
			defaultPalette = colorPal;
			defaultPaletteSize = paletteSize;
			defaultDiscrete = paletteDiscrete;
			defaultReverse = paletteReverse;
		}
예제 #9
0
		internal static _Palettes setCurrentPalettesType(Palette.Kind type, int size)
		{
			switch (type)
			{
				case Palette.Kind.Fixed:
					return generatePaletteSet(0, Palette.Kind.Fixed);
				default:
					return generatePaletteSet(size, type);
			}
			//switch (type)
			//{
			//	case Palette.Kind.Diverging:
			//		return generatePaletteSet(size, type);
			//		//return divPaletteSet; 
			//	case Palette.Kind.Qualitative:
			//		//return qualPaletteSet;
			//	case Palette.Kind.Sequential:
			//		//return seqPaletteSet;
			//	case Palette.Kind.Fixed:
			//		//return fixedPaletteSet;
			//	default:
			//		//return divPaletteSet;
			//}
		}
예제 #10
0
		private static _Palettes generatePaletteSet(int size, Palette.Kind type)
		{
			PaletteLoader.generatePalettes(type, size);
			return new _Palettes(PaletteLoader.palettes.ToArray(), type, size);
		}
예제 #11
0
		private void setNewTerrainConfigValues(SCANterrainConfig terrain, float min, float max, float? clamp, Palette c, int size, bool reverse, bool discrete)
		{
			terrain.MinTerrain = min;
			terrain.MaxTerrain = max;
			terrain.ClampTerrain = clamp;
			terrain.ColorPal = c;
			terrain.PalSize = size;
			terrain.PalRev = reverse;
			terrain.PalDis = discrete;
		}