• No replies
80 Posts

Pinned topic Text above IlvEllipse

‏2013-06-11T05:42:05Z |


I have 2 questions regarding ellipse drawing:

1. How can I change\update ellipse bounding box\location after creation?

2. I'm trying to draw an ellipse object and a text above it.

I'm trying to use the IlvCompositeGraphic to achieve it.

I'm using the following code:

  IlvCompositeGraphic compositeGraphic = new IlvCompositeGraphic();

  IlvAttachmentLayout layout = new IlvAttachmentLayout();

  compositeGraphic.setLayout( layout);                

   // create first child (base) - Ellipse graphic object

   Rectangle2D.Float ellipseRect = ellipseObject.getEllipseRect();

   IlvRect ellispeRect = new IlvRect(ellipseRect.x, ellipseRect.y, ellipseRect.width, ellipseRect.height);

   IlvEllipse ilvgraphic =  new IlvEllipse(ellispeRect);

   compositeGraphic.setChildren( 0, ilvgraphic);

// create upper label              

   IlvLabel upperLabelGraphic = new IlvLabel();           

   upperLabelGraphic.setLabel(" test label");             

   compositeGraphic.setChildren( 1, upperLabelGraphic);                    

    // create the constraint - label is attached on top center of the ellipse.

     IlvAttachmentConstraint topCenterConstaint = new IlvAttachmentConstraint( IlvAttachmentLocation. BottomCenter, IlvAttachmentLocation. TopCenter);

     compositeGraphic. setConstraints(1, topCenterConstaint);              

   // add the compsoite object to the manager

m_manager.addObject(graphic, layerIndex, true);


However, the ellipse is drawn in the right place but the text appears way above the ellipse. Is there something I missed or Is there another way I can use to draw as requested? (manager is set to use IlvGeographicCoordinateSystem. WGS84 as its Coordinate System).

Thanks a lot in advance,