Knowledge Base



KB10215 - Save or read a shape from the stream with the DK.

A shape has two properties, Shape.Geometry and Shape.GeometrySize.

The shape can be saved to the stream by:

  myStream.Write(Shape.Shape.GeometrySize, Sizeof(Shape.Shape.GeometrySize));
  myStream.Write(Shape.Geometry, Shape.GeometrySize);

A shape can be read from the stream by:

  myStream.Read(size, Sizeof(Shape.Shape.GeometrySize));
  Getmem(ptr, size);
  myStream.Write(Shape.Geometry, size);
  shp := TGIS_ShapeArc.Create(nil, ptr, false, uid, myLayer);
  FreeMem(ptr);

Of course you can also save a shape type, uid, etc. in a stream and then use this data for proper shape creation.

Created: November 21, 2003, Modified: December 18, 2015