diff --git a/Packages/Spatial_searching/examples/Spatial_searching/Example11.C b/Packages/Spatial_searching/examples/Spatial_searching/Example11.C index f16fa3024fb..3b2cfed177c 100644 --- a/Packages/Spatial_searching/examples/Spatial_searching/Example11.C +++ b/Packages/Spatial_searching/examples/Spatial_searching/Example11.C @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include @@ -13,7 +13,7 @@ #include #include -typedef CGAL::Cartesian R; +typedef CGAL::Simple_cartesian R; typedef R::Point_3 Point; typedef CGAL::Plane_separator Separator; @@ -69,7 +69,7 @@ int main() { Traits tr(bucket_size, 3.0, true); typedef CGAL::Kd_tree tree; - + t.reset(); t.start(); tree d(data_points.begin(), data_points.end(), tr); diff --git a/Packages/Spatial_searching/examples/Spatial_searching/ExampleC.C b/Packages/Spatial_searching/examples/Spatial_searching/ExampleC.C index 1b29d132224..919a63c11df 100755 --- a/Packages/Spatial_searching/examples/Spatial_searching/ExampleC.C +++ b/Packages/Spatial_searching/examples/Spatial_searching/ExampleC.C @@ -70,7 +70,7 @@ int main() { std::cout << "all points are:" << std::endl; - for (int j1=0; j1 < points_in_tree.size(); ++j1) { + for (unsigned int j1=0; j1 < points_in_tree.size(); ++j1) { std::cout << points_in_tree[j1] << "d(C,p)=" << sqrt(CGAL::squared_distance(points_in_tree[j1],C)) << std::endl; } @@ -79,7 +79,7 @@ int main() { std::cout << "points approximately in spherical range query are:" << std::endl; - for (int j2=0; j2 < points_in_spherical_range_query.size(); ++j2) { + for (unsigned int j2=0; j2 < points_in_spherical_range_query.size(); ++j2) { std::cout << points_in_spherical_range_query[j2] << std::endl; } @@ -102,7 +102,7 @@ int main() { std::cout << "points approximately in rectangular range query [-100,900]^4 are:" << std::endl; - for (int j3=0; j3 < points_in_rectangular_range_query.size(); ++j3) { + for (unsigned int j3=0; j3 < points_in_rectangular_range_query.size(); ++j3) { std::cout << points_in_rectangular_range_query[j3] << std::endl; } diff --git a/Packages/Spatial_searching/include/CGAL/General_priority_search.h b/Packages/Spatial_searching/include/CGAL/General_priority_search.h index 460edd98e7c..f18d21c0b9f 100755 --- a/Packages/Spatial_searching/include/CGAL/General_priority_search.h +++ b/Packages/Spatial_searching/include/CGAL/General_priority_search.h @@ -39,8 +39,8 @@ public: typedef typename Tree_traits::Item Item; typedef typename Tree_traits::NT NT; -typedef Item** Item_iterator; -typedef Kd_tree_node Node; +typedef Kd_tree::Item_iterator Item_iterator; +typedef Kd_tree::Node_handle Node_handle; typedef Kd_tree Tree; typedef Kd_tree_rectangle Node_box; @@ -49,19 +49,19 @@ class Cell private: Node_box* the_box; - Node* the_node; + Node_handle the_node; public: // constructor - Cell (Node_box* Nb, Node* N) + Cell (Node_box* Nb, Node_handle N) { the_box = Nb; the_node = N; } Node_box* box() {return the_box;}; - Node* node() {return the_node;}; + Node_handle node() {return the_node;}; ~Cell() {} @@ -406,7 +406,7 @@ class Distance_smaller while ((!next_neighbour_found) && (!PriorityQueue->empty())) { Cell_with_distance* The_node_top=PriorityQueue->top(); - Node* N= The_node_top->first->node(); + Node_handle N= The_node_top->first->node(); Node_box* B= The_node_top->first->box(); PriorityQueue->pop(); delete The_node_top->first; diff --git a/Packages/Spatial_searching/include/CGAL/General_standard_search.h b/Packages/Spatial_searching/include/CGAL/General_standard_search.h index a8f1fc1a753..87981369a59 100755 --- a/Packages/Spatial_searching/include/CGAL/General_standard_search.h +++ b/Packages/Spatial_searching/include/CGAL/General_standard_search.h @@ -43,12 +43,12 @@ typedef typename Traits::Item Item; typedef typename Traits::NT NT; typedef std::pair Item_with_distance; -typedef Kd_tree_node Node; +typedef Kd_tree::Node_handle Node_handle; typedef Kd_tree Tree; // private: -typedef Item** Item_iterator; +typedef Kd_tree::Item_iterator Item_iterator; typedef Kd_tree_rectangle Rectangle; private: @@ -166,7 +166,7 @@ Distance* distance_instance; private: - void compute_neighbours_general(Node* N, Kd_tree_rectangle* r) { + void compute_neighbours_general(Node_handle N, Kd_tree_rectangle* r) { if (!(N->is_leaf())) { number_of_internal_nodes_visited++; diff --git a/Packages/Spatial_searching/include/CGAL/Kd_tree.h b/Packages/Spatial_searching/include/CGAL/Kd_tree.h index b548d5a88a0..8a46c9916e3 100644 --- a/Packages/Spatial_searching/include/CGAL/Kd_tree.h +++ b/Packages/Spatial_searching/include/CGAL/Kd_tree.h @@ -40,10 +40,11 @@ public: typedef Kd_tree_node Node; typedef Kd_tree Tree; + typedef typename Compact_container::iterator Node_handle; + typedef std::vector::iterator Item_iterator; private: Compact_container nodes; - typedef typename Compact_container::iterator Node_handle; Node_handle tree_root; @@ -55,7 +56,7 @@ private: // and we only store an iterator range in the Kd_tree_node. // std::vector data; - std::vector::iterator data_iterator; + Item_iterator data_iterator; Traits tr; int the_item_number; diff --git a/Packages/Spatial_searching/include/CGAL/Kd_tree_node.h b/Packages/Spatial_searching/include/CGAL/Kd_tree_node.h index 8011543aa1f..a63be9813ca 100644 --- a/Packages/Spatial_searching/include/CGAL/Kd_tree_node.h +++ b/Packages/Spatial_searching/include/CGAL/Kd_tree_node.h @@ -36,15 +36,13 @@ namespace CGAL { friend class Kd_tree; - typedef Kd_tree_node Node; - - typedef typename Compact_container::iterator Node_handle; - + typedef typename Kd_tree::Node_handle Node_handle; enum Node_type {LEAF, INTERNAL, EXTENDED_INTERNAL}; typedef typename Traits::Item Item; - typedef std::vector::iterator Item_iterator; + typedef typename Traits::NT NT; typedef typename Traits::Separator Separator; + typedef typename Kd_tree::Item_iterator Item_iterator; private: @@ -71,7 +69,7 @@ namespace CGAL { void * & for_compact_container() { return lower_ch.for_compact_container(); } // default constructor - Kd_tree_node(): the_node_type() {}; + Kd_tree_node() {}; // members for all nodes inline bool is_leaf() const { return (the_node_type==LEAF);} diff --git a/Packages/Spatial_searching/include/CGAL/Orthogonal_priority_search.h b/Packages/Spatial_searching/include/CGAL/Orthogonal_priority_search.h index ef369bef5a4..9b662401bbf 100755 --- a/Packages/Spatial_searching/include/CGAL/Orthogonal_priority_search.h +++ b/Packages/Spatial_searching/include/CGAL/Orthogonal_priority_search.h @@ -38,13 +38,13 @@ public: typedef typename Traits::Item Item; typedef typename Traits::NT NT; -typedef Item** Item_iterator; -typedef Kd_tree_node Node; +typedef Kd_tree::Item_iterator Item_iterator; +typedef Kd_tree::Node_handle Node_handle; typedef Kd_tree Tree; typedef std::pair Item_with_distance; -typedef std::pair Node_with_distance; +typedef std::pair Node_with_distance; @@ -378,7 +378,7 @@ class iterator; // otherwise browse the tree further while ((!next_neighbour_found) && (!PriorityQueue->empty())) { Node_with_distance* The_node_top=PriorityQueue->top(); - Node* N= The_node_top->first; + Node_handle N= The_node_top->first; PriorityQueue->pop(); delete The_node_top; diff --git a/Packages/Spatial_searching/include/CGAL/Orthogonal_standard_search.h b/Packages/Spatial_searching/include/CGAL/Orthogonal_standard_search.h index c910a82cb81..49bd5e6ecb0 100755 --- a/Packages/Spatial_searching/include/CGAL/Orthogonal_standard_search.h +++ b/Packages/Spatial_searching/include/CGAL/Orthogonal_standard_search.h @@ -42,12 +42,12 @@ typedef typename Traits::Item Item; typedef typename Traits::NT NT; typedef std::pair Item_with_distance; -typedef Kd_tree_node Node; typedef Kd_tree Tree; +typedef Tree::Node_handle Node_handle; //private: -typedef Item** Item_iterator; +typedef Kd_tree::Item_iterator Item_iterator; typedef Kd_tree_rectangle Rectangle; private: @@ -170,7 +170,7 @@ Distance* distance_instance; private: - void compute_neighbours_orthogonally(Node* N, NT rd) { + void compute_neighbours_orthogonally(Node_handle N, NT rd) { if (!(N->is_leaf())) { number_of_internal_nodes_visited++;