ILImageSCPlot doesn't draw image correct - ilnumerics

In a Plotting Form I want draw an ILImageSCPlot:
private void ilPanel1_Load(object sender, EventArgs e)
{ var data = ILSpecialData.waterfallf(25, 100);
ilPanel1.Scene.Add(new ILPlotCube {
new ILImageSCPlot(data );
});
}
But the drawing is not complete. The upper blue/green range is missing.
Sometimes at refresh (resize form) I can see the blue/green for a short moment.

Related

Calling C# click event without actually clicking the button not working

I have below code written inside C# Form application where I am trying to get x,y and z co-ordinates from Leap Motion device.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
//controller.EventContext = WindowsFormsSynchronizationContext.Current;
button1.Click += new EventHandler(button1_Click);
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button1_Click(object sender, EventArgs e)
{
// Initialize the Controller object which connects to the Leap motion service
// and captures the hand tracking data
Controller controller = new Controller();
//Get the most recent tracking data using the Frame object
Frame frame = controller.Frame();
for (int h = 0; h < frame.Hands.Count; h++)
{
// Initialize the Hand in the given frame
Hand leapHand = frame.Hands[h];
// Get the "Pointer" finger of current hand which refers to where a person is pointing
Finger leapFinger = leapHand.Fingers[1];
// Prepare a vector which will store the co-ordinate values of the tip of the pointer
Vector currentPosition = leapFinger.StabilizedTipPosition;
textBox1.Text = Convert.ToString(currentPosition.x);
textBox2.Text = Convert.ToString(currentPosition.y);
textBox3.Text = Convert.ToString(currentPosition.z);
}
}
}
However, I need to explicitly click the button1 to display.
Any idea what's wrong ?
Here is an overly simple example of one way to do it. I'm not saying it's the best way, but you should be able to modify this sample code with your code.
In this example, there is a simple "HelloWorld" method that is called when the form is initialized as well as whenever you press the button. Let me know if this gets you close to what you're after.
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
button1.Click += new EventHandler(button1_Click);
HelloWorldTest();
}
private void button1_Click(object sender, EventArgs e)
{
HelloWorldTest();
}
private void HelloWorldTest()
{
MessageBox.Show("Hello World!");
}
}
}
For what it's worth, I didn't use your code because I don't have the Leap libraries installed and if there was a typo, I wouldn't be much help to resolve it. Nonetheless, hopefully it gets you going down the right path.

How can I hide row/column headers in a NatTable?

I want to be able to add options to a right click menu of the NatTable that when clicked will cause either the row or column headers to be hidden but can be brought back as well.
The common practice is to operate on the corresponding DataLayer and modify the row height. Modifying the IDataProvider is typically not a good practice, as the IDataProvider is responsible for providing the data, not how the data should be rendered. So the following is an example of how to toggle the visibility of the column header layer (supposed that hideHeader is the flag to store the current state).
Button hideButton = new Button(buttonPanel, SWT.PUSH);
hideButton.setText("Hide/Show");
hideButton.addSelectionListener(new SelectionAdapter() {
#Override
public void widgetSelected(SelectionEvent e) {
this.hideHeader = !this.hideHeader;
if (this.hideHeader) {
columnHeaderDataLayer.setDefaultRowHeight(0);
} else {
columnHeaderDataLayer.setDefaultRowHeight(20);
}
natTable.refresh(false);
}
});
I know users who even used that approach to implement some sort of transition by slowly reducing the height to 0.
Alternatively you could use the RowResizeCommand if the column header DataLayer is not known
Button hideButton = new Button(buttonPanel, SWT.PUSH);
hideButton.setText("Hide/Show");
hideButton.addSelectionListener(new SelectionAdapter() {
#Override
public void widgetSelected(SelectionEvent e) {
this.hideHeader = !this.hideHeader;
if (this.hideHeader) {
natTable.doCommand(new RowResizeCommand(natTable, 0, 0));
} else {
natTable.doCommand(new RowResizeCommand(natTable, 0, 20));
}
}
});
I ended up solving this by changing the logic in the getColumnCount() method in my RowHeaderDataProvider to return 0 when flagged to be hidden, or 1 when flagged to be not hidden. Same applies for the getRowCount() in my ColumnHeaderDataProvider.

Devexpress pivotgrid Customization CustomizationFormStyle

I show fields in customization form. I choose Excel2007 as CustomizationFormStyle but I would like to show just Filter area. I want Column, Row and Data area to be invisible.
How can I manage this?
pivotGridControl1.OptionsCustomization.CustomizationFormStyle = DevExpress.XtraPivotGrid.Customization.CustomizationFormStyle.Excel2007;
pivotGridControl1.OptionsCustomization.CustomizationFormLayout = CustomizationFormLayout.BottomPanelOnly1by4;
pivotGridControl1.OptionsCustomization.CustomizationFormAllowedLayouts = CustomizationFormAllowedLayouts.BottomPanelOnly1by4;
You need to use PivotGridControl.ShowingCustomizationForm event and PivotGridControl.ShowCustomizationForm event. In PivotGridControl.ShowingCustomizationForm event you need to get CustomizationForm object from CustomizationFormShowingEventArgs.CustomizationForm property and use this object in PivotGridControl.ShowCustomizationForm event to customize the customization form. To get the filter area and other area objects, you need to use CustomizationForm.BottomPanel property and its GetAreaLabel, GetAreaIcon and GetAreaList methods.
Here is example:
private void pivotGridControl1_ShowingCustomizationForm(object sender, CustomizationFormShowingEventArgs e)
{
_customizationForm = e.CustomizationForm as CustomizationForm;
}
private void pivotGridControl1_ShowCustomizationForm(object sender, EventArgs e)
{
var bottomPanel = _customizationForm.BottomPanel as ExcelCustomizationFormBottomPanel;
var areas = new PivotArea[] { PivotArea.ColumnArea, PivotArea.RowArea, PivotArea.DataArea };
foreach (var area in areas)
{
bottomPanel.GetAreaLabel(area).Hide();
bottomPanel.GetAreaIcon(area).Hide();
bottomPanel.GetAreaList(area).Hide();
}
var filterAreaList = bottomPanel.GetAreaList(PivotArea.FilterArea);
var dataAreaList = bottomPanel.GetAreaList(PivotArea.DataArea);
filterAreaList.Height = dataAreaList.Bottom - filterAreaList.Top;
}

how to refresh a ILPanel by clicking a button...?

i am a Student and just startet programming and try out ILNumerics.
Here is my question:
How can i refresh or replot a IlPanal after changing colormap or userdata?
I want to refresh the Surfacegraph by clicking on a button. I guess the answer is very easy, but i tried a lot the last two days... i'm a noob ;)
For example:
private void ilPanel_3D_Load(object sender, EventArgs e)
{
var scene = new ILScene();
var pc = scene.Add(new ILPlotCube(twoDMode: false));
var sf = pc.Add(new ILSurface(Z));
ilPanel_3D.Scene = scene;
}
private void button1_Click(object sender, EventArgs e)
{
// dont know what to put in here...
}
thanks
For such interactive actions you will have to access the 'synchronized copy' which every driver internally maintains of the global scene. Since a scene may get displayed by many drivers at the same time, this internal copy only reflects all changes due to user interaction / modifications.
private void button1_Click(object sender, EventArgs e) {
ilPanel_3D.GetCurrentScene().First<ILSurface>().Colormap = Colormaps.Summer;
ilPanel_3D.Refresh();
}
PS: no need to wait for two days the next time ... ! ;)
#Edit2: Actually, the update works just fine on the global scene also. But in order to broadcast the change to the ilPanel1 driver, you will have to add a call to Configure() at the end of your modifications. Configure can be called once for all changed nodes on one of their common parent nodes. So, you might simply call Configure() on the scene:
private void button1_Click(object sender, EventArgs e) {
ilPanel_3D.Scene.First<ILSurface>().Colormap = Colormaps.Summer;
ilPanel_3D.Scene.Configure();
ilPanel_3D.Refresh();
}

Drawing in Form_Load

So, I have:
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
DrawBackground();
}
private: System::Void DrawBackground(){
Graphics^ g1=this->CreateGraphics();
SolidBrush^ p1 = gcnew SolidBrush(System::Drawing::Color::Gray);
g1->FillRectangle(p1,90,150,600,150);
}
This should load this rectangle when form loaded, but it doesn't.
Why ?? How to you write this correctly ?
You cannot draw in the Load event, the form isn't visible yet. Nor is it ever correct to use CreateGraphics(). Whatever you draw won't survive until the next redraw. Override the OnPaintBackground method instead. Like this:
protected:
virtual void OnPaintBackground(PaintEventArgs^ e) override {
__super::OnPaintBackground(e);
SolidBrush brush(System::Drawing::Color::Gray);
e->Graphics->FillRectangle(%brush,90,150,600,150);
}
Note the use of the stack semantics for brush (no hat), that ensures the brush is automatically disposed.