From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a Measurement Studio replacement for CVI PlotScaleIntensity function ?

I'm converting a CVI project to use Measurement Studio for Visual C++, and I can't seem to find a replacement for the CVI function PlotScaledIntensity.

Am I just missing it, or has anyone done this ?
0 Kudos
Message 1 of 8
(3,638 Views)
There is no direct equivalent for this in Measurement Studio for Visual C++. One thing that you can do is plot on the 3D graph with a color map and then rotate the plot such that you're looking down the Y axis. You can find a VB example of this in the article Plotting Intensity Using a Measurement Studio 3D Graph Control.

Another option would be to develop this part of your user interface in CVI, then use the Measurement Studio application wizard in VC++ to convert the CVI project to a VC++ project, then develop the rest of your application using hte Measurement Studio for VC++ libraries.

- Elton
Message 2 of 8
(3,638 Views)
Thanks. Believe it or not, I had thought of that, and that's what I did, but it seemed like a lot of work, so I thought it just had to be there.

If I develop in CVI and convert to a VC++, will all the controls be "wrapped" in an active-X container ? Is there bound properties control ? I could just try it, I suppose.

Obviously I'm a real newbie here.
0 Kudos
Message 3 of 8
(3,638 Views)
They won't be wrapped in ActiveX controls - you can take the CVI project, convert it, and then compile the project using VC++. When you run the application, it will run just as it did when you were developing in CVI because it's still using the CVI runtime. Once you have the project in VC++, some parts would still have to remain in C (for example, the UIR callbacks that CVI expects), but other than that you could just start adding C++ code as you like in the project.

- Elton
0 Kudos
Message 4 of 8
(3,638 Views)
That's what I thought. I've already done that for a different application, and what we want to do is make a NEW application using Measurement Studio, but leave the old CVI app behind. We have some class libraries we want to protect our investment in, but they are nonCVI code - code we can use in conjuction with Measurement Studio classes.

Thanks for the pointer to the VB project - I found the correct properties to set to get the 3d graph to align on the Y axis.
0 Kudos
Message 5 of 8
(3,638 Views)
I thought I'd put in my two cents here on this intensity plot thing. What I did to implement this was grab the background bitmap of a 2D graph and set the bitmap bits according to intensity and BitBlt that to the background. It works really well and quite fast. I can plot a 6400 point wide bitmap by 480 points long in <10ms.

It's kinda cool because I still have all the functionality of the 2D graph, cursors, annotations, axes, etc. I can even superimpose any number of regular line plots over the top of the "intensity plot".

Scott
0 Kudos
Message 6 of 8
(3,638 Views)
So, what you are suggesting is to use a CNiGraph, call
Images to get a CNiPicture, and then use the Handle propery as an HBITMAP and use the Windows API directly ?
0 Kudos
Message 7 of 8
(3,638 Views)
Basically, yes.

Here�s how it�s done. I got the idea from this website by searching on CScaleBmpPlotAreaGraph. I think that will get you there.

1. Create a �compatible� CBitmap object, in this case, mp_masterBitmap,

CClientDC dcScreen (&mGraph); // mGraph is the CNiGraph

mp_masterBitmap = new CBitmap;

mp_masterBitmap->CreateCompatibleBitmap (&dcScreen, 6400, 480);

and use it to fill the data by using CBitmap::SetBitmapBits(�). Elsewhere in my code I filled the bitmap with 6400x480 points.

2. In your Draw() method, create a CDC and select a the CBitmap object into it.

3. Create a DC to use to write to the control's bitmap.

4. Select the control's bitmap into that DC.

5. Then
BitBlt it to the graph control�s bitmap DC from the masterDC (memory DC).

6. Super fast!!

7. Also note that I did not mess with palettes so there�s a bit of a kludge on the data. For every byte of data the next three bytes have to be the same, that is for 32-bit color. So for a gray scale value of say, 128, middle gray, the array would have to be:
data[0] = 128;
data[1] = 128;
data[2] = 128;
data[3] = 128;

data[4] would be the next pixel value in the bitmap. That�s the only messy part. But that is a ton less problem than trying to deal with palettes.


Here�s some draw code that I use when it�s time to draw:

// Create a DC to use to read the master bitmap.
CDC masterDC;
masterDC.CreateCompatibleDC(NULL)
masterDC.SelectObject(mp_masterBitmap)

// Create a DC to use to write to the control's bitmap.
CDC ctrlBitmapDC;
ctrlBitmapDC.CreateCompatibleDC(NULL)

// Select the control's bitmap into the DC.
HBITMAP controlHBitma
p = (HBITMAP)mGraph.Images(3).Picture.Handle;
ctrlBitmapDC.SelectObject(CBitmap::FromHandle(controlHBitmap))

ctrlBitmapDC.BitBlt(0, 0, 6400, 480, &masterDC, 0,0, SRCCOPY);


There you have it. Hope that will get you going.

Scott O'Friel
0 Kudos
Message 8 of 8
(3,638 Views)