Administrative Unit Local Data Source
Responsible for interacting with retrievers and data sources of administrative unit names and cartographic boundaries. It creates new administrative unit names and cartographic boundaries each time a new image is added.
Constructors
Functions
The administrativeUnitsFlow is triggered in many ways:
Merge the currentAdministrativeUnitIndexFlow with administrativeUnitsFlow to receive the newly updated flow of the current AdministrativeUnit. Both flows are necessary because with the currentAdministrativeUnitIndexFlow, it's possible to get the currently selected AdministrativeUnit when the user selects one on the screen. And the administrativeUnitsFlow keeps sending changes that happen on that AdministrativeUnit in real-time while the user is on the administrative unit screen. It's guaranteed that the Flow only emits the object when there's a new change in it, for example, when a new Image is added. This Flow always emits the same instance of AdministrativeUnit for each index repeatedly. Therefore, you can't compare objects if they are the same instance. To verify if the object really changed its contents, its hash code is annotated. So, the next time this same object tries to emit, the hash code is compared to see if there was really a change, and it is emitted again only if its contents changed.
Update the current index selected by the user. This lastAdministrativeUnitHashCode property is used to compare if the contents of the current AdministrativeUnit really changed. If the user goes back to the administrative units screen and selects the same one again, it won't emit it again. To solve that problem, the lastAdministrativeUnitHashCode is reset each time this method is called.