FeatureReader.FeatureReader Class Reference


Detailed Description

FeatureReader is used for reading the data of a particular feature.

A new class must be derived for each feature that requires reading, and furthermore, the read() method must be implemented. Any pre- processing should be done in preRead(), and any post-processing in postRead().

#include <class_feature_reader_1_1_feature_reader.h>

Inheritance diagram for FeatureReader.FeatureReader:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  __init__ ()
  setSearchPaths ()
  Sets the search paths for this feature.
  getSearchPaths ()
  Returns the search paths.
  qualifyPath ()
  Given a relative path, returns a fully qualified path if found in one of the search paths for this feature.
  setOptions ()
  Sets the read options for this reader.
  getOptions ()
  Returns the currently used read options.
  setSourceFilename ()
  Sets the filename of the source.
  getSourceFilename ()
  Returns the filename of the source.
  generateUniqueNamespace ()
  Generates and returns a new namespace unique to the sequence of namespaces.
  readSource ()
  Override this method in derived classes.
  read ()
  Override this method in derived classes.
  preRead ()
  Override this method for doing any processing before reading.
  postRead ()
  Override this method for doing any processing after reading.
  getConverters ()
  Override this method to supply feature data converters.
  setFinalIdMaps ()
  Sets the maps from which one can find and store the final ids of objects that were remapped.
  isFinalId ()
  Returns True if the given object id relevant to the given feature, is the final id; False otherwise.
  getFinalId ()
  Returns the final id for the given object id, relevant to the given feature.
  setFinalId ()
  Sets the final object id to the given object id for the feature for which this reader is responsible.
  setStageId ()
  Sets the stage id for use by objects that have an id.
  getStageId ()
  Returns the stage id.
  setNamespaceId ()
  getNamespaceId ()
  setUnitConversionMultiplier ()
  If the internal unit and the unit in the file are the same this value will be 1.
  getUnitConversionMultiplier ()
  Returns the unit conversion multiplier.

Member Function Documentation

FeatureReader.FeatureReader.__init__ ( )
FeatureReader.FeatureReader.setSearchPaths ( )

Sets the search paths for this feature.

Invalid search paths are ignored.

FeatureReader.FeatureReader.getSearchPaths ( )

Returns the search paths.

FeatureReader.FeatureReader.qualifyPath ( )

Given a relative path, returns a fully qualified path if found in one of the search paths for this feature.

Otherwise, returns the path unchanged.

Reimplemented in CompanionFeatureIO.CompanionFeatureReader.

FeatureReader.FeatureReader.setOptions ( )

Sets the read options for this reader.

FeatureReader.FeatureReader.getOptions ( )

Returns the currently used read options.

FeatureReader.FeatureReader.setSourceFilename ( )

Sets the filename of the source.

FeatureReader.FeatureReader.getSourceFilename ( )

Returns the filename of the source.

FeatureReader.FeatureReader.generateUniqueNamespace ( )

Generates and returns a new namespace unique to the sequence of namespaces.

If prependSourceFilename is True and the source filename has been previously set, then a prefix is added to the namespace prior to generation.

FeatureReader.FeatureReader.readSource ( )

Override this method in derived classes.

This method is responsible for storing the source for this feature in its document.

FeatureReader.FeatureReader.read ( )

Override this method in derived classes.

This method is responsible for populating the given document with the data provided in the given source. It should return True if the read was successful; False otherwise.

Reimplemented in AlternativeIO.XMLAlternativeReader, BackgroundIO.XMLBackgroundReader, BehaviorIO.XMLBehaviorReader, BookmarkIO.XMLBookmarkReader, CalibrationPreferenceIO.XMLCalibrationPreferenceReader, ClusterPreferenceIO.XMLClusterPreferenceReader, CustomUIIO.XMLCustomUIReader, DrawCacheIO.XMLDrawCacheReader, EnvironmentHeaderIO.XMLEnvironmentHeaderReader, EnvironmentIO.XMLEnvironmentReader, EnvironmentPreferenceIO.XMLEnvironmentPreferenceReader, HotkeyIO.XMLHotkeyReader, ImportSettingsIO.XMLImportSettingsReader, LightAssignmentIO.XMLLightAssignmentReader, LightingIO.XMLLightingReader, MaterialAssignmentIO.XMLMaterialAssignmentReader, MaterialIO.XMLMaterialReader, MaterialLibraryIO.XMLMaterialLibraryReader, MetaDataIO.XMLMetaDataReader, ModelIO.XMLModelReader, ModelImportIO.XMLModelImportReader, NavigationIO.XMLNavigationReader, NetworkPreferenceIO.XMLNetworkPreferenceReader, ObjectAssociationsIO.XMLObjectAssociationsReader, ObjectPropertiesIO.XMLObjectPropertiesReader, OptionPreferenceIO.XMLOptionPreferenceReader, PathListPreferenceIO.XMLBehaviorDirectoryPreferenceReader, PathListPreferenceIO.XMLEnvironmentDirectoryPreferenceReader, PathListPreferenceIO.XMLEnvironmentGeometryDirectoryPreferenceReader, PathListPreferenceIO.XMLHelpDirectoryPreferenceReader, PathListPreferenceIO.XMLImageDirectoryPreferenceReader, PathListPreferenceIO.XMLMaterialDirectoryPreferenceReader, PathListPreferenceIO.XMLRapidPresetsDirectoryPreferenceReader, PathListPreferenceIO.XMLSceneHistoryDirectoryPreferenceReader, PathListPreferenceIO.XMLShadowPresetsDirectoryPreferenceReader, PathListPreferenceIO.XMLTessellationDirectoryPreferenceReader, PathListPreferenceIO.XMLWelcomeDirectoryPreferenceReader, ScenePreferenceIO.XMLScenePreferenceReader, SelectionSetIO.XMLSelectionSetReader, ShadowIO.XMLShadowReader, ShotIO.XMLShotReader, StoryboardIO.XMLStoryboardReader, TranslationIO.XMLTranslationReader, TriggerIO.XMLTriggerReader, UiPrefsIO.XMLUiPrefsReader, and WindowPreferenceIO.XMLWindowPreferenceReader.

FeatureReader.FeatureReader.postRead ( )

Override this method for doing any processing after reading.

Reimplemented in BehaviorIO.XMLBehaviorReader, EnvironmentIO.XMLEnvironmentReader, and SelectionSetIO.XMLSelectionSetReader.

FeatureReader.FeatureReader.getConverters ( )

Override this method to supply feature data converters.

Return a tuple containing ( method, version ) pairs. The order in which you specify the pairs is important, that is the oldest converter must be listed first, and the most recent converter listed last.

The method must have the following signature:

def <some_name>( self, xmlData ): # Convert data to a particular version.

The version indicates when the data converter method is applied.

For example:

class YourFeatureReader( FeatureReader ):

def getConverters( self ): return ( ( self.convert_to_v2, theVersionManager[ VersionLabel.v2 ] ) , ( self.convert_to_v4, theVersionManager[ VersionLabel.v4 ] ) )

def convert_to_v2( self, xmlData ): # # Convert the given xml data to whatever is required # by version 2 of the application. # pass

def convert_to_v4( self, xmlData ): # # Convert the given xml data to whatever is required # by version 4 of the application. # # Note the convert_to_v2 converter will have already # been applied to the xmlData. # pass

Note that all necessary converters will be applied to bring the document data up to what's needed. That is if a version 1 file is opened then the v2 converter will be applied followed by the v4 converter. If a version 3 file is opened then only the v4 converter is applied. If a version 4 file is opened then no converters will need to be called.

Reimplemented in EnvironmentHeaderIO.XMLEnvironmentHeaderReader, EnvironmentIO.XMLEnvironmentReader, EnvironmentModelIO.XMLEnvironmentModelReader, LightingIO.XMLLightingReader, MaterialIO.XMLMaterialReader, ModelIO.XMLModelReader, ModelImportIO.XMLModelImportReader, ObjectPropertiesIO.XMLObjectPropertiesReader, SelectionSetIO.XMLSelectionSetReader, ShadowIO.XMLShadowReader, and StoryboardIO.XMLStoryboardReader.

FeatureReader.FeatureReader.setFinalIdMaps ( )

Sets the maps from which one can find and store the final ids of objects that were remapped.

FeatureReader.FeatureReader.isFinalId ( )

Returns True if the given object id relevant to the given feature, is the final id; False otherwise.

FeatureReader.FeatureReader.getFinalId ( )

Returns the final id for the given object id, relevant to the given feature.

Note, be sure to call isFinalId(), and that it returns False before calling this method.

FeatureReader.FeatureReader.setFinalId ( )

Sets the final object id to the given object id for the feature for which this reader is responsible.

FeatureReader.FeatureReader.setStageId ( )

Sets the stage id for use by objects that have an id.

FeatureReader.FeatureReader.getStageId ( )

Returns the stage id.

FeatureReader.FeatureReader.setNamespaceId ( )
FeatureReader.FeatureReader.getNamespaceId ( )
FeatureReader.FeatureReader.setUnitConversionMultiplier ( )

If the internal unit and the unit in the file are the same this value will be 1.

Otherwise it's the multiplier for the values in the file, to move them to the internal units. For example, if the file is in cm, and internal unit is m, this should be set to 0.01. If the file is in m, and internal unit is cm, this should be set to 100.0.

FeatureReader.FeatureReader.getUnitConversionMultiplier ( )

Returns the unit conversion multiplier.


FeatureReader.FeatureReader FeatureReader.FeatureReader FeatureReader.FeatureReader FeatureReader.FeatureReader FeatureReader.FeatureReader FeatureReader.FeatureReader FeatureReader.FeatureReader FeatureReader.FeatureReader FeatureReader.FeatureReader FeatureReader.FeatureReader
FeatureReader.FeatureReader FeatureReader.FeatureReader FeatureReader.FeatureReader FeatureReader.FeatureReader FeatureReader.FeatureReader FeatureReader.FeatureReader FeatureReader.FeatureReader FeatureReader.FeatureReader FeatureReader.FeatureReader FeatureReader.FeatureReader