Changeset 1221 in josm for trunk/src/org/openstreetmap/josm/data/osm
- Timestamp:
- 2009-01-09T09:42:46+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/osm/visitor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
r1215 r1221 752 752 g.drawRect(p.x - radius, p.y - radius, size, size); 753 753 754 String name = getNodeName(n); 755 if (name!=null /* && annotate */) 756 { 757 g.setColor(textColor); 758 Font defaultFont = g.getFont(); 759 g.setFont (orderFont); 760 g.drawString (name, p.x+radius+2, p.y+radius+2); 761 g.setFont(defaultFont); 762 } 763 } 754 String name = getNodeName(n); 755 if (name!=null /* && annotate */) 756 { 757 g.setColor(textColor); 758 Font defaultFont = g.getFont(); 759 g.setFont (orderFont); 760 g.drawString (name, p.x+radius+2, p.y+radius+2); 761 g.setFont(defaultFont); 762 } 763 } 764 } 765 766 public void getColors() 767 { 768 super.getColors(); 769 untaggedColor = Main.pref.getColor(marktr("untagged"),Color.GRAY); 770 textColor = Main.pref.getColor (marktr("text"), Color.WHITE); 764 771 } 765 772 … … 767 774 // Shows areas before non-areas 768 775 public void visitAll(DataSet data, Boolean virtual) { 769 770 771 772 773 774 775 776 777 778 776 777 boolean profiler = Main.pref.getBoolean("mappaint.profiler",false); 778 long profilerStart = java.lang.System.currentTimeMillis(); 779 long profilerLast = profilerStart; 780 int profilerN; 781 if(profiler) 782 { 783 System.out.println("Mappaint Profiler"); 784 } 785 779 786 getSettings(virtual); 780 untaggedColor = Main.pref.getColor(marktr("untagged"),Color.GRAY);781 textColor = Main.pref.getColor (marktr("text"), Color.WHITE);782 787 useRealWidth = Main.pref.getBoolean("mappaint.useRealWidth",false); 783 788 zoomLevelDisplay = Main.pref.getBoolean("mappaint.zoomLevelDisplay",false); … … 795 800 selectedCall = false; 796 801 797 798 799 800 801 802 802 if(profiler) 803 { 804 System.out.format("Prepare : %4dms\n", (java.lang.System.currentTimeMillis()-profilerLast)); 805 profilerLast = java.lang.System.currentTimeMillis(); 806 } 807 803 808 if (fillAreas && styles.hasAreas()) { 804 809 Collection<Way> noAreaWays = new LinkedList<Way>(); 805 810 806 807 811 /*** RELATIONS ***/ 812 profilerN = 0; 808 813 for (final Relation osm : data.relations) 809 814 { 810 815 if(!osm.deleted && !osm.incomplete) 811 816 { 812 817 osm.visit(this); 813 814 815 } 816 817 818 819 820 821 822 823 824 818 profilerN++; 819 } 820 } 821 822 if(profiler) 823 { 824 System.out.format("Relations: %4dms, n=%d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 825 profilerLast = java.lang.System.currentTimeMillis(); 826 } 827 828 /*** AREAS ***/ 829 profilerN = 0; 825 830 for (final Way osm : data.ways) 826 831 { … … 836 841 } 837 842 alreadyDrawnAreas = null; 838 839 840 841 842 843 844 845 846 843 844 if(profiler) 845 { 846 System.out.format("Areas : %4dms, n=%d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 847 profilerLast = java.lang.System.currentTimeMillis(); 848 } 849 850 /*** WAYS ***/ 851 profilerN = 0; 847 852 fillAreas = false; 848 853 for (final OsmPrimitive osm : noAreaWays) … … 851 856 profilerN++; 852 857 } 853 854 855 856 857 858 858 859 if(profiler) 860 { 861 System.out.format("Ways : %4dms, n=%d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 862 profilerLast = java.lang.System.currentTimeMillis(); 863 } 859 864 } 860 865 else 861 866 { 862 863 867 /*** WAYS (filling disabled) ***/ 868 profilerN = 0; 864 869 for (final OsmPrimitive osm : data.ways) 865 870 if (!osm.incomplete && !osm.deleted && !osm.selected) 866 871 { 867 872 osm.visit(this); 868 873 profilerN++; 869 870 871 872 873 874 875 876 } 877 878 874 } 875 876 if(profiler) 877 { 878 System.out.format("Ways : %4dms, n=%d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 879 profilerLast = java.lang.System.currentTimeMillis(); 880 } 881 } 882 883 /*** SELECTED ***/ 879 884 selectedCall = true; 880 885 profilerN = 0; 881 886 for (final OsmPrimitive osm : data.getSelected()) { 882 887 if (!osm.incomplete && !osm.deleted 883 888 && !(osm instanceof Node) && !alreadyDrawn.contains(osm)) 884 889 { 885 890 osm.visit(this); 886 887 888 } 889 890 891 892 893 894 895 896 891 profilerN++; 892 } 893 } 894 895 if(profiler) 896 { 897 System.out.format("Selected : %4dms, n=%d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 898 profilerLast = java.lang.System.currentTimeMillis(); 899 } 900 901 /*** DISPLAY CACHED SEGMENTS (WAYS) NOW ***/ 897 902 displaySegments(); 898 899 900 901 902 903 /*System.out.println("display segments " + (java.lang.System.currentTimeMillis()-profilerLast) + "ms"); 904 profilerLast = java.lang.System.currentTimeMillis();*/ 905 906 /*** NODES ***/ 907 profilerN = 0; 903 908 for (final OsmPrimitive osm : data.nodes) 904 909 if (!osm.incomplete && !osm.deleted && !alreadyDrawn.contains(osm)) 905 910 { 906 911 osm.visit(this); 907 908 909 910 911 912 913 914 912 profilerN++; 913 } 914 915 if(profiler) 916 { 917 System.out.format("Nodes : %4dms, n=%d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 918 profilerLast = java.lang.System.currentTimeMillis(); 919 } 915 920 916 921 alreadyDrawn = null; 917 922 918 923 /*** VIRTUAL ***/ 919 924 if (virtualNodeSize != 0) 920 925 { 921 926 profilerN = 0; 922 927 currentColor = nodeColor; 923 928 for (final OsmPrimitive osm : data.ways) 924 929 if (!osm.incomplete && !osm.deleted) 925 930 { 926 931 visitVirtual((Way)osm); 927 928 929 930 931 932 933 934 935 936 937 938 939 } 940 941 942 943 944 932 profilerN++; 933 } 934 935 if(profiler) 936 { 937 System.out.format("Virtual : %4dms, n=%d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 938 profilerLast = java.lang.System.currentTimeMillis(); 939 } 940 941 displaySegments(null); 942 /*System.out.println("display segments virtual " + (java.lang.System.currentTimeMillis()-profilerLast) + "ms"); 943 profilerLast = java.lang.System.currentTimeMillis();*/ 944 } 945 946 if(profiler) 947 { 948 System.out.format("All : %4dms\n", (profilerLast-profilerStart)); 949 } 945 950 } 946 951 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java
r1216 r1221 85 85 Rectangle bbox = new Rectangle(); 86 86 87 protected void getSettings(Boolean virtual) { 88 inactiveColor = Main.pref.getColor(marktr("inactive"), Color.DARK_GRAY); 89 selectedColor = Main.pref.getColor(marktr("selected"), Color.WHITE); 90 nodeColor = Main.pref.getColor(marktr("node"), Color.RED); 87 public void getColors() 88 { 89 inactiveColor = Main.pref.getColor(marktr("inactive"), Color.darkGray); 90 selectedColor = Main.pref.getColor(marktr("selected"), Color.red); 91 nodeColor = Main.pref.getColor(marktr("node"), Color.yellow); 91 92 dfltWayColor = Main.pref.getColor(marktr("way"), darkblue); 92 93 relationColor = Main.pref.getColor(marktr("relation"), teal); … … 94 95 incompleteColor = Main.pref.getColor(marktr("incomplete way"), darkerblue); 95 96 backgroundColor = Main.pref.getColor(marktr("background"), Color.BLACK); 97 } 98 99 protected void getSettings(Boolean virtual) { 96 100 showDirectionArrow = Main.pref.getBoolean("draw.segment.direction"); 97 101 showRelevantDirectionsOnly = Main.pref.getBoolean("draw.segment.relevant_directions_only", true);
Note:
See TracChangeset
for help on using the changeset viewer.