bpelakh

Using toImageFile() on IMoleSymbol

Discussion created by bpelakh on Jun 3, 2010
I am trying to create a MOLE symbol selection dialog, since unfortunately DefenseSolutions does not give me a nice tool I can use through the API to place MilStd 2525 annotations on the map.

In my symbol selection dialog I have a JLabel which I use for a symbol preview. I create the appropriate IMoleSymbol (IMoleMarker, IMoleLine or IMoleFill), and then use .toImageFile() w/ a dummy Geometry argument (point, line or polygon) to create a preview image, which I then load into the JLabel (as a .bmp). This works ... sometimes. Even though I specify width and height for the output (which is the size of the .bmp created), the actual image can be a LOT bigger (and thus it gets cropped in the output) or a LOT smaller (resulting in a tiny blob in the center of the large .bmp). Sometimes the lines and areas fail to render entirely, giving me the geometry outlined in pink lines (w/ solid black fill, for areas).

I cannot discern the difference between the cases that work and the ones that don't - what all do I need to set on the symbol to get it to output properly? Is there anything else that functionality is dependent on? Also, is there a way to create the image in memory in such a way that I can put it into a label directly, as opposed to having to go through the file?

Outcomes