Commit 0d6d37f2 authored by patrick.lambert's avatar patrick.lambert
Browse files

Merge branch 'BasinImprovement' into develop

parents c4249470 f4f8b041
<hashtable>
<entry>
<java-class>fr.cemagref.simaqualife.kernel.AquaticWorld</java-class>
<!--
<java-class>fr.cemagref.simaqualife.kernel.AquaticWorld</java-class>-->
<java-class>environment.RIOBasinNetworkWithContinent</java-class>
<fr.cemagref.observation.kernel.ObservablesHandler>
<observers>
<environment.RIOBasinNetworkObserverWithContinent>
<title>North East America</title>
<threshold>1000000</threshold>
<colorScaleEnum>RedsScale</colorScaleEnum>
</environment.RIOBasinNetworkObserverWithContinent>
<environment.RIOBasinNetworkObserverPresence>
......
......@@ -36,6 +36,7 @@ public abstract class RIOBasinNetwork extends BasinNetwork {
@InitTransientParameters
public void initTransientParameters(Pilot pilot) {
time = new Time();
}
......
......@@ -41,7 +41,7 @@ public class RIOBasinNetworkObserverWithContinent extends ObserverListener
private double threshold = 13000000.;
@Description(name = "Color scale", tooltip = "")
public ColorScaleEnum colorScaleEnum = ColorScaleEnum.RedsScale;
private ColorScaleEnum colorScaleEnum = ColorScaleEnum.RedsScale;
// a basin network
private transient RIOBasinNetworkWithContinent bn;
......@@ -299,7 +299,9 @@ public class RIOBasinNetworkObserverWithContinent extends ObserverListener
for (DiadromousFishGroup group : basin.getGroups()) {
abundance += basin.getEffective(group);
}
// System.out.println(basin.getName()+ "-->"+abundance);
if (basin instanceof RiverBasin & abundance > 0)
System.out.println(" " + basin.getName() + " (" + basin.getClass().getSimpleName() + ") -->" + abundance);
if (abundance == 0.) {
g.setColor(Color.WHITE);
} else {
......
......@@ -24,6 +24,7 @@ import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
import environment.OffshoreBasin.OffshoreBasinFunction;
import fr.cemagref.observation.kernel.ObservablesHandler;
import fr.cemagref.simaqualife.kernel.util.TransientParameters.InitTransientParameters;
import fr.cemagref.simaqualife.pilot.Pilot;
import miscellaneous.QueueMemoryMap;
......@@ -55,6 +56,13 @@ public class RIOBasinNetworkWithContinent extends RIOBasinNetwork {
private transient Map<String, Path2D.Double> mapContinent;
protected transient ObservablesHandler cobservable;
public ObservablesHandler getCobservable() {
return cobservable;
}
class Record implements Comparable<Record> {
private int order;
......@@ -215,6 +223,10 @@ public class RIOBasinNetworkWithContinent extends RIOBasinNetwork {
super.initTransientParameters(pilot);
if (cobservable == null) {
cobservable = pilot.addObservable(this.getClass());
}
FileReader reader;
Scanner scanner;
......@@ -387,7 +399,7 @@ public class RIOBasinNetworkWithContinent extends RIOBasinNetwork {
basin_id = Integer.valueOf(fields[0]); // gid
name = fields[1];
function = fields[2];
//System.out.println(basin_id + " " + name);
// System.out.println(basin_id + " " + name);
OffshoreBasin offshorebasin = new OffshoreBasin(basin_id, name, OffshoreBasinFunction.valueOf(function));
......
......@@ -11,10 +11,10 @@ import org.openide.util.lookup.ServiceProvider;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
import environment.RIOBasinNetwork;
import environment.RiverBasin;
import environment.InshoreBasin;
import environment.RIOBasinNetwork;
import environment.RIOBasinNetworkWithContinent;
import environment.RiverBasin;
import environment.Time;
import environment.Time.Season;
import fr.cemagref.simaqualife.kernel.processes.AquaNismsGroupProcess;
......@@ -142,7 +142,7 @@ public class DisperseAndMigrateToRiverWithMultiNomDistriAndDeathBasin extends Di
for (InshoreBasin departure : group.getEnvironment().getSeaBasins()) {
RiverBasin homingDestination = (RiverBasin) bn.getAssociatedRiverBasin(departure);
RiverBasin homingDestination = bn.getAssociatedRiverBasin(departure);
List<DiadromousFish> fishes = departure.getFishs(group);
if (fishes != null) {
......@@ -248,10 +248,16 @@ public class DisperseAndMigrateToRiverWithMultiNomDistriAndDeathBasin extends Di
}
}
}
System.out.println(this.getClass().getSimpleName());
System.out.println(" total abundance in river basins: " + group.getFishEffective());
System.out.println(
"female spawners: " + group.getFemaleSpawnerEffective() + " \tmale spawners: " + group.getMaleSpawnerEffective());
System.out.println(" female spawners: " + group.getFemaleSpawnerEffective() + " \tmale spawners: "
+ group.getMaleSpawnerEffective());
// --------------------------------------------------------------------------------------------------
// update the observers
// ------------------------------------------------------------------------------------------------------
((RIOBasinNetworkWithContinent) group.getEnvironment()).getCobservable().fireChanges((group.getEnvironment()),
pilot.getCurrentTime());
}
}
}
package species;
import java.util.List;
import java.util.ListIterator;
import org.openide.util.lookup.ServiceProvider;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
import environment.Basin;
import environment.OffshoreBasin;
import environment.RIOBasinNetworkWithContinent;
import environment.RiverBasin;
import environment.Time;
import environment.OffshoreBasin.OffshoreBasinFunction;
import environment.Time.Season;
import fr.cemagref.simaqualife.kernel.processes.AquaNismsGroupProcess;
import species.DiadromousFish.Stage;
import java.util.List;
import java.util.ListIterator;
import org.geotools.data.FeatureEvent.Type;
import org.openide.util.lookup.ServiceProvider;
@ServiceProvider(service = AquaNismsGroupProcess.class)
public class MigrateBetweenOffshores extends AquaNismsGroupProcess<DiadromousFish, DiadromousFishGroup> {
/**
* Season to migrate from summering to winteringOffshoreBasin
*/
......@@ -34,10 +30,10 @@ public class MigrateBetweenOffshores extends AquaNismsGroupProcess<DiadromousFis
public static void main(String[] args) {
System.out.println((new XStream(new DomDriver()))
.toXML(new MigrateBetweenOffshores()));
System.out.println((new XStream(new DomDriver())).toXML(new MigrateBetweenOffshores()));
}
@Override
public void doProcess(DiadromousFishGroup group) {
......@@ -45,7 +41,6 @@ public class MigrateBetweenOffshores extends AquaNismsGroupProcess<DiadromousFis
if (group.getEnvironment().getTime().getSeason(group.getPilot()) == migrationSeasonToReachWinteringOffshore) {
for (OffshoreBasin summeringOffshoreBasin : group.getEnvironment().getSummeringOffshoreBasins()) {
List<DiadromousFish> fishInSummeringOffshoreBasin = summeringOffshoreBasin.getFishs(group);
......@@ -56,7 +51,8 @@ public class MigrateBetweenOffshores extends AquaNismsGroupProcess<DiadromousFis
DiadromousFish fish = fishIterator.next();
//TODO find a more generic way to memorized a basin which differs from riverBasin (i.e. catadromous fish)
// TODO find a more generic way to memorized a basin which differs from riverBasin (i.e.
// catadromous fish)
destination = ((RiverBasin) fish.getMemorisedBasin()).getConnectedWinteringOffshoreBasin();
fish.setPosition(destination);
......@@ -66,8 +62,14 @@ public class MigrateBetweenOffshores extends AquaNismsGroupProcess<DiadromousFis
}
}
}
}
else if (group.getEnvironment().getTime().getSeason(group.getPilot()) == migrationSeasonToReachSummeringOffshore) {
// --------------------------------------------------------------------------------------------------
// update the observers
// ------------------------------------------------------------------------------------------------------
((RIOBasinNetworkWithContinent) group.getEnvironment()).getCobservable().fireChanges((group.getEnvironment()),
pilot.getCurrentTime());
} else if (group.getEnvironment().getTime().getSeason(group.getPilot()) == migrationSeasonToReachSummeringOffshore) {
for (OffshoreBasin winteringOffshoreBasin : group.getEnvironment().getWinteringOffshoreBasins()) {
......@@ -79,7 +81,8 @@ public class MigrateBetweenOffshores extends AquaNismsGroupProcess<DiadromousFis
DiadromousFish fish = fishIterator.next();
//TODO find a more generic way to memorized a basin which differs from riverBasin (i.e. catadromous fish)
// TODO find a more generic way to memorized a basin which differs from riverBasin (i.e.
// catadromous fish)
destination = ((RiverBasin) fish.getMemorisedBasin()).getConnectedSummeringOffshoreBasin();
// add fish with its new position to destination basin
......@@ -90,6 +93,11 @@ public class MigrateBetweenOffshores extends AquaNismsGroupProcess<DiadromousFis
}
}
}
// --------------------------------------------------------------------------------------------------
// update the observers
// ------------------------------------------------------------------------------------------------------
((RIOBasinNetworkWithContinent) group.getEnvironment()).getCobservable().fireChanges((group.getEnvironment()),
pilot.getCurrentTime());
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment