Interface MeasurementValueConfigurationEditor

    • Constructor Detail

    • Method Detail

      • modify

         abstract boolean modify(@NonNull() Context context, @NonNull() MeasurementValueConfiguration oldValue, @NonNull() MeasurementValueConfiguration newValue, @NonNull() MeasurementValueConfigurationPickerListener onSelectedExistingConfiguration)

        Modifies an existing MeasurementValueConfiguration in the current document. Any measurement annotations that use the original configuration will be updated, too. On top of that, it is checked if the modified value matches an already existing configuration. In that case a dialog is displayed and asks how to proceed. If the dialog is confirmed with "Use Existing" the provided callback `onSelectedExistingConfiguration` informs about the used configuration. The original configuration will be deleted in this case.

        Parameters:
        context - The context to be used if we need to show a dialog.
        oldValue - The original MeasurementValueConfiguration to be changed.
        newValue - The value to change it to.
        onSelectedExistingConfiguration - callback which is called if `newValue` matches an already existing configuration and the user decides to use that one instead of `newValue`.
        Returns:

        true if the configuration could be modified to `newValue`, otherwise false which indicates that a dialog was displayed to resolve the conflict.

      • modify

         abstract void modify(@NonNull() MeasurementValueConfiguration oldValue, @NonNull() MeasurementValueConfiguration newValue, boolean modifyAssociatedAnnotations, boolean addToUndo)

        Replaces the `oldValue` configuration straightforward in the document's configuration list with `newValue`. No checks are being made, no dialogs displayed.

        Parameters:
        oldValue - The original MeasurementValueConfiguration to be changed.
        newValue - The value to change it to.
        modifyAssociatedAnnotations - if true all measurement annotations that use the scale and precision of `oldValue` will be updated to the scale and precision of `newValue`.
        addToUndo - Set to true if the modification is supposed to be recorded to the undo stack.
      • remove

         abstract boolean remove(@NonNull() Context context, @NonNull() MeasurementValueConfiguration value)

        Deletes the provided configuration from the document. If it's currently in use by any measurement annotations, a dialog is displayed and this function returns false. If the user decides via the dialog to delete the configuration anyways, the operation proceeds and will also delete those affected annotations. If the function returns true, the configuration was not in use and was deleted without further ado.

        Parameters:
        context - The context to be used if we need to show a dialog.
        value - The MeasurementValueConfiguration to be removed from the document.
        Returns:

        true if the configuration could be deleted right away, otherwise false which indicates that a dialog was displayed, informing the user that the configuration is used by at least one measurement annotation.

      • remove

         abstract void remove(@NonNull() MeasurementValueConfiguration value, boolean deleteAssociatedAnnotations, boolean addToUndo)

        Deletes the `value` configuration from the document's configuration list. No checks are being made, no dialogs displayed.

        Parameters:
        value - The MeasurementValueConfiguration to be removed from the document.
        deleteAssociatedAnnotations - if true all measurement annotations that use the scale and precision of `value` will be deleted as well.
        addToUndo - Set to true if the delete operation is supposed to be recorded to the undo stack.
      • add

         abstract boolean add(@NonNull() Context context, @NonNull() MeasurementValueConfiguration value, @NonNull() MeasurementValueConfigurationPickerListener onSelectedExistingConfiguration)

        Adds the provided configuration to the document. If it's already present in the document, a dialog is displayed and this function returns false. If the user decides via the dialog to use the already existing configuration, `value` will not be added to the document, `onDeletedUsedConfiguration` is called with the existing configuration as parameter and this function returns false.

        If the function returns true, the configuration was not in use and was deleted without further ado.

        Parameters:
        context - The context to be used if we need to show a dialog.
        value - The MeasurementValueConfiguration to be removed from the document.
        onSelectedExistingConfiguration - callback which is called if `value` matches an already existing configuration and the user decides to use that one.
        Returns:

        true if the configuration could be added right away, otherwise false which indicates that a dialog was displayed, informing the user that an identical configuration is already present in the document.

      • add

         abstract void add(@NonNull() MeasurementValueConfiguration value, boolean addToUndo)

        Adds the `value` configuration to the document's configuration list. No checks are being made, no dialogs displayed.

        Parameters:
        value - The MeasurementValueConfiguration to be added to the document.
        addToUndo - Set to true if this add operation is supposed to be recorded to the undo stack.
      • startCalibrationTool

         abstract void startCalibrationTool()

        Starts the scale calibration tool. (Same as activating the calibration tool from the AnnotationCreationToolBar)

      • getUsageCount

         abstract int getUsageCount(MeasurementValueConfiguration configuration)

        Checks how many annotations are using the provided configuration.

        Parameters:
        configuration - The MeasurementValueConfiguration we want to know how many annotations it is used in
        Returns:

        The amount of annotations which use both the scale and precision of the provided configuration.