AnsweredAssumed Answered

Get the Image out from ISymbol using ArcObjects Java

Question asked by rtolapi on Mar 2, 2018
Latest reply on Mar 21, 2018 by rtolapi

Can someone help me please for the relevant Java code of the below C# function.

I am having trouble to pass the first argument i.e. “hDC” for ISymbol.setupDC method. For variable “g”, I am using Java “java.awt.Graphics2D” class as an equivalent of C# “System.Drawing.Graphics”.

 

private static Image PointSymbolToImage(ISymbol symbol, Size imageSize) {
        
double (imageSize.Width / 2);
        double 
((imageSize.Height - 1) / 2);


        
IPoint point = new PointClass();
        
point.PutCoords(x, y);


        
Bitmap bmp = new Bitmap(imageSize.Width, imageSize.Height);
        
Graphics g Graphics.FromImage(bmp);


        
symbol.SetupDC(g.GetHdc().ToInt32(), null);
        try 
{
            symbol.Draw(point)
;
        
}
        
catch (System.Exception ) {

        }
        symbol.ResetDC()
;


        
g.Dispose();


        return
(Image) bmp;
}

 

The specified item was not found. Esri Technical Support ArcObjects SDK ArcObjects.NET ArcGIS Runtime SDK for Java

Outcomes