资源简介
LabWindows CVI 3D graph控件编程
可以使用、参考,绘制3D图的基础提高程序~
代码片段和文件信息
#include “3DGraphCtrl.h“
#include
#include
#include
#include “3DGraph.h“
static CW3DGraphLibObj_CWPlot3D plotObjHandle;
static CW3DGraphLibObj_CWPlots3D plotsObjHandle;
static CAObjHandle graphObjHandle;
static int panelHandle;
int main (int argc char *argv[])
{
if (InitCVIRTE (0 argv 0) == 0)
return -1; /* out of memory */
if ((panelHandle = LoadPanel (0 “3DGraph.uir“ PANEL)) < 0)
return -1;
/*=CHANGE:=============================================================*
To programmatically interact with the 3D graph you will need to first obtain
the object handle. Use this handle to register event callback functions
call methods or get and set properties of the 3D graph.
Example Code:
int i j;
HRESULT __result;
CAObjHandle graphObjHandle;
CW3DGraphLibObj_CWPlots3D plotsObjHandle;
CW3DGraphLibObj_CWPlot3D plotObjHandle;
double zMatrix[10][10];
VARIANT zMatrixV;
GetObjHandleFromActiveXCtrl (panelHandle PANEL_GRAPH3D
&graphObjHandle);
__caErrChk(CW3DGraphLib__DCWGraph3DGetPlots (graphObjHandle NULL
&plotsObjHandle));
__caErrChk(CW3DGraphLib_CWPlots3DItem (plotsObjHandle NULL
CA_VariantLong(1) &plotObjHandle));
for (i=0; i<10; i++)
for (j=0; j<10; j++)
zMatrix[i][j] = (i*i) + (j*j);
__caErrChk(CA_VariantSet2DArray (&zMatrixV CAVT_DOUBLE 10 10
zMatrix));
__caErrChk(CW3DGraphLib_CWPlot3DPlot3DSimpleSurface (plotObjHandle NULL zMatrixV
CA_DEFAULT_VAL));
Error:
CA_VariantClear(&zMatrixV);
CA_DiscardObjHandle(plotsObjHandle);
CA_DiscardObjHandle(plotObjHandle);
*==========================================================END=CHANGE=*/
GetObjHandleFromActiveXCtrl(panelHandlePANEL_GRAPH3D&graphObjHandle);
CW3DGraphLib__DCWGraph3DGetPlots(graphObjHandleNULL&plotsObjHandle);
CW3DGraphLib_CWPlots3DItem(plotsObjHandleNULLCA_VariantLong(1)&plotObjHandle);
DisplayPanel (panelHandle);
RunUserInterface ();
DiscardPanel (panelHandle);
CA_DiscardObjHandle(plotsObjHandle);
CA_DiscardObjHandle(plotObjHandle);
return 0;
}
int CVICALLBACK generatewave (int panel int control int event
void *callbackData int eventData1 int eventData2)
{
VARIANT GaussianNoiseV;
double GaussianNoise[20][200];
int i;
switch (event)
{
case EVENT_COMMIT:
for(i=0;i<20;i++)
{
GaussNoise(2001.0-2GaussianNoise[i]);
}
CA_VariantSet2DArray(&GaussianNoiseVCAVT_DOUBLE10200GaussianNoise);
CW3DGraphLib_CWPlot3DPlot3DSimpleSurface(plotObjHandleNULLGaussianNoiseVCA_DEFAULT_VAL);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6012 2008-07-01 12:52 3DGraph控件\3DGraph.c
文件 3340 2011-03-13 23:01 3DGraph控件\3DGraph.cws
文件 2127 2008-07-01 12:39 3DGraph控件\3DGraph.h
文件 3466 2008-07-01 10:35 3DGraph控件\3DGraph.prj
文件 11012 2008-07-01 12:39 3DGraph控件\3DGraph.uir
文件 2944541 2011-03-13 23:01 3DGraph控件\3DGraph_dbg.cdb
文件 460800 2011-03-13 23:01 3DGraph控件\3DGraph_dbg.exe
文件 1955363 2011-03-13 23:01 3DGraph控件\cvibuild.3DGraph\3DGraph.nidobj
文件 5566 2011-03-13 23:02 3DGraph控件\cvibuild.3DGraph\build.ini
文件 307 2011-03-13 23:01 3DGraph控件\cvibuild.3DGraph\dependencies.bri
文件 5048 2011-03-13 23:01 3DGraph控件\cvibuild.3DGraph\resources.res
目录 0 2011-03-13 23:02 3DGraph控件\cvibuild.3DGraph
目录 0 2011-03-13 23:01 3DGraph控件
----------- --------- ---------- ----- ----
5397582 13
- 上一篇:miniui使用说明
- 下一篇:CH340驱动(USB串口驱动)_XP_WIN7共用
评论
共有 条评论