<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Curve structure definitions in File Geodatabase API Questions</title>
    <link>https://community.esri.com/t5/file-geodatabase-api-questions/curve-structure-definitions/m-p/355433#M591</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm writing some code to use the API add curve sections to a polyline row.&amp;nbsp; Are there any structure definitions for the curves in the headers? The only definitions I can find are in doc\html\extended_shapefile_format.pdf&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can copy these into my own code, but it would seem more appropriate for the API headers to define them for me.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Oct 2011 02:58:26 GMT</pubDate>
    <dc:creator>__11</dc:creator>
    <dc:date>2011-10-19T02:58:26Z</dc:date>
    <item>
      <title>Curve structure definitions</title>
      <link>https://community.esri.com/t5/file-geodatabase-api-questions/curve-structure-definitions/m-p/355433#M591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm writing some code to use the API add curve sections to a polyline row.&amp;nbsp; Are there any structure definitions for the curves in the headers? The only definitions I can find are in doc\html\extended_shapefile_format.pdf&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can copy these into my own code, but it would seem more appropriate for the API headers to define them for me.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2011 02:58:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/file-geodatabase-api-questions/curve-structure-definitions/m-p/355433#M591</guid>
      <dc:creator>__11</dc:creator>
      <dc:date>2011-10-19T02:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: Curve structure definitions</title>
      <link>https://community.esri.com/t5/file-geodatabase-api-questions/curve-structure-definitions/m-p/355434#M592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is being looked at for a future release.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rather than simply use the curve structure definitions that are in the shape doc, it will probably be better to have a class hierarchy for the three curve types.&amp;nbsp; This avoids the ugliness of the nested unions which is shown in the doc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One of the challenges is the fact that when serialized in the shape buffer, the three curve types are different in size, and the curves are packed in the buffer with no padding bytes.&amp;nbsp; That means that it is not possible to cast the byte array containing the curves into an array of curve objects.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2011 16:57:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/file-geodatabase-api-questions/curve-structure-definitions/m-p/355434#M592</guid>
      <dc:creator>DavidSousa</dc:creator>
      <dc:date>2011-11-09T16:57:58Z</dc:date>
    </item>
    <item>
      <title>Definitions in v1.2 ?</title>
      <link>https://community.esri.com/t5/file-geodatabase-api-questions/curve-structure-definitions/m-p/355435#M593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;According to "&lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/52389-File-Geodatabase-API-1.2-now-available" rel="nofollow noopener noreferrer" target="_blank"&gt;File Geodatabase API 1.2 now available&lt;/A&gt;&lt;SPAN&gt;":&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;What�??s new at 1.2:&lt;BR /&gt;* Structure definitions for curves (CircularArcCurve, BezierCurve, EllipticArcCurve).&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In v1.2, util.h includes class definitions for Curves:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT]class EXT_FILEGDB_API Curve&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;class EXT_FILEGDB_API CircularArcCurve : public Curve&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;etc, but there's no indication as to how we should use them. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No API function uses these classes, so I can't get/set a curve object from/to a shape.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can't just use them as structs and cast the byte pointer from MultiPartShapeBuffer::GetCurves because:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;* The classes/structs are not packed, so I can't guarantee alignment with the byte pointer data&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;* The members include ints, whose size is machine dependent, rather than the fixed size int32&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;* Objects derived from the base class Curve include the virtual function table pointer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a better way than my current methodology, which is to copy the structure definitions from doc\html\extended_shape_buffer_format.pdf and use them thus:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

namespace FileGDBAPI 
{
/*-----------------------------------------------------------------------------
 Curve structure definition, from Extended Shape Buffer Format, February 9, 2012 (doc\html\extended_shape_buffer_format.pdf)
 The document uses "long" for some members, but we use int32 (from FileGDBCore.h) here to ensure a fixed size.
 (The necessary size of a "long" can be deduced from footnote 12.)
*/

#pragma pack(push, 1)

struct WKSPoint
{
 double x, y;
};

struct SegmentArc
{
 union {
&amp;nbsp; WKSPoint centerPoint; // If IsPoint is 0. Also, it is ignored if
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // IsLine is 1.
&amp;nbsp; double angles[2];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // If IsPoint is 1: start and central angle
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // centerPoint = endPoint
 };
 int32 Bits; // Contains, among others, bits for IsPoint, IsLine ...
};

struct esriSegmentModifier
{
 int32 startPointIndex,
 /* enum esriSegmentType */ segmentType;
 union {
&amp;nbsp; SegmentArc arc;
&amp;nbsp; SegmentBezierCurve bezierCurve;
&amp;nbsp; SegmentEllipticArc ellipticArc;
&amp;nbsp; // SegmentOther otherKindsOfSegment;
&amp;nbsp; // ...
 } segmentParams;
};

...

#pragma pack(pop)

} // namespace FileGDBAPI


// Build a vector of curves from my input data
 vector&amp;lt;esriSegmentModifier&amp;gt; vCurves;
 for (...)
 {
&amp;nbsp;&amp;nbsp; esriSegmentModifier modifier;
&amp;nbsp;&amp;nbsp; modifier.startPointIndex = ... 
&amp;nbsp;&amp;nbsp; modifier.segmentType = esriSegmentArc;
&amp;nbsp;&amp;nbsp; modifier.segmentParams.arc.centerPoint.x = ... 
&amp;nbsp;&amp;nbsp; modifier.segmentParams.arc.centerPoint.y = ...
&amp;nbsp;&amp;nbsp; modifier.segmentParams.arc.Bits = ...
&amp;nbsp;&amp;nbsp; vCurves.push_back(modifier);
 }

// Put the curves into a MultiPartShapeBuffer for the database

 MultiPartShapeBuffer polyline;
 ...
 if (vCurves.size() != 0)
 {
&amp;nbsp; byte* curve;
&amp;nbsp; polyline.GetCurves(curve);
&amp;nbsp; for (vector&amp;lt;esriSegmentModifier&amp;gt;::const_iterator iter = vCurves.begin(); iter != vCurves.end(); ++iter)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; // SegmentArc is the only curve supported by this code
&amp;nbsp;&amp;nbsp; assert(iter-&amp;gt;segmentType == esriSegmentArc);

&amp;nbsp;&amp;nbsp; // copy the data from my vector to the ShapeBuffer
&amp;nbsp;&amp;nbsp; esriSegmentModifier* modifier = reinterpret_cast&amp;lt;esriSegmentModifier*&amp;gt;(curve);
&amp;nbsp;&amp;nbsp; *modifier = *iter; 
&amp;nbsp;&amp;nbsp; curve += offsetof(esriSegmentModifier, segmentParams) +&amp;nbsp; sizeof(SegmentArc); 
&amp;nbsp; }
 }

 polyline.CalculateExtent();
 polyline.PackCurves();
 row.SetGeometry(polyline);
}

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:39:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/file-geodatabase-api-questions/curve-structure-definitions/m-p/355435#M593</guid>
      <dc:creator>__11</dc:creator>
      <dc:date>2021-12-11T16:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Curve structure definitions</title>
      <link>https://community.esri.com/t5/file-geodatabase-api-questions/curve-structure-definitions/m-p/355436#M594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My comments re v1.2 apply equally to v1.3&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Dec 2012 04:44:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/file-geodatabase-api-questions/curve-structure-definitions/m-p/355436#M594</guid>
      <dc:creator>__11</dc:creator>
      <dc:date>2012-12-10T04:44:40Z</dc:date>
    </item>
  </channel>
</rss>

