Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Oracle/GetOrthancWebViewerJpegCommand.h @ 2012:637d6373127a
width of the vertical slider has doubled to ease user interactions
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 02 Dec 2022 18:49:06 +0100 |
parents | 7053b8a0aaec |
children | 07964689cb0b |
rev | line source |
---|---|
746 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1871
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
746 | 7 * |
8 * This program is free software: you can redistribute it and/or | |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
746 | 10 * as published by the Free Software Foundation, either version 3 of |
11 * the License, or (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
16 * Lesser General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1571
diff
changeset
|
17 * |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
19 * License along with this program. If not, see |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
746 | 21 **/ |
22 | |
23 | |
24 #pragma once | |
25 | |
26 #include "../Messages/IMessageEmitter.h" | |
1128
8e3763d1736a
removing CustomOracleCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1098
diff
changeset
|
27 #include "OracleCommandBase.h" |
746 | 28 |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1300
diff
changeset
|
29 #include <Images/ImageAccessor.h> |
746 | 30 |
31 #include <map> | |
32 | |
33 namespace OrthancStone | |
34 { | |
1128
8e3763d1736a
removing CustomOracleCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1098
diff
changeset
|
35 class GetOrthancWebViewerJpegCommand : public OracleCommandBase |
746 | 36 { |
37 public: | |
38 typedef std::map<std::string, std::string> HttpHeaders; | |
39 | |
40 class SuccessMessage : public OriginMessage<GetOrthancWebViewerJpegCommand> | |
41 { | |
42 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); | |
43 | |
44 private: | |
1134
87fbeb823375
allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
45 const Orthanc::ImageAccessor& image_; |
746 | 46 |
47 public: | |
48 SuccessMessage(const GetOrthancWebViewerJpegCommand& command, | |
1134
87fbeb823375
allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
49 const Orthanc::ImageAccessor& image) : |
1135
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
50 OriginMessage(command), |
1134
87fbeb823375
allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
51 image_(image) |
87fbeb823375
allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
52 { |
87fbeb823375
allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
53 } |
746 | 54 |
55 const Orthanc::ImageAccessor& GetImage() const | |
56 { | |
1134
87fbeb823375
allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
57 return image_; |
746 | 58 } |
59 }; | |
60 | |
61 private: | |
62 std::string instanceId_; | |
63 unsigned int frame_; | |
64 unsigned int quality_; | |
65 HttpHeaders headers_; | |
66 unsigned int timeout_; | |
67 Orthanc::PixelFormat expectedFormat_; | |
68 | |
1135
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
69 GetOrthancWebViewerJpegCommand(const GetOrthancWebViewerJpegCommand& other) : |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
70 instanceId_(other.instanceId_), |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
71 frame_(other.frame_), |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
72 quality_(other.quality_), |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
73 headers_(other.headers_), |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
74 timeout_(other.timeout_), |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
75 expectedFormat_(other.expectedFormat_) |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
76 { |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
77 } |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
78 |
746 | 79 public: |
80 GetOrthancWebViewerJpegCommand(); | |
81 | |
1571 | 82 virtual Type GetType() const ORTHANC_OVERRIDE |
746 | 83 { |
84 return Type_GetOrthancWebViewerJpeg; | |
85 } | |
86 | |
1571 | 87 virtual IOracleCommand* Clone() const ORTHANC_OVERRIDE |
1135
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
88 { |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
89 return new GetOrthancWebViewerJpegCommand(*this); |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
90 } |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
91 |
746 | 92 void SetExpectedPixelFormat(Orthanc::PixelFormat format) |
93 { | |
94 expectedFormat_ = format; | |
95 } | |
96 | |
97 void SetInstance(const std::string& instanceId) | |
98 { | |
99 instanceId_ = instanceId; | |
100 } | |
101 | |
102 void SetFrame(unsigned int frame) | |
103 { | |
104 frame_ = frame; | |
105 } | |
106 | |
107 void SetQuality(unsigned int quality); | |
108 | |
109 void SetHttpHeader(const std::string& key, | |
110 const std::string& value) | |
111 { | |
112 headers_[key] = value; | |
113 } | |
114 | |
115 Orthanc::PixelFormat GetExpectedPixelFormat() const | |
116 { | |
117 return expectedFormat_; | |
118 } | |
119 | |
120 const std::string& GetInstanceId() const | |
121 { | |
122 return instanceId_; | |
123 } | |
124 | |
125 unsigned int GetFrame() const | |
126 { | |
127 return frame_; | |
128 } | |
129 | |
130 unsigned int GetQuality() const | |
131 { | |
132 return quality_; | |
133 } | |
134 | |
135 const HttpHeaders& GetHttpHeaders() const | |
136 { | |
137 return headers_; | |
138 } | |
139 | |
140 void SetTimeout(unsigned int seconds) | |
141 { | |
142 timeout_ = seconds; | |
143 } | |
144 | |
145 unsigned int GetTimeout() const | |
146 { | |
147 return timeout_; | |
148 } | |
149 | |
150 std::string GetUri() const; | |
151 | |
1134
87fbeb823375
allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
152 void ProcessHttpAnswer(boost::weak_ptr<IObserver> receiver, |
87fbeb823375
allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
153 IMessageEmitter& emitter, |
746 | 154 const std::string& answer) const; |
155 }; | |
156 } |