RE: [OpenMap Users] OMScalingIcon not re-rendering after property change

From: Benito, Robert P. <rbenito_at_mitre.org>
Date: Wed, 14 Jan 2009 08:57:26 -0500

Using select() did the trick. Thanks!

-----Original Message-----
From: Don Dietrick [mailto:dietrick_at_bbn.com]
Sent: Tuesday, January 13, 2009 6:56 PM
To: Benito, Robert P.
Cc: openmap-users_at_bbn.com
Subject: Re: [OpenMap Users] OMScalingIcon not re-rendering after property change

Hi,

Your code looks OK at first glance, i.e. your approach seems OK - the
matting paint is black by default, you are setting matting to true,
you are generating the raster (not sure if you really have to do that,
since the raster isn't moving, but no harm) and calling repaint().


Ahh, this might matter, just checked the code. Looks like the
boundary rectangle doesn't get rendered unless the OMScalingIcon is
selected(). So if you just want a box to be drawn around the image,
setSelected(true) on the icon, you don't really have to set the
matting. That will render a box around it with the select color. If
you want the matted look as well when it's selected, then also set
matted to true and the matting color, and also set selected.

Hope this helps,

Don

On Jan 12, 2009, at 9:18 AM, SlikWilly wrote:

>
>
> Hi,
> I am trying to set the matting on the an OMScalingIcon whenever the
> icon
> is in a predefined Rectangle. My code (below) is able to identify
> when an
> OMSCalingIcon is in the Rectangle, and it sets the Matting on the
> icon (I've
> verified this through breakpoints), but the OMScalingIcon matting is
> not
> being shown on the map. I've attached the pertinent methods of my
> Layer
> class below. Any suggestions on how to get this working?
>
> Thanks
>
>
>
> public void findInRectangle(){
> int listSize = myOMGraphicList.size();
> if(listSize == 0){return;}
> int counter = 0;
>
> while(counter <= listSize - 1){
> OMScalingIcon graphicToTest = (OMScalingIcon)
> myOMGraphicList.getOMGraphicAt(counter);
>
> //areaDrawn is a predefined Rectangle object
> if(areaDrawn.contains(graphicToTest.getMapLocation())){
> //Set the matting of the OMGraphic
> System.out.println("In the rectangle");
> graphicToTest.setMatted(Boolean.TRUE);
> graphicToTest.regenerate(getProjection());
> }
> else{
> System.out.println("Not in the rectangle");
> }
> counter++;
> }
> update();
> }
>
> private void update(){
> myOMGraphicList.generate(getProjection());
> repaint();
> }
>
> public void projectionChanged(ProjectionEvent e) {
> this.setProjection(e);
> myOMGraphicList.project(e.getProjection(), true);
> repaint();
> }
>
> public void paint(java.awt.Graphics g) {
> myOMGraphicList.render(g);
> }
> --
> View this message in context: http://www.nabble.com/OMScalingIcon-not-re-rendering-after-property-change-tp21415302p21415302.html
> Sent from the OpenMap mailing list archive at Nabble.com.
>
> --
> [To unsubscribe to this list send an email to "majdart_at_bbn.com"
> with the following text in the BODY of the message "unsubscribe
> openmap-users"]

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Wed Jan 14 2009 - 08:58:12 EST

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:09 EDT