1 | .. _api-zoo-format: |
---|
2 | |
---|
3 | ZOO.Format |
---|
4 | ========== |
---|
5 | |
---|
6 | Base class for format reading/writing a variety of formats. |
---|
7 | |
---|
8 | Properties |
---|
9 | ---------- |
---|
10 | |
---|
11 | .. list-table:: |
---|
12 | :widths: 30 50 |
---|
13 | :header-rows: 1 |
---|
14 | |
---|
15 | * - NAME |
---|
16 | - DESCRIPTION |
---|
17 | * - :ref:`options <options>` |
---|
18 | - {Object} A reference to options passed to the constructor. |
---|
19 | * - :ref:`externalProjection <externalProjection>` |
---|
20 | - {ZOO.Projection} When passed a externalProjection and internalProjection, the format will reproject the geometries it reads or writes. |
---|
21 | * - :ref:`internalProjection <internalProjection>` |
---|
22 | - {ZOO.Projection} When passed a externalProjection and internalProjection, the format will reproject the geometries it reads or writes. |
---|
23 | * - :ref:`data <data>` |
---|
24 | - {Object} When keepData is true, this is the parsed string sent to read. |
---|
25 | * - :ref:`keepData <keepData>` |
---|
26 | - {Object} Maintain a reference (data) to the most recently read data. |
---|
27 | |
---|
28 | Functions |
---|
29 | --------- |
---|
30 | |
---|
31 | .. list-table:: |
---|
32 | :widths: 12 50 |
---|
33 | :header-rows: 1 |
---|
34 | |
---|
35 | * - NAME |
---|
36 | - DESCRIPTION |
---|
37 | * - :ref:`ZOO.Format <ZOO.Format>` |
---|
38 | - Instances of this class are not useful. |
---|
39 | * - :ref:`destroy <destroy>` |
---|
40 | - Clean up. |
---|
41 | * - :ref:`read <read>` |
---|
42 | - Read data from a string, and return an object whose type depends on the subclass. |
---|
43 | * - :ref:`data <data>` |
---|
44 | - {Object} When keepData is true, this is the parsed string sent to read. |
---|
45 | * - :ref:`write <write>` |
---|
46 | - Accept an object, and return a string. |
---|
47 | |
---|
48 | **Properties** |
---|
49 | |
---|
50 | .. _options: |
---|
51 | |
---|
52 | options |
---|
53 | ``{Object}`` A reference to options passed to the constructor. |
---|
54 | |
---|
55 | .. _externalProjection: |
---|
56 | |
---|
57 | externalProjection |
---|
58 | :ref:`{ZOO.Projection} <api-zoo-projection>` When passed a externalProjection and internalProjection, |
---|
59 | the format will reproject the geometries it reads or writes. The externalProjection is the projection |
---|
60 | used by the content which is passed into read or which comes out of write. In order to reproject, |
---|
61 | a projection transformation function for the specified projections must be available. This support |
---|
62 | is provided via zoo-proj4js. |
---|
63 | |
---|
64 | .. _internalProjection: |
---|
65 | |
---|
66 | internalProjection |
---|
67 | :ref:`{ZOO.Projection} <api-zoo-projection>` When passed a externalProjection and internalProjection, |
---|
68 | the format will reproject the geometries it reads or writes. The internalProjection is the projection |
---|
69 | used by the geometries which are returned by read or which are passed into write. In order to reproject, |
---|
70 | a projection transformation function for the specified projections must be available. This support |
---|
71 | is provided via zoo-proj4js. |
---|
72 | |
---|
73 | .. _data: |
---|
74 | |
---|
75 | data |
---|
76 | ``{Object}`` When :ref:`keepData <keepData>` is true, this is the parsed string sent to :ref:`read <read>`. |
---|
77 | |
---|
78 | .. _keepData: |
---|
79 | |
---|
80 | keepData |
---|
81 | ``{Object}`` Maintain a reference (:ref:`data <data>`) to the most recently read data. Default is false. |
---|
82 | |
---|
83 | **Functions** |
---|
84 | |
---|
85 | .. _ZOO.Format: |
---|
86 | |
---|
87 | ZOO.Format |
---|
88 | Instances of this class are not useful. See one of the subclasses. |
---|
89 | |
---|
90 | *Parameters* |
---|
91 | |
---|
92 | ``options {Object}`` An optional object with properties to set on the format |
---|
93 | |
---|
94 | *Valid options* |
---|
95 | |
---|
96 | ``keepData {Boolean}`` If true, upon read, the data property will be set to the parsed object (e.g. the json or xml object). |
---|
97 | |
---|
98 | *Returns* |
---|
99 | |
---|
100 | An instance of ZOO.Format |
---|
101 | |
---|
102 | .. _destroy: |
---|
103 | |
---|
104 | destroy |
---|
105 | :: |
---|
106 | |
---|
107 | destroy: function() |
---|
108 | |
---|
109 | Clean up. |
---|
110 | |
---|
111 | .. _read: |
---|
112 | |
---|
113 | read |
---|
114 | :: |
---|
115 | |
---|
116 | read: function(data) |
---|
117 | |
---|
118 | Read data from a string, and return an object whose type depends on the subclass. |
---|
119 | |
---|
120 | *Parameters* |
---|
121 | |
---|
122 | ``data {string}`` Data to read/parse. |
---|
123 | |
---|
124 | *Returns* |
---|
125 | |
---|
126 | Depends on the subclass |
---|
127 | |
---|
128 | .. _write: |
---|
129 | |
---|
130 | write |
---|
131 | :: |
---|
132 | |
---|
133 | write: function(data) |
---|
134 | |
---|
135 | Accept an object, and return a string. |
---|
136 | |
---|
137 | *Parameters* |
---|
138 | |
---|
139 | ``object {Object}`` Object to be serialized |
---|
140 | |
---|
141 | *Returns* |
---|
142 | |
---|
143 | ``{String}`` A string representation of the object. |
---|