Osmium  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Member Functions | Private Attributes
Osmium::OSM::AreaFromRelation Class Reference

#include <area.hpp>

Inheritance diagram for Osmium::OSM::AreaFromRelation:
Inheritance graph
[legend]
Collaboration diagram for Osmium::OSM::AreaFromRelation:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 AreaFromRelation (Relation *r, bool b, int n, void(*callback)(Osmium::OSM::Area *), bool repair)
 ~AreaFromRelation ()
osm_object_type_t get_type () const
void add_member_way (Osmium::OSM::Way *way)
 Add way to list of member ways. This will create a copy of the way.
bool is_complete ()
 Do we have all the ways we need to build the multipolygon?
void handle_complete_multipolygon ()

Private Member Functions

bool ignore_tag (const std::string &s)
bool same_tags (const Object *a, const Object *b)
bool merge_tags (Object *a, const Object *b)
bool untagged (const Object *r)
geos::geom::LinearRing * create_non_intersecting_linear_ring (geos::geom::CoordinateSequence *orig_cs)
RingInfomake_one_ring (std::vector< WayInfo * > &ways, osm_object_id_t first, osm_object_id_t last, int ringcount, int sequence)
bool find_and_repair_holes_in_rings (std::vector< WayInfo * > *ways)
bool build_geometry ()
bool geometry_error (const char *message)

Private Attributes

bool boundary
 was this area created from relation with tag type=boundary?
Relationrelation
 the relation this area was build from
std::vector< Osmium::OSM::Waymember_ways
 the member ways of this area
int num_ways
 number of ways in this area
int missing_ways
 how many ways are missing before we can build the multipolygon
std::string geometry_error_message
void(* callback )(Osmium::OSM::Area *)
 callback we should call when a multipolygon was completed
bool attempt_repair
 whether we want to repair a broken geometry

Constructor & Destructor Documentation

Osmium::OSM::AreaFromRelation::AreaFromRelation ( Relation r,
bool  b,
int  n,
void(*)(Osmium::OSM::Area *)  callback,
bool  repair 
) [inline]

Member Function Documentation

Add way to list of member ways. This will create a copy of the way.

Tries to build a multipolygon from the given relation.

geos::geom::LinearRing* Osmium::OSM::AreaFromRelation::create_non_intersecting_linear_ring ( geos::geom::CoordinateSequence *  orig_cs) [inline, private]

This helper gets called when we find a ring that is not valid - usually because it self-intersects. The method tries to salvage as much of the ring as possible, using binary search to find the bit that needs to be cut out. It then returns a valid LinearRing, or NULL if none can be built.

There is massive potential for improvement here. The biggest limitation is that this method does not deliver results for linear rings with more than one self-intersection.

bool Osmium::OSM::AreaFromRelation::find_and_repair_holes_in_rings ( std::vector< WayInfo * > *  ways) [inline, private]

Checks if there are any dangling ends, and connects them to the nearest other dangling end with a straight line. This could conceivably introduce intersections, but it's the best we can do.

Returns true on success.

(This implementation always succeeds because it is impossible for there to be only one dangling end in a collection of lines.)

bool Osmium::OSM::AreaFromRelation::geometry_error ( const char *  message) [inline, private]

Implements Osmium::OSM::Object.

bool Osmium::OSM::AreaFromRelation::ignore_tag ( const std::string &  s) [inline, private]

Do we have all the ways we need to build the multipolygon?

RingInfo* Osmium::OSM::AreaFromRelation::make_one_ring ( std::vector< WayInfo * > &  ways,
osm_object_id_t  first,
osm_object_id_t  last,
int  ringcount,
int  sequence 
) [inline, private]

Tries to collect 1...n ways from the n ways in the given list so that they form a closed ring. If this is possible, flag those as being used by ring #ringcount in the way list and return the geometry. (The method may be called again to find further rings.) If this is not possible, return NULL.

bool Osmium::OSM::AreaFromRelation::merge_tags ( Object a,
const Object b 
) [inline, private]

returns false if there was a collision, true otherwise

bool Osmium::OSM::AreaFromRelation::same_tags ( const Object a,
const Object b 
) [inline, private]
bool Osmium::OSM::AreaFromRelation::untagged ( const Object r) [inline, private]

Member Data Documentation

whether we want to repair a broken geometry

was this area created from relation with tag type=boundary?

callback we should call when a multipolygon was completed

the member ways of this area

how many ways are missing before we can build the multipolygon

number of ways in this area

the relation this area was build from


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines