[vtkusers] Problem with vtkChartXY::SetTitle and vtkAxis::SetTitle

Frese Daniel Dr. frese at heidenhain.de
Tue Oct 25 01:50:27 EDT 2011


Hi Andrew, Marcus,
I am still interested in this issue, too. Since May, when I reported a similar issue (the quoted post by Andrew), I took care to combine only Release binaries or only Debug binaries, and it worked nicely so far. And I guess this is really all a user can ask for ☺.
But still, a strange feeling remains. During the (admittedly quite limited time) I have been using vtk, this was the only place within the toolkit that led to trouble mixing a debug app and a release vtk lib. I am aware, that with MSVC (I still use version 2008) anything strange can happen if you mix these, but for my applications the fact remains, that everything I tried works fine with mixed debug/release stuff – except of the charts API.

Daniel

Von: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] Im Auftrag von Andrew Wiles
Gesendet: Montag, 24. Oktober 2011 20:58
An: vtkusers at vtk.org
Betreff: [vtkusers] Problem with vtkChartXY::SetTitle and vtkAxis::SetTitle

Hello,

I have been using the vtkChartXY in previous release versions for a while now without any problems.  However, I recently upgraded to VTK 5.8 and I having some difficulties.  I am wondering if it has anything to do with the vtkChartXY::SetTitle being changed from a "const char* title" to a "const vtkStdString &title" -- but I am just guessing.

At any rate, I create the vtkChartXY using a vtkSmartPointer and the axis get their titles initialized to "X Axis" and "Y Axis" without any difficulties.  However, when I go to change the Axis titles or the chart title to something useful, I get an unhandled exception: access violation.  I tried to change the input from a quoted string to an actual vtkStdString but it crashes as well.  I saw a post online (http://vtk.org/pipermail/vtkusers/2011-May/116473.html) that this is due to mismatched build types, but I build VTK with RelWithDebInfo and my project is build with RelWithDebInfo.

I am working with VTK 5.8 Release Tag, on Windows XP 32Bit and using MSVC2010 and Qt 4.7.2.

Here is my code:

   In Header:
    vtkSmartPointer<vtkChartXY> m_Chart;

    In Source:
  m_Chart = vtkSmartPointer<vtkChartXY>::New();

  m_Chart->SetShowLegend(true);

  //const vtkStdString xAxisLabel = "Index";
  //m_Chart->GetAxis(vtkAxis::BOTTOM)->SetTitle(xAxisLabel);
  m_Chart->GetAxis(vtkAxis::BOTTOM)->SetTitle("Index");
  //const vtkStdString yAxisLabel = "Position (mm)";
  //m_Chart->GetAxis(vtkAxis::LEFT)->SetTitle(yAxisLabel);
  m_Chart->GetAxis(vtkAxis::LEFT)->SetTitle("Position (mm)");

  if( this->getName().isEmpty() )  // Note: getName() returns a QString
  {
    const vtkStdString title = "Position Data";
    m_Chart->SetTitle(title);
  }
  else
  {
    const vtkStdString title = "Position Data - " + this->getName().toStdString();
    m_Chart->SetTitle(title);
  }

Any help is appreciated!

Thanks.
Andrew



---------------------------------------------------------------
1981-2011: Celebrating 30 Years of Innovation
Follow us on Twitter: @NDIMedResearch<http://twitter.com/#!/NDIMedResearch>
Andrew D. Wiles, PhD, PEng
Research Scientist, Medical Division
NDI
103 Randall Drive
Waterloo, ON, Canada, N2V 1C5
Telephone: +1 (519) 884-5142 ext. 314
Toll Free: +1 (877) 634-6340
Global: ++ (800) 634-634-00
Facsimile: +1 (519) 884-5184
Website: www.ndigital.com<http://www.ndigital.com/>

[cid:image001.png at 01CC92E9.B183C560]
--------------------
</PRE><p>
------------------------------------------------------------------------------------------------------ <br>
Registergericht: Traunstein / Registry Court: HRB 275 - Sitz / Head Office: Traunreut <br>
Aufsichtsratsvorsitzender / Chairman of Supervisory Board: Rainer Burkhard <br>
Geschäftsführung / Management Board: Thomas Sesselmann (Vorsitzender / Chairman),<br>
Michael Grimm, Matthias Fauser, Sebastian Tondorf<br><br>
<a href="http://www.heidenhain.de/disclaimer" target="_blank">E-Mail Haftungsausschluss / E-Mail Disclaimer</a><br><pre>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111025/9d8a960b/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 5829 bytes
Desc: image001.png
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111025/9d8a960b/attachment.png>


More information about the vtkusers mailing list