using system;
using system.windows.forms;
using system.runtime.interopservices;
using system.diagnostics;
using kitware.vtk;
namespace activiz.examples
private void initializecomponent()
protected override void dispose(bool disposing)
}catch (exception)
base.dispose(disposing);
}private kitware.vtk.renderwindowcontrol renderwindowcontrol1;
vtkstructuredgrid structuredgrid;
vtkpoints points;
vtkunsignedchararray colors;
vtkstructuredgridgeometryfilter filter;
vtkrenderwindow renderwindow;
vtkrenderer renderer;
vtkactor actor;
int xdim = 60;
int ydim = 80;
int zdim = 50;
double xystartangle = 30;
double xyendangle = 150;
double xystartradius = 10;
double xyendradius = 50;
double zystartangle = 30;
double zanglelist =
;intptr data;
private void renderwindowcontrol1_load(object sender, eventargs e)}}
structuredgrid.setdimensions(xdim, ydim, zanglelist.length);
structuredgrid.setpoints(points);
colors = vtkunsignedchararray.new();
colors.setnumberofcomponents(3);
data = marshal.allochglobal((int)(colors.getnumberofcomponents() * structuredgrid.getnumberofpoints()));
colors.setarray(data, structuredgrid.getnumberofpoints(), 1);
structuredgrid.getpointdata().setscalars(colors);
filter = vtkstructuredgridgeometryfilter.new();
filter.setinput(structuredgrid);
filter.update();
actor = vtkactor.new();
vtkstructuredgridoutlinefilter outlinefilter = vtkstructuredgridoutlinefilter.new();
outlinefilter.setinput(structuredgrid);
vtkactor outlineactor = vtkactor.new();
outlineactor.getproperty().setcolor(0, 255, 0);
//vtkshrinkfilter shrinkfilter = vtkshrinkfilter.new();
//vtkactor shrinkactor = vtkactor.new();
renderwindow = renderwindowcontrol1.renderwindow;
renderer = renderwindow.getrenderers().getfirstrenderer();
renderwindow.setdoublebuffer(1);
renderer.addactor(actor);
renderer.addactor(outlineactor);
vtkrenderwindowinteractor interactor = renderwindow.getinteractor();
vtkobject.vtkobjecteventhandler interactorhandler = new kitware.vtk.vtkobject.vtkobjecteventhandler(interactor_anyeventhandler);
interactor.anyevt += interactorhandler;//繫結所有事件對應的事件處理器
// give our own style a higher priority than the built-in one
// so that we see the events first:
//float builtinpriority = interactor.getinteractorstyle().getpriority();//interactor handler 的優先順序
system.console.writeline("builtinpriority" + builtinpriority);
vtkinteractorstyleuser userstyle = kitware.vtk.vtkinteractorstyleuser.new();
//事件處理
vtkobject.vtkobjecteventhandler userhandler = new kitware.vtk.vtkobject.vtkobjecteventhandler(userstyle_multipleeventhandler);
// userhandler 新增接收事件繫結
userstyle.keypressevt += userhandler;
userstyle.charevt += userhandler;
userstyle.keyreleaseevt += userhandler;
userstyle.setpriority(0.5f);//eventhandler 的優先順序
userstyle.setinteractor(interactor);
system.windows.forms.timer timer = new system.windows.forms.timer();
timer.interval = 1;
timer.tick += new eventhandler(timer_tick);
timer.start();
}//事件處理函式,優先順序為0
void interactor_anyeventhandler(kitware.vtk.vtkobject sender, kitware.vtk.vtkobjecteventargs e)
}//事件處理方法,(vtkinteractorstyleuser 使用者自定義的事件處理器,可設定優先順序,接收事件的型別)
void userstyle_multipleeventhandler(kitware.vtk.vtkobject sender, kitware.vtk.vtkobjecteventargs e)
void timer_tick(object sender, eventargs e)
//}for (int i = 0; i < zanglelist.length; i++)
else if (j < 10)
else}}
}stopwatch sw = new stopwatch();
structuredgrid.modified();//更新物件修改時間,不可缺少
sw.reset();
sw.start();
renderwindow.render();//使用render()重新整理介面
使用invalidate()也可重新整理介面
pyQt5 實時重新整理介面例子 QThread
如下 from pyqt5.qtcore import qthread,pyqtsignal,qdatetime,qobject import time import sys class backendthread qobject 通過類成員物件定義訊號 update date pyqtsignal...
Vue專案強制重新整理(雙擊重新整理介面)
1.定義子標籤並通過 v if hackreset 值 true fasle 控制子標籤的重建定義hackreset初始值 true 保證初始化子標籤正常顯示 data 呼叫方法使子標籤銷毀並重建 rebuilecomponents 2.通過window.location.reload 和windo...
CDN頁面重新整理介面定義 高公升
一 任務 分發 工作流程 步驟 1.合作方按照高公升定義的 json 資料格式向高公升分發介面 post 任務,高公升分發介面 會根據接收情況即時反饋接收成功還是失敗的結果。二 高公升 分發 介面 定義 和 返回值 1.post 方式 建議 使用第二種方式 a.通過 http 引數方式 post,例...