![]() |
MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
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 TSLGMLPropertyMapping * | propertyMapping () const |
void | propertyMapping (const TSLGMLPropertyMapping *newMapping) |
const TSLGMLPropertyMappingSet * | propertyMappingSet () 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) |
TSLGMLInstanceDataWriter::TSLGMLInstanceDataWriter | ( | ) |
const char * TSLGMLInstanceDataWriter::coordinateFormatString | ( | ) | const |
Returns the current format string that will be used to write out coordinates.
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")
format | the 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. |
|
static |
Buffers provided via the write methods of this class should be freed by calling this method.
buffer | The buffer to be deleted. |
void TSLGMLInstanceDataWriter::destroy | ( | ) |
Destroy this object.
This method must be used instead of delete.
void * TSLGMLInstanceDataWriter::operator new | ( | size_t | size | ) |
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.
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:
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:
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:
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:
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.
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.
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.
bufferPtr | On 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. |
bufferLen | On success, this will be populated with the length of the buffer provided in the bufferPtr parameter. |
layer | The TSLStandardDataLayer containing the data to be written. |
coordinateSystem | The 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. |
schema | The 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. |
schemaLocation | If provided, this will be the path written in the instance data's schemaLocation attribute. If null is passed, then the schemaLocation attribute is omitted. |
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.
filename | The location to write the GML instance data file to. |
layer | The TSLStandardDataLayer containing the data to be written. |
coordinateSystem | The 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. |
schema | The 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. |
schemaLocation | If provided, this will be the path written in the instance data's schemaLocation attribute. If null is passed, then the schemaLocation attribute is omitted. |