Go to the documentation of this file.00001
00002 #ifndef vtol_one_chain_h_
00003 #define vtol_one_chain_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #include <vcl_iosfwd.h>
00036 #include <vcl_vector.h>
00037 #include <vtol/vtol_chain.h>
00038 #include <vtol/vtol_edge_2d_sptr.h>
00039 #include <vtol/vtol_face_2d_sptr.h>
00040 class vtol_edge;
00041 class vtol_vertex;
00042 class vtol_face;
00043 class vtol_block;
00044 class vtol_zero_chain;
00045 class vtol_two_chain;
00046
00047
00048
00049 class vtol_one_chain : public vtol_chain
00050 {
00051 public:
00052
00053
00054
00055
00056 void link_chain_inferior(vtol_one_chain_sptr chain_inferior);
00057 void unlink_chain_inferior(vtol_one_chain_sptr chain_inferior);
00058
00059
00060
00061
00062 vtol_one_chain() { set_cycle(false); }
00063
00064
00065
00066
00067 explicit vtol_one_chain(edge_list const&,
00068 bool new_is_cycle=false);
00069
00070
00071
00072
00073 vtol_one_chain(edge_list const&,
00074 vcl_vector<signed char> const&,
00075 bool new_is_cycle=false);
00076
00077
00078
00079
00080 vtol_one_chain(vtol_one_chain_sptr const& other);
00081 private:
00082
00083
00084
00085 vtol_one_chain(vtol_one_chain const& other);
00086 public:
00087
00088
00089
00090 virtual ~vtol_one_chain();
00091
00092
00093
00094
00095
00096 virtual vsol_spatial_object_2d* clone() const;
00097
00098
00099 virtual vcl_string is_a() const { return vcl_string("vtol_one_chain"); }
00100
00101
00102 virtual bool is_class(const vcl_string& cls) const
00103 { return cls==is_a() || vtol_chain::is_class(cls); }
00104
00105
00106
00107 private:
00108
00109 virtual vtol_topology_object_type topology_type() const {return ONECHAIN;}
00110
00111 public:
00112 virtual signed char direction(vtol_edge const& e) const;
00113
00114
00115
00116
00117
00118
00119
00120
00121 virtual const vtol_one_chain *cast_to_one_chain() const { return this; }
00122
00123
00124
00125
00126 virtual vtol_one_chain *cast_to_one_chain() { return this; }
00127
00128
00129
00130
00131
00132 void link_inferior(vtol_edge_sptr inf);
00133 void unlink_inferior(vtol_edge_sptr inf);
00134
00135
00136
00137
00138 virtual bool valid_inferior_type(vtol_topology_object const* inferior) const
00139 { return inferior->cast_to_edge() != 0; }
00140 bool valid_inferior_type(vtol_edge_sptr const& ) const { return true; }
00141 bool valid_inferior_type(vtol_edge_2d_sptr const& ) const { return true; }
00142 bool valid_superior_type(vtol_face_sptr const& ) const { return true; }
00143 bool valid_superior_type(vtol_face_2d_sptr const& ) const { return true; }
00144
00145
00146
00147
00148 virtual bool valid_chain_type(vtol_chain_sptr chain_inf_sup) const
00149 { return chain_inf_sup->cast_to_one_chain() != 0; }
00150 bool valid_chain_type(vtol_one_chain_sptr const& ) const { return true; }
00151
00152
00153
00154 virtual vertex_list *outside_boundary_vertices();
00155 virtual zero_chain_list *outside_boundary_zero_chains();
00156 virtual edge_list *outside_boundary_edges();
00157 virtual one_chain_list *outside_boundary_one_chains();
00158
00159
00160 virtual one_chain_list *inferior_one_chains();
00161 virtual one_chain_list *superior_one_chains();
00162
00163
00164
00165 virtual void reverse_directions();
00166
00167 virtual vtol_one_chain * copy_with_arrays(topology_list &verts,
00168 topology_list &edges) const;
00169
00170 virtual void compute_bounding_box() const;
00171
00172 virtual vtol_edge_sptr edge(int i) const;
00173 int num_edges() const { return numinf(); }
00174
00175 virtual void determine_edge_directions();
00176 virtual void add_edge(vtol_edge_sptr const&, bool);
00177 virtual void add_edge(vtol_edge_2d_sptr const&, bool);
00178 virtual void remove_edge(vtol_edge_sptr const&, bool);
00179 virtual void remove_edge(vtol_edge_2d_sptr const&, bool);
00180 private:
00181
00182 virtual void add_edge(vtol_edge &, bool);
00183 virtual void remove_edge(vtol_edge &, bool);
00184 public:
00185
00186
00187 virtual bool operator==(vtol_one_chain const& other) const;
00188 inline bool operator!=(const vtol_one_chain &other)const{return !operator==(other);}
00189 bool operator==(vsol_spatial_object_2d const& obj) const;
00190
00191 virtual void print(vcl_ostream &strm=vcl_cout) const;
00192 virtual void describe_directions(vcl_ostream &strm=vcl_cout, int blanking=0) const;
00193 virtual void describe(vcl_ostream &strm=vcl_cout, int blanking=0) const;
00194
00195 protected:
00196
00197
00198
00199 virtual vcl_vector<vtol_vertex*> *compute_vertices();
00200 virtual vcl_vector<vtol_edge*> *compute_edges();
00201 virtual vcl_vector<vtol_zero_chain*> *compute_zero_chains();
00202 virtual vcl_vector<vtol_one_chain*> *compute_one_chains();
00203 virtual vcl_vector<vtol_face*> *compute_faces();
00204 virtual vcl_vector<vtol_two_chain*> *compute_two_chains();
00205 virtual vcl_vector<vtol_block*> *compute_blocks();
00206
00207 public:
00208 virtual vcl_vector<vtol_vertex*> *outside_boundary_compute_vertices();
00209 virtual vcl_vector<vtol_zero_chain*> *outside_boundary_compute_zero_chains();
00210 virtual vcl_vector<vtol_edge*> *outside_boundary_compute_edges();
00211 virtual vcl_vector<vtol_one_chain*> *outside_boundary_compute_one_chains();
00212 };
00213
00214 #endif // vtol_one_chain_h_