Possible bug with GraphicGroup

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Possible bug with GraphicGroup

McCool, Bob

I am trying to remove a polygon object from an AOI layer and replace it with another object that has been moved slightly.  The problem is that the attributes of the new object ( color, fill, etc. ) are not getting set correctly.  The code snippet below shows basically what I am trying to do ( minus some details such as where the new vertices come from, etc. ):

 

GraphicGroup *pGroup = pAoi->getGroup ();

std::list<GraphicObject*> objects = pGroup->getObjects ();

 

PolygonObject *pPolygon = model_cast<PolygonObject*> objects.begin ();

double lineWidth = pPolygon->getLineWidth ();

colorType color = pPolygon->getColor ();

LineStyle lineStyle = pPolygon->getLineStyle ();

bool success = pGroup->removeObject ( pPolygon, true );

 

std::vector<LocationType> newVertices;

 

GraphicObject *pNewPolygon = pGroup->addObject ( POLYGON_OBJECT );

success = pNewPolygon->addVertices ( newVertices );

success = pNewPolygon->setLineColor ( color );

success = pNewPolygon->setLineWidth ( lineWidth );

success = pNewPolygon->setLineStyle ( lineStyle );

success = pNewPolygon->setFillState ( false );

 

 

 

I have noticed that at the end of this code the pPolygon pointer is still valid, even though the object should have been deleted, and that pPolygon and pNewPolygon are pointing to the same object.  Is this a bug in the GraphicGroup code? 

 

I have tried adding the new object before deleting the old object, but that doesn’t make any difference.  Also, if I don’t remove the old object then I am able to set all of the attributes, but obviously I am left with a bunch of objects that I don’t want in the AOI.

 

 


This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.
Reply | Threaded
Open this post in threaded view
|

RE: Possible bug with GraphicGroup

Kip Streithorst
Administrator

Besides recommending you use a dynamic_cast<> instead of a model_cast<>, just by reading the source code everything looks good.  My only thought is that you say that pPolygon and pNewPolygon are the same object, what do you mean by that?  It is possible that pPolygon was deleted and that pGroup->addObject( POLYGON_OBJECT ) created a new polygon object at the same pointer address as the previous polygon.  Can you verify after calling pGroup->removeObject( pPolygon, true ); that pPolygon has actually been destroyed?  So far that’s my only idea, the code you have appears to be correct.

 

Thanks,

Kip

 


From: McCool, Bob [mailto:[hidden email]]
Sent: Tuesday, May 27, 2008 2:04 PM
To: [hidden email]
Subject: Possible bug with GraphicGroup

 

I am trying to remove a polygon object from an AOI layer and replace it with another object that has been moved slightly.  The problem is that the attributes of the new object ( color, fill, etc. ) are not getting set correctly.  The code snippet below shows basically what I am trying to do ( minus some details such as where the new vertices come from, etc. ):

 

GraphicGroup *pGroup = pAoi->getGroup ();

std::list<GraphicObject*> objects = pGroup->getObjects ();

 

PolygonObject *pPolygon = model_cast<PolygonObject*> objects.begin ();

double lineWidth = pPolygon->getLineWidth ();

colorType color = pPolygon->getColor ();

LineStyle lineStyle = pPolygon->getLineStyle ();

bool success = pGroup->removeObject ( pPolygon, true );

 

std::vector<LocationType> newVertices;

 

GraphicObject *pNewPolygon = pGroup->addObject ( POLYGON_OBJECT );

success = pNewPolygon->addVertices ( newVertices );

success = pNewPolygon->setLineColor ( color );

success = pNewPolygon->setLineWidth ( lineWidth );

success = pNewPolygon->setLineStyle ( lineStyle );

success = pNewPolygon->setFillState ( false );

 

 

 

I have noticed that at the end of this code the pPolygon pointer is still valid, even though the object should have been deleted, and that pPolygon and pNewPolygon are pointing to the same object.  Is this a bug in the GraphicGroup code? 

 

I have tried adding the new object before deleting the old object, but that doesn’t make any difference.  Also, if I don’t remove the old object then I am able to set all of the attributes, but obviously I am left with a bunch of objects that I don’t want in the AOI.

 

 


This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.
Reply | Threaded
Open this post in threaded view
|

RE: RE: Possible bug with GraphicGroup

McCool, Bob

Kip,

 

Yes, I verified that the polygon object is being destroyed after pGroup->removeObject () is called.  What I was seeing was that, in some cases, the new object was being created at the same location, so the old pointer was again pointing at a valid object. 

 

The real problem is that I can’t set any of the parameters on the GraphicObject programmatically.  After some more experimentation, I found that I can’t set any parameters on a graphic object via the user interface either.  If I create a new AOI layer, add a polygon object, and attempt to change its fill type, line color, etc. via the properties dialog, nothing happens.  Do you see the same thing?  Do you have any suggestions for a workaround?

 

Bob

 


From: Streithorst, Kip [mailto:[hidden email]]
Sent: Wednesday, May 28, 2008 3:06 PM
To: [hidden email]
Subject: RE: Possible bug with GraphicGroup

 

Besides recommending you use a dynamic_cast<> instead of a model_cast<>, just by reading the source code everything looks good.  My only thought is that you say that pPolygon and pNewPolygon are the same object, what do you mean by that?  It is possible that pPolygon was deleted and that pGroup->addObject( POLYGON_OBJECT ) created a new polygon object at the same pointer address as the previous polygon.  Can you verify after calling pGroup->removeObject( pPolygon, true ); that pPolygon has actually been destroyed?  So far that’s my only idea, the code you have appears to be correct.

 

Thanks,

Kip

 


From: McCool, Bob [mailto:[hidden email]]
Sent: Tuesday, May 27, 2008 2:04 PM
To: [hidden email]
Subject: Possible bug with GraphicGroup

 

I am trying to remove a polygon object from an AOI layer and replace it with another object that has been moved slightly.  The problem is that the attributes of the new object ( color, fill, etc. ) are not getting set correctly.  The code snippet below shows basically what I am trying to do ( minus some details such as where the new vertices come from, etc. ):

 

GraphicGroup *pGroup = pAoi->getGroup ();

std::list<GraphicObject*> objects = pGroup->getObjects ();

 

PolygonObject *pPolygon = model_cast<PolygonObject*> objects.begin ();

double lineWidth = pPolygon->getLineWidth ();

colorType color = pPolygon->getColor ();

LineStyle lineStyle = pPolygon->getLineStyle ();

bool success = pGroup->removeObject ( pPolygon, true );

 

std::vector<LocationType> newVertices;

 

GraphicObject *pNewPolygon = pGroup->addObject ( POLYGON_OBJECT );

success = pNewPolygon->addVertices ( newVertices );

success = pNewPolygon->setLineColor ( color );

success = pNewPolygon->setLineWidth ( lineWidth );

success = pNewPolygon->setLineStyle ( lineStyle );

success = pNewPolygon->setFillState ( false );

 

 

 

I have noticed that at the end of this code the pPolygon pointer is still valid, even though the object should have been deleted, and that pPolygon and pNewPolygon are pointing to the same object.  Is this a bug in the GraphicGroup code? 

 

I have tried adding the new object before deleting the old object, but that doesn’t make any difference.  Also, if I don’t remove the old object then I am able to set all of the attributes, but obviously I am left with a bunch of objects that I don’t want in the AOI.

 

 


This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.
Reply | Threaded
Open this post in threaded view
|

RE: RE: RE: Possible bug with GraphicGroup

Forehand, Richard
Message
Bob,
 
Here's a screen shot of polygon and rectangle AOI's that I changed to hatch via the objects properties pages:
 
 
Maybe you didn't change both the Fill Style to "Hatch" and the Hatch symbol to something other than solid.
 
 
 
Dick
-----Original Message-----
From: McCool, Bob [mailto:[hidden email]]
Sent: Thursday, May 29, 2008 1:46 PM
To: [hidden email]
Subject: RE: RE: Possible bug with GraphicGroup

Kip,

 

Yes, I verified that the polygon object is being destroyed after pGroup->removeObject () is called.  What I was seeing was that, in some cases, the new object was being created at the same location, so the old pointer was again pointing at a valid object. 

 

The real problem is that I can’t set any of the parameters on the GraphicObject programmatically.  After some more experimentation, I found that I can’t set any parameters on a graphic object via the user interface either.  If I create a new AOI layer, add a polygon object, and attempt to change its fill type, line color, etc. via the properties dialog, nothing happens.  Do you see the same thing?  Do you have any suggestions for a workaround?

 

Bob

 


From: Streithorst, Kip [mailto:[hidden email]]
Sent: Wednesday, May 28, 2008 3:06 PM
To: [hidden email]
Subject: RE: Possible bug with GraphicGroup

 

Besides recommending you use a dynamic_cast<> instead of a model_cast<>, just by reading the source code everything looks good.  My only thought is that you say that pPolygon and pNewPolygon are the same object, what do you mean by that?  It is possible that pPolygon was deleted and that pGroup->addObject( POLYGON_OBJECT ) created a new polygon object at the same pointer address as the previous polygon.  Can you verify after calling pGroup->removeObject( pPolygon, true ); that pPolygon has actually been destroyed?  So far that’s my only idea, the code you have appears to be correct.

 

Thanks,

Kip

 


From: McCool, Bob [mailto:[hidden email]]
Sent: Tuesday, May 27, 2008 2:04 PM
To: [hidden email]
Subject: Possible bug with GraphicGroup

 

I am trying to remove a polygon object from an AOI layer and replace it with another object that has been moved slightly.  The problem is that the attributes of the new object ( color, fill, etc. ) are not getting set correctly.  The code snippet below shows basically what I am trying to do ( minus some details such as where the new vertices come from, etc. ):

 

GraphicGroup *pGroup = pAoi->getGroup ();

std::list<GraphicObject*> objects = pGroup->getObjects ();

 

PolygonObject *pPolygon = model_cast<PolygonObject*> objects.begin ();

double lineWidth = pPolygon->getLineWidth ();

colorType color = pPolygon->getColor ();

LineStyle lineStyle = pPolygon->getLineStyle ();

bool success = pGroup->removeObject ( pPolygon, true );

 

std::vector<LocationType> newVertices;

 

GraphicObject *pNewPolygon = pGroup->addObject ( POLYGON_OBJECT );

success = pNewPolygon->addVertices ( newVertices );

success = pNewPolygon->setLineColor ( color );

success = pNewPolygon->setLineWidth ( lineWidth );

success = pNewPolygon->setLineStyle ( lineStyle );

success = pNewPolygon->setFillState ( false );

 

 

 

I have noticed that at the end of this code the pPolygon pointer is still valid, even though the object should have been deleted, and that pPolygon and pNewPolygon are pointing to the same object.  Is this a bug in the GraphicGroup code? 

 

I have tried adding the new object before deleting the old object, but that doesn’t make any difference.  Also, if I don’t remove the old object then I am able to set all of the attributes, but obviously I am left with a bunch of objects that I don’t want in the AOI.

 

 

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.
This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.
This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.
Reply | Threaded
Open this post in threaded view
|

RE: RE: RE: Possible bug with GraphicGroup

Kip Streithorst
Administrator
In reply to this post by McCool, Bob

Are you talking about AOIs or Annotations?  It’s important and may explain some of your problems.

 

Thanks,

Kip

 


From: McCool, Bob [mailto:[hidden email]]
Sent: Thursday, May 29, 2008 4:46 PM
To: [hidden email]
Subject: RE: RE: Possible bug with GraphicGroup

 

Kip,

 

Yes, I verified that the polygon object is being destroyed after pGroup->removeObject () is called.  What I was seeing was that, in some cases, the new object was being created at the same location, so the old pointer was again pointing at a valid object. 

 

The real problem is that I can’t set any of the parameters on the GraphicObject programmatically.  After some more experimentation, I found that I can’t set any parameters on a graphic object via the user interface either.  If I create a new AOI layer, add a polygon object, and attempt to change its fill type, line color, etc. via the properties dialog, nothing happens.  Do you see the same thing?  Do you have any suggestions for a workaround?

 

Bob

 


From: Streithorst, Kip [mailto:[hidden email]]
Sent: Wednesday, May 28, 2008 3:06 PM
To: [hidden email]
Subject: RE: Possible bug with GraphicGroup

 

Besides recommending you use a dynamic_cast<> instead of a model_cast<>, just by reading the source code everything looks good.  My only thought is that you say that pPolygon and pNewPolygon are the same object, what do you mean by that?  It is possible that pPolygon was deleted and that pGroup->addObject( POLYGON_OBJECT ) created a new polygon object at the same pointer address as the previous polygon.  Can you verify after calling pGroup->removeObject( pPolygon, true ); that pPolygon has actually been destroyed?  So far that’s my only idea, the code you have appears to be correct.

 

Thanks,

Kip

 


From: McCool, Bob [mailto:[hidden email]]
Sent: Tuesday, May 27, 2008 2:04 PM
To: [hidden email]
Subject: Possible bug with GraphicGroup

 

I am trying to remove a polygon object from an AOI layer and replace it with another object that has been moved slightly.  The problem is that the attributes of the new object ( color, fill, etc. ) are not getting set correctly.  The code snippet below shows basically what I am trying to do ( minus some details such as where the new vertices come from, etc. ):

 

GraphicGroup *pGroup = pAoi->getGroup ();

std::list<GraphicObject*> objects = pGroup->getObjects ();

 

PolygonObject *pPolygon = model_cast<PolygonObject*> objects.begin ();

double lineWidth = pPolygon->getLineWidth ();

colorType color = pPolygon->getColor ();

LineStyle lineStyle = pPolygon->getLineStyle ();

bool success = pGroup->removeObject ( pPolygon, true );

 

std::vector<LocationType> newVertices;

 

GraphicObject *pNewPolygon = pGroup->addObject ( POLYGON_OBJECT );

success = pNewPolygon->addVertices ( newVertices );

success = pNewPolygon->setLineColor ( color );

success = pNewPolygon->setLineWidth ( lineWidth );

success = pNewPolygon->setLineStyle ( lineStyle );

success = pNewPolygon->setFillState ( false );

 

 

 

I have noticed that at the end of this code the pPolygon pointer is still valid, even though the object should have been deleted, and that pPolygon and pNewPolygon are pointing to the same object.  Is this a bug in the GraphicGroup code? 

 

I have tried adding the new object before deleting the old object, but that doesn’t make any difference.  Also, if I don’t remove the old object then I am able to set all of the attributes, but obviously I am left with a bunch of objects that I don’t want in the AOI.

 

 


This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.
Reply | Threaded
Open this post in threaded view
|

RE: RE: RE: RE: Possible bug with GraphicGroup

McCool, Bob

I’m adding GraphicObjects to the GraphicGroup in an AoiElement ( pAoi in the code sample ).

 


From: Streithorst, Kip [mailto:[hidden email]]
Sent: Friday, May 30, 2008 7:47 AM
To: [hidden email]
Subject: RE: RE: RE: Possible bug with GraphicGroup

 

Are you talking about AOIs or Annotations?  It’s important and may explain some of your problems.

 

Thanks,

Kip

 


From: McCool, Bob [mailto:[hidden email]]
Sent: Thursday, May 29, 2008 4:46 PM
To: [hidden email]
Subject: RE: RE: Possible bug with GraphicGroup

 

Kip,

 

Yes, I verified that the polygon object is being destroyed after pGroup->removeObject () is called.  What I was seeing was that, in some cases, the new object was being created at the same location, so the old pointer was again pointing at a valid object. 

 

The real problem is that I can’t set any of the parameters on the GraphicObject programmatically.  After some more experimentation, I found that I can’t set any parameters on a graphic object via the user interface either.  If I create a new AOI layer, add a polygon object, and attempt to change its fill type, line color, etc. via the properties dialog, nothing happens.  Do you see the same thing?  Do you have any suggestions for a workaround?

 

Bob

 


From: Streithorst, Kip [mailto:[hidden email]]
Sent: Wednesday, May 28, 2008 3:06 PM
To: [hidden email]
Subject: RE: Possible bug with GraphicGroup

 

Besides recommending you use a dynamic_cast<> instead of a model_cast<>, just by reading the source code everything looks good.  My only thought is that you say that pPolygon and pNewPolygon are the same object, what do you mean by that?  It is possible that pPolygon was deleted and that pGroup->addObject( POLYGON_OBJECT ) created a new polygon object at the same pointer address as the previous polygon.  Can you verify after calling pGroup->removeObject( pPolygon, true ); that pPolygon has actually been destroyed?  So far that’s my only idea, the code you have appears to be correct.

 

Thanks,

Kip

 


From: McCool, Bob [mailto:[hidden email]]
Sent: Tuesday, May 27, 2008 2:04 PM
To: [hidden email]
Subject: Possible bug with GraphicGroup

 

I am trying to remove a polygon object from an AOI layer and replace it with another object that has been moved slightly.  The problem is that the attributes of the new object ( color, fill, etc. ) are not getting set correctly.  The code snippet below shows basically what I am trying to do ( minus some details such as where the new vertices come from, etc. ):

 

GraphicGroup *pGroup = pAoi->getGroup ();

std::list<GraphicObject*> objects = pGroup->getObjects ();

 

PolygonObject *pPolygon = model_cast<PolygonObject*> objects.begin ();

double lineWidth = pPolygon->getLineWidth ();

colorType color = pPolygon->getColor ();

LineStyle lineStyle = pPolygon->getLineStyle ();

bool success = pGroup->removeObject ( pPolygon, true );

 

std::vector<LocationType> newVertices;

 

GraphicObject *pNewPolygon = pGroup->addObject ( POLYGON_OBJECT );

success = pNewPolygon->addVertices ( newVertices );

success = pNewPolygon->setLineColor ( color );

success = pNewPolygon->setLineWidth ( lineWidth );

success = pNewPolygon->setLineStyle ( lineStyle );

success = pNewPolygon->setFillState ( false );

 

 

 

I have noticed that at the end of this code the pPolygon pointer is still valid, even though the object should have been deleted, and that pPolygon and pNewPolygon are pointing to the same object.  Is this a bug in the GraphicGroup code? 

 

I have tried adding the new object before deleting the old object, but that doesn’t make any difference.  Also, if I don’t remove the old object then I am able to set all of the attributes, but obviously I am left with a bunch of objects that I don’t want in the AOI.

 

 


This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.
Reply | Threaded
Open this post in threaded view
|

RE: RE: RE: RE: RE: Possible bug with GraphicGroup

Kip Streithorst
Administrator

That might partially explain the problems you’re seeing.  Currently, both the AoiLayer and individual graphic objects specifiy how object’s should be drawn and currently this behaves in weird and interesting ways.  You may be setting properties on the graphic object that the AoiLayer is in effect overwriting when the layer is drawn.  I would suggest you look into that.

 

Thanks,

Kip

 


From: McCool, Bob [mailto:[hidden email]]
Sent: Friday, May 30, 2008 9:02 AM
To: [hidden email]
Subject: RE: RE: RE: RE: Possible bug with GraphicGroup

 

I’m adding GraphicObjects to the GraphicGroup in an AoiElement ( pAoi in the code sample ).

 


From: Streithorst, Kip [mailto:[hidden email]]
Sent: Friday, May 30, 2008 7:47 AM
To: [hidden email]
Subject: RE: RE: RE: Possible bug with GraphicGroup

 

Are you talking about AOIs or Annotations?  It’s important and may explain some of your problems.

 

Thanks,

Kip

 


From: McCool, Bob [mailto:[hidden email]]
Sent: Thursday, May 29, 2008 4:46 PM
To: [hidden email]
Subject: RE: RE: Possible bug with GraphicGroup

 

Kip,

 

Yes, I verified that the polygon object is being destroyed after pGroup->removeObject () is called.  What I was seeing was that, in some cases, the new object was being created at the same location, so the old pointer was again pointing at a valid object. 

 

The real problem is that I can’t set any of the parameters on the GraphicObject programmatically.  After some more experimentation, I found that I can’t set any parameters on a graphic object via the user interface either.  If I create a new AOI layer, add a polygon object, and attempt to change its fill type, line color, etc. via the properties dialog, nothing happens.  Do you see the same thing?  Do you have any suggestions for a workaround?

 

Bob

 


From: Streithorst, Kip [mailto:[hidden email]]
Sent: Wednesday, May 28, 2008 3:06 PM
To: [hidden email]
Subject: RE: Possible bug with GraphicGroup

 

Besides recommending you use a dynamic_cast<> instead of a model_cast<>, just by reading the source code everything looks good.  My only thought is that you say that pPolygon and pNewPolygon are the same object, what do you mean by that?  It is possible that pPolygon was deleted and that pGroup->addObject( POLYGON_OBJECT ) created a new polygon object at the same pointer address as the previous polygon.  Can you verify after calling pGroup->removeObject( pPolygon, true ); that pPolygon has actually been destroyed?  So far that’s my only idea, the code you have appears to be correct.

 

Thanks,

Kip

 


From: McCool, Bob [mailto:[hidden email]]
Sent: Tuesday, May 27, 2008 2:04 PM
To: [hidden email]
Subject: Possible bug with GraphicGroup

 

I am trying to remove a polygon object from an AOI layer and replace it with another object that has been moved slightly.  The problem is that the attributes of the new object ( color, fill, etc. ) are not getting set correctly.  The code snippet below shows basically what I am trying to do ( minus some details such as where the new vertices come from, etc. ):

 

GraphicGroup *pGroup = pAoi->getGroup ();

std::list<GraphicObject*> objects = pGroup->getObjects ();

 

PolygonObject *pPolygon = model_cast<PolygonObject*> objects.begin ();

double lineWidth = pPolygon->getLineWidth ();

colorType color = pPolygon->getColor ();

LineStyle lineStyle = pPolygon->getLineStyle ();

bool success = pGroup->removeObject ( pPolygon, true );

 

std::vector<LocationType> newVertices;

 

GraphicObject *pNewPolygon = pGroup->addObject ( POLYGON_OBJECT );

success = pNewPolygon->addVertices ( newVertices );

success = pNewPolygon->setLineColor ( color );

success = pNewPolygon->setLineWidth ( lineWidth );

success = pNewPolygon->setLineStyle ( lineStyle );

success = pNewPolygon->setFillState ( false );

 

 

 

I have noticed that at the end of this code the pPolygon pointer is still valid, even though the object should have been deleted, and that pPolygon and pNewPolygon are pointing to the same object.  Is this a bug in the GraphicGroup code? 

 

I have tried adding the new object before deleting the old object, but that doesn’t make any difference.  Also, if I don’t remove the old object then I am able to set all of the attributes, but obviously I am left with a bunch of objects that I don’t want in the AOI.

 

 


This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.
Reply | Threaded
Open this post in threaded view
|

RE: RE: RE: RE: RE: Possible bug with GraphicGroup

Kip Streithorst
Administrator
In reply to this post by McCool, Bob
You may want to look at this issue in JIRA, I think it describes at least one of the problems you're encountering.

https://issues.ballforge.net/jira/browse/OPTICKS-126

Thanks,
Kip

________________________________________
From: Streithorst, Kip
Sent: Friday, May 30, 2008 4:10 PM
To: '[hidden email]'
Subject: RE: RE: RE: RE: RE: Possible bug with GraphicGroup

That might partially explain the problems you're seeing.  Currently, both the AoiLayer and individual graphic objects specifiy how object's should be drawn and currently this behaves in weird and interesting ways.  You may be setting properties on the graphic object that the AoiLayer is in effect overwriting when the layer is drawn.  I would suggest you look into that.

Thanks,
Kip

________________________________________
From: McCool, Bob [mailto:[hidden email]]
Sent: Friday, May 30, 2008 9:02 AM
To: [hidden email]
Subject: RE: RE: RE: RE: Possible bug with GraphicGroup

I'm adding GraphicObjects to the GraphicGroup in an AoiElement ( pAoi in the code sample ).
 
________________________________________
From: Streithorst, Kip [mailto:[hidden email]]
Sent: Friday, May 30, 2008 7:47 AM
To: [hidden email]
Subject: RE: RE: RE: Possible bug with GraphicGroup
 
Are you talking about AOIs or Annotations?  It's important and may explain some of your problems.
 
Thanks,
Kip
 
________________________________________
From: McCool, Bob [mailto:[hidden email]]
Sent: Thursday, May 29, 2008 4:46 PM
To: [hidden email]
Subject: RE: RE: Possible bug with GraphicGroup
 
Kip,
 
Yes, I verified that the polygon object is being destroyed after pGroup->removeObject () is called.  What I was seeing was that, in some cases, the new object was being created at the same location, so the old pointer was again pointing at a valid object. 
 
The real problem is that I can't set any of the parameters on the GraphicObject programmatically.  After some more experimentation, I found that I can't set any parameters on a graphic object via the user interface either.  If I create a new AOI layer, add a polygon object, and attempt to change its fill type, line color, etc. via the properties dialog, nothing happens.  Do you see the same thing?  Do you have any suggestions for a workaround?
 
Bob
 
________________________________________
From: Streithorst, Kip [mailto:[hidden email]]
Sent: Wednesday, May 28, 2008 3:06 PM
To: [hidden email]
Subject: RE: Possible bug with GraphicGroup
 
Besides recommending you use a dynamic_cast<> instead of a model_cast<>, just by reading the source code everything looks good.  My only thought is that you say that pPolygon and pNewPolygon are the same object, what do you mean by that?  It is possible that pPolygon was deleted and that pGroup->addObject( POLYGON_OBJECT ) created a new polygon object at the same pointer address as the previous polygon.  Can you verify after calling pGroup->removeObject( pPolygon, true ); that pPolygon has actually been destroyed?  So far that's my only idea, the code you have appears to be correct.
 
Thanks,
Kip
 
________________________________________
From: McCool, Bob [mailto:[hidden email]]
Sent: Tuesday, May 27, 2008 2:04 PM
To: [hidden email]
Subject: Possible bug with GraphicGroup
 
I am trying to remove a polygon object from an AOI layer and replace it with another object that has been moved slightly.  The problem is that the attributes of the new object ( color, fill, etc. ) are not getting set correctly.  The code snippet below shows basically what I am trying to do ( minus some details such as where the new vertices come from, etc. ):
 
GraphicGroup *pGroup = pAoi->getGroup ();
std::list<GraphicObject*> objects = pGroup->getObjects ();
 
PolygonObject *pPolygon = model_cast<PolygonObject*> objects.begin ();
double lineWidth = pPolygon->getLineWidth ();
colorType color = pPolygon->getColor ();
LineStyle lineStyle = pPolygon->getLineStyle ();
bool success = pGroup->removeObject ( pPolygon, true );
 
std::vector<LocationType> newVertices;
 
GraphicObject *pNewPolygon = pGroup->addObject ( POLYGON_OBJECT );
success = pNewPolygon->addVertices ( newVertices );
success = pNewPolygon->setLineColor ( color );
success = pNewPolygon->setLineWidth ( lineWidth );
success = pNewPolygon->setLineStyle ( lineStyle );
success = pNewPolygon->setFillState ( false );
 
 
 
I have noticed that at the end of this code the pPolygon pointer is still valid, even though the object should have been deleted, and that pPolygon and pNewPolygon are pointing to the same object.  Is this a bug in the GraphicGroup code? 
 
I have tried adding the new object before deleting the old object, but that doesn't make any difference.  Also, if I don't remove the old object then I am able to set all of the attributes, but obviously I am left with a bunch of objects that I don't want in the AOI.
 
 



This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]