Index: applications/editors/josm/plugins/smed2/js57toosm/src/js57toosm/Js57toosm.java
===================================================================
--- applications/editors/josm/plugins/smed2/js57toosm/src/js57toosm/Js57toosm.java	(revision 30321)
+++ applications/editors/josm/plugins/smed2/js57toosm/src/js57toosm/Js57toosm.java	(revision 30323)
@@ -33,12 +33,11 @@
 		ArrayList<Long> done = new ArrayList<Long>();
 
-		if (args.length < 1) {
-			System.err.println("Usage: java -jar js57toosm.jar S57_filename [types_filename]");
+		if (args.length < 3) {
+			System.err.println("Usage: java -jar js57toosm.jar S57_filename types_filename OSM_filename");
 			System.exit(-1);
 		}
 		in = new FileInputStream(args[0]);
-		out = System.out;
+		out = new PrintStream(args[2]);
 		ArrayList<Obj> types = new ArrayList<Obj>();
-		if (args.length == 2) {
 			Scanner tin = new Scanner(new FileInputStream(args[1]));
 			while (tin.hasNext()) {
@@ -48,8 +47,7 @@
 			}
 			tin.close();
-		}
 		
 		map = new S57map();
-		MapBounds bounds = S57dec.decodeFile(in, types, map);
+		MapBounds bounds = S57dec.decodeFile(in, map);
 
 		out.format("<?xml version='1.0' encoding='UTF-8'?>%n");
@@ -168,4 +166,6 @@
 		}
 		out.println("</osm>\n");
+		out.close();
+		System.out.println("Finished");
 	}
 	
Index: applications/editors/josm/plugins/smed2/src/panels/PanelS57.java
===================================================================
--- applications/editors/josm/plugins/smed2/src/panels/PanelS57.java	(revision 30321)
+++ applications/editors/josm/plugins/smed2/src/panels/PanelS57.java	(revision 30323)
@@ -65,5 +65,5 @@
 		}
 		map = new S57map();
-		MapBounds bounds = S57dec.decodeFile(in, types, map);
+		MapBounds bounds = S57dec.decodeFile(in, map);
 
 		in.close();
Index: applications/editors/josm/plugins/smed2/src/render/Renderer.java
===================================================================
--- applications/editors/josm/plugins/smed2/src/render/Renderer.java	(revision 30321)
+++ applications/editors/josm/plugins/smed2/src/render/Renderer.java	(revision 30323)
@@ -27,35 +27,4 @@
 	public static final double symbolScale[] = { 256.0, 128.0, 64.0, 32.0, 16.0, 8.0, 4.0, 2.0, 1.0, 0.61, 0.372, 0.227, 0.138, 0.0843, 0.0514, 0.0313, 0.0191, 0.0117, 0.007, 0.138 };
 
-	static final EnumMap<ColCOL, Color> bodyColours = new EnumMap<ColCOL, Color>(ColCOL.class);
-	static {
-		bodyColours.put(ColCOL.COL_UNK, new Color(0, true));
-		bodyColours.put(ColCOL.COL_WHT, new Color(0xffffff));
-		bodyColours.put(ColCOL.COL_BLK, new Color(0x000000));
-		bodyColours.put(ColCOL.COL_RED, new Color(0xd40000));
-		bodyColours.put(ColCOL.COL_GRN, new Color(0x00d400));
-		bodyColours.put(ColCOL.COL_BLU, Color.blue);
-		bodyColours.put(ColCOL.COL_YEL, new Color(0xffd400));
-		bodyColours.put(ColCOL.COL_GRY, Color.gray);
-		bodyColours.put(ColCOL.COL_BRN, new Color(0x8b4513));
-		bodyColours.put(ColCOL.COL_AMB, new Color(0xfbf00f));
-		bodyColours.put(ColCOL.COL_VIO, new Color(0xee82ee));
-		bodyColours.put(ColCOL.COL_ORG, Color.orange);
-		bodyColours.put(ColCOL.COL_MAG, new Color(0xf000f0));
-		bodyColours.put(ColCOL.COL_PNK, Color.pink);
-	}
-
-	static final EnumMap<ColPAT, Patt> pattMap = new EnumMap<ColPAT, Patt>(ColPAT.class);
-	static {
-		pattMap.put(ColPAT.PAT_UNKN, Patt.Z);
-		pattMap.put(ColPAT.PAT_HORI, Patt.H);
-		pattMap.put(ColPAT.PAT_VERT, Patt.V);
-		pattMap.put(ColPAT.PAT_DIAG, Patt.D);
-		pattMap.put(ColPAT.PAT_BRDR, Patt.B);
-		pattMap.put(ColPAT.PAT_SQUR, Patt.S);
-		pattMap.put(ColPAT.PAT_CROS, Patt.C);
-		pattMap.put(ColPAT.PAT_SALT, Patt.X);
-		pattMap.put(ColPAT.PAT_STRP, Patt.H);
-	}
-	
 	public enum LabelStyle { NONE, RRCT, RECT, ELPS, CIRC, VCLR, PCLR, HCLR }
 
@@ -558,3 +527,11 @@
 		}
 	}
+	
+	public static void lightSector(Feature feature, Color col1, Color col2, double radius, double s1, double s2, boolean dir, String str) {
+//	private static Point2D.Double radial(Feature feature, Snode centre, double radius, double angle) {
+//	Point2D origin = Renderer.context.getPoint(centre);
+//	return new Point2D.Double(origin.getX() - (radius * Renderer.context.mile(feature) * Math.sin(angle)), origin.getY() - (radius * Renderer.context.mile(feature) * Math.cos(angle)));
+//}
+
+	}
 }
Index: applications/editors/josm/plugins/smed2/src/render/Rules.java
===================================================================
--- applications/editors/josm/plugins/smed2/src/render/Rules.java	(revision 30321)
+++ applications/editors/josm/plugins/smed2/src/render/Rules.java	(revision 30323)
@@ -14,4 +14,5 @@
 import java.awt.geom.AffineTransform;
 import java.util.ArrayList;
+import java.util.EnumMap;
 import java.util.HashMap;
 
@@ -30,4 +31,35 @@
 	public static final Color Mline = new Color(0xc480ff);
 	public static final Color Msymb = new Color(0xa30075);
+	
+	static final EnumMap<ColCOL, Color> bodyColours = new EnumMap<ColCOL, Color>(ColCOL.class);
+	static {
+		bodyColours.put(ColCOL.COL_UNK, new Color(0, true));
+		bodyColours.put(ColCOL.COL_WHT, new Color(0xffffff));
+		bodyColours.put(ColCOL.COL_BLK, new Color(0x000000));
+		bodyColours.put(ColCOL.COL_RED, new Color(0xd40000));
+		bodyColours.put(ColCOL.COL_GRN, new Color(0x00d400));
+		bodyColours.put(ColCOL.COL_BLU, Color.blue);
+		bodyColours.put(ColCOL.COL_YEL, new Color(0xffd400));
+		bodyColours.put(ColCOL.COL_GRY, Color.gray);
+		bodyColours.put(ColCOL.COL_BRN, new Color(0x8b4513));
+		bodyColours.put(ColCOL.COL_AMB, new Color(0xfbf00f));
+		bodyColours.put(ColCOL.COL_VIO, new Color(0xee82ee));
+		bodyColours.put(ColCOL.COL_ORG, Color.orange);
+		bodyColours.put(ColCOL.COL_MAG, new Color(0xf000f0));
+		bodyColours.put(ColCOL.COL_PNK, Color.pink);
+	}
+
+	static final EnumMap<ColPAT, Patt> pattMap = new EnumMap<ColPAT, Patt>(ColPAT.class);
+	static {
+		pattMap.put(ColPAT.PAT_UNKN, Patt.Z);
+		pattMap.put(ColPAT.PAT_HORI, Patt.H);
+		pattMap.put(ColPAT.PAT_VERT, Patt.V);
+		pattMap.put(ColPAT.PAT_DIAG, Patt.D);
+		pattMap.put(ColPAT.PAT_BRDR, Patt.B);
+		pattMap.put(ColPAT.PAT_SQUR, Patt.S);
+		pattMap.put(ColPAT.PAT_CROS, Patt.C);
+		pattMap.put(ColPAT.PAT_SALT, Patt.X);
+		pattMap.put(ColPAT.PAT_STRP, Patt.H);
+	}
 	
 	static String getName(Feature feature) {
@@ -68,9 +100,9 @@
 		ArrayList<Color> colours = new ArrayList<Color>();
 		for (ColCOL col : (ArrayList<ColCOL>)getAttVal(feature, obj, 0, Att.COLOUR)) {
-			colours.add(Renderer.bodyColours.get(col));
+			colours.add(bodyColours.get(col));
 		}
 		ArrayList<Patt> patterns = new ArrayList<Patt>();
 		for(ColPAT pat: (ArrayList<ColPAT>) getAttVal(feature, obj, 0, Att.COLPAT)) {
-			patterns.add(Renderer.pattMap.get(pat));
+			patterns.add(pattMap.get(pat));
 		}
 		return new Scheme(patterns, colours);
@@ -1029,4 +1061,27 @@
 			Signals.addSignals(feature);
 		}
+/*  case CGUSTA:
+    strcpy(string1, "CG");
+    if ((obj != NULL) && (att = getAtt(obj, COMCHA)) != NULL)
+      sprintf(strchr(string1, 0), " Ch.%s", stringValue(att->val));
+    break;
+  case SISTAT:
+    strcpy(string1, "SS");
+    if (obj != NULL) {
+      if ((att = getAtt(obj, CATSIT)) != NULL)
+        strcat(string1, sit_map[att->val.val.l->val]);
+      if ((att = getAtt(obj, COMCHA)) != NULL)
+        sprintf(strchr(string1, 0), "\nCh.%s", stringValue(att->val));
+    }
+    break;
+  case SISTAW:
+    strcpy(string1, "SS");
+    if (obj != NULL) {
+      if ((att = getAtt(obj, CATSIW)) != NULL)
+        strcat(string1, siw_map[att->val.val.l->val]);
+      if ((att = getAtt(obj, COMCHA)) != NULL)
+        sprintf(strchr(string1, 0), "\nCh.%s", stringValue(att->val));
+    }
+    break;*/
 	}
 
Index: applications/editors/josm/plugins/smed2/src/render/Signals.java
===================================================================
--- applications/editors/josm/plugins/smed2/src/render/Signals.java	(revision 30321)
+++ applications/editors/josm/plugins/smed2/src/render/Signals.java	(revision 30323)
@@ -14,4 +14,5 @@
 import java.awt.geom.*;
 import java.util.ArrayList;
+import java.util.EnumMap;
 
 import s57.S57att.*;
@@ -25,4 +26,58 @@
 public class Signals {
 
+	static final EnumMap<ColCOL, Color> lightColours = new EnumMap<ColCOL, Color>(ColCOL.class);
+	static {
+		lightColours.put(ColCOL.COL_WHT, new Color(0xffff00));
+		lightColours.put(ColCOL.COL_RED, new Color(0xff0000));
+		lightColours.put(ColCOL.COL_GRN, new Color(0x00ff00));
+		lightColours.put(ColCOL.COL_BLU, new Color(0x0000ff));
+		lightColours.put(ColCOL.COL_YEL, new Color(0xffff00));
+		lightColours.put(ColCOL.COL_AMB, new Color(0xfbf00f));
+		lightColours.put(ColCOL.COL_VIO, new Color(0xee82ee));
+		lightColours.put(ColCOL.COL_ORG, Color.orange);
+		lightColours.put(ColCOL.COL_MAG, Color.magenta);
+	}
+
+	static final EnumMap<ColCOL, String> lightLetters = new EnumMap<ColCOL, String>(ColCOL.class);
+	static {
+		lightLetters.put(ColCOL.COL_WHT, "W");
+		lightLetters.put(ColCOL.COL_RED, "R");
+		lightLetters.put(ColCOL.COL_GRN, "G");
+		lightLetters.put(ColCOL.COL_BLU, "Bu");
+		lightLetters.put(ColCOL.COL_YEL, "Y");
+		lightLetters.put(ColCOL.COL_AMB, "Am");
+		lightLetters.put(ColCOL.COL_VIO, "Vi");
+		lightLetters.put(ColCOL.COL_ORG, "Or");
+	}
+
+	static final EnumMap<LitCHR, String> lightCharacters = new EnumMap<LitCHR, String>(LitCHR.class);
+	static {
+		lightCharacters.put(LitCHR.CHR_F, "W");
+		lightCharacters.put(LitCHR.CHR_FL, "Fl");
+		lightCharacters.put(LitCHR.CHR_LFL, "LFl");
+		lightCharacters.put(LitCHR.CHR_Q, "Q");
+		lightCharacters.put(LitCHR.CHR_VQ, "VQ");
+		lightCharacters.put(LitCHR.CHR_UQ, "UQ");
+		lightCharacters.put(LitCHR.CHR_ISO, "Iso");
+		lightCharacters.put(LitCHR.CHR_OC, "Oc");
+		lightCharacters.put(LitCHR.CHR_IQ, "IQ");
+		lightCharacters.put(LitCHR.CHR_IVQ, "IVQ");
+		lightCharacters.put(LitCHR.CHR_IUQ, "IUQ");
+		lightCharacters.put(LitCHR.CHR_MO, "Mo");
+		lightCharacters.put(LitCHR.CHR_FFL, "FFl");
+		lightCharacters.put(LitCHR.CHR_FLLFL, "FlLFl");
+		lightCharacters.put(LitCHR.CHR_OCFL, "OcFl");
+		lightCharacters.put(LitCHR.CHR_FLFL, "FLFl");
+		lightCharacters.put(LitCHR.CHR_ALOC, "Al.Oc");
+		lightCharacters.put(LitCHR.CHR_ALLFL, "Al.LFl");
+		lightCharacters.put(LitCHR.CHR_ALFL, "Al.Fl");
+		lightCharacters.put(LitCHR.CHR_ALGR, "Al.Gr");
+		lightCharacters.put(LitCHR.CHR_QLFL, "Q+LFl");
+		lightCharacters.put(LitCHR.CHR_VQLFL, "VQ+LFl");
+		lightCharacters.put(LitCHR.CHR_UQLFL, "UQ+LFl");
+		lightCharacters.put(LitCHR.CHR_AL, "Al");
+		lightCharacters.put(LitCHR.CHR_ALFFL, "Al.FFl");
+	}
+	
 	public static void addSignals(Feature feature) {
 	  if (feature.objs.containsKey(Obj.FOGSIG)) fogSignals(feature);
@@ -33,6 +88,39 @@
 	}
 	
+	static final EnumMap<CatFOG, String> fogSignals = new EnumMap<CatFOG, String>(CatFOG.class);
+	static {
+		fogSignals.put(CatFOG.FOG_EXPL, "Explos");
+		fogSignals.put(CatFOG.FOG_DIA, "Dia");
+		fogSignals.put(CatFOG.FOG_SIRN, "Siren");
+		fogSignals.put(CatFOG.FOG_NAUT, "Horn");
+		fogSignals.put(CatFOG.FOG_REED, "Horn");
+		fogSignals.put(CatFOG.FOG_TYPH, "Horn");
+		fogSignals.put(CatFOG.FOG_BELL, "Bell");
+		fogSignals.put(CatFOG.FOG_WHIS, "Whis");
+		fogSignals.put(CatFOG.FOG_GONG, "Gong");
+		fogSignals.put(CatFOG.FOG_HORN, "Horn");
+	}
+
 	public static void fogSignals(Feature feature) {
-		
+		Renderer.symbol(feature, Beacons.FogSignal);
+		AttMap atts = feature.objs.get(Obj.FOGSIG).get(0);
+		String str = "";
+		if (atts.containsKey(Att.CATFOG)) {
+			str += fogSignals.get(atts.get(Att.CATFOG).val);
+		}
+		if (atts.containsKey(Att.SIGGRP)) {
+			str += "(" + atts.get(Att.SIGGRP).val + ")";
+		} else {
+			str += " ";
+		}
+		if (atts.containsKey(Att.SIGPER)) {
+			str += atts.get(Att.SIGPER).val + "s";
+		}
+		if (atts.containsKey(Att.VALMXR)) {
+			str += atts.get(Att.VALMXR).val + "M";
+		}
+		if ((Renderer.zoom >= 15) && !str.isEmpty()) {
+			Renderer.labelText(feature, str, new Font("Arial", Font.PLAIN, 40),Color.black, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-60, -30)));
+		}
 	}
 
@@ -63,5 +151,5 @@
 		}
 		if ((Renderer.zoom >= 15) && !bstr.isEmpty()) {
-			Renderer.labelText(feature, bstr, new Font("Arial", Font.PLAIN, 40),Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -30)));
+			Renderer.labelText(feature, bstr, new Font("Arial", Font.PLAIN, 40),Color.black, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -70)));
 		}
 	}
@@ -177,5 +265,5 @@
 			}
 			if (!bstr.isEmpty()) {
-				Renderer.labelText(feature, bstr, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -70)));
+				Renderer.labelText(feature, bstr, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -110)));
 			}
 		}
@@ -183,22 +271,65 @@
 
 	public static void lights(Feature feature) {
-		
-	}
-
-//	private static Point2D.Double radial(Feature feature, Snode centre, double radius, double angle) {
-//		Point2D origin = Renderer.context.getPoint(centre);
-//		return new Point2D.Double(origin.getX() - (radius * Renderer.context.mile(feature) * Math.sin(angle)), origin.getY() - (radius * Renderer.context.mile(feature) * Math.cos(angle)));
-//	}
-/*
-void renderFlare(Item_t *item) {
-  char *col = light_colours[COL_MAG];
-  Obj_t *obj = getObj(item, LIGHTS, 0);
-  Att_t *att;
-  if (((att = getAtt(obj, COLOUR)) != NULL) && (att->val.val.l->next == NULL)) {
-    col = light_colours[att->val.val.l->val];
-  }
-  renderSymbol(item, LIGHTS, "light", "", col, CC, 0, 0, 120);
-}
-
+		Enum<ColCOL> col = null;
+		Enum<ColCOL> tcol = null;
+		ObjTab objs = feature.objs.get(Obj.LIGHTS);
+		for (AttMap atts : objs.values()) {
+			if (atts.containsKey(Att.COLOUR)) {
+				ArrayList<Enum<ColCOL>> cols = (ArrayList<Enum<ColCOL>>) atts.get(Att.COLOUR).val;
+				if (cols.size() == 1) {
+					tcol = cols.get(0);
+					if (col == null) {
+						col = tcol;
+					} else if (tcol != col) {
+						col = ColCOL.COL_MAG;
+						break;
+					}
+				} else {
+					col = ColCOL.COL_MAG;
+					break;
+				}
+			}
+		}
+		Renderer.symbol(feature, Beacons.LightFlare, new Scheme(lightColours.get(col)), new Delta(Handle.BC, AffineTransform.getRotateInstance(Math.toRadians(120))));
+		if (objs.get(1) != null) {
+			for (AttMap atts : objs.values()) {
+				Enum<ColCOL> col1 = null;
+				Enum<ColCOL> col2 = null;
+				double radius = 0.2;
+				double s1 = 0;
+				double s2 = 0;
+				boolean dir = false;
+				if (atts.containsKey(Att.COLOUR)) {
+					ArrayList<Enum<ColCOL>> cols = (ArrayList<Enum<ColCOL>>) atts.get(Att.COLOUR).val;
+					col1 = cols.get(0);
+					if (cols.size() > 1) col2 = cols.get(1);
+				} else {
+					continue;
+				}
+				if (atts.containsKey(Att.RADIUS)) {
+					radius = (Double) atts.get(Att.RADIUS).val;
+				}
+				if (atts.containsKey(Att.SECTR1)) {
+					s1 = (Double) atts.get(Att.SECTR1).val;
+				} else {
+					continue;
+				}
+				if (atts.containsKey(Att.SECTR2)) {
+					s1 = (Double) atts.get(Att.SECTR2).val;
+				} else {
+					continue;
+				}
+				if (atts.containsKey(Att.CATLIT)) {
+					ArrayList<CatLIT> cats = (ArrayList<CatLIT>) atts.get(Att.CATLIT).val;
+					if (cats.contains(CatLIT.LIT_DIR)) {
+						dir = true;
+					}
+				}
+				Renderer.lightSector(feature, lightColours.get(col1), lightColours.get(col2), radius, s1, s2, dir, "");
+			}
+		}
+	}
+
+	/*
 void renderSector(Item_t *item, int s, char *text, char *style, double offset, int dy) {
   Obj_t *sector;
@@ -356,41 +487,4 @@
   Obj_t *obj = getObj(item, enumType(type), idx);
   switch (enumType(type)) {
-    case CGUSTA:
-      strcpy(string1, "CG");
-      if ((obj != NULL) && (att = getAtt(obj, COMCHA)) != NULL)
-        sprintf(strchr(string1, 0), " Ch.%s", stringValue(att->val));
-      break;
-    case FOGSIG:
-      if (obj != NULL) {
-        if ((att = getAtt(obj, CATFOG)) != NULL)
-          strcat(string1, fog_signals[att->val.val.e]);
-        if ((att = getAtt(obj, SIGGRP)) != NULL)
-          sprintf(strchr(string1, 0), "(%s)", stringValue(att->val));
-        else 
-          strcat(string1, " ");
-        if ((att = getAtt(obj, SIGPER)) != NULL)
-          sprintf(strchr(string1, 0), "%ss ", stringValue(att->val));
-        if ((att = getAtt(obj, VALMXR)) != NULL)
-          sprintf(strchr(string1, 0), "%sM", stringValue(att->val));
-      }
-      break;
-    case SISTAT:
-      strcpy(string1, "SS");
-      if (obj != NULL) {
-        if ((att = getAtt(obj, CATSIT)) != NULL)
-          strcat(string1, sit_map[att->val.val.l->val]);
-        if ((att = getAtt(obj, COMCHA)) != NULL)
-          sprintf(strchr(string1, 0), "\nCh.%s", stringValue(att->val));
-      }
-      break;
-    case SISTAW:
-      strcpy(string1, "SS");
-      if (obj != NULL) {
-        if ((att = getAtt(obj, CATSIW)) != NULL)
-          strcat(string1, siw_map[att->val.val.l->val]);
-        if ((att = getAtt(obj, COMCHA)) != NULL)
-          sprintf(strchr(string1, 0), "\nCh.%s", stringValue(att->val));
-      }
-      break;
     case LIGHTS:
     {
Index: applications/editors/josm/plugins/smed2/src/s57/S57dec.java
===================================================================
--- applications/editors/josm/plugins/smed2/src/s57/S57dec.java	(revision 30321)
+++ applications/editors/josm/plugins/smed2/src/s57/S57dec.java	(revision 30323)
@@ -12,13 +12,11 @@
 import java.io.FileInputStream;
 import java.io.IOException;
-import java.util.ArrayList;
 
 import s57.S57dat.*;
 import s57.S57map.*;
-import s57.S57obj.*;
 
 public class S57dec {
 
-	public static MapBounds decodeFile(FileInputStream in, ArrayList<Obj> types, S57map map) throws IOException {
+	public static MapBounds decodeFile(FileInputStream in, S57map map) throws IOException {
 		S57dat.rnum = 0;
 		byte[] leader = new byte[24];
Index: applications/editors/josm/plugins/smed2/src/symbols/Beacons.java
===================================================================
--- applications/editors/josm/plugins/smed2/src/symbols/Beacons.java	(revision 30321)
+++ applications/editors/josm/plugins/smed2/src/symbols/Beacons.java	(revision 30323)
@@ -16,5 +16,4 @@
 
 import symbols.Symbols.*;
-
 import s57.S57val.*;
 
@@ -69,4 +68,5 @@
 	public static final Symbol LightFlare = new Symbol();
 	static {
+		LightFlare.add(new Instr(Form.BBOX, new Rectangle2D.Double(-20,-100,40,100)));
 		LightFlare.add(new Instr(Form.RSHP, new Ellipse2D.Double(-3,-3,6,6)));
 		Path2D.Double p = new Path2D.Double();
