44 #include <ObjectTypes/PolyLine/PolyLineT.hh> 54 iterator(
typename std::vector<PolyLine*>::iterator _begin,
typename std::vector<PolyLine*>::iterator _end) :
60 PolyLine*& operator* (){
64 PolyLine* operator-> (){
77 operator bool()
const{
82 typename std::vector<PolyLine*>::iterator it_;
83 typename std::vector<PolyLine*>::iterator end_;
87 index_iterator(std::vector<PolyLine*>& _lines,
typename std::vector<size_t>::iterator _begin,
typename std::vector<size_t>::iterator _end) :
93 PolyLine*& operator* (){
97 PolyLine* operator-> (){
109 operator bool()
const{
113 std::vector<PolyLine*>& lines_;
114 typename std::vector<size_t>::iterator it_;
115 typename std::vector<size_t>::iterator end_;
126 const size_t n = poly_lines_.size();
127 for(
size_t i = 0; i < n; ++i){
128 delete poly_lines_[i];
140 if(empty_slots_.empty()){
142 const size_t new_idx = poly_lines_.size();
143 poly_lines_.push_back(_poly_line);
144 visible_.push_back(new_idx);
149 const size_t new_idx = empty_slots_.front();
151 poly_lines_[new_idx] = _poly_line;
152 visible_.push_back(new_idx);
165 PolyLine* pl =
new PolyLine();
166 pl->request_vertex_selections();
167 pl->request_edge_selections();
168 pl->request_vertex_vhandles();
169 pl->request_vertex_ehandles();
170 pl->request_vertex_fhandles();
171 pl->request_edge_scalars();
178 poly_lines_.reserve(poly_lines_.size() + _count);
186 inline size_t n_polylines(){
return poly_lines_.size();}
187 inline PolyLine* polyline(
size_t _i){
return poly_lines_[_i];}
189 inline size_t n_visible_polylines(){
return visible_.size();}
190 inline PolyLine* visible_polyline(
size_t _i){
return poly_lines_[visible_[_i]];}
198 inline iterator iter(){
return iterator(poly_lines_.begin(), poly_lines_.end());}
208 size_t n_lines = poly_lines_.size();
209 visible_.resize(n_lines);
210 for(
size_t i = 0; i < n_lines; ++i){
230 selected_ = _selected;
243 for (
size_t i = 0; i < poly_lines_.size(); ++i)
245 delete poly_lines_[i];
250 while(!empty_slots_.empty()) empty_slots_.pop();
260 if(_id <
int(poly_lines_.size()) && poly_lines_[_id] != 0){
261 delete poly_lines_[_id];
262 poly_lines_[_id] = 0;
263 empty_slots_.push(_id);
271 inline void set_color(
size_t _edge_scalar,
const ACG::Vec4uc& _color) {color_map_[_edge_scalar] = _color;}
272 inline ACG::Vec4uc color(
size_t _edge_scalar) {
return color_map_[_edge_scalar];}
276 std::vector<PolyLine*> poly_lines_;
277 std::vector<size_t> visible_;
278 std::vector<size_t> selected_;
280 std::queue<size_t> empty_slots_;
283 std::map<size_t, ACG::Vec4uc> color_map_;
void set_visible_all()
Set all polylines to visible.
void remove_polyline(int _id)
Remove one polyline from the collection.
void set_visible(const std::vector< size_t > &_visible)
Set given polylines to visible.
virtual ~PolyLineCollectionT()
Destructor.
void clear()
Clear Collection.
void clear_selection()
unselect all polylines in collection
int new_poly_line()
Create empty polyline and return id.
void set_selected(const std::vector< size_t > &_selected)
Set given polylines to selected.
size_t add_poly_line(PolyLine *_poly_line)
void reserve(size_t _count)
Reserve space for additional _count polylines.