|
Posted by Paul Cooper on May 5, 2004, 1:16 pm
Please log in for more thread options On 5 May 2004 04:25:21 -0700, simon_chenery@yahoo.com wrote:
>> On 3 May 2004 23:58:38 -0700, simon_chenery@yahoo.com wrote:
>>
>> >Paul,
>> >
>> >> I am writing a Java application to display map data. It is very
>> >> simple, written using 2D graphics, and I use the AffineTransform
>> >> object to translate the Graphics2D from world space to screen space.
>> >> This works fine except that I cannot find a way of plotting a constant
>> >> sized marker! Java doesn't have a "marker" type of graphical object -
>> >> [snip]
>> >
>> >I do exactly this in my Java-based project 'Mapyrus' (freely available from
>> >http://www.chenery.id.au/mapyrus).
>> >
>> >To achieve constant size markers I do not apply an AffineTransform
>> >to my Graphics2D object. I use an AffineTransform independently
>> >to transform the map data to pixel coordinates. Then I use pass the
>> >pixel coordinate values I have calculated to Graphics2D drawLine()
>> >and fillPolygon() methods.
>> >
>> >Simon.
>>
>> Thanks, Simon. Unfortunately the way I have done it is pretty deeply
>> embedded in my code, and re-writing it this way may be too hard. I did
>> it that way because I suspected it would be more efficient that way -
>> any opinion? I should say that this is a display sub-system for what
>
>A workaround may be to draw your fixed size marker symbols to a BufferedImage
>and then use Graphics2D.drawImage() to blat the image containing the
>correctly sized symbols into your map image.
>
>Or, if you can use characters from a font as symbols then you may be
>able to set a font with appropriate size and Graphics2D.drawString()
>to draw each symbol with the correct size.
>
>Simon.
Thanks, Simon - all good ideas! I'll have another go at it.
Paul
|