Commit 7e721d6a authored by Hans-Christian Ebke's avatar Hans-Christian Ebke

Added preimage handling to polylines.


git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@18679 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 5394806e
......@@ -22,6 +22,7 @@ void PolyLineObjectSerializer::serialize(std::ostream& _stream) {
//std::cerr << "write " << _filename << std::endl;
std::cerr << "#points: " << _polyLine.n_vertices() << std::endl;
fout.precision(14);
// write each point
for(unsigned int i=0; i< _polyLine.n_vertices(); ++i)
......
......@@ -100,7 +100,8 @@ PolyLineT<PointT>::
ref_count_enormals_(0),
ref_count_ecolors_(0),
ref_count_escalars_(0),
ref_count_eselections_(0)
ref_count_eselections_(0),
ref_count_epreimage_direction_(0)
{
}
......@@ -131,6 +132,7 @@ PolyLineT<PointT>::
ecolors_ = _line.ecolors_;
escalars_ = _line.escalars_;
eselections_ = _line.eselections_;
epreimage_direction_ = _line.epreimage_direction_;
// property reference counter
ref_count_vnormals_ = _line.ref_count_vnormals_;
......@@ -146,6 +148,7 @@ PolyLineT<PointT>::
ref_count_ecolors_ = _line.ref_count_ecolors_;
ref_count_escalars_ = _line.ref_count_escalars_;
ref_count_eselections_ = _line.ref_count_eselections_;
ref_count_epreimage_direction_ = _line.ref_count_epreimage_direction_;
}
//-----------------------------------------------------------------------------
......@@ -172,6 +175,7 @@ clear()
ecolors_.clear();
escalars_.clear();
eselections_.clear();
epreimage_direction_.clear();
}
//-----------------------------------------------------------------------------
......@@ -224,8 +228,8 @@ resize( unsigned int _n)
ecolors_.resize( _n);
if( edge_scalars_available())
escalars_.resize( _n);
if( edge_selections_available())
eselections_.resize( _n);
if( edge_preimage_directions_available())
epreimage_direction_.resize( _n);
}
else
{
......@@ -282,6 +286,10 @@ add_point(const Point& _p)
if( edge_selections_available())
eselections_.push_back(false);
if( edge_preimage_directions_available())
epreimage_direction_.push_back(Point(0,0,0));
}
//-----------------------------------------------------------------------------
......@@ -332,6 +340,9 @@ insert_point(int _idx, const Point& _p)
if( edge_selections_available())
eselections_.insert(eselections_.begin()+_idx, false);
if( edge_preimage_directions_available())
epreimage_direction_.insert(epreimage_direction_.begin()+_idx, Point(0,0,0));
}
......@@ -385,6 +396,9 @@ delete_point(int _idx)
if( edge_selections_available())
eselections_.erase(eselections_.begin()+_idx);
if( edge_preimage_directions_available())
epreimage_direction_.erase(epreimage_direction_.begin()+_idx);
}
......
......@@ -366,6 +366,7 @@ public:
void request_edge_colors() { request_prop( ref_count_ecolors_ , ecolors_ );}
void request_edge_scalars() { request_prop( ref_count_escalars_ , escalars_);}
void request_edge_selections() { request_prop( ref_count_eselections_, eselections_);}
void request_preimage_directions() { request_prop( ref_count_epreimage_direction_, epreimage_direction_);}
// release properties
void release_vertex_normals() { release_prop( ref_count_vnormals_ , vnormals_);}
......@@ -381,6 +382,7 @@ public:
void release_edge_colors() { release_prop( ref_count_ecolors_ , ecolors_ );}
void release_edge_scalars() { release_prop( ref_count_escalars_ , escalars_);}
void release_edge_selections() { release_prop( ref_count_eselections_, eselections_);}
void release_preimage_directions() { release_prop( ref_count_epreimage_direction_, epreimage_direction_);}
// property availability
bool vertex_normals_available() const {return (ref_count_vnormals_ != 0 ); }
......@@ -396,6 +398,7 @@ public:
bool edge_colors_available() const {return (ref_count_ecolors_ != 0 ); }
bool edge_scalars_available() const {return (ref_count_escalars_ != 0 ); }
bool edge_selections_available() const {return (ref_count_eselections_ != 0 ); }
bool edge_preimage_directions_available() const {return (ref_count_epreimage_direction_ != 0 ); }
// property access ( no range or availability check! )
Point& vertex_normal(unsigned int _i) { return vnormals_[_i];}
......@@ -434,6 +437,9 @@ public:
unsigned char& edge_selection(unsigned int _i) {return eselections_[_i];}
const unsigned char& edge_selection(unsigned int _i) const {return eselections_[_i];}
Point & preimage_direction(unsigned int _i) { return epreimage_direction_[_i];}
const Point & preimage_direction(unsigned int _i) const { return epreimage_direction_[_i];}
// ############################### SelectionWrappers ############################
bool vertex_selected(unsigned int _i) { return (_i < vselections_.size() ? vertex_selection(_i) == 1 : false); }
......@@ -558,6 +564,7 @@ private:
std::vector<Point> ecolors_;
std::vector<Scalar> escalars_;
std::vector<unsigned char> eselections_;
std::vector<Point> epreimage_direction_;
// property reference counter
......@@ -574,6 +581,7 @@ private:
unsigned int ref_count_ecolors_;
unsigned int ref_count_escalars_;
unsigned int ref_count_eselections_;
unsigned int ref_count_epreimage_direction_;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment