-
Notifications
You must be signed in to change notification settings - Fork 1
/
nodus.groovy
executable file
·55 lines (52 loc) · 2.16 KB
/
nodus.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* Copyright (c) 1991-2024 Université catholique de Louvain,
* Center for Operations Research and Econometrics (CORE)
* http://www.uclouvain.be
*
* This file is part of Nodus.
*
* Nodus is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
import com.bbn.openmap.proj.coords.LatLonPoint;
import j4r.net.server.JavaGatewayServer;
import j4r.net.server.ServerConfiguration;
import py4j.GatewayServer;
/**
* Sample "autoexec" Groovy script. The "nodus.groovy" script, if exists, is run by Nodus at
* launch time and also just before exit.
*
* Three variables are set by Nodus when this script is called:
* - startNodus = true and quitNodus = false at startup
* - startNodus = false and quiteNodus = true at closing
* - nodusMapPanel, the NodusMapPanel instance of the running Nodus. This is used as entry point
* to the API.
*
* This example shows how to interact with the Nodus API (zoom on the European zone of the
* World map).
*
* The same "autoexec" mechanism exists at the projet level: if a [projetname].groovy script is
* found in the directory that contains the [projetname].nodus file, it is executed when the
* project is loaded and closed. The "openProject", "closeProject" and "nodusMapPanel" variables
* are then set by Nodus.
*
* Example Groovy, Python and R scripts can be found in the script directory.
*/
if (startNodus) {
/*
* Present an European view to the user instead of the World map.
*/
nodusMapPanel.getMapBean().setScale((float) 1.4E7);
nodusMapPanel.getMapBean().setCenter(new LatLonPoint.Double(50.0, 4.0));
nodusMapPanel.getMapBean().validate();
}