comparison trunk/src/Modules/Output/Graphics/GraphicsView.cc @ 410:7af493eb1563

- SWIG fixes. Graphics updates.
author tomwalters
date Tue, 19 Oct 2010 19:48:37 +0000
parents 69466da9745e
children a908972d234e
comparison
equal deleted inserted replaced
409:1d0f39b04954 410:7af493eb1563
28 module_description_ = "Graphics output."; 28 module_description_ = "Graphics output.";
29 module_identifier_ = "graphics"; 29 module_identifier_ = "graphics";
30 module_type_ = "output"; 30 module_type_ = "output";
31 module_version_ = "$Id: $"; 31 module_version_ = "$Id: $";
32 32
33 m_pDev = NULL; 33 m_pDev = new GraphicsOutputDeviceCairo();
34 m_bPlotLabels = false; 34 m_bPlotLabels = false;
35 m_pAxisX = new GraphAxisSpec(); 35 m_pAxisX = new GraphAxisSpec();
36 AIM_ASSERT(m_pAxisX); 36 AIM_ASSERT(m_pAxisX);
37 m_pAxisY = new GraphAxisSpec(); 37 m_pAxisY = new GraphAxisSpec();
38 AIM_ASSERT(m_pAxisY); 38 AIM_ASSERT(m_pAxisY);
39 m_pAxisFreq = new GraphAxisSpec(); 39 m_pAxisFreq = new GraphAxisSpec();
40 AIM_ASSERT(m_pAxisFreq); 40 AIM_ASSERT(m_pAxisFreq);
41 initialized_ = true; 41 initialized_ = true;
42 42
43 if (!m_pAxisY->Initialize(m_pParam, 43 if (!m_pAxisY->Initialize(parameters_,
44 _S("graph.y"), 44 _S("graph.y"),
45 -1, 45 -1,
46 1, 46 1,
47 Scale::SCALE_LINEAR)) { 47 Scale::SCALE_LINEAR)) {
48 LOG_ERROR("Axis initialization failed"); 48 LOG_ERROR("Axis initialization failed");
49 initialized_ = false; 49 initialized_ = false;
50 } 50 }
51 m_fMarginLeft = m_pParam->GetFloat(_S("graph.margin.left")); 51 m_fMarginLeft = parameters_->GetFloat(_S("graph.margin.left"));
52 m_fMarginRight = m_pParam->GetFloat(_S("graph.margin.right")); 52 m_fMarginRight = parameters_->GetFloat(_S("graph.margin.right"));
53 m_fMarginTop = m_pParam->GetFloat(_S("graph.margin.top")); 53 m_fMarginTop = parameters_->GetFloat(_S("graph.margin.top"));
54 m_fMarginBottom = m_pParam->GetFloat(_S("graph.margin.bottom")); 54 m_fMarginBottom = parameters_->GetFloat(_S("graph.margin.bottom"));
55 m_bPlotLabels = m_pParam->GetBool(_S("graph.plotlabels")); 55 m_bPlotLabels = parameters_->GetBool(_S("graph.plotlabels"));
56 56
57 const char *sGraphType = m_pParam->GetString(_S("graph.type")); 57 const char *sGraphType = parameters_->GetString(_S("graph.type"));
58 if (strcmp(sGraphType, _S("line"))==0) 58 if (strcmp(sGraphType, _S("line"))==0)
59 m_iGraphType = GraphTypeLine; 59 m_iGraphType = GraphTypeLine;
60 else if (strcmp(sGraphType, _S("colormap"))==0) 60 else if (strcmp(sGraphType, _S("colormap"))==0)
61 m_iGraphType = GraphTypeColormap; 61 m_iGraphType = GraphTypeColormap;
62 else if (strcmp(sGraphType, _S("none"))==0) 62 else if (strcmp(sGraphType, _S("none"))==0)
64 else { 64 else {
65 LOG_ERROR(_T("Unrecognized graph type: '%s'"), sGraphType); 65 LOG_ERROR(_T("Unrecognized graph type: '%s'"), sGraphType);
66 initialized_ = false; 66 initialized_ = false;
67 } 67 }
68 68
69 if (strcmp(m_pParam->GetString(_S("graph.mindistance")),"auto") == 0) 69 if (strcmp(parameters_->GetString(_S("graph.mindistance")),"auto") == 0)
70 // -1 means detect later, based on type and Fire() argument 70 // -1 means detect later, based on type and Fire() argument
71 m_fMinPlotDistance = -1; 71 m_fMinPlotDistance = -1;
72 else 72 else
73 m_fMinPlotDistance = m_pParam->GetFloat(_S("graph.mindistance")); 73 m_fMinPlotDistance = parameters_->GetFloat(_S("graph.mindistance"));
74 } 74 }
75 75
76 GraphicsView::~GraphicsView() { 76 GraphicsView::~GraphicsView() {
77 DELETE_IF_NONNULL(m_pAxisX); 77 DELETE_IF_NONNULL(m_pAxisX);
78 DELETE_IF_NONNULL(m_pAxisY); 78 DELETE_IF_NONNULL(m_pAxisY);
88 return false; 88 return false;
89 } 89 }
90 90
91 float y_min = bank.centre_frequency(0); 91 float y_min = bank.centre_frequency(0);
92 float y_max = bank.centre_frequency(bank.channel_count() - 1); 92 float y_max = bank.centre_frequency(bank.channel_count() - 1);
93 if (!m_pAxisFreq->Initialize(m_pParam, 93 if (!m_pAxisFreq->Initialize(parameters_,
94 "graph.freq", 94 "graph.freq",
95 y_min, 95 y_min,
96 y_max, 96 y_max,
97 Scale::SCALE_ERB)) { 97 Scale::SCALE_ERB)) {
98 LOG_ERROR(""); 98 LOG_ERROR("");
99 return false; 99 return false;
100 } 100 }
101 101
102 float x_min = 0.0; 102 float x_min = 0.0;
103 float x_max = 1000.0 * bank.buffer_length() / bank.sample_rate(); 103 float x_max = 1000.0 * bank.buffer_length() / bank.sample_rate();
104 if (!m_pAxisX->Initialize(m_pParam, 104 if (!m_pAxisX->Initialize(parameters_,
105 "graph.x", 105 "graph.x",
106 x_min, 106 x_min,
107 x_max, 107 x_max,
108 Scale::SCALE_LINEAR)) { 108 Scale::SCALE_LINEAR)) {
109 LOG_ERROR(""); 109 LOG_ERROR("");