fun EveningActivityMovement(settings: Settings) { super(settings) super.backAllowed = false pathFinder = DijkstraPathFinder(null) mode = WALKING_TO_MEETING_SPOT_MODE nrOfMeetingSpots = settings.getInt(NR_OF_MEETING_SPOTS_SETTING) minGroupSize = settings.getInt(MIN_GROUP_SIZE_SETTING) maxGroupSize = settings.getInt(MAX_GROUP_SIZE_SETTING) val mapNodes: Array<MapNode> = jdk.nashorn.internal.objects.Global.getMap().getNodes() .toArray(arrayOfNulls<MapNode>(0)) var shoppingSpotsFile: String? = null try { shoppingSpotsFile = settings.getSetting(MEETING_SPOTS_FILE_SETTING) } catch (t: Throwable) { } var meetingSpotLocations: MutableList<Coord?>? = null if (shoppingSpotsFile == null) { meetingSpotLocations = LinkedList<Coord?>() for (i in mapNodes.indices) { if (i % (mapNodes.size / nrOfMeetingSpots) === 0) { startAtLocation = mapNodes[i].getLocation().clone() meetingSpotLocations!!.add(startAtLocation.clone()) } } } else { try { meetingSpotLocations = LinkedList<Coord?>() val locationsRead: List<Coord> = WKTReader().readPoints(File(shoppingSpotsFile)) for (coord in locationsRead) { val map: SimMap = jdk.nashorn.internal.objects.Global.getMap() val offset: Coord = map.getOffset() if (map.isMirrored()) { coord.setLocation(coord.getX(), -coord.getY()) } coord.translate(offset.getX(), offset.getY()) meetingSpotLocations!!.add(coord) } } catch (e: Exception) { e.printStackTrace() } } this.id = nextID++ val scsID: Int = settings.getInt(EVENING_ACTIVITY_CONTROL_SYSTEM_NR_SETTING) scs = EveningActivityControlSystem.getEveningActivityControlSystem(scsID) scs.setRandomNumberGenerator(rng) scs.addEveningActivityNode(this) scs.setMeetingSpots(meetingSpotLocations) maxPathLength = 100 minPathLength = 10 maxWaitTime = settings.getInt(MAX_WAIT_TIME_SETTING) minWaitTime = settings.getInt(MIN_WAIT_TIME_SETTING) }
Creates a new instance of EveningActivityMovement