Class TLcyModelReferenceAddOn

java.lang.Object
com.luciad.lucy.addons.ALcyAddOn
com.luciad.lucy.addons.modelreference.TLcyModelReferenceAddOn

public class TLcyModelReferenceAddOn extends ALcyAddOn
This addon adds the possibility to handle data files that don't have a model reference (or geo reference). When a data file is opened that does not have a model reference, a dialog is popup to ask the user which reference should be used. The user has the possibility to automatically save the chosen reference. The reference is saved as a Luciad .ref file, a file with the same name as the data file but with the extension replaced by .ref.

Furthermore, it adds a menu item to create a directory.ref file. If such a file is present in a directory, all data files in that directory that don't have a model reference will use that model reference.

The predefined references the user can choose from can be specified in the configuration file, or can be set directly using setGeodeticReferences and/or setGridReferences.

The add-on also registers default ILcdModelReferenceParser instances on the Lucy back-end. The registered ILcdModelReferenceParser instances will be used by e.g. the GML model decoder to parse model references. See ILcyLucyEnv.addService(Object) for more information.

A help ID (see ALcyHelpManager) is registered to allow to display context sensitive help for the panel that allows to choose a reference: "com.luciad.lucy.addons.modelreference.TLcyModelReferenceAddOn.ModelReferenceChooser"

See Also:
  • Field Details

    • MODEL_REFERENCE_GROUP_DESCRIPTOR

      public static final TLcyGroupDescriptor MODEL_REFERENCE_GROUP_DESCRIPTOR
  • Constructor Details

    • TLcyModelReferenceAddOn

      public TLcyModelReferenceAddOn()
  • Method Details

    • setClassTraceOn

      @Deprecated public static void setClassTraceOn(boolean aClassTraceOn)
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Enables tracing for all instances of this class. If the argument is true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
      Parameters:
      aClassTraceOn - if true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
    • setTraceOn

      @Deprecated public void setTraceOn(boolean aTraceOn)
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Enables tracing for this class instance. Calling this method with either true or false as argument automatically turns off tracing for all other class instances for which setTraceOn has not been called. If the argument is false then only the informative, warning and error log messages are recorded.
      Parameters:
      aTraceOn - if true then all log messages are recorded for this instance. If false, then only the informative, warning and error log messages are recorded.
    • isTraceOn

      @Deprecated public boolean isTraceOn()
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Returns true if tracing is enabled for this class.
      Returns:
      true if tracing is enabled for this class, false otherwise.
    • plugInto

      public void plugInto(ILcyLucyEnv aLucyEnv)
      Adds a ILcdModelReferenceDecoder to the given ILcyLucyEnv that pops up a dialog to ask the user to specify the reference. The ILcdModelReferenceDecoder should be used a last resort, when all other attempts to find a reference have failed.

      Furthermore it adds a menu item that allows to create a .ref file on demand. If the file is named directory.ref, all data files in that directory will use that reference.

      Specified by:
      plugInto in class ALcyAddOn
      Parameters:
      aLucyEnv - The lucy environment to plug into.
      See Also:
    • unplugFrom

      public void unplugFrom(ILcyLucyEnv aLucyEnv)
      Removes the added ILcdModelReferenceDecoder and menu item.
      Specified by:
      unplugFrom in class ALcyAddOn
      Parameters:
      aLucyEnv - The lucy environment that was passed in plugInto.
      See Also:
    • getGeodeticReferences

      public ILcdGeodeticReference[] getGeodeticReferences()
    • setGeodeticReferences

      public void setGeodeticReferences(ILcdGeodeticReference[] aGeodeticReferences)
      Sets the list of predefined geodetic references. A geodetic reference can be modfied if it is an instance of TLcyGeodeticReference and its editable property is true.

      The geodetic references should be set before the addon is plugged.

      Parameters:
      aGeodeticReferences - The list of geodetic references.
    • getGridReferences

      public ILcdGridReference[] getGridReferences()
      Returns the set of predefined grid references the user can choose from.
      Returns:
      the set of predefined grid references the user can choose from.
    • setGridReferences

      public void setGridReferences(ILcdGridReference[] aGridReferences)
      Sets the list of predefined grid references. A grid reference can be modified if it is an instance of TLcyGridReference and its editable property is true.

      The grid references should be set before the addon is plugged.

      Parameters:
      aGridReferences - The list of grid references.
    • showModelReferenceChooser

      public ILcdGeoReference showModelReferenceChooser(Component aParentComponent)

      Presents a model reference chooser UI to the user in a modal dialog. The chosen model reference will be returned.

      Calling this method is equivalent to calling

      
           showModelReferenceChooser( aParentComponent, true, true ).
         

      Note: this method should be called on the Event Dispatch Thread and only when this add-on is plugged in. This method only returns after the user selected a reference or cancelled the dialog.

      Parameters:
      aParentComponent - Parent component for the dialog
      Returns:
      the chosen model reference, or null when the user cancelled.
      See Also:
    • showModelReferenceChooser

      public ILcdGeoReference showModelReferenceChooser(Component aParentComponent, boolean aIncludeGeodeticReferences, boolean aIncludeGridReferences)

      Presents a model reference chooser UI to the user in a modal dialog. The chosen model reference will be returned.

      Calling this method is equivalent to calling

      
           showModelReferenceChooser( aParentComponent, true, true ).
         

      Note: this method should be called on the Event Dispatch Thread and only when this add-on is plugged in. This method only returns after the user selected a reference or cancelled the dialog.

      Parameters:
      aParentComponent - Parent component for the dialog
      aIncludeGeodeticReferences - when true, geodetic references will be included in the chooser. When false, geodetic references will not be shown. Note that either aIncludeGeodeticReferences or aIncludeGridReferences must be true
      aIncludeGridReferences - when true, grid references will be included in the chooser. When false, grid references will not be shown. Note that either aIncludeGeodeticReferences or aIncludeGridReferences must be true
      Returns:
      the chosen model reference, or null when the user cancelled.