summaryrefslogtreecommitdiff
path: root/boost/geometry/io/svg/write_svg.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/geometry/io/svg/write_svg.hpp')
-rw-r--r--boost/geometry/io/svg/write_svg.hpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/boost/geometry/io/svg/write_svg.hpp b/boost/geometry/io/svg/write_svg.hpp
index fba3cbebaf..4a518a0815 100644
--- a/boost/geometry/io/svg/write_svg.hpp
+++ b/boost/geometry/io/svg/write_svg.hpp
@@ -3,6 +3,11 @@
// Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
+// This file was modified by Oracle on 2016.
+// Modifications copyright (c) 2016, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@@ -66,9 +71,9 @@ struct svg_box
typedef typename coordinate_type<Box>::type ct;
ct x = geometry::get<geometry::min_corner, 0>(box);
ct y = geometry::get<geometry::min_corner, 1>(box);
- ct width = max BOOST_PREVENT_MACRO_SUBSTITUTION(1,
+ ct width = max BOOST_PREVENT_MACRO_SUBSTITUTION (ct(1),
geometry::get<geometry::max_corner, 0>(box) - x);
- ct height = max BOOST_PREVENT_MACRO_SUBSTITUTION (1,
+ ct height = max BOOST_PREVENT_MACRO_SUBSTITUTION (ct(1),
geometry::get<geometry::max_corner, 1>(box) - y);
os << "<rect x=\"" << x << "\" y=\"" << y
@@ -77,6 +82,24 @@ struct svg_box
}
};
+template <typename Segment>
+struct svg_segment
+{
+ template <typename Char, typename Traits>
+ static inline void apply(std::basic_ostream<Char, Traits>& os,
+ Segment const& segment, std::string const& style, int)
+ {
+ typedef typename coordinate_type<Segment>::type ct;
+ ct x1 = geometry::get<0, 0>(segment);
+ ct y1 = geometry::get<0, 1>(segment);
+ ct x2 = geometry::get<1, 0>(segment);
+ ct y2 = geometry::get<1, 1>(segment);
+
+ os << "<line x1=\"" << x1 << "\" y1=\"" << y1
+ << "\" x2=\"" << x2 << "\" y2=\"" << y2
+ << "\" style=\"" << style << "\"/>";
+ }
+};
/*!
\brief Stream ranges as SVG
@@ -204,6 +227,9 @@ struct svg
template <typename Point>
struct svg<point_tag, Point> : detail::svg::svg_point<Point> {};
+template <typename Segment>
+struct svg<segment_tag, Segment> : detail::svg::svg_segment<Segment> {};
+
template <typename Box>
struct svg<box_tag, Box> : detail::svg::svg_box<Box> {};