Package hec.gfx2d

Class G2dGlyphFactory

java.lang.Object
hec.gfx2d.G2dGlyphFactory

public class G2dGlyphFactory extends Object
Makes the Glyphs for the Maps.. And sets the Glyph Characteristics through the GlyphDataRecord in the MapObject (if it has one). To add a new Glyph to the factory, use addMapping(Class, Class). It is recommended to call addMapping in a static { ... } block at the top of your Data object class. Example:
     public class MyG2dObject implements G2dObject {
         static {
                G2dGlyphFactory.addMapping(MyG2dObject.class.getName(), MyG2dObjectGlyph.class);
         }

         public MyG2dObject() {
             // ...
         }

         // ...
     }
 
This ensures that when the Data Object is created for the first time, it will add the mapping to the G2dGlyphFactory. This avoids the need to directly reference the classes in the Glyph Factory, and the static{} block ensures that it is only added once per classloader.
  • Field Details

    • g2dGlyphMapping

      public static Map g2dGlyphMapping
  • Constructor Details

    • G2dGlyphFactory

      public G2dGlyphFactory()
  • Method Details

    • addMapping

      @Deprecated public static void addMapping(String g2dGlyphDataClass, String g2dGlyphClass)
      Deprecated.
      add a MapObjectInterface to MapGlyph mapping.
      Parameters:
      g2dGlyphDataClass - the classname of the MapObjectInterface
      g2dGlyphClass - the classname of the MapGlyph
      See Also:
    • addMapping

      public static void addMapping(Class<?> g2dGlyphDataClass, Class<? extends G2dGlyph> g2dGlyphClass)
      add a Plot object to G2dGlyph mapping.
      Parameters:
      g2dGlyphDataClass - the class of the Plot object
      g2dGlyphClass - the class of the G2dGlyph
    • newG2dGlyph

      public static G2dGlyph newG2dGlyph(Viewport view, G2dObject obj, Scale scl)