Serverコンソールアプリ


10.3でx64にビルド変更後に、WKB化を試す。
昔上手くいかなかったのはWKB⇒IGeometryだったけ?
IGeometry⇒WKBは上手くいく模様

using (ESRI.ArcGIS.ADF.ComReleaser com = new ESRI.ArcGIS.ADF.ComReleaser())
{
  IPointCollection pts = new PolylineClass();
  com.ManageLifetime(pts);
  IPoint fromPt = new PointClass();
  com.ManageLifetime(fromPt);
  IPoint toPt = new PointClass();
  com.ManageLifetime(toPt);

  fromPt.PutCoords(0, 0);
  toPt.PutCoords(100, 0);

  pts.AddPoint(fromPt);
  pts.AddPoint(toPt);

  ITopologicalOperator2 simple = (ITopologicalOperator2)pts;
  simple.IsKnownSimple_2 = false;
  simple.Simplify();

  IGeometryFactory3 geometryFactory = (IGeometryFactory3)Activator.CreateInstance(Type.GetTypeFromProgID("esriGeometry.GeometryEnvironment"));
  com.ManageLifetime(geometryFactory);
  byte[] data = geometryFactory.CreateWkbVariantFromGeometry((IGeometry)pts) as byte[];

  Console.WriteLine(data.Length);
}
カテゴリー: 開発 パーマリンク