datafacer ShapeFile; datafacer KmlFile; datafacer Geometry; entity Rive{ property ShapeFile shp; property list[list[real]] coordinates; property real sable; property KmlFile kml; service list[list[real]] getCoordinates(){ return coordinates; } service kmlSave(text date){ kml.addCoordinateStep(date,coordinates); } } entity Vase{ property boolean circle; property list[list[real]] coordinates; property Geometry geom; property KmlFile kml; property int id; service list[list[real]] getCoordinates(){ return coordinates; } service setCoordinates(list[list[real]] value){ coordinates = value; } service moveCoordinates(real k1,real k2){ coordinates = geom.getMovedCoordinates(coordinates,k1,k2); } service moveCoordinatesAndAdapt(real k1,real k2,list[list[real]] riveCoords){ coordinates = geom.getMovedCoordinatesAndAdapt(coordinates,riveCoords,k1,k2); } service moveCoordinatesByRight(real k1,real k2,list[list[real]] riveCoords){ coordinates = geom.graduateMove(0.0002,0.00001,coordinates,riveCoords); } service kmlSave(text date){ kml.addCoordinateStep(date,coordinates); } } entity Ocean{ property real houle; property real sable; } relation VoisinageVase[vase,disturb]{ service evolve(text date,list[list[real]] line){ if(vase.id == 1){ vase.moveCoordinatesAndAdapt(disturb.houle,disturb.sable,line); } if(vase.id == 2){ vase.moveCoordinatesByRight(disturb.houle,disturb.sable,line); } if(vase.id == 3){ vase.moveCoordinates(disturb.houle,disturb.sable); } vase.kmlSave(date); } } relation VoisinageRive[rive,disturb]{ service evolve(text date){ //la rive n'evolue pas donc on ne fait que sauvegarder dans le fichier google rive.kmlSave(date); } } scenario Main{ kml = KmlFile{}; geom = Geometry{}; shp = ShapeFile{}; voisinVase = VoisinageVase[Vase,Ocean]; voisinRive = VoisinageRive[Rive,Vase]; // read the shape file shp.read("D:\\TETIS\\ANR - Programme Blanc\\01-Execution\\Landscapes\\Mangrove-AIC\\1986-2001\\sinnamary1988_1_latlong.shp"); //shp.view("c:\\Project\\shape\\Sinamarry\\sinnamary1988_1_latlong.shp"); // get all the coordinates of the shape file shpCoordinates = shp.getCoordinates(); vase2 = Vase{id=2;coordinates = shpCoordinates.get(2);geom = geom;kml = kml;}; vase3 = Vase{id=3;coordinates = shpCoordinates.get(3);geom = geom;kml = kml;}; rive = Rive{coordinates = shpCoordinates.get(0);kml=kml;}; vase1 = Vase{id=1;coordinates = geom.stickToLine(shpCoordinates.get(1),rive.coordinates);geom = geom;kml = kml;}; ocean = Ocean{houle = 0.0002;sable = 0.0002;}; voisinVase.connect(vase1,ocean); voisinVase.connect(vase2,ocean); voisinVase.connect(vase3,ocean); voisinRive.connect(rive,vase1); kml.addCoordinateStep("1988",vase1.coordinates); kml.addCoordinateStep("1988",vase2.coordinates); kml.addCoordinateStep("1988",vase3.coordinates); kml.addCoordinateStep("1988",rive.coordinates); dates = kml.getDates(1989,2010); for(date in dates){ voisinVase.evolve(date,rive.coordinates); voisinRive.evolve(date); } kml.createKmlFile("mangrove.kml"); }