Skip to content

Commit

Permalink
improve setup opencv
Browse files Browse the repository at this point in the history
  • Loading branch information
yunica committed Nov 20, 2022
1 parent 3c31d2c commit 1e4e491
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ This functionality allows you to merge several geometries into one, the geometri

## Requirements

- Java JDK 11.
- Java JDK 11+.
- JOSM 18193 or higher.

## Extra options
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "org.openstreetmap.josm.plugins.devseed.JosmMagicWand"
version = "1.0-SNAPSHOT"
version = "1.1"

java {
toolchain {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.openstreetmap.josm.gui.MapFrame;
import org.openstreetmap.josm.plugins.Plugin;
import org.openstreetmap.josm.plugins.PluginInformation;
import org.opencv.core.Core;
import org.openstreetmap.josm.tools.Logging;

import javax.swing.*;

Expand All @@ -31,8 +31,18 @@ public static LatLon eastNorth2latlon(EastNorth p) {

public MainJosmMagicWandPlugin(PluginInformation info) {
super(info);
nu.pattern.OpenCV.loadShared();
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
try {
System.out.println(Double.parseDouble(System.getProperty("java.specification.version")));
if (Double.parseDouble(System.getProperty("java.specification.version")) >= 12) {
nu.pattern.OpenCV.loadLocally();
} else {
nu.pattern.OpenCV.loadShared();
}
} catch (Exception e) {
Logging.error(e.getMessage());
throw new RuntimeException(e);
}

JMenu jToolmenu = MainApplication.getMenu().toolsMenu;
jToolmenu.addSeparator();
MainMenu.add(jToolmenu, new MergeSelectAction());
Expand Down

0 comments on commit 1e4e491

Please sign in to comment.