double RefEdge::fraction_from_arc_length(RefVertex *root_vertex, double length) { if (root_vertex != start_vertex() && root_vertex != end_vertex()) return -1.0; if (geometry_type() == POINT_CURVE_TYPE || get_arc_length() < GEOMETRY_RESABS) return 0.0; if (length >= get_arc_length()) return 1.0; if (root_vertex == start_vertex()) return length/get_arc_length(); else return 1-length/get_arc_length(); }
geometry_generator_grammar<OutputIterator, Geometry>::geometry_generator_grammar() : geometry_generator_grammar::base_type(geometry) { boost::spirit::karma::_val_type _val; boost::spirit::karma::_1_type _1; boost::spirit::karma::_a_type _a; boost::spirit::karma::lit_type lit; boost::spirit::karma::uint_type uint_; boost::spirit::karma::eps_type eps; geometry = geometry_dispatch.alias() ; geometry_dispatch = eps[_a = geometry_type(_val)] << (&uint_(geometry::geometry_types::Point)[_1 = _a] << (point | lit("null"))) | (&uint_(geometry::geometry_types::LineString)[_1 = _a] << (linestring | lit("null"))) | (&uint_(geometry::geometry_types::Polygon)[_1 = _a] << (polygon | lit("null"))) | (&uint_(geometry::geometry_types::MultiPoint)[_1 = _a] << (multi_point | lit("null"))) | (&uint_(geometry::geometry_types::MultiLineString)[_1 = _a] << (multi_linestring | lit("null"))) | (&uint_(geometry::geometry_types::MultiPolygon)[_1 = _a] << (multi_polygon | lit("null"))) | (&uint_(geometry::geometry_types::GeometryCollection)[_1 = _a] << (geometry_collection | lit("null"))) | lit("null") ; point = lit("{\"type\":\"Point\",\"coordinates\":") << point_coord << lit("}") ; linestring = lit("{\"type\":\"LineString\",\"coordinates\":[") << linestring_coord << lit("]}") ; polygon = lit("{\"type\":\"Polygon\",\"coordinates\":[") << polygon_coord << lit("]}") ; multi_point = lit("{\"type\":\"MultiPoint\",\"coordinates\":[") << multi_point_coord << lit("]}") ; multi_linestring = lit("{\"type\":\"MultiLineString\",\"coordinates\":[") << multi_linestring_coord << lit("]}") ; multi_polygon = lit("{\"type\":\"MultiPolygon\",\"coordinates\":[") << multi_polygon_coord << lit("]}") ; geometry_collection = lit("{\"type\":\"GeometryCollection\",\"geometries\":[") << geometries << lit("]}") ; point_coord = lit('[') << coordinate << lit(',') << coordinate << lit(']') ; linestring_coord = point_coord % lit(',') ; polygon_coord = lit('[') << exterior_ring_coord << lit(']') << interior_ring_coord ; exterior_ring_coord = linestring_coord.alias() ; interior_ring_coord = *(lit(",[") << exterior_ring_coord << lit(']')) ; multi_point_coord = linestring_coord.alias() ; multi_linestring_coord = (lit('[') << linestring_coord << lit(']')) % lit(',') ; multi_polygon_coord = (lit('[') << polygon_coord << lit(']')) % lit(',') ; geometries = geometry % lit(',') ; }