Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
7c53c12
Disable GitHub workflows
gijs-pennings Jan 19, 2023
bef37ec
Fix outdated docs
gijs-pennings Jan 19, 2023
e4d0ac7
Copy files as base
gijs-pennings Jan 19, 2023
4ed8df2
Add mosaic cartogram as module and strip irrelevant code
gijs-pennings Jan 19, 2023
41d06d5
Add computation of dual
gijs-pennings Jan 19, 2023
fd77ed9
Implement orderly spanning trees
gijs-pennings Feb 20, 2023
3d1be7a
Decouple OST algorithm and arrangements, and simplify algorithm
gijs-pennings Feb 21, 2023
2bbbeef
Minor simplification of OST algorithm
gijs-pennings Feb 21, 2023
68bdbf1
Restore `painting.cpp` of necklace map
gijs-pennings Feb 22, 2023
6466a69
Move graph to separate file
gijs-pennings Mar 2, 2023
417bdc3
Split graph class into directed (standard) and undirected
gijs-pennings Mar 2, 2023
dfdc387
Build tree from parent array in OST
gijs-pennings Mar 2, 2023
0c7d28f
Compute CCW preordering of OST
gijs-pennings Mar 7, 2023
3d5dfa6
Implement use of straight skeleton
gijs-pennings Mar 15, 2023
b64e88f
Add simplified map and implement function to read salient points
gijs-pennings Mar 23, 2023
3125320
Only keep largest polygon for each region
gijs-pennings Mar 23, 2023
bf3ccd2
Simplify (future) test case
gijs-pennings Mar 23, 2023
57632a0
Add more salient points to map of Europe
gijs-pennings Mar 29, 2023
93b36dd
Fix matrix of Lux and overlapping borders of Tur & Rus
gijs-pennings Mar 29, 2023
060173e
Add colors
gijs-pennings Mar 29, 2023
9beda8d
Simplify straight skeleton
gijs-pennings Mar 30, 2023
36e5393
Fix various salient points
gijs-pennings Apr 7, 2023
553572c
Implement 2-visibility drawing
gijs-pennings Apr 7, 2023
32a62bd
Implement heuristic to improve OST
gijs-pennings May 24, 2023
53d2e06
Implement ellipses for guiding shapes
gijs-pennings Aug 24, 2023
c613267
Implement ellipse rendering for Qt
gijs-pennings Aug 25, 2023
a326c96
Add data for missing countries (and only consider European Russia)
gijs-pennings Aug 28, 2023
6d0f144
Read data from JSON and major cleanup
gijs-pennings Aug 30, 2023
06e0dce
Implement class for pairs of guiding shapes
gijs-pennings Sep 13, 2023
b9345a2
Add class for hexagonal tile maps with barycentric coordinates
gijs-pennings Sep 27, 2023
fcd5a30
Implement guiding shapes for tile maps
gijs-pennings Sep 27, 2023
cf09506
Implement ellipse normalization for 'same-scale' score calculation
gijs-pennings Oct 18, 2023
8894705
Minor improvements
gijs-pennings Oct 24, 2023
ebfe84b
Move ellipse to core and fix CMake configs
gijs-pennings Oct 25, 2023
e044bbf
Improve guiding pairs and coordinate hashing
gijs-pennings Nov 16, 2023
75be5b5
Generalize `paint` so color is easily customizable for each tile
gijs-pennings Nov 29, 2023
9f859de
Improve some comments and add utility functions
gijs-pennings Mar 4, 2024
774dcd6
Decouple tile map computation and rendering
gijs-pennings Mar 18, 2024
00bba67
Implement unit length path transfers
gijs-pennings Mar 19, 2024
15d20a0
Add (debug) function to visualize score computation
gijs-pennings Mar 19, 2024
fdcd073
Fix contiguity check
gijs-pennings Mar 20, 2024
2411df8
Implement Edmonds' algorithm, and allow manual sea regions
gijs-pennings Jun 24, 2024
b90f7ef
Rework regions to store guiding shapes for seas
gijs-pennings Jun 24, 2024
ac4d227
Integrate sea region guiding shapes into score computation
gijs-pennings Jul 9, 2024
242ef15
Draw borders between regions
gijs-pennings Jul 9, 2024
18ffcf3
Rename 'score' to 'cost', since we minimize
gijs-pennings Jul 9, 2024
4f0ff1d
Create new sea tiles at edge of map
gijs-pennings Jul 9, 2024
867e633
Merge remote-tracking branch 'upstream/master' into mosaic
gijs-pennings Jul 10, 2024
3064abb
Fix compilation error
gijs-pennings Jul 10, 2024
f49f442
Finetune parameters
gijs-pennings Jul 10, 2024
94da0bd
Fix auto sea region computation
gijs-pennings Jul 10, 2024
9aeedb9
Fix near-zero floating point bug
gijs-pennings Jul 10, 2024
678d802
Add documentation
gijs-pennings Jul 10, 2024
3e6106f
Clean up
gijs-pennings Jul 10, 2024
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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ find_package(Qt5Widgets REQUIRED)
set(CMAKE_AUTOMOC ON)
find_package(glog REQUIRED)
find_package(Ipelib REQUIRED)
find_package(Eigen3 3.4 REQUIRED NO_MODULE)

# ## SOURCES ###

Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

CartoCrow is a framework that simplifies the implementation of algorithms in cartographic visualization. It allows researchers to experiment with these algorithms and use them to generate maps. The framework behind CartoCrow can be used to run other cartography algorithms online. CartoCrow consists of a C++ library (this repository) which provides a set of command-line applications, and a web interface (see [cartocrow-web](https://github.com/tue-alga/cartocrow-web)) which allows end users to generate maps in a user-friendly way.

> [!WARNING]
> [!WARNING]
> CartoCrow is still a **work in progress** and should not be considered stable yet.

This repository consists of the following subdirectories:
Expand Down Expand Up @@ -115,7 +115,7 @@ The remaining dependencies need to be built manually.
* in `src/ipelib/ipeplatform.cpp` and `src/ipelib/ipebitmap_win.cpp`, add an `#include <string>`;
* in `src/ipelib/ipeplatform.cpp`, in `Platform::runLatex()`, replace `wcmd.data()` by `&wcmd[0]`;
* in `src/ipelib/ipeplatform.cpp`, in `String::w()`, replace `result.data()` by `&result[0]`.

Then, to compile:
```sh
cd src
Expand All @@ -135,6 +135,15 @@ On Ubuntu, most dependencies can be obtained from the repository:
```sh
sudo apt install build-essential cmake
sudo apt install libcgal-dev nlohmann-json3-dev qtbase5-dev
sudo apt install libeigen3-dev
```

If Eigen [cannot be found](https://stackoverflow.com/q/23284473) during compilation, you might need to run:

```sh
cd /usr/include
sudo ln -s eigen3/Eigen Eigen

```

The remaining dependencies need to be built manually.
Expand Down
9 changes: 3 additions & 6 deletions cartocrow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ add_subdirectory(renderer)
add_subdirectory(necklace_map)
add_subdirectory(simplification)
add_subdirectory(flow_map)
add_subdirectory(mosaic_cartogram)
add_subdirectory(isoline_simplification)

add_library(cartocrow_lib INTERFACE)
Expand All @@ -25,14 +26,10 @@ target_link_libraries(
necklace_map
flow_map
simplification
mosaic_cartogram
)

install(
TARGETS cartocrow_lib
EXPORT ${CARTOCROW_EXPORT_TARGETS}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBRARY_DIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_SOURCE_DIR}
)
cartocrow_install_module(cartocrow_lib)
install(
EXPORT ${CARTOCROW_EXPORT_TARGETS}
FILE "${CARTOCROW_EXPORT_TARGETS}.cmake"
Expand Down
4 changes: 3 additions & 1 deletion cartocrow/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(SOURCES
core.cpp
ellipse.cpp
ipe_reader.cpp
region_arrangement.cpp
region_map.cpp
Expand All @@ -9,6 +10,7 @@ set(SOURCES
set(HEADERS
centroid.h
core.h
ellipse.h
ipe_reader.h
region_arrangement.h
region_map.h
Expand All @@ -18,7 +20,7 @@ set(HEADERS

add_library(core ${SOURCES})
target_link_libraries(core
PUBLIC Ipe::ipelib
PUBLIC Eigen3::Eigen Ipe::ipelib
PRIVATE glog::glog
)

Expand Down
12 changes: 12 additions & 0 deletions cartocrow/core/centroid.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Created by tvl (t.vanlankveld@esciencecenter.nl) on 05-12-2019
#define CARTOCROW_CORE_POLYGON_H

#include "core.h"
#include "region_arrangement.h"

#include <CGAL/Kernel/global_functions_2.h>
#include <CGAL/Origin.h>
Expand Down Expand Up @@ -89,6 +90,17 @@ template <class K> Point<K> centroid(const PolygonSet<K>& polygon) {
return CGAL::ORIGIN + sum / areaSum;
}

/// Computes the centroid of the given face.
inline Point<Exact> centroid(RegionArrangement::Face_const_handle f) {
Polygon<Exact> polygon;
auto circ = f->outer_ccb();
auto curr = circ;
do {
polygon.push_back(curr->target()->point());
} while (++curr != circ);
return centroid(polygon);
}

} // namespace cartocrow

#endif //CARTOCROW_CORE_POLYGON_H
22 changes: 22 additions & 0 deletions cartocrow/core/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,32 @@ Created by tvl (t.vanlankveld@esciencecenter.nl) on 05-12-2019
*/

#include "core.h"
#include <algorithm>
#include <cmath>
#include <CGAL/number_utils_classes.h>

namespace cartocrow {

Color Color::shaded(double f) const {
f = std::clamp(f, 0.0, 2.0);
if (f < 1) {
// darken (shade)
return {
(int) std::round(r * f),
(int) std::round(g * f),
(int) std::round(b * f)
};
} else {
// lighten (tint)
f -= 1;
return {
(int) std::round(r + (255 - r) * f),
(int) std::round(g + (255 - g) * f),
(int) std::round(b + (255 - b) * f),
};
}
}

Number<Inexact> wrapAngle(Number<Inexact> alpha, Number<Inexact> beta) {
return wrap<Inexact>(alpha, beta, beta + M_2xPI);
}
Expand Down
12 changes: 12 additions & 0 deletions cartocrow/core/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@ Polyline<Inexact> approximate(const Polyline<K>& p) {
return result;
}

/// Returns the area of a polygon with holes.
/// TODO: move to more logical place
template <class K> Number<K> area(PolygonWithHoles<K> polygon) {
Number<K> a = polygon.outer_boundary().area();
for (const auto &h : polygon.holes()) a -= h.area();
return a; // = outer area minus area of each hole
}

/// An RGB color. Used for storing the color of elements to be drawn.
struct Color {
/// Red component (integer 0-255).
Expand All @@ -170,6 +178,10 @@ struct Color {
int g;
/// Blue component (integer 0-255).
int b;

/// Returns a new color that is darker (\f$0 \le f < 1\f$) or lighter
/// (\f$1 < f \le 2\f$).
Color shaded(double f) const;
};

/// Wraps the given number \f$n\f$ to the interval \f$[a, b)\f$.
Expand Down
Loading