comparison Framework/Scene2D/Scene2D.cpp @ 632:500c3f70b6c2

- Added a ClearAllChains method to PolylineSceneLayer --> revision must change when calling it ==> BumpRevision has been added to base class - Added some docs = Added GetMinDepth + GetMaxDepth to Scene2D (to alleviate the need for app- specific "Z depth registry" : clients may simply add a new layer on top or at the bottom of the existing layer set. - Added the line tracker measurement tools, commands and trackers. Generic base classes + Line measure - started work on the line measure handles
author Benjamin Golinvaux <bgo@osimis.io>
date Thu, 09 May 2019 10:41:31 +0200
parents d9c0a66304cb
children f939f449482c
comparison
equal deleted inserted replaced
618:0925b27e8750 632:500c3f70b6c2
100 100
101 101
102 void Scene2D::SetLayer(int depth, 102 void Scene2D::SetLayer(int depth,
103 ISceneLayer* layer) // Takes ownership 103 ISceneLayer* layer) // Takes ownership
104 { 104 {
105 LOG(INFO) << "SetLayer(" << depth << ", " <<
106 reinterpret_cast<intptr_t>(layer) << ")";
105 std::auto_ptr<Item> item(new Item(layer, layerCounter_++)); 107 std::auto_ptr<Item> item(new Item(layer, layerCounter_++));
106 108
107 if (layer == NULL) 109 if (layer == NULL)
108 { 110 {
109 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); 111 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer);
124 } 126 }
125 127
126 128
127 void Scene2D::DeleteLayer(int depth) 129 void Scene2D::DeleteLayer(int depth)
128 { 130 {
131
129 Content::iterator found = content_.find(depth); 132 Content::iterator found = content_.find(depth);
130 133
131 if (found != content_.end()) 134 if (found != content_.end())
132 { 135 {
136 LOG(INFO) << "DeleteLayer --found-- (" << depth << ")";
133 assert(found->second != NULL); 137 assert(found->second != NULL);
134 delete found->second; 138 delete found->second;
135 content_.erase(found); 139 content_.erase(found);
136 } 140 }
137 } 141 }
157 return found->second->GetLayer(); 161 return found->second->GetLayer();
158 } 162 }
159 } 163 }
160 164
161 165
166 int Scene2D::GetMinDepth() const
167 {
168 if (content_.size() == 0)
169 return 0;
170 else
171 return content_.begin()->first;
172 }
173
174
175 int Scene2D::GetMaxDepth() const
176 {
177 if (content_.size() == 0)
178 return 0;
179 else
180 return content_.rbegin()->first;
181 }
182
162 ISceneLayer* Scene2D::ReleaseLayer(int depth) 183 ISceneLayer* Scene2D::ReleaseLayer(int depth)
163 { 184 {
164 Content::iterator found = content_.find(depth); 185 Content::iterator found = content_.find(depth);
165 186
166 if (found == content_.end()) 187 if (found == content_.end())