AffineTransform

Discussion in 'Java' started by Thijs Muizelaar, Jan 11, 2008.

  1. For a my PhD project I'm programming a simulator in which a road network
    is displayed on a small map. This happens inside an extended JPanel. The
    size of the road network is larger than the size of this JPanel, so I
    applied an AffineTransform, such that the road network is displayed
    correctly inside the JPanel. In this network the origin and destination
    of a trip is also displayed (with the letters O and D).

    However, because of the large scaling, the stroke use for the lines is
    too thin. The same applies to the fontsize used for O and D. Is it
    possible to use the fontsize and the BasicStroke I defined in my code,
    without applying the AffineTransform? I can't think of a way, because
    the coordinates still have to be scaled and transformed properly. This
    would make the code independent from the size of the road network that I
    will use.

    Thanks in advance!

    Thijs
     
    Thijs Muizelaar, Jan 11, 2008
    #1
    1. Advertising

  2. Thijs Muizelaar

    Roedy Green Guest

    On Fri, 11 Jan 2008 11:40:08 +0100, Thijs Muizelaar
    <> wrote, quoted or indirectly quoted
    someone who said :

    >However, because of the large scaling, the stroke use for the lines is
    >too thin. The same applies to the fontsize used for O and D. Is it
    >possible to use the fontsize and the BasicStroke I defined in my code,
    >without applying the AffineTransform? I can't think of a way, because
    >the coordinates still have to be scaled and transformed properly. This
    >would make the code independent from the size of the road network that I
    >will use.


    I guess you have to scale up the width of your roads so they will be
    fat enough to see, ditto for lettering. You know your scale, so it is
    just a matter of multiplying to figure out the width you need to draw
    your road lines.
    --
    Roedy Green, Canadian Mind Products
    The Java Glossary, http://mindprod.com
     
    Roedy Green, Jan 11, 2008
    #2
    1. Advertising

  3. Thijs Muizelaar

    Wayne Guest

    Thijs Muizelaar wrote:
    > For a my PhD project I'm programming a simulator in which a road network
    > is displayed on a small map. This happens inside an extended JPanel. The
    > size of the road network is larger than the size of this JPanel, so I
    > applied an AffineTransform, such that the road network is displayed
    > correctly inside the JPanel. In this network the origin and destination
    > of a trip is also displayed (with the letters O and D).
    >
    > However, because of the large scaling, the stroke use for the lines is
    > too thin. The same applies to the fontsize used for O and D. Is it
    > possible to use the fontsize and the BasicStroke I defined in my code,
    > without applying the AffineTransform? I can't think of a way, because
    > the coordinates still have to be scaled and transformed properly. This
    > would make the code independent from the size of the road network that I
    > will use.
    >
    > Thanks in advance!
    >
    > Thijs


    You should pick a SansSerif font that uses constant-width strokes.
    Also try enabling some hinting in the Graphics2D object, e.g.:

    g2.setRenderingHint( RenderingHints.KEY_ANTIALIASING,
    RenderingHints.VALUE_ANTIALIAS_ON );

    -Wayne
     
    Wayne, Jan 11, 2008
    #3
  4. Thijs Muizelaar

    Roedy Green Guest

    On Fri, 11 Jan 2008 10:55:33 -0500, Wayne <>
    wrote, quoted or indirectly quoted someone who said :

    >You should pick a SansSerif font that uses constant-width strokes.
    >Also try enabling some hinting in the Graphics2D object, e.g.:


    if you can use a commercial font, consider the Tiresias family.
    http://mindprod.com/jgloss/tiresias.html

    It was designed for the people with visual impairment, so is easy to
    see at small font sizes.

    Also have a look at http://mindprod.com/jgloss/browserfonts.html
    to find a suitable font.

    see also http://mindprod.com/jgloss/font.html#PROGRAMMER
    for my recommended programmer fonts which are good at small sizes and
    have distinctive glyphs.
    --
    Roedy Green, Canadian Mind Products
    The Java Glossary, http://mindprod.com
     
    Roedy Green, Jan 11, 2008
    #4
  5. Thijs Muizelaar

    Wayne Guest

    Roedy Green wrote:
    > On Fri, 11 Jan 2008 10:55:33 -0500, Wayne <>
    > wrote, quoted or indirectly quoted someone who said :
    >
    >> You should pick a SansSerif font that uses constant-width strokes.
    >> Also try enabling some hinting in the Graphics2D object, e.g.:

    >
    > if you can use a commercial font, consider the Tiresias family.
    > http://mindprod.com/jgloss/tiresias.html


    That looks very useful. But from your sample on your site (and my
    browser resolution) it seems the kerning between "rn" needs to
    be increased. To me this looks like an 'm'.

    >
    > It was designed for the people with visual impairment, so is easy to
    > see at small font sizes.


    Microsoft also developed a font for this, Andale Mono (AndaleMo.ttf).
    AFAIK it is free, however MS no longer distributes this font (or any
    fonts) from their web site. Search the Internet for Andale.exe;
    if you don't have a Windows system just open the .exe with zip
    and extract the TTF file. It is very easy to read and all characters
    and symbols are easy to differentiate.

    -Wayne
     
    Wayne, Jan 11, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rick
    Replies:
    2
    Views:
    774
    Thomas Weidenfeller
    Oct 8, 2003
  2. hilz
    Replies:
    2
    Views:
    1,339
  3. SPG
    Replies:
    0
    Views:
    386
  4. news.skynet.be
    Replies:
    0
    Views:
    602
    news.skynet.be
    Mar 25, 2005
  5. fiziwig
    Replies:
    10
    Views:
    2,397
    Thomas Weidenfeller
    Aug 14, 2006
Loading...

Share This Page