Index: applications/editors/josm/plugins/mappaint/README
===================================================================
--- applications/editors/josm/plugins/mappaint/README	(revision 2688)
+++ applications/editors/josm/plugins/mappaint/README	(revision 2688)
@@ -0,0 +1,15 @@
+This is the MapPaint Plugin for JOSM.
+
+Ways are shown in different colours and width.
+
+Install:
+
+LINUX:
+	Copy the mappaint.jar file into your ./josm/plugins/ folder.
+	Copy the elemstyles.xml to your ./josm/plugins/mappaint/ folder
+
+Directories:
+ 	styles:
+	  Some day you will find different style files here, currently MapPaint supports only one Style.
+	images:
+		Icons which will apear in the map.
Index: applications/editors/josm/plugins/mappaint/src/mappaint/MapPaintVisitor.java
===================================================================
--- applications/editors/josm/plugins/mappaint/src/mappaint/MapPaintVisitor.java	(revision 2687)
+++ applications/editors/josm/plugins/mappaint/src/mappaint/MapPaintVisitor.java	(revision 2688)
@@ -35,5 +35,5 @@
 	// Altered from SimplePaintVisitor
 	@Override public void visit(Node n) {
-		if (isNodeVisible(n)) {
+		if (!n.shown) {
 			ElemStyle nodeStyle = MapPaintPlugin.elemStyles.getStyle(n);
 			if(nodeStyle!=null && Main.map.mapView.zoom()>=nodeStyle.getMinZoom()){
@@ -57,5 +57,4 @@
 	 */
 	@Override public void visit(Segment ls) {
-		if (isSegmentVisible(ls))
 			drawSegment(ls, getPreferencesColor("untagged",Color.GRAY),Main.pref.getBoolean("draw.segment.direction"));
 	}
@@ -92,11 +91,9 @@
 		{
 			orderNumber++;
-			if (isSegmentVisible(ls))
-			{
 				if (area && fillAreas)
 					//Draw segments in a different colour so direction arrows show against the fill
-					drawSegment(ls, w.selected ? getPreferencesColor("selected", Color.YELLOW) : getPreferencesColor("untagged",Color.GRAY), width);
+					drawSegment(ls, w.selected ? getPreferencesColor("selected", Color.YELLOW) : getPreferencesColor("untagged",Color.GRAY),Main.pref.getBoolean("draw.segment.direction"), width);
 				else
-					drawSegment(ls, w.selected ? getPreferencesColor("selected", Color.YELLOW) : colour, width);
+					drawSegment(ls, w.selected ? getPreferencesColor("selected", Color.YELLOW) : colour,Main.pref.getBoolean("draw.segment.direction"), width);
 				if (!ls.incomplete && Main.pref.getBoolean("draw.segment.order_number"))
 				{
@@ -108,5 +105,4 @@
 					catch (IllegalAccessError e) {} //SimplePaintVisitor::drawOrderNumber was private prior to rev #211
 				}
-			}
 		}
 	}
@@ -137,31 +133,10 @@
 	}
 
-	/**
-	 * Checks if the given node is in the visible area.
-	 */
-	protected boolean isNodeVisible(Node n) {
-		Point p = nc.getPoint(n.eastNorth);
-		return !((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight()));
-	}
-
-	/**
-	 * Checks if the given segment is in the visible area.
-	 * NOTE: This will return true for a small number of non-visible
-	 *       segments.
-	 */
-	protected boolean isSegmentVisible(Segment ls) {
-		if (ls.incomplete) return false;
-		Point p1 = nc.getPoint(ls.from.eastNorth);
-		Point p2 = nc.getPoint(ls.to.eastNorth);
-		if ((p1.x < 0) && (p2.x < 0)) return false;
-		if ((p1.y < 0) && (p2.y < 0)) return false;
-		if ((p1.x > nc.getWidth()) && (p2.x > nc.getWidth())) return false;
-		if ((p1.y > nc.getHeight()) && (p2.y > nc.getHeight())) return false;
-		return true;
-	}
-
 	// NEW
 	protected void drawNode(Node n, ImageIcon icon) {
+		if (n.shown) return;
+		n.shown=true;
 		Point p = nc.getPoint(n.eastNorth);
+		if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return;
 		int w = icon.getIconWidth(), h=icon.getIconHeight();
 		icon.paintIcon ( Main.map.mapView, g, p.x-w/2, p.y-h/2 );
@@ -187,9 +162,13 @@
 	// Altered - now specify width
 	@Override protected void drawSegment(Segment ls, Color col,boolean showDirection) {
-			drawSegment(ls,col,1);
-	}
+			drawSegment(ls,col,showDirection,1);
+	}
+
 
 	// Altered - now specify width
-	private void drawSegment (Segment ls, Color col, int width) {
+	private void drawSegment (Segment ls, Color col,boolean showDirection, int width) {
+		//do not draw already visible segments
+		if (ls.shown) return;
+		ls.shown=true;
 		Graphics2D g2d = (Graphics2D)g;
 		if (ls.incomplete)
@@ -202,11 +181,18 @@
 		Point p1 = nc.getPoint(ls.from.eastNorth);
 		Point p2 = nc.getPoint(ls.to.eastNorth);
+		// checking if this Point is visible
+		if ((p1.x < 0) && (p2.x < 0)) return ;
+		if ((p1.y < 0) && (p2.y < 0)) return ;
+		if ((p1.x > nc.getWidth()) && (p2.x > nc.getWidth())) return ;
+		if ((p1.y > nc.getHeight()) && (p2.y > nc.getHeight())) return ;
+
 		g.drawLine(p1.x, p1.y, p2.x, p2.y);
 
-		if (Main.pref.getBoolean("draw.segment.direction")) {
+		if (showDirection) {
 			double t = Math.atan2(p2.y-p1.y, p2.x-p1.x) + Math.PI;
-	        g.drawLine(p2.x,p2.y, (int)(p2.x + 10*Math.cos(t-PHI)), (int)(p2.y + 10*Math.sin(t-PHI)));
-	        g.drawLine(p2.x,p2.y, (int)(p2.x + 10*Math.cos(t+PHI)), (int)(p2.y + 10*Math.sin(t+PHI)));
-		}
+	    g.drawLine(p2.x,p2.y, (int)(p2.x + 10*Math.cos(t-PHI)), (int)(p2.y + 10*Math.sin(t-PHI)));
+	    g.drawLine(p2.x,p2.y, (int)(p2.x + 10*Math.cos(t+PHI)), (int)(p2.y + 10*Math.sin(t+PHI)));
+		}
+		
 	}
 
@@ -220,4 +206,5 @@
 	@Override public void drawNode(Node n, Color color) {
 		Point p = nc.getPoint(n.eastNorth);
+		if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return;
 		g.setColor(color);
 		g.drawRect(p.x-1, p.y-1, 2, 2);
@@ -229,7 +216,12 @@
 
 		Collection<Way> noAreaWays = new LinkedList<Way>();
+
 		for (final OsmPrimitive osm : data.segments)
 			if (!osm.deleted)
-				osm.visit(this);
+				osm.shown=false;
+
+		for (final OsmPrimitive osm : data.nodes)
+			if (!osm.deleted)
+				osm.shown=false;
 				
 		for (final OsmPrimitive osm : data.ways)
@@ -242,4 +234,8 @@
 			osm.visit(this);
 
+		for (final OsmPrimitive osm : data.segments)
+			if (!osm.deleted)
+				osm.visit(this);
+
 		for (final OsmPrimitive osm : data.nodes)
 			if (!osm.deleted)
@@ -247,6 +243,8 @@
 
 		for (final OsmPrimitive osm : data.getSelected())
-			if (!osm.deleted)
-				osm.visit(this);
+			if (!osm.deleted){
+				osm.shown=false; //to be sure it will be drawn
+				osm.visit(this);
+			}
 	}
 }
Index: applications/editors/josm/plugins/mappaint/styles/elemstyles.xml
===================================================================
--- applications/editors/josm/plugins/mappaint/styles/elemstyles.xml	(revision 2688)
+++ applications/editors/josm/plugins/mappaint/styles/elemstyles.xml	(revision 2688)
@@ -0,0 +1,329 @@
+<rules>
+<rule>
+<condition k="highway" v="footway"/>
+<line width="1" colour="#00ff00" />
+</rule>
+
+<rule>
+<condition k="highway" v="bridleway"/>
+<line width="1" colour="#c08000" />
+</rule>
+
+<rule>
+<condition k="highway" v="unsurfaced"/>
+<line width="1" colour="#ff0000" />
+</rule>
+
+<rule>
+<condition k="highway" v="primary"/>
+<line width="3" colour="#fb805f"/>
+</rule>
+
+<rule>
+<condition k="highway" v="primary_link"/>
+<line width="3" colour="#fb805f"/>
+</rule>
+
+<rule>
+<condition k="highway" v="secondary"/>
+<line width="3" colour="#fdbf6f"/>
+</rule>
+
+<rule>
+<condition k="highway" v="motorway"/>
+<line width="3" colour="#809bc0"/>
+</rule>
+
+<rule>
+<condition k="highway" v="motorway_link"/>
+<line width="3" colour="#809bc0"/>
+</rule>
+
+<rule>
+<condition k="highway" v="trunk"/>
+<line width="3" colour="#7fc97f"/>
+</rule>
+
+<rule>
+<condition k="highway" v="cycleway"/>
+<line width="1" colour="#ff00ff"/>
+</rule>
+
+<rule>
+<condition k="highway" v="unclassified"/>
+<line width="2" colour="#c0c0c0"/>
+</rule>
+
+<rule>
+<condition k="highway" v="residential"/>
+<line width="2" colour="#c0c0c0"/>
+</rule>
+
+<rule>
+<condition k="highway" v="pedestrian"/>
+<line width="1" colour="#aaaaaa"/>
+</rule>
+
+<rule>
+<condition k="highway" />
+	<rule>
+		<condition k="bridge" v="yes|true" />
+	</rule>
+</rule>
+
+<rule>
+<condition k="waterway" v="river"/>
+<line width="2" colour="#0000ff" />
+</rule>
+
+<rule>
+<condition k="waterway" v="canal"/>
+<line width="2" colour="#0000ff" />
+</rule>
+
+<rule>
+<condition k="waterway" v="riverbank"/>
+<line widht="1" colour="#0000ff"/>
+</rule>
+
+
+<rule>
+<condition k="class" v="hill" />
+<icon annotate="true" src="peak_small.png"  />
+</rule>
+
+<rule>
+<condition k="natural" v="peak" />
+<icon annotate="true" src="peak_small.png"  />
+</rule>
+
+<rule>
+<condition k="class" v="farm" />
+<icon annotate="true" src="farm.png"  />
+</rule>
+
+<rule>
+<condition k="residence" v="farm" />
+<icon annotate="true" src="farm.png" />
+</rule>
+
+<rule>
+<condition k="class" v="pub" />
+<icon annotate="true" src="pub.png"  />
+</rule>
+
+<rule>
+<condition k="amenity" v="pub" />
+<icon annotate="true" src="pub.png"  />
+</rule>
+
+<rule>
+<condition k="class" v="viewpoint" />
+<icon annotate="true" src="viewpoint.png"  />
+</rule>
+
+<rule>
+<condition k="tourism" v="viewpoint" />
+<icon annotate="true" src="viewpoint.png" />
+</rule>
+
+<rule>
+<condition k="class" v="church" />
+<icon annotate="true" src="church.png" />
+</rule>
+
+<rule>
+<condition k="amenity" v="place_of_worship" />
+<icon annotate="true" src="church.png" />
+</rule>
+
+<rule>
+<condition k="class" v="railway station" />
+<icon annotate="true" src="station.png" />
+</rule>
+
+<rule>
+<condition k="railway" v="rail"/>
+<line width="2" colour="#808080"/>
+</rule>
+
+<rule>
+<condition k="railway" v="station" />
+<icon annotate="true" src="station.png" />
+</rule>
+
+<rule>
+<condition k="railway" v="level_crossing" />
+<icon annotate="true" src="crossing.png" />
+</rule>
+
+<rule>
+<condition k="class" v="mast" />
+<icon annotate="true" src="mast.png"  />
+</rule>
+
+<rule>
+<condition k="man_made" v="mast" />
+<icon annotate="true" src="mast.png" />
+</rule>
+
+<rule>
+<condition k="class" v="car park" />
+<icon annotate="true" src="carpark.png" />
+</rule>
+
+<rule>
+<condition k="amenity" v="parking" />
+<icon annotate="true" src="carpark.png" />
+</rule>
+
+<rule>
+<condition k="amenity" v="hospital" />
+<!-- <icon annotate="true" src="hospital.png" /> -->
+<line width="1" />
+</rule>
+
+<rule>
+<condition k="class" v="point of interest" />
+<icon annotate="true" src="interest.png" />
+</rule>
+
+<rule>
+<condition k="tourism" v="attraction" />
+<icon annotate="true" src="interest.png" />
+</rule>
+
+<rule>
+<condition k="class" v="caution" />
+<icon annotate="true" src="caution.png" />
+</rule>
+
+<rule>
+<condition k="class" v="amenity" />
+<icon annotate="true" src="amenity.png" />
+</rule>
+
+<rule>
+<condition k="class" v="tea shop" />
+<icon annotate="true" src="teashop.png" />
+</rule>
+
+<rule>
+<condition k="class" v="restaurant" />
+<icon annotate="true" src="restaurant.png" />
+</rule>
+
+<rule>
+<condition k="class" v="campsite" />
+<icon annotate="true" src="campsite.png" />
+</rule>
+
+<rule>
+<condition k="tourism" v="camp_site" />
+<icon annotate="true" src="campsite.png" />
+</rule>
+
+
+<rule>
+<condition k="place" v="village" />
+<icon annotate="true" src="place.png" />
+</rule>
+
+<rule>
+<condition k="place" v="town" />
+<icon annotate="true" src="place.png" />
+</rule>
+
+<rule>
+<condition k="place" v="city" />
+<icon annotate="true" src="place.png" />
+</rule>
+
+<rule>
+<condition k="place" v="hamlet" />
+<icon annotate="true" src="place.png" />
+</rule>
+
+<rule>
+<condition k="place" v="suburb" />
+<icon annotate="true" src="place.png" />
+</rule>
+
+<rule>
+<condition k="class" v="village" />
+<icon annotate="true" src="place.png" />
+</rule>
+
+<rule>
+<condition k="class" v="town" />
+<icon annotate="true" src="place.png" />
+</rule>
+
+<rule>
+<condition k="class" v="city" />
+<icon annotate="true" src="place.png" />
+</rule>
+
+<rule>
+<condition k="class" v="hamlet" />
+<icon annotate="true" src="place.png" />
+</rule>
+
+<rule>
+<condition k="class" v="suburb" />
+<icon annotate="true" src="place.png" />
+</rule>
+
+<rule>
+<condition k="landuse" v="wood"/>
+<area colour="#b1efc8" />
+</rule>
+
+<rule>
+<condition k="landuse" v="forest"/>
+<area colour="#b1efc8" />
+</rule>
+
+<rule>
+<condition k="landuse" v="cemetery"/>
+<line widht="1" colour="#bde3cb"/>
+</rule>
+
+<rule>
+<condition k="landuse" v="residential"/>
+<area colour="#f0f0f0"/>
+</rule>
+
+<rule>
+<condition k="landuse" v="industrial"/>
+<area colour="#ecd8ff"/>
+</rule>
+
+<rule>
+<condition k="natural" v="heath"/>
+<line widht="1" colour="#ffffc0"/>
+</rule>
+
+<rule>
+<condition k="natural" v="water"/>
+<area colour="#0000ff"/>
+</rule>
+
+<rule>
+<condition k="leisure" v="park"/>
+<area colour="#c7f1a3"/>
+</rule>
+
+<rule>
+<condition k="sport" v="soccer" />
+<area colour="#bde3cb"/>
+</rule>
+
+
+
+<rule>
+<condition k="natural" v="coastline"/>
+<line width="1" colour="#0000ff"/>
+</rule>
+
+</rules>
