STK ObjectsSend comments on this topic.
Recycling Property (IAgMtoTrackCollection)
See Also
Windows





Windows & Linux

Description

Recycling is used for optimizing performance in iterative modification or addition of elements in a particular collection (see Remarks section for this property).

Property type

Read-write property

Syntax

[Visual Basic .NET]
Public Property Recycling() As Boolean
[C#]
public bool Recycling {get; set;}
[Managed C++]
public: __property bool get_Recycling();
public: __property void set_Recycling( bool );
[Unmanaged C++]
public: HRESULT get_Recycling(
    VARIANT_BOOL * pVal
);
public: HRESULT put_Recycling(
    VARIANT_BOOL pVal
);
[Java]
public bool getRecycling();
public void setRecycling(
    bool
);
[Python - STK API ]
@property
def Recycling(self) -> bool:

@Recycling.setter
def Recycling(self, pVal:bool) -> None:

Remarks

Recycling is used for optimizing performance in iterative modification or addition of elements in a particular collection. The elements returned by a recycling collection are not unique instances; rather they are references to an existing instantiation cached within the collection that has the attributes of the last element accessed. Note that recycling is not currently supported for collection enumeration.

Recycling is useful for iterating through a collection, since it enables you to remove the cost of the instantiation. For instance:

AGI.STKObjects.IAgMtoGfxTrackCollection oTrackCollectionGfx =
(AGI.STKObjects.IAgMtoGfxTrackCollection)AG_MTO.Graphics.Tracks;


oTrackCollectionGfx.Recycling = true;


for (int i = 0 ; i < oTrackCollectionGfx.Count; ++i)
{
oTrackCollectionGfx[i].Color = (uint)i;
oTrackCollectionGfx[i].IsVisible = true;
}

However, it is not useful in a case where you need unique instantiations, such as:

AGI.STKObjects.IAgMtoTrackCollection oTrackCollection =
(AGI.STKObjects.IAgMtoTrackCollection)AG_MTO.Tracks;


oTrackCollection.Recycling = true;


STKObjects.IAgMtoTrack oTrack = oTrackCollection.Add(0);


oTrack.Interpolate = true;


STKObjects.IAgMtoTrack oTrack1 = oTrackCollection.Add(1);


oTrack.Interpolate = false;


Assert.IsTrue(oTrack.Interpolate == false)

The last line will fail, as oTrack is actually a reference to oTrack1 (the last element accessed).

See Also

© 2024 Analytical Graphics, Inc. All Rights Reserved.