20
20
#include " qgslogger.h"
21
21
#include " qgsapplication.h"
22
22
23
+ /* SqlGeometry serialization format
24
+
25
+ Simple Point (SerializationProps & IsSinglePoint)
26
+ [SRID][0x01][SerializationProps][Point]
27
+
28
+ Simple Line Segment (SerializationProps & IsSingleLineSegment)
29
+ [SRID][0x01][SerializationProps][Point][Point]
30
+
31
+ Complex Geometries
32
+ [SRID][0x01][SerializationProps][NumPoints][Point]..[Point]
33
+ [NumFigures][Figure]..[Figure][NumShapes][Shape]..[Shape]
34
+
35
+ SRID
36
+ Spatial Reference Id (4 bytes)
37
+
38
+ SerializationProps (bitmask) 1 byte
39
+ 0x01 = HasZValues
40
+ 0x02 = HasMValues
41
+ 0x04 = IsValid
42
+ 0x08 = IsSinglePoint
43
+ 0x10 = IsSingleLineSegment
44
+ 0x20 = IsWholeGlobe
45
+
46
+ Point (2-4)x8 bytes, size depends on SerializationProps & HasZValues & HasMValues
47
+ [x][y][z][m] - SqlGeometry
48
+ [latitude][longitude][z][m] - SqlGeography
49
+
50
+ Figure
51
+ [FigureAttribute][PointOffset]
52
+
53
+ FigureAttribute (1 byte)
54
+ 0x00 = Interior Ring
55
+ 0x01 = Stroke
56
+ 0x02 = Exterior Ring
57
+
58
+ Shape
59
+ [ParentFigureOffset][FigureOffset][ShapeType]
60
+
61
+ ShapeType (1 byte)
62
+ 0x00 = Unknown
63
+ 0x01 = Point
64
+ 0x02 = LineString
65
+ 0x03 = Polygon
66
+ 0x04 = MultiPoint
67
+ 0x05 = MultiLineString
68
+ 0x06 = MultiPolygon
69
+ 0x07 = GeometryCollection
70
+
71
+ */
72
+
23
73
/* ***********************************************************************/
24
74
/* Geometry parser macros */
25
75
/* ***********************************************************************/
@@ -179,10 +229,8 @@ void QgsMssqlGeometryParser::ReadPoint( int iShape )
179
229
180
230
void QgsMssqlGeometryParser::ReadMultiPoint ( int iShape )
181
231
{
182
- int iFigure, iPoint, iNextPoint, iCount;
183
- iFigure = FigureOffset ( iShape );
184
- iNextPoint = NextPointOffset ( iFigure );
185
- iCount = iNextPoint - PointOffset ( iFigure );
232
+ int i, iCount;
233
+ iCount = nNumShapes - iShape - 1 ;
186
234
if ( iCount <= 0 )
187
235
return ;
188
236
// copy byte order
@@ -197,9 +245,13 @@ void QgsMssqlGeometryParser::ReadMultiPoint( int iShape )
197
245
// copy point count
198
246
CopyBytes ( &iCount, 4 );
199
247
// copy points
200
- for ( iPoint = PointOffset ( iFigure ); iPoint < iNextPoint; iPoint ++ )
248
+ for ( i = iShape + 1 ; i < nNumShapes; i ++ )
201
249
{
202
- CopyPoint ( iShape );
250
+ if ( ParentOffset ( i ) == ( unsigned int )iShape )
251
+ {
252
+ if ( ShapeType ( i ) == ST_POINT )
253
+ ReadPoint ( i );
254
+ }
203
255
}
204
256
}
205
257
0 commit comments