A user has 29 Legend Entries and has used the Select By Legend Entry command or has the appropriate code in an automation program to select all 29 Legend Entries. However, in the automation program, the MapView MapViewSelectedObjects.Count Property is 25 and not 29. Is this an error?
The maximum number of objects that can be added to the MapViewSelectedObjects Collection or the MapViewHighlightedObjects Collection is 25. The maximum value for these 2 collections cannot be increased even if the LocatedObjectsCollection.MaxNumOfObjects property is set to a value greater than 25 in an automation program.
Here is additional information/clarification on the MapViewSelectedObejcts and MapViewHighlightedObjects collections which are instances of a DisplayedObjects Collection:
DisplayedObjects is not a creatable object, but LocatedObjectsCollection is. To populate a LocatedObjectsCollection, use the SmartLocateService.
The MapView’s HighlightedObjects and MapviewSelectedObjects collections are instances of a DisplayedObjects collection, which in turn internally instantiates a LocatedObjectsCollection object. Any time a DisplayedObjects collection is instantiated, it creates an instance of the LocatedObjectsCollection which has a default setting for MaxNumOfObjects = 25.
The artificial limit of 25 placed on the DisplayedObjects collection was needed for performance reasons when doing a “drill down” locate. If more than 25 objects are within the locate tolerance on a click, then only the first 25 will be added to the DisplayedObjects collection.
It is recommended that the Document.SelectedObjects be used whenever possible, because there isn’t a limit on the number of objects it can hold. This is the only selection object available to the DataView. However, a judgement call is required. If the user wishes to do things like get the range of the geometry or get the geometry information from multiple MapViews, then the MapViewSelectedObjects would probably be the better way to go.
For example, GeoMedia’s Fit Select Set command does not use the Document.SelectedObjects, but gets each MapView associated with the Document and accumulates a range from the MapViewSelectedObjects of each MapView. It then uses the accumulated range and does a MapView.ZoomArea in the active MapView. Items in the LocatedObjectsCollection will not automatically be highlighted. If an item needs to be highlighted, the item has to be added to the Mapview.HighlightedObjects collection or use either the GeometryPlacementService or GeometryEditService.
Automation help for the DisplayedObjects Object states:
Objects owned by the DisplayedObjects collection object are GMObjects. GMObjects are objects that support the IsEqual method. These objects can include geometry objects, raster objects, recordset objects, and record objects. The properties and methods extended to an item in the DisplayedObjects collection vary depending on its GMObject type
If all the recordset objects and geometry objects are added up, the MapViewSelectedObjects collection will not store more than 25 objects. This does not mean it cannot store more than 25 features, but that it cannot store more than a total of 25 GMObjects. A single recordset object may contain hundreds of features, so the MapViewSelectedObjects collection can contain hundreds of features, provided they are selected as a recordset rather than using single mouse clicks.