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

Andrew Wiles awiles at ndigital.com
Tue Oct 25 15:23:53 EDT 2011


Hi Daniel,

Thanks for your support :).

I took the time today to rebuild my VTK and my application code using both Debug.  I then had to change my title string to use the ".toAscii()" conversion instead of the ".toStdString()" conversion for my QString objects.  Everything now works in Debug only with MSVC 2010 Express.  I still need to test the release modes.  

However, things still don't work when both are RelWithDebInfo.  Maybe Marcus can enlighten when he has a chance.

Cheers.
Andrew



---------------------------------------------------------------
1981-2011: Celebrating 30 Years of Innovation
Follow us on Twitter: @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


--------------------
>>> Frese Daniel Dr. <frese at heidenhain.de> 10/25/2011 1:50 AM >>>

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 J. 
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
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


--------------------

------------------------------------------------------------------------------------------------------ 
Registergericht: Traunstein / Registry Court: HRB 275 - Sitz / Head Office: Traunreut 
Aufsichtsratsvorsitzender / Chairman of Supervisory Board: Rainer Burkhard 
Geschäftsführung / Management Board: Thomas Sesselmann (Vorsitzender / Chairman),
Michael Grimm, Matthias Fauser, Sebastian Tondorf

E-Mail Haftungsausschluss / E-Mail Disclaimer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111025/72dda9ed/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/bmp
Size: 36150 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111025/72dda9ed/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 5829 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111025/72dda9ed/attachment.png>


More information about the vtkusers mailing list