Ignore:
Timestamp:
2007-05-06T18:12:25+02:00 (17 years ago)
Author:
damians
Message:

added useRealWidth function

Location:
applications/editors/josm/plugins/mappaint
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mappaint/src/mappaint/ElemStyleHandler.java

    r2768 r2787  
    1818    ElemStyle curStyle;
    1919    ElemStyles styles;
    20     String curWidth, curKey, curValue;
     20    String curKey, curValue ;
     21                int curWidth = 1, curRealWidth = 0;
    2122        int curMinZoom;
    2223    ImageIcon curIcon;
     
    7879                {
    7980                    if(atts.getQName(count).equals("width"))
    80                         curWidth = atts.getValue(count);
     81                        curWidth = Integer.parseInt(atts.getValue(count));
    8182                    else if (atts.getQName(count).equals("colour"))
    8283                        curColour=ColorHelper.html2color(atts.getValue(count));
     84                                                                                else if (atts.getQName(count).equals("realwidth"))
     85                                                                                                curRealWidth=Integer.parseInt(atts.getValue(count));
    8386                }
    8487            }
     
    137140        {
    138141            inLine = false;
    139             curStyle = new LineElemStyle(Integer.parseInt(curWidth), curColour,
     142            curStyle = new LineElemStyle(curWidth,curRealWidth, curColour,
    140143                                                                                curMinZoom);
     144                                                curWidth=1;
     145                                                curRealWidth = 0;
    141146        }
    142147        else if (inIcon && qName.equals("icon"))
  • applications/editors/josm/plugins/mappaint/src/mappaint/LineElemStyle.java

    r1501 r2787  
    55{
    66        int width;
     7        int realWidth = 0; //the real width of this line in meter
    78        Color colour;
    89
    9         public LineElemStyle (int width, Color colour, int minZoom)
     10        public LineElemStyle (int width, int realWidth, Color colour, int minZoom)
    1011        {
    1112                this.width = width;
     13                this.realWidth = realWidth;
    1214                this.colour = colour;
    1315                this.minZoom = minZoom;
     
    1719        {
    1820                return width;
     21        }
     22
     23        public int getRealWidth()
     24        {
     25                return realWidth;
    1926        }
    2027
  • applications/editors/josm/plugins/mappaint/src/mappaint/MapPaintVisitor.java

    r2768 r2787  
    6464        // Altered from SimplePaintVisitor
    6565        @Override public void visit(Way w) {
     66                double circum = Main.map.mapView.getScale()*100*Main.proj.scaleFactor()*40041455; // circumference of the earth in meter
    6667                Color colour = getPreferencesColor("untagged",Color.GRAY);
    67                 int width=2;
     68                int width = 2;
     69                int realWidth = 0; //the real width of the element in meters
    6870                boolean area=false;
    6971                ElemStyle wayStyle = MapPaintPlugin.elemStyles.getStyle(w);
     
    7476                                colour = ((LineElemStyle)wayStyle).getColour();
    7577                                width = ((LineElemStyle)wayStyle).getWidth();
     78                                realWidth = ((LineElemStyle)wayStyle).getRealWidth();   
    7679                        }
    7780                        else if (wayStyle instanceof AreaElemStyle)
     
    9699                                                drawSegment(ls, w.selected ? getPreferencesColor("selected", Color.YELLOW) : colour,Main.pref.getBoolean("draw.segment.direction"), width,true);
    97100                                        else
     101                                                if (realWidth > 0 && Main.pref.getBoolean("mappaint.useRealWith",false)){
     102                                                        int tmpWidth = (int) (100 /  (float) (circum / realWidth));
     103                                                        if (tmpWidth > width) width = tmpWidth;
     104                                                }
     105
    98106                                                drawSegment(ls, w.selected ? getPreferencesColor("selected", Color.YELLOW) : colour,Main.pref.getBoolean("draw.segment.direction"), width,false);
    99107                                if (!ls.incomplete && Main.pref.getBoolean("draw.segment.order_number"))
     
    217225        // Shows areas before non-areas
    218226        public void visitAll(DataSet data) {
    219 
     227               
    220228                Collection<Way> noAreaWays = new LinkedList<Way>();
    221229
  • applications/editors/josm/plugins/mappaint/styles/standard/elemstyles.xml

    r2768 r2787  
    33        <rule>
    44                <condition k="highway" v="footway"/>
    5                 <line width="1" colour="#00ff00" />
     5                <line width="1" realwidth="1" colour="#00ff00" />
    66        </rule>
    77
     
    1818        <rule>
    1919                <condition k="highway" v="primary"/>
    20                 <line width="3" colour="#fb805f"/>
     20                <line width="3" realwidth="8" colour="#fb805f"/>
    2121        </rule>
    2222
     
    2828        <rule>
    2929                <condition k="highway" v="secondary"/>
    30                 <line width="3" colour="#fdbf6f"/>
     30                <line width="3" realwidth="6" colour="#fdbf6f"/>
    3131        </rule>
    3232
    3333        <rule>
    3434                <condition k="highway" v="motorway"/>
    35                 <line width="3" colour="#809bc0"/>
     35                <line width="3" realwidth="8" colour="#809bc0"/>
    3636        </rule>
    3737
     
    4848        <rule>
    4949                <condition k="highway" v="cycleway"/>
    50                 <line width="1" colour="#ff00ff"/>
     50                <line width="1" realwidth="2" colour="#ff00ff"/>
    5151        </rule>
    5252
     
    5858        <rule>
    5959                <condition k="highway" v="residential"/>
    60                 <line width="2" colour="#c0c0c0"/>
     60                <line width="2" realwidth="5" colour="#c0c0c0"/>
    6161        </rule>
    6262
     
    6969        <rule>
    7070                <condition k="waterway" v="river"/>
    71                 <line width="2" colour="#0000ff" />
     71                <line realwidth="10" colour="#0000ff" />
    7272        </rule>
    7373
     
    7979        <rule>
    8080                <condition k="waterway" v="riverbank"/>
    81                 <line widht="1" colour="#0000ff"/>
     81                <line width="1" colour="#0000ff"/>
    8282        </rule>
    8383
     
    188188<rule>
    189189<condition k="landuse" v="cemetery"/>
    190 <line widht="1" colour="#bde3cb"/>
     190<line width="1" colour="#bde3cb"/>
    191191</rule>
    192192
Note: See TracChangeset for help on using the changeset viewer.