How to color specific vtkCells? - vtk

I have a 3D model loaded into a vtkActor and I need to be able to color specific vtkCells of this actor after selecting (clicking on those vtkCells). I know how to retrieve the selected cells from the vtkUnstructuredGrid but have no idea of how to set color to them. I've read a bit about vtkLookUpTables and think that might be it but I don't understand how it works, or if it really is what I need.
Thanks.

You can use vtkExtractCells to fetch all special cells and form a vtkDataObject, then create vtkDataSetMapper and vtkActor objects to color and shot it.

Related

How to show different colour in the same data in tableau?

In tableau, I want the colours of my fields to be shown separately, but Tableau automatically creates a custom colour for both of the fields, which i do not want. Is there any way to show the fields in different colours? TIA
Also, if it is not possible, is there any way to do this in Python?
This is the way it looks right now
This is the colour setting

Auto Grouping/Merging in Excel

I think the image attached describes better than I can in words the functionality I am trying to locate within excel.
Is there a way to auto group based on the contents within the columns as shown? This is achievable for the example shown, but when there are up to say 30 Groups and many sub group types, I am wondering whether excel can auto-detect and work its way through the list, grouping as shown as it goes.
You can get a similar result using conditional formatting. select the whole table and create a new conditional format rule and choose formula and enter =A1=A2 set the format font to white (I've used very light grey to show that the data is still there)
To get the borders, do the same again and this time enter the formula =A1<>A2 and make the top border black.
It's not exactly the same as yours but it's close.

Custom attributes/properties for cells in excel?

I'm interested in making an Excel cell formatting macro that allows me to scroll through different options (different font/cell colors, different border types, etc.). I know that I could accomplish this by checking conditions -- if I'm changing font colors, then I can just "scroll" by using conditional logic (if color1, then change to color2; if color2, then change to color 3; etc.). I was wondering if there might be a more elegant way to accomplish this -- specifically, is there a way to store custom attributes for cells in VBA?
For example, if I set cell B3 to a certain border style (thin line for top,left,right but double line for bottom), is there a way to create and set a VBA attribute of Cell.CustomBorderStyle = 1? Otherwise, I believe I would have to build logic into my macro for the precise formatting (if top,left,right = thin and bottom = double then change to second style, etc.). I'm not sure if creating a custom class in VBA would allow me to do this, or if there's any way at all to do this.
Please let me know if my question is unclear -- thanks!
if you only want the cell attribute to be available within this VBA session then I would use a collection or dictionary with a key of the cell address (Sheet_Row_Column) to store the attribute(s).
If you want to persist this information within an Excel workbook then it would probably be best done using custom xml.

I wish to apply a background color to ONLY the cells in a specific dataGrid column?

I asked this question on the LiveCode email list. No response, so I figure it must not be possible. I know about editing the template graphic that enables alternating row colors. That doesn't help me.
This lesson is the closest to what I have found, but it only sets the overlay color to empty cells. It also had an unwanted affect, where any data that was present in the grid no longer shows up.
http://lessons.runrev.com/s/lessons/m/datagrid/l/7327-how-do-i-override-the-default-behavior-for-rendering-data-to-a-cell
As a little experiment, since the data became invisible (note that I'm on WinXP), I tried placing an opaque graphic over the column I wish to colorize. I set the ink of the graphic to AddMax or AddOver, and it looked nice, but the text in the cells disappeared. Then I tried setting the ink to AddMin, and it still looks good, but the test shows through!!!!
So, I think this will work fine visually, but how can I pass a double-click through this graphic to the cell underneath (to allow cell editing only within this column)?
Yes, you can do this.
This suggestion comes from Trevor DeVore at http://www.bluemangolearning.com/
Create a custom column template using the property inspector. From there you can edit the behavior of the column to colorize the background color of the field for that column or just edit the field in the template group to change the color.
The background color will only show up in rows that have data, however.

Dynamics AX - Color multiple grid cells in different colors

In Dynamics AX 2012, is there a way to change the background color of multiple cells to different colors?
Order Status Ship Status Order ID
[green] [red] SO-1234
[green] [green] SO-1235
[red] [red] SO-1236
I've written a displayOption override that can change the color of one cell, but it seems to apply all the changes at the end, so whatever the last color you specify is the one that gets applied to all cells.
_options.backColor(46080); //green
_options.affectedElementsByControl(OrderStatus.id());
//is there anyway to apply the first change, so I can make a second one?
_options.backColor(255); //red
_options.affectedElementsByControl(ShipStatus.id());
In the code listed above, both cell background colors would be red.
Any suggestions?
Thanks
I had a similar task to accomplish, and I did not find a way to do it in Ax (well, techinically you could try Table control, but I strongly encourage you NOT to do so - you will end up swearing out aloud).
What I did is implemented a WPF user control and used this post as a template.
This is a small tutorial (found in Answer #7) which shows how to implement a cell background converter in built-in WPF data grid control, to accomplish the task.
After you have it implemented you can populate your datagrid by using LINQ (if using AX 2012 R2), web services, or passing a temporary table - there are many ways to access AX data.
It may not be the ultimate solution, but it works.
I did it using a table control ( although Maciej advised you not to do ).
It works without problems.
You need to add a table control which gets your data and set the property
ColorScheme to RGB
Then, override the FormControl editControl(int column, int row)
You can access each value by value = data.cell(column, row).data(); whereby data is the name of the table control.
Beware, that you have to add a control with the correct datatype to the table control and give it a name. Also set the ColorScheme property to RGB.
If you got RGB values for your desired background color, setting this color can be done by
RealEdit.backgroundColor(WinAPI::RGB2int(real2int(R),real2int(G),real2int(B)));
RealEdit is the name of the added control.
I've done this to display a matrix filled with values between 0 and 1 and to display a color gradient overlay with a range from green to red. See this link, if you like more information about the color conversion.

Resources