Mercurial > hg > orthanc-stone
comparison Framework/Layers/LineMeasureTracker.cpp @ 726:4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 21 May 2019 11:43:25 +0200 |
parents | 3b4df9925db6 |
children |
comparison
equal
deleted
inserted
replaced
714:d2c0e347ddc2 | 726:4f2416d519b4 |
---|---|
21 | 21 |
22 #include "LineMeasureTracker.h" | 22 #include "LineMeasureTracker.h" |
23 | 23 |
24 #include <stdio.h> | 24 #include <stdio.h> |
25 | 25 |
26 namespace OrthancStone | 26 namespace Deprecated |
27 { | 27 { |
28 LineMeasureTracker::LineMeasureTracker(IStatusBar* statusBar, | 28 LineMeasureTracker::LineMeasureTracker(IStatusBar* statusBar, |
29 const CoordinateSystem3D& slice, | 29 const OrthancStone::CoordinateSystem3D& slice, |
30 double x, | 30 double x, |
31 double y, | 31 double y, |
32 uint8_t red, | 32 uint8_t red, |
33 uint8_t green, | 33 uint8_t green, |
34 uint8_t blue, | 34 uint8_t blue, |
45 color_[1] = green; | 45 color_[1] = green; |
46 color_[2] = blue; | 46 color_[2] = blue; |
47 } | 47 } |
48 | 48 |
49 | 49 |
50 void LineMeasureTracker::Render(CairoContext& context, | 50 void LineMeasureTracker::Render(OrthancStone::CairoContext& context, |
51 double zoom) | 51 double zoom) |
52 { | 52 { |
53 context.SetSourceColor(color_[0], color_[1], color_[2]); | 53 context.SetSourceColor(color_[0], color_[1], color_[2]); |
54 | 54 |
55 cairo_t* cr = context.GetObject(); | 55 cairo_t* cr = context.GetObject(); |
58 cairo_line_to(cr, x2_, y2_); | 58 cairo_line_to(cr, x2_, y2_); |
59 cairo_stroke(cr); | 59 cairo_stroke(cr); |
60 | 60 |
61 if (y2_ - y1_ < 0) | 61 if (y2_ - y1_ < 0) |
62 { | 62 { |
63 context.DrawText(font_, FormatLength(), x2_, y2_ - 5, BitmapAnchor_BottomCenter); | 63 context.DrawText(font_, FormatLength(), x2_, y2_ - 5, OrthancStone::BitmapAnchor_BottomCenter); |
64 } | 64 } |
65 else | 65 else |
66 { | 66 { |
67 context.DrawText(font_, FormatLength(), x2_, y2_ + 5, BitmapAnchor_TopCenter); | 67 context.DrawText(font_, FormatLength(), x2_, y2_ + 5, OrthancStone::BitmapAnchor_TopCenter); |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 | 71 |
72 double LineMeasureTracker::GetLength() const // In millimeters | 72 double LineMeasureTracker::GetLength() const // In millimeters |
73 { | 73 { |
74 Vector a = slice_.MapSliceToWorldCoordinates(x1_, y1_); | 74 OrthancStone::Vector a = slice_.MapSliceToWorldCoordinates(x1_, y1_); |
75 Vector b = slice_.MapSliceToWorldCoordinates(x2_, y2_); | 75 OrthancStone::Vector b = slice_.MapSliceToWorldCoordinates(x2_, y2_); |
76 return boost::numeric::ublas::norm_2(b - a); | 76 return boost::numeric::ublas::norm_2(b - a); |
77 } | 77 } |
78 | 78 |
79 | 79 |
80 std::string LineMeasureTracker::FormatLength() const | 80 std::string LineMeasureTracker::FormatLength() const |