Map-Data XML document.
More...
#include <MapDataDocument.h>
Public Members | |||
![]() | ![]() | MapDataDocument (void) | |
![]() | ![]() | The only constructor for a MapDataDocument. More... | |
![]() | ![]() | virtual | ~MapDataDocument (void) |
![]() | ![]() | const vector2& | origin (void) const |
![]() | ![]() | Get the top left corner of the map area. More... | |
![]() | ![]() | double | height (void) const |
![]() | ![]() | Get the height of the map area. More... | |
![]() | ![]() | double | width (void) const |
![]() | ![]() | Get the width of the map area. More... | |
![]() | ![]() | const map< string, vector2 * >& | named_points (void) const |
![]() | ![]() | Get the list of named points. More... | |
![]() | ![]() | const vector< vector2 * >& | anon_points (void) const |
![]() | ![]() | Get the list of anonymous points. More... | |
![]() | ![]() | const map< string, curve * >& | curves (void) const |
![]() | ![]() | Get the list of named curves. More... | |
![]() | ![]() | const set< vector2 * >& | fixed_points (void) const |
![]() | ![]() | Get the list of the fixed points. More... | |
![]() | ![]() | const vector< constraint * >& | constraints (void) const |
![]() | ![]() | Get the list of the constraints on the point positions. More... | |
![]() | ![]() | set< vector2 * > | all_points (void) const |
![]() | ![]() | Create a simple list of all the named and anonymous points. More... | |
![]() | ![]() | void | read ( InputSource &source, MapperErrorHandler &err_handler ) |
![]() | ![]() | Read a Map-Data document. More... | |
![]() | ![]() | void | write ( ostream &out, const double tol ) |
![]() | ![]() | Write a Map-Data document as text. More... | |
![]() | ![]() | unsigned | precision |
![]() | ![]() | The number of decimal places for coordinates. | |
Map-Data XML document.
DOM_Document representation of the XML document. Definition at line 80 of file MapDataDocument.h.
| MapDataDocument::MapDataDocument (void) |
The only constructor for a MapDataDocument.
assert( this->origin() == vector2(0,0) ); assert( this->height() == 0.0 ); assert( this->width() == 0.0 ); assert( this->named_points().empty() ); assert( this->anon_points().empty() ); assert( this->curves().empty() ); assert( this->fixed_points().empty() ); assert( this->constraints().empty() ); assert( this->precision = 6 );
Definition at line 38 of file MapDataDocument.cpp.
MapDataDocument::~MapDataDocument (void) [virtual]
|
Definition at line 63 of file MapDataDocument.cpp.
const vector2 & MapDataDocument::origin (void) const [inline]
|
Get the top left corner of the map area.
This is the point given by the x and y attributes of the Map-Data element.
Definition at line 114 of file MapDataDocument.h.
double MapDataDocument::height (void) const [inline]
|
Get the height of the map area.
This is the value given by the height attribute of the Map-Data element.
Definition at line 127 of file MapDataDocument.h.
double MapDataDocument::width (void) const [inline]
|
Get the width of the map area.
This is the value given by the width attribute of the Map-Data element.
Definition at line 140 of file MapDataDocument.h.
const map<string,vector2 *>& MapDataDocument::named_points (void) const [inline]
|
Get the list of named points.
Each entry in the map corresponds to either a Point element or a Point-alias element in the Map-Data document. Each point is represented by a vector2 object.
id attributes) to their corresponding vector2 objects.
assert( !this->named_points().count(n) || this->named_points[n] );
Definition at line 166 of file MapDataDocument.h.
const vector<vector2 *>& MapDataDocument::anon_points (void) const [inline]
|
Get the list of anonymous points.
Each entry in the map corresponds to a Traced-point element without a point attribute in the Map-Data document.
assert( this->anon_points().size() < i || this->anon_points[i] );
Definition at line 187 of file MapDataDocument.h.
const map<string,curve *>& MapDataDocument::curves (void) const [inline]
|
Get the list of named curves.
Each entry in the map corresponds to a a Curve element in the Map-Data document.
id attributes) to curve objects representing the identified curve.
assert( !this->curve().count(n) || this->curve[n] );
Definition at line 209 of file MapDataDocument.h.
const set<vector2 *>& MapDataDocument::fixed_points (void) const [inline]
|
Get the list of the fixed points.
Each entry in the map corresponds to a Fixed-point element in the Map-Data document.
assert( this->fixed_points().size() < i || this->fixed_points[i] );
Definition at line 229 of file MapDataDocument.h.
const vector<constraint *>& MapDataDocument::constraints (void) const [inline]
|
Get the list of the constraints on the point positions.
Each entry in the map corresponds to a element in the Map-Data document that explicitly specifies a constraint, or corresponds to the constraints created implicitly from Traced-point elements. Elements that explicitly indicate a constraint are Angle, Bearing, Distance, Through and Vector elements.
constraint objects that represent the constraints constraints.
assert( this->fixed_points().size() < i || this->fixed_points[i] );
Definition at line 254 of file MapDataDocument.h.
| set<vector2 *> MapDataDocument::all_points (void) const |
Create a simple list of all the named and anonymous points.
Definition at line 132 of file MapDataDocument.cpp.
| void MapDataDocument::read (InputSource & source, MapperErrorHandler & err_handler) |
Read a Map-Data document.
The internal representation stored by this object is altered to correspond to the input document. The function must parse the input document. It handles input and parsing errors using a provided error handling object.
| source | the document to read |
| err_handler |
the error handler
|
Map-Data elements to objects as follows.
| Tag of Element | Conversion Done |
| Angle | Create a coresponding new angle_constraint object, add the object to the constraints() list. |
| Area-feature | Do nothing. |
| Cite | Do nothing. |
| Constraint-group | Do nothing |
| Coord | Create a coresponding new vector2 object, and add the object to the param list of the corresponding curve. |
| Curve-segment | Create a coresponding new curve_segment object. |
| Distance | Create a coresponding new distance_constraint object, add the object to the constraints() list. |
| Fixed-point | Add the indicated point to the fixed_points() list, and set the coordinates of the point to the given values. |
| Linear-feature | Do nothing |
| Line-segment | Do nothing. |
| Name | Do nothing. |
| Path-node | Do nothing. |
| Point | Create a coresponding new vector2 object, and add the object to the named_points() map. |
| Point-alias | Use the named_points map to find the corresponding existing point. Add an extra entry to the named_points() map, so this alias also indicates the existing point. |
| Point-feature | Do nothing |
| Through | Create a coresponding new through_constraint object, add the object to the constraints() list. |
| Tracing | Create a delaunay::triangulation object for all is traced points. For all the triangles in that triangulation that are not border triangles, create an angle_constraint object for each vertex, to constrain the angle at that vertex. Add those constraints to the constraints() list. |
| Traced-point | If the point is anonymous, create a new vector2 object for it and add a pointer to the new object to the anon_points() list. Otherwise, look up the point in the named_points() map. |
| Units | Check whether the angle units are degrees. Issue an error if they are not. |
| Vector | Create a coresponding new vector_constraint object, and add the object to the constraints() list. |
Angle element has a pointer to the angle_constraint created to represent it. These user-data points are used for updating the DOM object. Definition at line 93 of file MapDataDocument.cpp.
| void MapDataDocument::write (ostream & out, const double tol) |
Write a Map-Data document as text.
The output routine must calculate some data to produce the text output. This requires a calculation tolerance. so it is consistent with its internal representation. This uses the user data references pointing from the elements to the corresponding internal representation. The output text has explicitly stated values for all attributes that have implicit or default values.
| out | the stram to write to |
| tol |
the calculation tolerance
|
assert( 0 < tol && tol < 1 );
Definition at line 121 of file MapDataDocument.cpp.
| unsigned MapDataDocument::precision |
1.0.0 written by Dimitri van Heesch,
© 1997-1999