@Override public void start() { super.start(); agents.clear(); // remove any agents from previous runs // add agents to the simulation addAgents(); // ensure both GeomFields Color same area agents.setMBR(county.getMBR()); }
private void createHouseholds() { // create households households.clear(); householdsField.clear(); householdsField.setMBR(highSchoolZones.getMBR()); Envelope bounds = highSchoolZones.getMBR(); // this is needed because Geometry exemplar = ((MasonGeometry) highSchoolZones.getGeometries().get(0)).getGeometry(); for (int i = 0; i < numHouseholds; i++) { Household h = new Household(this); households.add(h); Coordinate coord; do { coord = getRandomCoordinate(bounds); } while (!highSchoolZones.isCovered(coord)); Point pt = GeometryFactory.createPointFromInternalCoord(coord, exemplar); h.location = pt; householdsField.addGeometry(new MasonGeometry(pt)); } }