Ignore:
Timestamp:
2013-10-12T12:50:40+02:00 (11 years ago)
Author:
malcolmh
Message:

save

Location:
applications/editors/josm/plugins/smed2/src/seamap
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/smed2/src/seamap/Renderer.java

    r29992 r30020  
    1313import java.awt.font.*;
    1414import java.awt.geom.*;
     15import java.awt.image.*;
    1516import java.util.*;
    1617
     
    270271                }
    271272        }
     273       
     274        public static void fillPattern(Feature feature, BufferedImage image) {
     275                Path2D.Double p = new Path2D.Double();
     276                p.setWindingRule(GeneralPath.WIND_EVEN_ODD);
     277                Point2D point;
     278                switch (feature.flag) {
     279                case POINT:
     280                        point = helper.getPoint(feature.centre);
     281                        g2.drawImage(image, new AffineTransformOp(AffineTransform.getScaleInstance(sScale, sScale), AffineTransformOp.TYPE_NEAREST_NEIGHBOR),
     282                                        (int)(point.getX() - (50 * sScale)), (int)(point.getY() - (50 * sScale)));
     283                        break;
     284                case AREA:
     285                        for (Bound bound : map.areas.get(feature.refs)) {
     286                                BoundIterator bit = map.new BoundIterator(bound);
     287                                point = helper.getPoint(bit.next());
     288                                p.moveTo(point.getX(), point.getY());
     289                                while (bit.hasNext()) {
     290                                        point = helper.getPoint(bit.next());
     291                                        p.lineTo(point.getX(), point.getY());
     292                                }
     293                        }
     294            g2.setPaint(new TexturePaint(image, new Rectangle(0, 0, 1 + (int)(100 * sScale), 1 + (int)(100 * sScale))));
     295            g2.fill(p);
     296            break;
     297                }
     298        }
    272299
    273300        public static void labelText(Feature feature, String str, Font font, Color colour, Delta delta) {
  • applications/editors/josm/plugins/smed2/src/seamap/Rules.java

    r29992 r30020  
    105105                AttItem name = feature.atts.get(Att.OBJNAM);
    106106                switch (feature.type) {
    107                 case SPLARE:
    108                         if (zoom >= 12) {
    109                                 Renderer.symbol(feature, Areas.Plane, Obj.SPLARE, null, null);
    110                                 Renderer.lineSymbols(feature, Areas.Restricted, 0.5, Areas.LinePlane, 10);
    111                         }
    112                         if ((zoom >= 15) && (name != null))
    113                                 Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 80), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -90)));
    114                         break;
    115                 case MARCUL:
    116                         if (zoom >= 14)
    117                                 Renderer.symbol(feature, Areas.MarineFarm, Obj.MARCUL, null, null);
    118                         if (zoom >= 16)
    119                                 Renderer.lineVector(feature, new LineStyle( Color.black, 4, new float[] { 10, 10 }, null));
     107                case DRGARE:
     108                        if (zoom < 16)
     109                                Renderer.lineVector(feature, new LineStyle(Color.black, 8, new float[] { 25, 25 }, new Color(0x40ffffff, true)));
     110                        else
     111                                Renderer.lineVector(feature, new LineStyle(Color.black, 8, new float[] { 25, 25 }, null));
     112                        if ((zoom >= 12) && (name != null))
     113                                Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.PLAIN, 100), Color.black, null);
    120114                        break;
    121115                case FAIRWY:
     
    130124                        }
    131125                        break;
    132                 case DRGARE:
    133                         if (zoom < 16)
    134                                 Renderer.lineVector(feature, new LineStyle(Color.black, 8, new float[] { 25, 25 }, new Color(0x40ffffff, true)));
    135                         else
    136                                 Renderer.lineVector(feature, new LineStyle(Color.black, 8, new float[] { 25, 25 }, null));
    137                         if ((zoom >= 12) && (name != null))
    138                                 Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.PLAIN, 100), Color.black, null);
    139                         break;
    140                 case RESARE:
    141                         if (zoom >= 12) {
    142                                 Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, 0);
    143 //                              if ((CatREA)Renderer.getAttVal(feature, feature.type, 0, Att.CATREA) == CatREA.REA_NWAK)
    144 //                                      Renderer.symbol(feature, Areas.NoWake, Obj.RESARE, null);
    145                         }
     126                case MARCUL:
     127                        if (zoom >= 14)
     128                                Renderer.symbol(feature, Areas.MarineFarm, Obj.MARCUL, null, null);
     129                        if (zoom >= 16)
     130                                Renderer.lineVector(feature, new LineStyle( Color.black, 4, new float[] { 10, 10 }, null));
    146131                        break;
    147132                case OSPARE:
     
    153138                        }
    154139                        break;
     140                case RESARE:
     141                        if (zoom >= 12) {
     142                                Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, 0);
     143//                              if ((CatREA)Renderer.getAttVal(feature, feature.type, 0, Att.CATREA) == CatREA.REA_NWAK)
     144//                                      Renderer.symbol(feature, Areas.NoWake, Obj.RESARE, null);
     145                        }
     146                        break;
    155147                case SEAARE:
    156148                        switch ((CatSEA) Renderer.getAttVal(feature, feature.type, 0, Att.CATSEA)) {
     
    166158                        }
    167159                        break;
    168                 case SNDWAV:
    169 //        if (zoom>=12)) area("fill:url(#sandwaves)");
    170                         break;
    171                 }
    172160/*
    173161  if (is_type("sea_area")) {
     
    205193  }
    206194 */
    207         }
     195                case SNDWAV:
     196                        if (zoom >= 12) Renderer.fillPattern(feature, Areas.Sandwaves);
     197                        break;
     198                case SPLARE:
     199                        if (zoom >= 12) {
     200                                Renderer.symbol(feature, Areas.Plane, Obj.SPLARE, null, null);
     201                                Renderer.lineSymbols(feature, Areas.Restricted, 0.5, Areas.LinePlane, 10);
     202                        }
     203                        if ((zoom >= 15) && (name != null))
     204                                Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 80), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -90)));
     205                        break;
     206                }
     207        }
     208       
    208209        private static void beacons(Feature feature) {
    209210                BcnSHP shape = (BcnSHP) Renderer.getAttVal(feature, feature.type, 0, Att.BCNSHP);
Note: See TracChangeset for help on using the changeset viewer.