Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions extensions/example/io/Jamfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Boost.Geometry (aka GGL, Generic Geometry Library)
#
# Copyright (c) 2020 Baidyanath Kundu, Haldia, India.

# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

project boost-geometry-extensions-io
: #requirements
;

exe plotly_example : plotly_example.cpp ;
42 changes: 42 additions & 0 deletions extensions/example/io/plotly_example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example

// Copyright (c) 2013 Barend Gehrels, Amsterdam, the Netherlands.

// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <iostream>
#include <fstream>
#include <boost/geometry.hpp>
#include <boost/geometry/extensions/io/plotly/plotter.hpp>
#include <boost/geometry/geometries/point_xy.hpp>

namespace bg = boost::geometry;

int main()
{
typedef bg::model::point<double, 2, bg::cs::geographic<bg::degree>> point_t;
typedef bg::model::polygon<point_t> polygon_t;

polygon_t poly1;

bg::append(poly1.outer(), point_t(0.0, 0.0));
bg::append(poly1.outer(), point_t(0.0, 5.0));
bg::append(poly1.outer(), point_t(5.0, 5.0));
bg::append(poly1.outer(), point_t(5.0, 0.0));
bg::append(poly1.outer(), point_t(0.0, 0.0));

poly1.inners().resize(1);
bg::append(poly1.inners()[0], point_t(1.0, 1.0));
bg::append(poly1.inners()[0], point_t(4.0, 1.0));
bg::append(poly1.inners()[0], point_t(4.0, 4.0));
bg::append(poly1.inners()[0], point_t(1.0, 4.0));
bg::append(poly1.inners()[0], point_t(1.0, 1.0));

bg::plotly_plotter<std::ofstream> plotter("my_plot.json");
plotter.plot(poly1, bg::plotly_color(255, 39, 0));

return 0;
}
Loading