# HG changeset patch # User Sebastien Jodogne # Date 1541420703 -3600 # Node ID 70256a53ff21f56d68c2afa0b2131b6c715f926a # Parent d6136a7e914d04ab2765c764f6a8d93ac97f2529 fix compatibility with Visual Studio 2008 diff -r d6136a7e914d -r 70256a53ff21 Applications/Samples/SingleFrameApplication.h --- a/Applications/Samples/SingleFrameApplication.h Mon Nov 05 10:06:18 2018 +0100 +++ b/Applications/Samples/SingleFrameApplication.h Mon Nov 05 13:25:03 2018 +0100 @@ -28,6 +28,9 @@ #include +#include + + namespace OrthancStone { namespace Samples @@ -161,7 +164,7 @@ GetMainWidget().SetSlice(source_->GetSlice(slice_).GetGeometry()); #else // TEST for scene extents - Rotate the axes - double a = 15.0 / 180.0 * M_PI; + double a = 15.0 / 180.0 * boost::math::constants::pi(); #if 1 Vector x; GeometryToolbox::AssignVector(x, cos(a), sin(a), 0); diff -r d6136a7e914d -r 70256a53ff21 Applications/Samples/SingleFrameEditorApplication.h --- a/Applications/Samples/SingleFrameEditorApplication.h Mon Nov 05 10:06:18 2018 +0100 +++ b/Applications/Samples/SingleFrameEditorApplication.h Mon Nov 05 13:25:03 2018 +0100 @@ -42,6 +42,8 @@ #include +#include + namespace OrthancStone { @@ -1493,7 +1495,7 @@ static int ToDegrees(double angle) { - return static_cast(round(angle * 180.0 / boost::math::constants::pi())); + return boost::math::iround(angle * 180.0 / boost::math::constants::pi()); } protected: @@ -1581,7 +1583,7 @@ if (roundAngles_) { - angle = round(angle / ROUND_ANGLE) * ROUND_ANGLE; + angle = boost::math::round((angle / ROUND_ANGLE) * ROUND_ANGLE); } accessor_.GetBitmap().SetAngle(angle); @@ -1990,7 +1992,7 @@ if (roundScaling_) { - scaling = round(scaling / ROUND_SCALING) * ROUND_SCALING; + scaling = boost::math::round((scaling / ROUND_SCALING) * ROUND_SCALING); } BitmapStack::Bitmap& bitmap = accessor_.GetBitmap(); @@ -2152,7 +2154,9 @@ } else { - tmp = log2(delta); + // NB: Visual Studio 2008 does not provide "log2f()", so we + // implement it by ourselves + tmp = logf(delta) / logf(2.0f); } strength_ = tmp - 7; @@ -2796,10 +2800,10 @@ if (widget.GetStack().GetWindowing(center, width)) { json["Tags"][Orthanc::DICOM_TAG_WINDOW_CENTER.Format()] = - boost::lexical_cast(lroundf(center)); + boost::lexical_cast(boost::math::iround(center)); json["Tags"][Orthanc::DICOM_TAG_WINDOW_WIDTH.Format()] = - boost::lexical_cast(lroundf(width)); + boost::lexical_cast(boost::math::iround(width)); } #if EXPORT_USING_PAM == 1 diff -r d6136a7e914d -r 70256a53ff21 Framework/Layers/CircleMeasureTracker.cpp --- a/Framework/Layers/CircleMeasureTracker.cpp Mon Nov 05 10:06:18 2018 +0100 +++ b/Framework/Layers/CircleMeasureTracker.cpp Mon Nov 05 13:25:03 2018 +0100 @@ -19,12 +19,10 @@ **/ -#define _USE_MATH_DEFINES // To access M_PI in Visual Studio -#include - #include "CircleMeasureTracker.h" #include +#include namespace OrthancStone { @@ -66,7 +64,7 @@ cairo_save(cr); cairo_set_line_width(cr, 2.0 / zoom); cairo_translate(cr, x, y); - cairo_arc(cr, 0, 0, r, 0, 2 * M_PI); + cairo_arc(cr, 0, 0, r, 0, 2.0 * boost::math::constants::pi()); cairo_stroke_preserve(cr); cairo_stroke(cr); cairo_restore(cr); diff -r d6136a7e914d -r 70256a53ff21 Framework/Widgets/LayerWidget.cpp --- a/Framework/Widgets/LayerWidget.cpp Mon Nov 05 10:06:18 2018 +0100 +++ b/Framework/Widgets/LayerWidget.cpp Mon Nov 05 13:25:03 2018 +0100 @@ -27,6 +27,9 @@ #include +#include + + static const double THIN_SLICE_THICKNESS = 100.0 * std::numeric_limits::epsilon(); namespace OrthancStone @@ -179,8 +182,8 @@ double s = 5.0 / view.GetZoom(); cairo_rectangle(cr, -s, -s, 2.0 * s, 2.0 * s); #else - // TODO Drawing circles makes WebAssembly crash! - cairo_arc(cr, 0, 0, 5.0 / view.GetZoom(), 0, 2 * M_PI); + // TODO Drawing filled circles makes WebAssembly crash! + cairo_arc(cr, 0, 0, 5.0 / view.GetZoom(), 0, 2.0 * boost::math::constants::pi()); #endif cairo_set_line_width(cr, 2.0 / view.GetZoom());