16 |
import java.util.logging.Logger; |
import java.util.logging.Logger; |
17 |
import java.util.logging.SimpleFormatter; |
import java.util.logging.SimpleFormatter; |
18 |
|
|
19 |
import com.jwetherell.algorithms.data_structures.KdTree; |
import ags.utils.dataStructures.trees.thirdGenKD.KdTree; |
20 |
|
|
21 |
|
|
22 |
|
|
23 |
public class LookupMain { |
public class LookupMain { |
25 |
|
|
26 |
static final String CONFIG_FILENAME = "fulddaekning.properties"; |
static final String CONFIG_FILENAME = "fulddaekning.properties"; |
27 |
|
|
28 |
static boolean rename_tables; |
static boolean use_osrm; |
29 |
|
static boolean test_mode; |
30 |
static SafeProperties conf; |
static SafeProperties conf; |
31 |
|
|
32 |
static int max_workers; |
static int max_workers; |
72 |
verbose = Boolean.parseBoolean( conf.getSafeProperty("VERBOSE") ); |
verbose = Boolean.parseBoolean( conf.getSafeProperty("VERBOSE") ); |
73 |
logger.info("Starting with VERBOSE:" + verbose); |
logger.info("Starting with VERBOSE:" + verbose); |
74 |
|
|
75 |
rename_tables = Boolean.parseBoolean( conf.getSafeProperty("RENAMETABLES") ); |
test_mode = Boolean.parseBoolean( conf.getSafeProperty("TEST") ); |
76 |
logger.info("Starting with RENAMETABLES:" + rename_tables); |
logger.info("Starting with TEST:" + test_mode); |
77 |
|
|
78 |
|
use_osrm = Boolean.parseBoolean( conf.getSafeProperty("USE_OSRM") ); |
79 |
|
logger.info("Starting with USE_OSRM:" + use_osrm); |
80 |
|
|
81 |
distributor = conf.getSafeProperty("DISTRIBUTOR"); |
distributor = conf.getSafeProperty("DISTRIBUTOR"); |
82 |
distributor = distributor.toUpperCase(); |
distributor = distributor.toUpperCase(); |
94 |
max_workers = Math.max(1, cores); //Dog skal der som minimum være 1 core til beregning |
max_workers = Math.max(1, cores); //Dog skal der som minimum være 1 core til beregning |
95 |
|
|
96 |
} |
} |
97 |
|
if (test_mode) { |
98 |
|
max_workers = 1; |
99 |
|
} |
100 |
logger.info("Starting with MAX_WORKERS:" + max_workers); |
logger.info("Starting with MAX_WORKERS:" + max_workers); |
101 |
setupThreadPool(); |
setupThreadPool(); |
102 |
|
|
143 |
|
|
144 |
logger.info("Opbygger KDTree for " + ho + " - antal=" + geopoints.size() ); |
logger.info("Opbygger KDTree for " + ho + " - antal=" + geopoints.size() ); |
145 |
|
|
146 |
@SuppressWarnings("unchecked") |
int bucketSize = 96*12; |
|
List<KdTree.XYZPoint> tmpPoints = (List<KdTree.XYZPoint>)(List<?>) geopoints; |
|
147 |
|
|
148 |
KdTree<Adresse> addressTree = new KdTree<Adresse>( tmpPoints ); |
KdTree<Adresse> addressTree = new KdTree<Adresse>( 3, bucketSize ); |
149 |
|
for(Adresse a: geopoints) { |
150 |
|
addressTree.addPoint(a.xyz, a); |
151 |
|
} |
152 |
|
|
153 |
hoTrees.put(ho, addressTree); |
hoTrees.put(ho, addressTree); |
154 |
} |
} |
155 |
|
|
176 |
|
|
177 |
db.saveBatch(); |
db.saveBatch(); |
178 |
|
|
179 |
if (rename_tables) { |
if (test_mode == false) { |
180 |
db.renameResultTables(); |
db.renameResultTables(); |
181 |
} else { |
} else { |
182 |
logger.info( "Rename tables is disabled !!!" ); |
logger.info( "Rename tables is disabled !!!" ); |