File: test_singleplot.cxx

package info (click to toggle)
clam 1.4.0-6
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 17,836 kB
  • ctags: 20,981
  • sloc: cpp: 92,504; python: 9,721; ansic: 1,602; xml: 444; sh: 239; makefile: 153; perl: 54; asm: 15
file content (66 lines) | stat: -rw-r--r-- 1,389 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "Plot.hxx"
#include "SystemPlots.hxx"
#include "DataTypes.hxx"
#include "Array.hxx"
#include "BPF.hxx"
#include <iostream>

void buildTestArray( CLAM::Array<CLAM::TData>& array )
{
	array.Resize( 100 );
	array.SetSize( 100 );

	for ( int i = 0; i < 100; i++ )
	{
		array[i] = float(i)*0.005;
	}
}

void buildTestBPF( CLAM::BPF& bpf )
{
	bpf.Insert( -10.0, 0.0 );
	bpf.Insert( -5.0, 0.45 );
	bpf.Insert( 0.0, 1.0 );
	bpf.Insert( 5.0, 0.75 );
	bpf.Insert( 10.0, 0.0 );
}

int main( int argc, char** argv )
{
	
	CLAM::Array<CLAM::TData> population;
	CLAM::BPF func;

	CLAMVM::Plot myUglyPlot( "igloo" );

	myUglyPlot.SetPosition( 100, 100 );
	myUglyPlot.SetSize( 640, 480 );
	myUglyPlot.SetLabel( "My ugly plot" );
	myUglyPlot.SetYRange( 0.0, 1.0 );
	myUglyPlot.SetColor( CLAMVM::Color( 150, 150, 0 ) );

	CLAMVM::Plot myUglyPlot2( "igloo2" );

	myUglyPlot2.SetPosition( 100, 100 );
	myUglyPlot2.SetSize( 640, 480 );
	myUglyPlot2.SetLabel( "My ugly plot" );
	myUglyPlot2.SetYRange( 0.0, 1.0 );
	myUglyPlot2.SetTooltipFormat( "x=%3.2f, P(x)=%1.3f" );
	myUglyPlot2.SetColor( CLAMVM::Color( 0, 150, 150 ) );

	buildTestArray( population );

	myUglyPlot.SetData( population, 0, 99 );

	//CLAMVM::SystemPlots::Display( "igloo" );

	buildTestBPF( func );

	myUglyPlot2.SetData( func );

	//CLAMVM::SystemPlots::Display( "igloo2" );

	CLAMVM::SystemPlots::Display( "igloo" );
	return 0;
}