private void insertBtn_Click(object sender, EventArgs e) { if (palleteCmbBox.SelectedIndex == 0) { CustomMessageBox.ShowDialog(this, "Niste izabrali paletu za unos."); return; } int _palletId = (palleteCmbBox.SelectedItem as ComboBoxItem).Value; int _palletNumber = Convert.ToInt32(palleteCmbBox.Text); foreach (DataGridViewRow row in insertPalleteDataGridView.Rows) { int id = Convert.ToInt32(row.Cells["id_pallet"].Value); if (_palletId == id) { CustomMessageBox.ShowDialog(this, "Već ste izabrali paletu sa ovim paletnim brojem."); return; } } Pallete _pallete = new Pallete(_palletId, _palletNumber); insertPalleteDataGridView.Rows.Add(_pallete._id, _pallete._number); palleteCmbBox.SelectedIndex = 0; }
/// <summary> /// [1] conter is not equal 0 then Auto detect Acivate NO_Clusert = countr /// [2] Loop ant put K from disnct color into KmeanCLuster & set Avege foreach Cluster 0 /// [3] Recrsive To Fill optimal Cluster /// [4] change 3D RGP Color Values to new Values /// </summary> private void ClusterKmean() { // List save KmeanCluster befor delete it newCend = new List <List <RGBPixel> >(NO_Clusert); // Update every itertiom new mean KmeanCluster = new List <List <RGBPixel> >(NO_Clusert); // Only sum for Evege sum = new List <MiniRGB>(NO_Clusert); // intializetiaon Kmean by No_cluster in first iteration for (int i = 0; i < NO_Clusert; i++) // o(cluster) ~= o(C) { KmeanCluster.Add(new List <RGBPixel>()); KmeanCluster[i].Add(li[i]); sum.Add(new MiniRGB(0, 0, 0)); } Recrsive(0); for (int i = 0; i < NO_Clusert; i++) // o(cluster * length every cluster) ~= o(C*L) { Pallete.Add(KmeanCluster[i][0]); for (int j = 1; j < KmeanCluster[i].Count; j++) { RGB[KmeanCluster[i][j].red, KmeanCluster[i][j].green, KmeanCluster[i][j].blue] = new RGBPixel(KmeanCluster[i][0].red, KmeanCluster[i][0].green, KmeanCluster[i][0].blue); } } }
private void finishInsertBtn_Click(object sender, EventArgs e) { int broj = 0; DialogResult result = CustomDialog.ShowDialog(this, "Da li ste sigurni da ste završili sa ubacivanjem artikala u komoru ?"); if (result == DialogResult.No || result == DialogResult.Cancel) { return; } foreach (DataGridViewRow row in outStorageDataGridView.Rows) { int idPallete = Convert.ToInt32(row.Cells["id_pallet"].Value); broj = idPallete; int numberPallete = Convert.ToInt32(row.Cells["pallet_number"].Value); Pallete item = new Pallete(idPallete, numberPallete); palletes.Add(item); } DbConnection.palleting(palletes, _storageId, false); foreach (DataGridViewRow row in outStorageDataGridView.Rows) { string pallete_numberr = row.Cells["pallet_number"].Value.ToString(); pallete_number = pallete_numberr; string query2 = @$ "SELECT receipts.fk_client_id, clients.first_name, clients.last_name, items_receipt.fk_receipt_id, items_receipt.fk_article_id, items_receipt.id_items_receipt, items_receipt.quantity, items_receipt.status, articles.article_name, articles.sort, articles.organic, articles.category, item_pallete.fk_id_item_recepit, item_pallete.fk_id_pallete, pallete.pallet_number, pallete.id_pallete FROM receipts INNER JOIN clients ON receipts.fk_client_id = clients.id_client INNER JOIN items_receipt ON items_receipt.fk_receipt_id = receipts.id_receipt INNER JOIN articles ON articles.id_article = items_receipt.fk_article_id INNER JOIN item_pallete ON items_receipt.id_items_receipt = item_pallete.fk_id_item_recepit INNER JOIN pallete ON pallete.id_pallete = item_pallete.fk_id_pallete WHERE pallete.id_pallete = '{broj}'"; string queryForPdf = DbConnection.fillCustom(query2, "first_name", "last_name", "article_name", "sort", "organic", "category", "quantity"); queryForPdf2 = queryForPdf2 + queryForPdf; } OutStoragePDF createPDF = new OutStoragePDF(pallete_number, queryForPdf2); createPDF.exportgridview(outStorageDataGridView); Close(); }
// Builds Chunk's VoxelData using Decompression algorithm public static void DecompressBlocks(Chunk c, byte[] buffer) { // Preparation Variables Pallete p = Compression.BiomeToPallete(c.biomeName); List <ushort> palleteList = Compression.GetPallete(p); NativeArray <ushort> data = new NativeArray <ushort>(Chunk.chunkWidth * Chunk.chunkWidth * Chunk.chunkDepth, Allocator.TempJob); NativeArray <byte> readData = new NativeArray <byte>(buffer, Allocator.TempJob); NativeArray <ushort> pallete = new NativeArray <ushort>(palleteList.ToArray(), Allocator.TempJob); DecompressJob dbJob = new DecompressJob { data = data, readData = readData, pallete = pallete }; JobHandle job = dbJob.Schedule(); job.Complete(); c.data.SetData(data.ToArray()); data.Dispose(); readData.Dispose(); pallete.Dispose(); }
public SimulationRenderer(Simulation simulation, Interaction interaction) { this.simulation = simulation; this.interaction = interaction; straincolor = new Pallete(); }
public FontTableItem(BinaryReader brrReader) { m_arrpltParts = new Pallete[2, 2]; for (int index1 = 0; index1 < 2; ++index1) { for (int index2 = 0; index2 < 2; ++index2) { m_arrpltParts[index1, index2] = new Pallete(brrReader); } } }
public FontTableItem() { m_arrpltParts = new Pallete[2, 2]; for (int index1 = 0; index1 < 2; ++index1) { for (int index2 = 0; index2 < 2; ++index2) { m_arrpltParts[index1, index2] = new Pallete(); } } }
public Memory(int width, int height) { DisplayMode = DisplayMode.Text; TextBuffer = new TextBuffer(width, height); SysFont = new SysFont(); DisplayBuffer = new DisplayBuffer(width, height); Pallete = new Pallete(); InputBuffer = new InputBuffer(); SpriteBuffer = new SpriteBuffer(); CodeBuffer = string.Empty; }
public static void CreateLayer(VectorTileLayer layer, Pallete pallete, Model3DGroup model3DGroup, Vector2 <int> shiftCoords) { int featureCount = layer.FeatureCount(); for (int i = 0; i < featureCount; i++) { VectorTileFeature feature = layer.GetFeature(i); if (feature.GeometryType == GeomType.UNKNOWN) { Console.WriteLine("Unknown feature: " + feature); continue; } featureCreateDictionary[feature.GeometryType](feature, pallete, model3DGroup, shiftCoords); } }
public static void DrawLayer(VectorTileLayer layer, Pallete pallete, Graphics graphics, double divisionRatio) { int featureCount = layer.FeatureCount(); for (int i = 0; i < featureCount; i++) { VectorTileFeature feature = layer.GetFeature(i); if (feature.GeometryType == GeomType.UNKNOWN) { Console.WriteLine("Unknown feature: " + feature); continue; } featureDrawDictionary[feature.GeometryType](feature, pallete, graphics, divisionRatio); } }
private static void DrawPolygon(VectorTileFeature feature, Pallete pallete, Graphics graphics, double divisionRatio) { List <List <Vector2 <int> > > list = feature.Geometry <int>(); foreach (List <Vector2 <int> > item in list) { Point[] points = item.Select(vector2 => new Point((int)Math.Ceiling(vector2.X / divisionRatio), (int)Math.Ceiling(vector2.Y / divisionRatio))).ToArray(); using (SolidBrush solidBrush = new SolidBrush(pallete.MainFillColor)) { graphics.FillPolygon(solidBrush, points); } using (Pen pen = new Pen(pallete.MainDrawPen.Color, 2)) { graphics.DrawPolygon(pen, points); } } }
void Start() { bool apply = StateContainer.State != null && (StateContainer.State.CurrentPhase == StateContainer.Phase.Stimulus1 || StateContainer.State.CurrentPhase == StateContainer.Phase.Stimulus2) && StateContainer.State.CurrentPair != null && StateContainer.State.CurrentPair.Stimulus.Pallete != null; if (apply) { Pallete pallete = StateContainer.State.CurrentPair.Stimulus.Pallete; Walls.color = pallete.wall; Goal.color = pallete.goal; Killer.color = pallete.killer; Bounccer.color = pallete.bouncer; Absorber.color = pallete.dampner; } }
private void finishInsertBtn_Click(object sender, EventArgs e) { DialogResult result = CustomDialog.ShowDialog(this, "Da li ste sigurni da ste završili sa ubacivanjem artikala u komoru ?"); if (result == DialogResult.No || result == DialogResult.Cancel) { return; } foreach (DataGridViewRow row in insertPalleteDataGridView.Rows) { int idPallete = Convert.ToInt32(row.Cells["id_pallet"].Value); int numberPallete = Convert.ToInt32(row.Cells["pallet_number"].Value); Pallete item = new Pallete(idPallete, numberPallete); palletes.Add(item); } DbConnection.palleting(palletes, storageId, true); Close(); }
public void swapPallete(int index) { if (index > palletes.Length - 1) { index = palletes.Length - 1; } currentPalleteIndex = index; pallete = palletes[index]; if (index == 0) { camera.backgroundColor = Color.white; } else { Color whiteOrBlack = Random.value < 0.3 ? Color.white : Color.black; camera.backgroundColor = Random.value < 0.5 ? pallete.random() : whiteOrBlack; } }
private static void CreatePolygon(VectorTileFeature feature, Pallete pallete, Model3DGroup model3DGroup, Vector2 <int> shiftCoords) { PointCollection points = new PointCollection(); List <List <Vector2 <int> > > list = feature.Geometry <int>(); foreach (List <Vector2 <int> > item in list) { points.Clear(); foreach (Vector2 <int> point in item) { points.Add(new Point(point.X + shiftCoords.X, point.Y + shiftCoords.Y)); } points.RemoveAt(points.Count - 1); var model = new GeometryModel3D(); var meshbuilder = new MeshBuilder(true, true); var result = CuttingEarsTriangulator.Triangulate(points); List <int> tri = new List <int>(); for (int i = 0; i < result.Count; i++) { tri.Add(result[i]); if (tri.Count == 3) { //Console.WriteLine("Triangle " + (i / 3).ToString() + " : " + tri[0].ToString() + ", " + tri[1].ToString() + ", " + tri[2].ToString()); meshbuilder.AddTriangle(new Point3D(points[tri[0]].X, points[tri[0]].Y, 1), new Point3D(points[tri[1]].X, points[tri[1]].Y, 1), new Point3D(points[tri[2]].X, points[tri[2]].Y, 1)); tri.Clear(); } } model.Geometry = meshbuilder.ToMesh(); model.Material = MaterialHelper.CreateMaterial(pallete.MainFillColor.ToMediaColor()); model3DGroup.Children.Add(model); } }
/// <summary> /// [1] conter is not equal 0 then Auto detect Acivate NO_Clusert = countr /// [2] Loop ant put K from disnct color into KmeanCLuster & set Avege foreach Cluster 0 /// [3] Recrsive To Fill optimal Cluster /// [4] change 3D RGP Color Values to new Values /// </summary> private void ClusterKmean() { newCend = new List <List <RGBPixel> >(NO_Clusert); KmeanCluster = new List <List <RGBPixel> >(NO_Clusert); sum = new List <MiniRGB>(NO_Clusert); for (int i = 0; i < NO_Clusert; i++) // o(cluster) ~= o(C) { KmeanCluster.Add(new List <RGBPixel>()); KmeanCluster[i].Add(li[i]); sum.Add(new MiniRGB(0, 0, 0)); } Recrsive(0); for (int i = 0; i < NO_Clusert; i++) // o(cluster * length every cluster) ~= o(C*L) { Pallete.Add(KmeanCluster[i][0]); for (int j = 1; j < KmeanCluster[i].Count; j++) { RGB[KmeanCluster[i][j].red, KmeanCluster[i][j].green, KmeanCluster[i][j].blue] = new RGBPixel(KmeanCluster[i][0].red, KmeanCluster[i][0].green, KmeanCluster[i][0].blue); } } }
private static void DrawLineString(VectorTileFeature feature, Pallete pallete, Graphics graphics, double divisionRatio) { Dictionary <string, object> props = feature.GetProperties(); foreach (List <Vector2 <int> > geometry in feature.Geometry <int>()) { Point[] points = geometry.Select(vector2 => new Point((int)Math.Ceiling(vector2.X / divisionRatio), (int)Math.Ceiling(vector2.Y / divisionRatio))).ToArray(); using (Pen pen = new Pen(pallete.MainDrawPen.Color, 2)) { graphics.DrawLines(pen, points); } // Draw name of street //if (props.ContainsKey("name")) //{ // var text = (string)props["name"]; // foreach (Vector2<int> point in geometry) // { // graphics.DrawString(text, font, pallete.GetPropFillBrush("name"), point.X, point.Y); // } //} } }
// Writes Chunk c's data using a Pallete's compression into given buffer // and returns the amount of bytes written public static int CompressBlocks(Chunk c, byte[] buffer) { int bytes; Pallete p = Compression.BiomeToPallete(c.biomeName); List <ushort> palleteList = Compression.GetPallete(p); NativeArray <int> writtenBytes = new NativeArray <int>(new int[1] { 0 }, Allocator.TempJob); NativeArray <ushort> chunkData = new NativeArray <ushort>(c.data.GetData(), Allocator.TempJob); NativeArray <byte> buff = new NativeArray <byte>(buffer, Allocator.TempJob); NativeArray <ushort> palleteArray = new NativeArray <ushort>(palleteList.ToArray(), Allocator.TempJob); CompressionJob cbJob = new CompressionJob { chunkData = chunkData, buffer = buff, palleteArray = palleteArray, writtenBytes = writtenBytes }; JobHandle handle = cbJob.Schedule(); handle.Complete(); // NativeArray to Array convertion buff.CopyTo(buffer); bytes = writtenBytes[0]; chunkData.Dispose(); palleteArray.Dispose(); buff.Dispose(); writtenBytes.Dispose(); return(bytes); }
// Returns a Palleted list private static List <ushort> GetPallete(Pallete p) { switch (p) { case Pallete.BASIC: return(new List <ushort> { 0, 3, 6, (ushort)(ushort.MaxValue / 2) }); // Air, Stone and Water (and pregen air) case Pallete.GRASSLANDS: return(new List <ushort> { 0, 1, 2, 3, 6, ushort.MaxValue - 2, (ushort)(ushort.MaxValue / 2) }); // Air, Grass, Dirt, Stone, Water and Leaves (and pregen air) case Pallete.OCEAN: return(new List <ushort> { 0, 2, 3, 6, (ushort)(ushort.MaxValue / 2) }); // Air, Dirt, Stone and Water (and pregen air) case Pallete.FOREST: return(new List <ushort> { 0, 2, 3, 6, 65534, (ushort)(ushort.MaxValue / 2) }); // Air, Dirt, Stone, Water and Leaves (and pregen air) // Special Pallete used for Metadata Compression case Pallete.METADATA: return(new List <ushort> { 0, 1, ushort.MaxValue }); default: return(new List <ushort> { 0, 3, 6, ushort.MaxValue - 2, (ushort)(ushort.MaxValue / 2) }); // Returns Pallete.BASIC } }
// TOOD: Add implimentation private static void DrawPoint(VectorTileFeature feature, Pallete pallete, Graphics graphics, double divisionRatio) { }
// TOOD: Add implimentation private static void CreateLineString(VectorTileFeature feature, Pallete pallete, Model3DGroup model3DGroup, Vector2 <int> shiftCoords) { }
public SolutionsModel(IEnumerable <PulsationSolutionItemModel> solutionItems) { SolutionItems = solutionItems.Select((si, i) => new SolutionItemColoredModel(si, Pallete.GetColor(i))).ToList(); }
public void Generate() { //Current = palletes[0]; Current = RandomPallete(); }
public MainForm() { InitializeComponent(); myPallete = new Pallete(myMaxIter); BitmapPictureBox.MouseWheel += OnMouseWheel; }