| package org.eclipse.stem.loggers.imagewriter.logger; |
| |
| import org.eclipse.stem.core.graph.DynamicLabel; |
| import org.eclipse.stem.core.graph.DynamicNodeLabel; |
| import org.eclipse.stem.core.model.Decorator; |
| import org.eclipse.stem.diseasemodels.standard.DiseaseModel; |
| import org.eclipse.stem.jobs.simulation.ISimulation; |
| import org.eclipse.stem.loggers.imagewriter.ProjectedMapImageLogger; |
| import org.eclipse.stem.loggers.imagewriter.logger.PolygonHandler.ProjectedPolygon; |
| import org.eclipse.stem.loggers.imagewriter.logger.PolygonHandler.ProjectedPolygons; |
| import org.eclipse.stem.ui.views.geographic.map.StemPolygonsList; |
| |
| public class DecoratorPropertyImageWriter |
| { |
| private ProjectedMapImageLogger logger; |
| |
| private ISimulation simulation; |
| private Decorator decorator; |
| private String properties; |
| |
| |
| |
| public DecoratorPropertyImageWriter(ISimulation simulation, ProjectedMapImageLogger logger) |
| { |
| this.logger = logger; |
| this.simulation = simulation; |
| |
| this.decorator = logger.getDecorator(); |
| |
| } |
| |
| protected void setup() |
| { |
| |
| StemPolygonsList polygons = Utils.getPolygonsForDecorator(decorator); |
| |
| |
| } |
| |
| private Decorator getDefaultDecorator() |
| { |
| Decorator decorator = null; |
| for (Decorator d : simulation.getScenario().getCanonicalGraph().getDecorators()) { |
| if (d instanceof DiseaseModel) { |
| decorator = d; |
| break; |
| } |
| } |
| return decorator; |
| } |
| |
| public void start() |
| { |
| // decorator = getDefaultDecorator(); |
| // if (decorator != null) { |
| // |
| // for (DynamicLabel obj : decorator.getLabelsToUpdate()) { |
| // if (obj instanceof DynamicNodeLabel) { |
| // |
| // |
| // ProjectedPolygons pp = PolygonHandler.getPolygonsForProjection(logger.getProjection(), (DynamicNodeLabel)obj); |
| // } |
| // } |
| // } |
| } |
| |
| public void log() |
| { |
| decorator = getDefaultDecorator(); |
| if (decorator != null) { |
| |
| for (DynamicLabel obj : decorator.getLabelsToUpdate()) { |
| if (obj instanceof DynamicNodeLabel) { |
| |
| |
| ProjectedPolygons pp = PolygonHandler.getPolygonsForProjection(logger.getProjection(), (DynamicNodeLabel)obj); |
| |
| if (pp != null) { |
| pp.toString(); |
| } |
| |
| |
| // for (ProjectedPolygon p : pp.polygons) { |
| // for (int i=0; i<p.points.length-1; i+=2) { |
| // System.out.print(p.points[i] + "," + p.points[i+1]); |
| // } |
| // } |
| |
| } |
| } |
| } |
| } |
| |
| } |