// Path: src/main/java/com/mrl/debugger/layers/base/MrlBaseLayer.java
// public interface MrlBaseLayer {
// 
//     void bind(EntityID id, int key, Object... params);
// }
// 
// Path: src/main/java/com/mrl/debugger/remote/ViewerGateway.java
// public interface ViewerGateway extends Remote {
// 
// //    void draw(Integer agentId, String layerTag, Serializable data) throws RemoteException;
// 
//     void draw(Integer agentId, String layerTag, int dataType, Serializable data) throws RemoteException;
// 
// //    void drawPolygons(Integer agentId, String layerTag, List<Polygon> polygon) throws RemoteException;
// //
// //    void drawLines(Integer agentId, String layerTag, List<Line2D> data) throws RemoteException;
// //
// //    void drawPoints(Integer agentId, String layerTag, List<Point2D> data) throws RemoteException;
// //
// //    void drawInfo(Integer agentId, String layerTag, String[] info, Point[] locations) throws RemoteException;
// //
// //    void drawInfo(Integer agentId, String layerTag, HashMap<Point2D, String> infoLocationMap) throws RemoteException;
// //
// //    void drawEntities(Integer agentId, String layerTag , List<Integer> ids);
// }


import com.mrl.debugger.layers.base.MrlBaseLayer;
import com.mrl.debugger.remote.ViewerGateway;
import rescuecore2.view.ViewLayer;
import rescuecore2.worldmodel.EntityID;
import java.io.Serializable;
import java.rmi.RemoteException;
import java.util.HashMap;
import java.util.Map;
package com.mrl.debugger;



/**
 * @author Mahdi
 */

public class DefaultViewerGateway implements ViewerGateway {

    private Map<String, ViewLayer> layerMap;

    public DefaultViewerGateway(MrlViewer mrlViewer) {
        this.layerMap = new HashMap<>();
        for (ViewLayer viewLayer : mrlViewer.getViewerPanel().getLayers()) {
            com.mrl.debugger.ViewLayer annotation = viewLayer.getClass().getAnnotation(com.mrl.debugger.ViewLayer.class);
            String name;
            if (annotation == null) {
                continue;
            }
            if (annotation.tag().isEmpty()) {
                name = viewLayer.getClass().getSimpleName();
            } else {
                name = annotation.tag();
            }
            this.layerMap.put(name, viewLayer);
        }

    }

    @Override
    public void draw(Integer agentId, String layerTag, int dataType, Serializable data) throws RemoteException {
        ViewLayer viewLayer = this.layerMap.get(layerTag);
        if (viewLayer instanceof MrlBaseLayer) {
// Path: src/main/java/com/mrl/debugger/layers/base/MrlBaseLayer.java
// public interface MrlBaseLayer {
// 
//     void bind(EntityID id, int key, Object... params);
// }
// 
// Path: src/main/java/com/mrl/debugger/remote/ViewerGateway.java
// public interface ViewerGateway extends Remote {
// 
// //    void draw(Integer agentId, String layerTag, Serializable data) throws RemoteException;
// 
//     void draw(Integer agentId, String layerTag, int dataType, Serializable data) throws RemoteException;
// 
// //    void drawPolygons(Integer agentId, String layerTag, List<Polygon> polygon) throws RemoteException;
// //
// //    void drawLines(Integer agentId, String layerTag, List<Line2D> data) throws RemoteException;
// //
// //    void drawPoints(Integer agentId, String layerTag, List<Point2D> data) throws RemoteException;
// //
// //    void drawInfo(Integer agentId, String layerTag, String[] info, Point[] locations) throws RemoteException;
// //
// //    void drawInfo(Integer agentId, String layerTag, HashMap<Point2D, String> infoLocationMap) throws RemoteException;
// //
// //    void drawEntities(Integer agentId, String layerTag , List<Integer> ids);
// }


// Path: src/main/java/com/mrl/debugger/DefaultViewerGateway.java
import com.mrl.debugger.layers.base.MrlBaseLayer;
import com.mrl.debugger.remote.ViewerGateway;
import rescuecore2.view.ViewLayer;
import rescuecore2.worldmodel.EntityID;
import java.io.Serializable;
import java.rmi.RemoteException;
import java.util.HashMap;
import java.util.Map;

package com.mrl.debugger;



/**
 * @author Mahdi
 */

public class DefaultViewerGateway implements ViewerGateway {

    private Map<String, ViewLayer> layerMap;

    public DefaultViewerGateway(MrlViewer mrlViewer) {
        this.layerMap = new HashMap<>();
        for (ViewLayer viewLayer : mrlViewer.getViewerPanel().getLayers()) {
            com.mrl.debugger.ViewLayer annotation = viewLayer.getClass().getAnnotation(com.mrl.debugger.ViewLayer.class);
            String name;
            if (annotation == null) {
                continue;
            }
            if (annotation.tag().isEmpty()) {
                name = viewLayer.getClass().getSimpleName();
            } else {
                name = annotation.tag();
            }
            this.layerMap.put(name, viewLayer);
        }

    }

    @Override
    public void draw(Integer agentId, String layerTag, int dataType, Serializable data) throws RemoteException {
        ViewLayer viewLayer = this.layerMap.get(layerTag);
        if (viewLayer instanceof MrlBaseLayer) {
            MrlBaseLayer standardLayer = (MrlBaseLayer) viewLayer;