MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
Loading...
Searching...
No Matches
TSLGMLInstanceDataWriter Class Reference

Detailed Description

This class is used for writing GML instance data to either a file or a buffer.

The content of the GML instance data is formed from the MapLink entities held in a standard data layer passed to one of this class's methods. Each child entity of this layer's entity set is treated like a feature instance, with the feature class that it belongs to being the GML feature type. The GML feature's properties are formed from the entities dataset, geometry and, if a TSLGMLPropertyMapping object is provided, the entities properties and rendering attributes.

Public Member Functions

 TSLGMLInstanceDataWriter ()
 
void coordinateFormatString (const char *format)
 
const char * coordinateFormatString () const
 
void destroy ()
 
const TSLGMLPropertyMappingpropertyMapping () const
 
void propertyMapping (const TSLGMLPropertyMapping *newMapping)
 
const TSLGMLPropertyMappingSetpropertyMappingSet () const
 
void propertyMappingSet (const TSLGMLPropertyMappingSet *newMappingSet)
 
bool swapXandY () const
 
void swapXandY (bool value)
 
bool write (const char *filename, const TSLStandardDataLayer *layer, const TSLCoordinateSystem *coordinateSystem, const TSLGMLApplicationSchema *schema, const char *schemaLocation=0)
 
bool write (char *&bufferPtr, unsigned int &bufferLen, const TSLStandardDataLayer *layer, const TSLCoordinateSystem *coordinateSystem, const TSLGMLApplicationSchema *schema, const char *schemaLocation=0)
 
void * operator new (size_t size)
 
void * operator new (size_t size, char *filename, int line)
 

Static Public Member Functions

static void deleteBuffer (const char *buffer)
 

Constructor & Destructor Documentation

◆ TSLGMLInstanceDataWriter()

TSLGMLInstanceDataWriter::TSLGMLInstanceDataWriter ( )

Member Function Documentation

◆ coordinateFormatString() [1/2]

const char * TSLGMLInstanceDataWriter::coordinateFormatString ( ) const

Returns the current format string that will be used to write out coordinates.

◆ coordinateFormatString() [2/2]

void TSLGMLInstanceDataWriter::coordinateFormatString ( const char * format)

Set the printf style format string to write out coordinates in the output. If not set the default value ("%g") will be used.

Note: the default value of ("%g") is likely to truncate the accuracy of the output coordinates; it is advised to use ("%12.12g")

Parameters
formatthe string to use as the output format (e.g. "%8.3f"), if format is NULL the writer will be reset to use the default format.

◆ deleteBuffer()

static void TSLGMLInstanceDataWriter::deleteBuffer ( const char * buffer)
static

Buffers provided via the write methods of this class should be freed by calling this method.

Parameters
bufferThe buffer to be deleted.

◆ destroy()

void TSLGMLInstanceDataWriter::destroy ( )

Destroy this object.

This method must be used instead of delete.

◆ operator new() [1/2]

void * TSLGMLInstanceDataWriter::operator new ( size_t size)

◆ operator new() [2/2]

void * TSLGMLInstanceDataWriter::operator new ( size_t size,
char * filename,
int line )

When included in an MFC application in debug mode, the debug new expects this to be here. Override it and return the same as the normal one. The library must include it when compiled in release mode, since the user's application may be in debug mode.

◆ propertyMapping() [1/2]

const TSLGMLPropertyMapping * TSLGMLInstanceDataWriter::propertyMapping ( ) const

Queries the currently set property mapping object held on the writer. The current property mapping can be set via the other propertyMapping method.

Rather than acquiring the values of each of the properties of the GML feature instance from the MapLink entity's data sets, a mapping can be provide so that the value are taken from the rendering attributes or properties of the entity, such as its name or entity id.

There are 3 possible ways of using a mapping or mapping set:

  • Use neither. All property values are taken from the MapLink entity's data set
  • Set a TSLGMLPropertyMapping instance on the writer using the property Mapping method. The same mapping is performed for all feature types.
  • Set a TSLGMLPrropertyMappingSet instance on the writer using the property Mapping method. Different mappings can be performed for each feature type and not all features types need have a mapping defined.

◆ propertyMapping() [2/2]

void TSLGMLInstanceDataWriter::propertyMapping ( const TSLGMLPropertyMapping * newMapping)

Sets the current property mapping object held on the writer. The current property mapping can be queried via the other propertyMapping method.

Rather than acquiring the values of each of the properties of the GML feature instance from the MapLink entity's data sets, a mapping can be provide so that the value are taken from the rendering attributes or properties of the entity, such as its name or entity id.

There are 3 possible ways of using a mapping or mapping set:

  • Use neither. All property values are taken from the MapLink entity's data set
  • Set a TSLGMLPropertyMapping instance on the writer using the property Mapping method. The same mapping is performed for all feature types.
  • Set a TSLGMLPrropertyMappingSet instance on the writer using the property Mapping method. Different mappings can be performed for each feature type and not all features types need have a mapping defined.

◆ propertyMappingSet() [1/2]

const TSLGMLPropertyMappingSet * TSLGMLInstanceDataWriter::propertyMappingSet ( ) const

Queries the current property mapping set object held on the writer. The current property mapping set can be set via the other propertyMappingSet method.

Rather than acquiring the values of each of the properties of the GML feature instance from the MapLink entity's data sets, a mapping can be provide so that the value are taken from the rendering attributes or properties of the entity, such as its name or entity id.

There are 3 possible ways of using a mapping or mapping set:

  • Use neither. All property values are taken from the MapLink entity's data set
  • Set a TSLGMLPropertyMapping instance on the writer using the property Mapping method. The same mapping is performed for all feature types.
  • Set a TSLGMLPrropertyMappingSet instance on the writer using the property Mapping method. Different mappings can be performed for each feature type and not all features types need have a mapping defined.

◆ propertyMappingSet() [2/2]

void TSLGMLInstanceDataWriter::propertyMappingSet ( const TSLGMLPropertyMappingSet * newMappingSet)

Sets the current property mapping set object held on the writer. The current property mapping set can be queried via the other propertyMappingSet method.

Rather than acquiring the values of each of the properties of the GML feature instance from the MapLink entity's data sets, a mapping can be provide so that the value are taken from the rendering attributes or properties of the entity, such as its name or entity id.

There are 3 possible ways of using a mapping or mapping set:

  • Use neither. All property values are taken from the MapLink entity's data set
  • Set a TSLGMLPropertyMapping instance on the writer using the property Mapping method. The same mapping is performed for all feature types.
  • Set a TSLGMLPrropertyMappingSet instance on the writer using the property Mapping method. Different mappings can be performed for each feature type and not all features types need have a mapping defined.

◆ swapXandY() [1/2]

bool TSLGMLInstanceDataWriter::swapXandY ( ) const

If the swapXandY flag is true, then GML geometry will be written with the X and Y positions swapped around. By default this flag's value is false.

Some CRSs will want to output GML coordinates in a lat/lon orientation instead of lon/lat. As a result we have an option to swap the output orientation so we can still have the coordinates in an lon/lat orientation.

This method queries the value of the flag.

◆ swapXandY() [2/2]

void TSLGMLInstanceDataWriter::swapXandY ( bool value)

If the swapXandY flag is true, then GML geometry will be written with the X and Y positions swapped around. By default this flag's value is false.

Some CRSs will want to output GML coordinates in a lat/lon orientation instead of lon/lat. As a result we have an option to swap the output orientation so we can still have the coordinates in an lon/lat orientation.

This method sets the value of the flag.

◆ write() [1/2]

bool TSLGMLInstanceDataWriter::write ( char *& bufferPtr,
unsigned int & bufferLen,
const TSLStandardDataLayer * layer,
const TSLCoordinateSystem * coordinateSystem,
const TSLGMLApplicationSchema * schema,
const char * schemaLocation = 0 )

Writes instance data to a buffer.

Parameters
bufferPtrOn success, this will be pointed to a buffer containing the written instance data. Once this buffer is no longer needed, it should be deleted via the deleteBuffer method.
bufferLenOn success, this will be populated with the length of the buffer provided in the bufferPtr parameter.
layerThe TSLStandardDataLayer containing the data to be written.
coordinateSystemThe coordinate system that the geometry data, contained by the provided layer, should be written in. The coordinate system should also have had the correct TMC to MU scaling and translations setup.
schemaThe GML application schema that the written data should conform to. This schema should match the definition held in the provided standard data layer's data handler and feature class list.
schemaLocationIf provided, this will be the path written in the instance data's schemaLocation attribute. If null is passed, then the schemaLocation attribute is omitted.
Returns
true on success, false otherwise. Check the MapLink error stack for details of a failure and for warnings even if true is returned.

◆ write() [2/2]

bool TSLGMLInstanceDataWriter::write ( const char * filename,
const TSLStandardDataLayer * layer,
const TSLCoordinateSystem * coordinateSystem,
const TSLGMLApplicationSchema * schema,
const char * schemaLocation = 0 )

Writes instance data to a file.

Parameters
filenameThe location to write the GML instance data file to.
layerThe TSLStandardDataLayer containing the data to be written.
coordinateSystemThe coordinate system that the geometry data, contained by the provided layer, should be written in. The coordinate system should also have had the correct TMC to MU scaling and translations setup.
schemaThe GML application schema that the written data should conform to. This schema should match the definition held in the provided standard data layer's data handler and feature class list.
schemaLocationIf provided, this will be the path written in the instance data's schemaLocation attribute. If null is passed, then the schemaLocation attribute is omitted.
Returns
true on success, false otherwise. Check the MapLink error stack for details of a failure and for warnings even if true is returned.