Ejemplo n.º 1
0
        public bool TryAddNewColorSwatch(ColorSwatch newColorSwatch)
        {
            bool wasAdded = false;
            IQueryable <ColorSwatch> colorSwatchResults = ColorSwatches.Where(entity => entity.Brand == newColorSwatch.Brand && entity.Name == newColorSwatch.Name);

            if (colorSwatchResults.Count() == 0)
            {
                ColorSwatches.Add(newColorSwatch);
                SaveChanges();
                wasAdded = true;
                Console.WriteLine("Added " + newColorSwatch.Name);
            }
            else
            {
                ColorSwatch existingColorSwatch             = colorSwatchResults.First();
                ColorNumber newColorNumber                  = newColorSwatch.ColorNumbers[0];
                IQueryable <ColorNumber> colorNumberResults = ColorNumbers.Where(entity => entity.Number == newColorNumber.Number && entity.ColorSwatchId == existingColorSwatch.Id);
                if (colorNumberResults.Count() == 0)
                {
                    newColorNumber.ColorSwatchId = existingColorSwatch.Id;
                    ColorNumbers.Add(newColorNumber);
                    SaveChanges();
                    wasAdded = true;
                    Console.WriteLine("Added " + newColorNumber.Number + " for " + existingColorSwatch.Name);
                }
            }
            return(wasAdded);
        }
Ejemplo n.º 2
0
        public override void WriteGroupCodes()
        {
            int flags;

            WriteGroupCodeValue(2, LayerName.Trim());
            WriteGroupCodeValue(62, ColorNumber.ToString());
            WriteGroupCodeValue(6, LineTypeName.Trim());

            flags = GetStandardFlags();

            if (IsFrozen)
            {
                flags += 1;
            }
            if (IsFrozenInNewViewports)
            {
                flags += 2;
            }
            if (IsLocked)
            {
                flags += 4;
            }

            WriteGroupCodeValue(70, flags.ToString().Trim());
        }
Ejemplo n.º 3
0
        public void UpdateSensorValues()
        {
            var tex = dispCamera.targetTexture;

            // RenderTextureキャプチャ
            RenderTexture.active = dispCamera.targetTexture;

            targetTexture.ReadPixels(new Rect(0, 0, tex.width, tex.height), 0, 0);
            targetTexture.Apply();

            // 照度を取得する
            this.lightValue = GetLightValue(targetTexture);

            //color id を取得する.
            r_col         = this.GetCol(this.rgb_r);
            g_col         = this.GetCol(this.rgb_g);
            b_col         = this.GetCol(this.rgb_b);
            this.color_id = this.color_array[r_col, g_col, b_col];
        }