Q&A - Question

Using TGIS_ShapeTypePolygon.Create

Question
TreP asked on July 12, 2017, keyword: Developer Kernel
I'm migrating some code from DK8 to DK10.
The code creates a number of shapes which are stored and read from a FileStream and stored in records as Parts and Points.

InShape is declared as a TGIS_Shape;
TmpArc is declared as a TGIS_ShapeArc;

  ll := TGIS_Layervector(GIS.Items[0]);

Before calling TGIS_ShapePolygon.Create, TmpArc is created with
  TmpArc := TGIS_shapeArc(ll.CreateShape(gisShapeTypearc));
  if TmpArc = nil then exit;

The specific line of code that fails is:
   InShape := TGIS_ShapePolygon.Create( TmpArc, TmpPointer, False, 1, ll ) ;

The TGIS_ShapeTypePolygon.Create fails at run time in procedure TGIS_Shape.prepareGeometry with self.shapeType of "gisShapeTypeUnknown"

This works in DK8 but not in DK10, giving a "0002 Untested case' error

Any ideas?
Thanks!

 
Answers
TreP replied July 12, 2017
This was resolved with the assistance of Tatuk Support Staff, as follows:

{when opening the map, add another layervector}
 GIS.Add(  TGIS_LayerVector.Create ) ;    {this becomes GIS[1]}

{then to create the shape data, create it with no data then add (recreate) the data}
var
TmpShp : TGIS_Shape;
ll  : TGIS_LayerVector ;

 ll := TGIS_Layervector(GIS.Items[1])
TmpShp := ll.CreateShape(gisShapeTypePolygon);

  InShape := TGIS_ShapePolygon.Create();
  InShape.Recreate( TmpShp, TmpPointer, False, 1, ll ) ;

Incidentally, the title should have stated: Using TGIS_ShapePolygon.Create
If you would like to answer the question please Sign In.
*
*
Please review our recent Privacy Policy.
If you have any questions or requests, please contact us.
Rules
The Questions and Answers (Q & A) is intended to provide a means of communication between TatukGIS customers.
 
  1. Licensed users (with active maintenance play) of TatukGIS products may contribute to the Q & A content. Read-only access is available to anyone.
  2. Keep the content positive and professional.
  3. Be courteous to others by posting information when a question or issue asked on the Q & A is answered or resolved by other means (such as with help from TatukGIS technical support). Offer others at least a hint how the posted question was answered or the issue was resolved.
  4. The Q & A is not a replacement for TatukGIS technical support. TatukGIS team may or may not regularly follow or contribute content.