프로젝트

일반

사용자정보

개정판 f5db2097

IDf5db2097e13c4cfc4a1041b035f95ca0e62f19a7
상위 68de5457
하위 74676ef3

백흠경이(가) 2년 이상 전에 추가함

최신 코드로 반영

Change-Id: I647ae81ea94573e20ce8c724b6a2458c68aae2b6

차이점 보기:

DTI_PID/OdReadExMgd/OdReadExMgd.cs
158 158
        {
159 159
            Console.WriteLine();
160 160
        }
161

  
161 162
        static void dumpEntityData(Entity pEnt, int indent, XmlNode node)
162 163
        {
163 164
            if (node != null)
......
229 230
                TextNode.Attributes.SetNamedItem(XAttr);
230 231

  
231 232
                XmlAttribute YAttr = Program.xml.CreateAttribute("Y");
232
                XAttr.Value = pText.Position.Y.ToString();
233
                YAttr.Value = pText.Position.Y.ToString();
233 234
                TextNode.Attributes.SetNamedItem(YAttr);
234 235

  
235 236
                TextNode.InnerText = pText.TextString.Replace("%%U", "");
......
373 374

  
374 375
                dumpEntityData(pBlkRef, indent, BlockReferenceNode);
375 376

  
377
                DBObjectCollection objColl = new DBObjectCollection();
378
                pBlkRef.Explode(objColl);
379
                foreach (var obj in objColl)
380
                {
381
                    if (obj is DBText)
382
                    {
383
                        dumpTextData(obj as DBText, indent, BlockReferenceNode);
384
                    }
385
                }
386

  
376 387
                /**********************************************************************/
377 388
                /* Dump the attributes                                                */
378 389
                /**********************************************************************/
......
666 677
                ThicknessAttr.Value = pPolyline.Thickness.ToString();
667 678
                Polyline2dNode.Attributes.SetNamedItem(ThicknessAttr);
668 679

  
680
                XmlAttribute ClosedAttr = Program.xml.CreateAttribute("Closed");
681
                ClosedAttr.Value = pPolyline.Closed.ToString();
682
                Polyline2dNode.Attributes.SetNamedItem(ClosedAttr);
683

  
669 684
                foreach (var vt in Vertices)
670 685
                {
671 686
                    XmlNode VertexNode = Program.xml.CreateElement("Vertex");
......
869 884
            return null;
870 885
        }
871 886

  
872
    /************************************************************************/
873
    /* Arc Dumper                                                           */
874
    /************************************************************************/
875
    XmlNode dump(Arc pArc, int indent, XmlNode node)
876
    {
877
        if (node != null)
887
        /************************************************************************/
888
        /* Arc Dumper                                                           */
889
        /************************************************************************/
890
        XmlNode dump(Arc pArc, int indent, XmlNode node)
878 891
        {
879
            XmlElement ArcNode = Program.xml.CreateElement(pArc.GetRXClass().Name);
892
            if (node != null)
893
            {
894
                XmlElement ArcNode = Program.xml.CreateElement(pArc.GetRXClass().Name);
880 895

  
881
            XmlAttribute XAttr = Program.xml.CreateAttribute("X");
882
            XAttr.Value = pArc.Center.X.ToString();
883
            ArcNode.Attributes.SetNamedItem(XAttr);
896
                XmlAttribute XAttr = Program.xml.CreateAttribute("X");
897
                XAttr.Value = pArc.Center.X.ToString();
898
                ArcNode.Attributes.SetNamedItem(XAttr);
884 899

  
885
            XmlAttribute YAttr = Program.xml.CreateAttribute("Y");
886
            YAttr.Value = pArc.Center.Y.ToString();
887
            ArcNode.Attributes.SetNamedItem(YAttr);
900
                XmlAttribute YAttr = Program.xml.CreateAttribute("Y");
901
                YAttr.Value = pArc.Center.Y.ToString();
902
                ArcNode.Attributes.SetNamedItem(YAttr);
888 903

  
889
            XmlAttribute ZAttr = Program.xml.CreateAttribute("Z");
890
            ZAttr.Value = pArc.Center.Z.ToString();
891
            ArcNode.Attributes.SetNamedItem(ZAttr);
904
                XmlAttribute ZAttr = Program.xml.CreateAttribute("Z");
905
                ZAttr.Value = pArc.Center.Z.ToString();
906
                ArcNode.Attributes.SetNamedItem(ZAttr);
892 907

  
893
            XmlAttribute RadiusAttr = Program.xml.CreateAttribute("Radius");
894
            RadiusAttr.Value = pArc.Radius.ToString();
895
            ArcNode.Attributes.SetNamedItem(RadiusAttr);
908
                XmlAttribute RadiusAttr = Program.xml.CreateAttribute("Radius");
909
                RadiusAttr.Value = pArc.Radius.ToString();
910
                ArcNode.Attributes.SetNamedItem(RadiusAttr);
896 911

  
897
            XmlAttribute StartAngleAttr = Program.xml.CreateAttribute("StartAngle");
898
            StartAngleAttr.Value = pArc.StartAngle.ToString();
899
            ArcNode.Attributes.SetNamedItem(StartAngleAttr);
912
                XmlAttribute StartAngleAttr = Program.xml.CreateAttribute("StartAngle");
913
                StartAngleAttr.Value = pArc.StartAngle.ToString();
914
                ArcNode.Attributes.SetNamedItem(StartAngleAttr);
900 915

  
901
            XmlAttribute EndAngleAttr = Program.xml.CreateAttribute("EndAngle");
902
            EndAngleAttr.Value = pArc.EndAngle.ToString();
903
            ArcNode.Attributes.SetNamedItem(EndAngleAttr);
916
                XmlAttribute EndAngleAttr = Program.xml.CreateAttribute("EndAngle");
917
                EndAngleAttr.Value = pArc.EndAngle.ToString();
918
                ArcNode.Attributes.SetNamedItem(EndAngleAttr);
904 919

  
905
            XmlAttribute NormalAttr = Program.xml.CreateAttribute("Normal");
906
            NormalAttr.Value = pArc.Normal.ToString();
907
            ArcNode.Attributes.SetNamedItem(NormalAttr);
920
                XmlAttribute NormalAttr = Program.xml.CreateAttribute("Normal");
921
                NormalAttr.Value = pArc.Normal.ToString();
922
                ArcNode.Attributes.SetNamedItem(NormalAttr);
908 923

  
909
            XmlAttribute ThicknessAttr = Program.xml.CreateAttribute("Thickness");
910
            ThicknessAttr.Value = pArc.Normal.ToString();
911
            ArcNode.Attributes.SetNamedItem(ThicknessAttr);
924
                XmlAttribute ThicknessAttr = Program.xml.CreateAttribute("Thickness");
925
                ThicknessAttr.Value = pArc.Normal.ToString();
926
                ArcNode.Attributes.SetNamedItem(ThicknessAttr);
912 927

  
913
            writeLine(indent++, pArc.GetRXClass().Name, pArc.Handle);
914
            dumpCurveData(pArc, indent, ArcNode);
928
                writeLine(indent++, pArc.GetRXClass().Name, pArc.Handle);
929
                dumpCurveData(pArc, indent, ArcNode);
915 930

  
916
            node.AppendChild(ArcNode);
931
                node.AppendChild(ArcNode);
917 932

  
918
            return ArcNode;
919
        }
933
                return ArcNode;
934
            }
920 935

  
921
        return null;
922
    }
936
            return null;
937
        }
923 938

  
924 939
        /************************************************************************/
925 940
        /* Arc Dimension Dumper                                                 */
......
982 997
        }
983 998

  
984 999

  
985
    /************************************************************************/
986
    /* Block Reference Dumper                                                */
987
    /************************************************************************/
988
    void dump(BlockReference pBlkRef, int indent, XmlNode node)
989
    {
990
        writeLine(indent++, pBlkRef.GetRXClass().Name, pBlkRef.Handle);
991

  
992
        using (BlockTableRecord pRecord = (BlockTableRecord)pBlkRef.BlockTableRecord.Open(OpenMode.ForRead))
1000
        /************************************************************************/
1001
        /* Block Reference Dumper                                                */
1002
        /************************************************************************/
1003
        void dump(BlockReference pBlkRef, int indent, XmlNode node)
993 1004
        {
1005
            using (BlockTableRecord pRecord = (BlockTableRecord)pBlkRef.BlockTableRecord.Open(OpenMode.ForRead))
1006
            {
994 1007
                XmlNode BlockRefNode = dumpBlockRefData(pBlkRef, indent, node);
995 1008
                if (BlockRefNode != null)
996 1009
                {
......
998 1011
                    NameAttr.Value = pRecord.Name;
999 1012
                    BlockRefNode.Attributes.SetNamedItem(NameAttr);
1000 1013
                }
1001
            /********************************************************************/
1002
            /* Dump the Spatial Filter  (Xref Clip)                             */
1003
            /********************************************************************/
1004
            // TODO:
1005
            /*
1006
            Filters.SpatialFilter pFilt = 
1007
            {
1008
              writeLine(indent++, pFilt.GetRXClass().Name,   pFilt.Handle);
1009
              writeLine(indent, "Normal",                    pFilt.Definition.Normal);
1010
              writeLine(indent, "Elevation",                 pFilt.Definition.Elevation);
1011
              writeLine(indent, "Front Clip Distance",       pFilt.Definition.FrontClip);
1012
              writeLine(indent, "Back Clip Distance",        pFilt.Definition.BackClip);
1013
              writeLine(indent, "Enabled",                   pFilt.Definition.Enabled);
1014
              foreach (Point2d p in pFilt.Definition.GetPoints())
1015
              {
1016
                writeLine(indent, string.Format("Clip point %d",i), p);
1017
              }
1018 1014
            }
1019
             */
1020 1015
        }
1021
    }
1022 1016

  
1023 1017
        /************************************************************************/
1024 1018
        /* Body Dumper                                                          */
......
1114 1108
            return null;
1115 1109
        }
1116 1110

  
1117
    /************************************************************************/
1118
    /* Ellipse Dumper                                                       */
1119
    /************************************************************************/
1120
    void dump(Ellipse pEllipse, int indent, XmlNode node)
1121
    {
1111
        /************************************************************************/
1112
        /* Ellipse Dumper                                                       */
1113
        /************************************************************************/
1114
        void dump(Ellipse pEllipse, int indent, XmlNode node)
1115
        {
1122 1116
            if (node != null)
1123 1117
            {
1124 1118
                XmlElement EllipseNode = Program.xml.CreateElement(pEllipse.GetRXClass().Name);
......
1217 1211
            return null;
1218 1212
        }
1219 1213

  
1220
    /************************************************************************/
1221
    /* FCF Dumper                                                           */
1222
    /************************************************************************/
1223
    void dump(FeatureControlFrame pFcf, int indent)
1224
    {
1225
      writeLine(indent++, pFcf.GetRXClass().Name, pFcf.Handle);
1226
      writeLine(indent, "Location", pFcf.Location);
1227
      writeLine(indent, "Text", pFcf.Text);
1228
      writeLine(indent, "Dimension Style", pFcf.DimensionStyleName);
1229
      writeLine(indent, "Dimension Gap", pFcf.Dimgap);
1230
      writeLine(indent, "Dimension Scale", pFcf.Dimscale);
1231
      writeLine(indent, "Text Height", pFcf.Dimtxt);
1232
      writeLine(indent, "Frame Color", pFcf.Dimclrd);
1233
      writeLine(indent, "Text Style", pFcf.TextStyleName);
1234
      writeLine(indent, "Text Color", pFcf.Dimclrd);
1235
      writeLine(indent, "X-Direction", pFcf.Direction);
1236
      writeLine(indent, "Normal", pFcf.Normal);
1237
      dumpEntityData(pFcf, indent, Program.xml.DocumentElement);
1238
    }
1239

  
1240
    /************************************************************************/
1241
    /* Hatch Dumper                                                         */
1242
    /************************************************************************/
1243
    /***********************************************************************/
1244
    /* Dump Polyline Loop                                                  */
1245
    /***********************************************************************/
1246
    static void dumpPolylineType(int loopIndex, Hatch pHatch, int indent)
1247
    {
1248
      HatchLoop hl = pHatch.GetLoopAt(loopIndex);
1249
      for (int i = 0; i < hl.Polyline.Count; i++)
1250
      {
1251
        BulgeVertex bv = hl.Polyline[i];
1252
        writeLine(indent, "Vertex " + i.ToString(), bv.Vertex.ToString());
1253
        writeLine(indent + 1, "Bulge " + i.ToString(), bv.Bulge);
1254
        writeLine(indent + 1, "Bulge angle " + i.ToString(), toDegreeString(4 * Math.Atan(bv.Bulge)));
1255
      }
1256
    }
1257

  
1258
    /**********************************************************************/
1259
    /* Dump Circular Arc Edge                                             */
1260
    /**********************************************************************/
1261
    static void dumpCircularArcEdge(int indent, CircularArc2d pCircArc)
1262
    {
1263
      writeLine(indent, "Center", pCircArc.Center);
1264
      writeLine(indent, "Radius", pCircArc.Radius);
1265
      writeLine(indent, "Start Angle", toDegreeString(pCircArc.StartAngle));
1266
      writeLine(indent, "End Angle", toDegreeString(pCircArc.EndAngle));
1267
      writeLine(indent, "Clockwise", pCircArc.IsClockWise);
1268
    }
1214
        /************************************************************************/
1215
        /* FCF Dumper                                                           */
1216
        /************************************************************************/
1217
        void dump(FeatureControlFrame pFcf, int indent)
1218
        {
1219
          writeLine(indent++, pFcf.GetRXClass().Name, pFcf.Handle);
1220
          writeLine(indent, "Location", pFcf.Location);
1221
          writeLine(indent, "Text", pFcf.Text);
1222
          writeLine(indent, "Dimension Style", pFcf.DimensionStyleName);
1223
          writeLine(indent, "Dimension Gap", pFcf.Dimgap);
1224
          writeLine(indent, "Dimension Scale", pFcf.Dimscale);
1225
          writeLine(indent, "Text Height", pFcf.Dimtxt);
1226
          writeLine(indent, "Frame Color", pFcf.Dimclrd);
1227
          writeLine(indent, "Text Style", pFcf.TextStyleName);
1228
          writeLine(indent, "Text Color", pFcf.Dimclrd);
1229
          writeLine(indent, "X-Direction", pFcf.Direction);
1230
          writeLine(indent, "Normal", pFcf.Normal);
1231
          dumpEntityData(pFcf, indent, Program.xml.DocumentElement);
1232
        }
1269 1233

  
1270
    /**********************************************************************/
1271
    /* Dump Elliptical Arc Edge                                           */
1272
    /**********************************************************************/
1273
    static void dumpEllipticalArcEdge(int indent, EllipticalArc2d pEllipArc)
1274
    {
1275
      writeLine(indent, "Center", pEllipArc.Center);
1276
      writeLine(indent, "Major Radius", pEllipArc.MajorRadius);
1277
      writeLine(indent, "Minor Radius", pEllipArc.MinorRadius);
1278
      writeLine(indent, "Major Axis", pEllipArc.MajorAxis);
1279
      writeLine(indent, "Minor Axis", pEllipArc.MinorAxis);
1280
      writeLine(indent, "Start Angle", toDegreeString(pEllipArc.StartAngle));
1281
      writeLine(indent, "End Angle", toDegreeString(pEllipArc.EndAngle));
1282
      writeLine(indent, "Clockwise", pEllipArc.IsClockWise);
1283
    }
1284
    /**********************************************************************/
1285
    /* Dump NurbCurve Edge                                           */
1286
    /**********************************************************************/
1287
    static void dumpNurbCurveEdge(int indent, NurbCurve2d pNurbCurve)
1288
    {
1289
      NurbCurve2dData d = pNurbCurve.DefinitionData;
1290
      writeLine(indent, "Degree", d.Degree);
1291
      writeLine(indent, "Rational", d.Rational);
1292
      writeLine(indent, "Periodic", d.Periodic);
1234
        /************************************************************************/
1235
        /* Hatch Dumper                                                         */
1236
        /************************************************************************/
1237
        /***********************************************************************/
1238
        /* Dump Polyline Loop                                                  */
1239
        /***********************************************************************/
1240
        static void dumpPolylineType(int loopIndex, Hatch pHatch, int indent)
1241
        {
1242
          HatchLoop hl = pHatch.GetLoopAt(loopIndex);
1243
          for (int i = 0; i < hl.Polyline.Count; i++)
1244
          {
1245
            BulgeVertex bv = hl.Polyline[i];
1246
            writeLine(indent, "Vertex " + i.ToString(), bv.Vertex.ToString());
1247
            writeLine(indent + 1, "Bulge " + i.ToString(), bv.Bulge);
1248
            writeLine(indent + 1, "Bulge angle " + i.ToString(), toDegreeString(4 * Math.Atan(bv.Bulge)));
1249
          }
1250
        }
1293 1251

  
1294
      writeLine(indent, "Number of Control Points", d.ControlPoints.Count);
1295
      for (int i = 0; i < d.ControlPoints.Count; i++)
1296
      {
1297
        writeLine(indent, "Control Point " + i.ToString(), d.ControlPoints[i]);
1298
      }
1299
      writeLine(indent, "Number of Knots", d.Knots.Count);
1300
      for (int i = 0; i < d.Knots.Count; i++)
1301
      {
1302
        writeLine(indent, "Knot " + i.ToString(), d.Knots[i]);
1303
      }
1252
        /**********************************************************************/
1253
        /* Dump Circular Arc Edge                                             */
1254
        /**********************************************************************/
1255
        static void dumpCircularArcEdge(int indent, CircularArc2d pCircArc)
1256
        {
1257
          writeLine(indent, "Center", pCircArc.Center);
1258
          writeLine(indent, "Radius", pCircArc.Radius);
1259
          writeLine(indent, "Start Angle", toDegreeString(pCircArc.StartAngle));
1260
          writeLine(indent, "End Angle", toDegreeString(pCircArc.EndAngle));
1261
          writeLine(indent, "Clockwise", pCircArc.IsClockWise);
1262
        }
1304 1263

  
1305
      if (d.Rational)
1306
      {
1307
        writeLine(indent, "Number of Weights", d.Weights.Count);
1308
        for (int i = 0; i < d.Weights.Count; i++)
1264
        /**********************************************************************/
1265
        /* Dump Elliptical Arc Edge                                           */
1266
        /**********************************************************************/
1267
        static void dumpEllipticalArcEdge(int indent, EllipticalArc2d pEllipArc)
1309 1268
        {
1310
          writeLine(indent, "Weight " + i.ToString(), d.Weights[i]);
1269
          writeLine(indent, "Center", pEllipArc.Center);
1270
          writeLine(indent, "Major Radius", pEllipArc.MajorRadius);
1271
          writeLine(indent, "Minor Radius", pEllipArc.MinorRadius);
1272
          writeLine(indent, "Major Axis", pEllipArc.MajorAxis);
1273
          writeLine(indent, "Minor Axis", pEllipArc.MinorAxis);
1274
          writeLine(indent, "Start Angle", toDegreeString(pEllipArc.StartAngle));
1275
          writeLine(indent, "End Angle", toDegreeString(pEllipArc.EndAngle));
1276
          writeLine(indent, "Clockwise", pEllipArc.IsClockWise);
1311 1277
        }
1312
      }
1313
    }
1314 1278

  
1315
    /***********************************************************************/
1316
    /* Dump Edge Loop                                                      */
1317
    /***********************************************************************/
1318
    static void dumpEdgesType(int loopIndex, Hatch pHatch, int indent)
1319
    {
1320
      Curve2dCollection edges = pHatch.GetLoopAt(loopIndex).Curves;
1321
      for (int i = 0; i < (int)edges.Count; i++)
1322
      {
1323
        using (Curve2d pEdge = edges[i])
1279
        /**********************************************************************/
1280
        /* Dump NurbCurve Edge                                           */
1281
        /**********************************************************************/
1282
        static void dumpNurbCurveEdge(int indent, NurbCurve2d pNurbCurve)
1324 1283
        {
1325
          writeLine(indent, string.Format("Edge {0}", i), pEdge.GetType().Name);
1326
          switch (pEdge.GetType().Name)
1284
          NurbCurve2dData d = pNurbCurve.DefinitionData;
1285
          writeLine(indent, "Degree", d.Degree);
1286
          writeLine(indent, "Rational", d.Rational);
1287
          writeLine(indent, "Periodic", d.Periodic);
1288

  
1289
          writeLine(indent, "Number of Control Points", d.ControlPoints.Count);
1290
          for (int i = 0; i < d.ControlPoints.Count; i++)
1327 1291
          {
1328
            case "LineSegment2d":
1329
              break;
1330
            case "CircularArc2d":
1331
              dumpCircularArcEdge(indent + 1, (CircularArc2d)pEdge);
1332
              break;
1333
            case "EllipticalArc2d":
1334
              dumpEllipticalArcEdge(indent + 1, (EllipticalArc2d)pEdge);
1335
              break;
1336
            case "NurbCurve2d":
1337
              dumpNurbCurveEdge(indent + 1, (NurbCurve2d)pEdge);
1338
              break;
1292
            writeLine(indent, "Control Point " + i.ToString(), d.ControlPoints[i]);
1293
          }
1294
          writeLine(indent, "Number of Knots", d.Knots.Count);
1295
          for (int i = 0; i < d.Knots.Count; i++)
1296
          {
1297
            writeLine(indent, "Knot " + i.ToString(), d.Knots[i]);
1339 1298
          }
1340 1299

  
1341
          /******************************************************************/
1342
          /* Common Edge Properties                                         */
1343
          /******************************************************************/
1344
          Interval interval = pEdge.GetInterval();
1345
          writeLine(indent + 1, "Start Point", pEdge.EvaluatePoint(interval.LowerBound));
1346
          writeLine(indent + 1, "End Point", pEdge.EvaluatePoint(interval.UpperBound));
1347
          writeLine(indent + 1, "Closed", pEdge.IsClosed());
1300
          if (d.Rational)
1301
          {
1302
            writeLine(indent, "Number of Weights", d.Weights.Count);
1303
            for (int i = 0; i < d.Weights.Count; i++)
1304
            {
1305
              writeLine(indent, "Weight " + i.ToString(), d.Weights[i]);
1306
            }
1307
          }
1348 1308
        }
1349
      }
1350
    }
1351
    /************************************************************************/
1352
    /* Convert the specified value to a LoopType string                     */
1353
    /************************************************************************/
1354
    string toLooptypeString(HatchLoopTypes loopType)
1355
    {
1356
      string retVal = "";
1357
      if ((loopType & HatchLoopTypes.External) != 0)
1358
        retVal = retVal + " | kExternal";
1359 1309

  
1360
      if ((loopType & HatchLoopTypes.Polyline) != 0)
1361
        retVal = retVal + " | kPolyline";
1310
        /***********************************************************************/
1311
        /* Dump Edge Loop                                                      */
1312
        /***********************************************************************/
1313
        static void dumpEdgesType(int loopIndex, Hatch pHatch, int indent)
1314
        {
1315
          Curve2dCollection edges = pHatch.GetLoopAt(loopIndex).Curves;
1316
          for (int i = 0; i < (int)edges.Count; i++)
1317
          {
1318
            using (Curve2d pEdge = edges[i])
1319
            {
1320
              writeLine(indent, string.Format("Edge {0}", i), pEdge.GetType().Name);
1321
              switch (pEdge.GetType().Name)
1322
              {
1323
                case "LineSegment2d":
1324
                  break;
1325
                case "CircularArc2d":
1326
                  dumpCircularArcEdge(indent + 1, (CircularArc2d)pEdge);
1327
                  break;
1328
                case "EllipticalArc2d":
1329
                  dumpEllipticalArcEdge(indent + 1, (EllipticalArc2d)pEdge);
1330
                  break;
1331
                case "NurbCurve2d":
1332
                  dumpNurbCurveEdge(indent + 1, (NurbCurve2d)pEdge);
1333
                  break;
1334
              }
1362 1335

  
1363
      if ((loopType & HatchLoopTypes.Derived) != 0)
1364
        retVal = retVal + " | kDerived";
1336
              /******************************************************************/
1337
              /* Common Edge Properties                                         */
1338
              /******************************************************************/
1339
              Interval interval = pEdge.GetInterval();
1340
              writeLine(indent + 1, "Start Point", pEdge.EvaluatePoint(interval.LowerBound));
1341
              writeLine(indent + 1, "End Point", pEdge.EvaluatePoint(interval.UpperBound));
1342
              writeLine(indent + 1, "Closed", pEdge.IsClosed());
1343
            }
1344
          }
1345
        }
1365 1346

  
1366
      if ((loopType & HatchLoopTypes.Textbox) != 0)
1367
        retVal = retVal + " | kTextbox";
1347
        /************************************************************************/
1348
        /* Convert the specified value to a LoopType string                     */
1349
        /************************************************************************/
1350
        string toLooptypeString(HatchLoopTypes loopType)
1351
        {
1352
          string retVal = "";
1353
          if ((loopType & HatchLoopTypes.External) != 0)
1354
            retVal = retVal + " | kExternal";
1368 1355

  
1369
      if ((loopType & HatchLoopTypes.Outermost) != 0)
1370
        retVal = retVal + " | kOutermost";
1356
          if ((loopType & HatchLoopTypes.Polyline) != 0)
1357
            retVal = retVal + " | kPolyline";
1371 1358

  
1372
      if ((loopType & HatchLoopTypes.NotClosed) != 0)
1373
        retVal = retVal + " | kNotClosed";
1359
          if ((loopType & HatchLoopTypes.Derived) != 0)
1360
            retVal = retVal + " | kDerived";
1374 1361

  
1375
      if ((loopType & HatchLoopTypes.SelfIntersecting) != 0)
1376
        retVal = retVal + " | kSelfIntersecting";
1362
          if ((loopType & HatchLoopTypes.Textbox) != 0)
1363
            retVal = retVal + " | kTextbox";
1377 1364

  
1378
      if ((loopType & HatchLoopTypes.TextIsland) != 0)
1379
        retVal = retVal + " | kTextIsland";
1365
          if ((loopType & HatchLoopTypes.Outermost) != 0)
1366
            retVal = retVal + " | kOutermost";
1380 1367

  
1381
      if ((loopType & HatchLoopTypes.Duplicate) != 0)
1382
        retVal = retVal + " | kDuplicate";
1368
          if ((loopType & HatchLoopTypes.NotClosed) != 0)
1369
            retVal = retVal + " | kNotClosed";
1383 1370

  
1384
      return retVal == "" ? "kDefault" : retVal.Substring(3);
1385
    }
1371
          if ((loopType & HatchLoopTypes.SelfIntersecting) != 0)
1372
            retVal = retVal + " | kSelfIntersecting";
1386 1373

  
1387
    void dump(Hatch pHatch, int indent)
1388
    {
1389
      writeLine(indent++, pHatch.GetRXClass().Name, pHatch.Handle);
1390
      writeLine(indent, "Hatch Style", pHatch.HatchStyle);
1391
      writeLine(indent, "Hatch Object Type", pHatch.HatchObjectType);
1392
      writeLine(indent, "Is Hatch", pHatch.IsHatch);
1393
      writeLine(indent, "Is Gradient", !pHatch.IsGradient);
1394
      if (pHatch.IsHatch)
1395
      {
1396
        /******************************************************************/
1397
        /* Dump Hatch Parameters                                          */
1398
        /******************************************************************/
1399
        writeLine(indent, "Pattern Type", pHatch.PatternType);
1400
        switch (pHatch.PatternType)
1401
        {
1402
          case HatchPatternType.PreDefined:
1403
          case HatchPatternType.CustomDefined:
1404
            writeLine(indent, "Pattern Name", pHatch.PatternName);
1405
            writeLine(indent, "Solid Fill", pHatch.IsSolidFill);
1406
            if (!pHatch.IsSolidFill)
1407
            {
1408
              writeLine(indent, "Pattern Angle", toDegreeString(pHatch.PatternAngle));
1409
              writeLine(indent, "Pattern Scale", pHatch.PatternScale);
1410
            }
1411
            break;
1412
          case HatchPatternType.UserDefined:
1413
            writeLine(indent, "Pattern Angle", toDegreeString(pHatch.PatternAngle));
1414
            writeLine(indent, "Pattern Double", pHatch.PatternDouble);
1415
            writeLine(indent, "Pattern Space", pHatch.PatternSpace);
1416
            break;
1417
        }
1418
        DBObjectCollection entitySet = new DBObjectCollection();
1419
        Handle hhh = pHatch.Handle;
1420
        if (hhh.Value == 1692) //69C)
1421
        {
1422
          pHatch.Explode(entitySet);
1423
          return;
1374
          if ((loopType & HatchLoopTypes.TextIsland) != 0)
1375
            retVal = retVal + " | kTextIsland";
1376

  
1377
          if ((loopType & HatchLoopTypes.Duplicate) != 0)
1378
            retVal = retVal + " | kDuplicate";
1379

  
1380
          return retVal == "" ? "kDefault" : retVal.Substring(3);
1424 1381
        }
1425
        if (hhh.Value == 1693) //69D)
1382

  
1383
        void dump(Hatch pHatch, int indent)
1426 1384
        {
1427
          try
1385
          writeLine(indent++, pHatch.GetRXClass().Name, pHatch.Handle);
1386
          writeLine(indent, "Hatch Style", pHatch.HatchStyle);
1387
          writeLine(indent, "Hatch Object Type", pHatch.HatchObjectType);
1388
          writeLine(indent, "Is Hatch", pHatch.IsHatch);
1389
          writeLine(indent, "Is Gradient", !pHatch.IsGradient);
1390
          if (pHatch.IsHatch)
1428 1391
          {
1429
            pHatch.Explode(entitySet);
1392
            /******************************************************************/
1393
            /* Dump Hatch Parameters                                          */
1394
            /******************************************************************/
1395
            writeLine(indent, "Pattern Type", pHatch.PatternType);
1396
            switch (pHatch.PatternType)
1397
            {
1398
              case HatchPatternType.PreDefined:
1399
              case HatchPatternType.CustomDefined:
1400
                writeLine(indent, "Pattern Name", pHatch.PatternName);
1401
                writeLine(indent, "Solid Fill", pHatch.IsSolidFill);
1402
                if (!pHatch.IsSolidFill)
1403
                {
1404
                  writeLine(indent, "Pattern Angle", toDegreeString(pHatch.PatternAngle));
1405
                  writeLine(indent, "Pattern Scale", pHatch.PatternScale);
1406
                }
1407
                break;
1408
              case HatchPatternType.UserDefined:
1409
                writeLine(indent, "Pattern Angle", toDegreeString(pHatch.PatternAngle));
1410
                writeLine(indent, "Pattern Double", pHatch.PatternDouble);
1411
                writeLine(indent, "Pattern Space", pHatch.PatternSpace);
1412
                break;
1413
            }
1414
            DBObjectCollection entitySet = new DBObjectCollection();
1415
            Handle hhh = pHatch.Handle;
1416
            if (hhh.Value == 1692) //69C)
1417
            {
1418
              pHatch.Explode(entitySet);
1419
              return;
1420
            }
1421
            if (hhh.Value == 1693) //69D)
1422
            {
1423
              try
1424
              {
1425
                pHatch.Explode(entitySet);
1426
              }
1427
              catch (System.Exception e)
1428
              {
1429
                if (e.Message == "eCannotExplodeEntity")
1430
                {
1431
                  writeLine(indent, "Hatch " + e.Message + ": ", pHatch.Handle);
1432
                  return;
1433
                }
1434
              }
1435
            }
1430 1436
          }
1431
          catch (System.Exception e)
1437
          if (pHatch.IsGradient)
1432 1438
          {
1433
            if (e.Message == "eCannotExplodeEntity")
1439
            /******************************************************************/
1440
            /* Dump Gradient Parameters                                       */
1441
            /******************************************************************/
1442
            writeLine(indent, "Gradient Type", pHatch.GradientType);
1443
            writeLine(indent, "Gradient Name", pHatch.GradientName);
1444
            writeLine(indent, "Gradient Angle", toDegreeString(pHatch.GradientAngle));
1445
            writeLine(indent, "Gradient Shift", pHatch.GradientShift);
1446
            writeLine(indent, "Gradient One-Color Mode", pHatch.GradientOneColorMode);
1447
            if (pHatch.GradientOneColorMode)
1434 1448
            {
1435
              writeLine(indent, "Hatch " + e.Message + ": ", pHatch.Handle);
1436
              return;
1449
              writeLine(indent, "ShadeTintValue", pHatch.ShadeTintValue);
1450
            }
1451
            GradientColor[] colors = pHatch.GetGradientColors();
1452
            for (int i = 0; i < colors.Length; i++)
1453
            {
1454
              writeLine(indent, string.Format("Color         {0}", i), colors[i].get_Color());
1455
              writeLine(indent, string.Format("Interpolation {0}", i), colors[i].get_Value());
1437 1456
            }
1438 1457
          }
1439
        }
1440
      }
1441
      if (pHatch.IsGradient)
1442
      {
1443
        /******************************************************************/
1444
        /* Dump Gradient Parameters                                       */
1445
        /******************************************************************/
1446
        writeLine(indent, "Gradient Type", pHatch.GradientType);
1447
        writeLine(indent, "Gradient Name", pHatch.GradientName);
1448
        writeLine(indent, "Gradient Angle", toDegreeString(pHatch.GradientAngle));
1449
        writeLine(indent, "Gradient Shift", pHatch.GradientShift);
1450
        writeLine(indent, "Gradient One-Color Mode", pHatch.GradientOneColorMode);
1451
        if (pHatch.GradientOneColorMode)
1452
        {
1453
          writeLine(indent, "ShadeTintValue", pHatch.ShadeTintValue);
1454
        }
1455
        GradientColor[] colors = pHatch.GetGradientColors();
1456
        for (int i = 0; i < colors.Length; i++)
1457
        {
1458
          writeLine(indent, string.Format("Color         {0}", i), colors[i].get_Color());
1459
          writeLine(indent, string.Format("Interpolation {0}", i), colors[i].get_Value());
1460
        }
1461
      }
1462 1458

  
1463
      /********************************************************************/
1464
      /* Dump Associated Objects                                          */
1465
      /********************************************************************/
1466
      writeLine(indent, "Associated objects", pHatch.Associative);
1467
      foreach (ObjectId id in pHatch.GetAssociatedObjectIds())
1468
      {
1469
        writeLine(indent + 1, id.ObjectClass.Name, id.Handle);
1470
      }
1459
          /********************************************************************/
1460
          /* Dump Associated Objects                                          */
1461
          /********************************************************************/
1462
          writeLine(indent, "Associated objects", pHatch.Associative);
1463
          foreach (ObjectId id in pHatch.GetAssociatedObjectIds())
1464
          {
1465
            writeLine(indent + 1, id.ObjectClass.Name, id.Handle);
1466
          }
1471 1467

  
1472
      /********************************************************************/
1473
      /* Dump Loops                                                       */
1474
      /********************************************************************/
1475
      writeLine(indent, "Loops", pHatch.NumberOfLoops);
1476
      for (int i = 0; i < pHatch.NumberOfLoops; i++)
1477
      {
1478
        writeLine(indent + 1, "Loop " + i.ToString(), toLooptypeString(pHatch.LoopTypeAt(i)));
1468
          /********************************************************************/
1469
          /* Dump Loops                                                       */
1470
          /********************************************************************/
1471
          writeLine(indent, "Loops", pHatch.NumberOfLoops);
1472
          for (int i = 0; i < pHatch.NumberOfLoops; i++)
1473
          {
1474
            writeLine(indent + 1, "Loop " + i.ToString(), toLooptypeString(pHatch.LoopTypeAt(i)));
1479 1475

  
1480
        /******************************************************************/
1481
        /* Dump Loop                                                      */
1482
        /******************************************************************/
1483
        if ((pHatch.LoopTypeAt(i) & HatchLoopTypes.Polyline) != 0)
1484
        {
1485
          dumpPolylineType(i, pHatch, indent + 2);
1486
        }
1487
        else
1488
        {
1489
          dumpEdgesType(i, pHatch, indent + 2);
1476
            /******************************************************************/
1477
            /* Dump Loop                                                      */
1478
            /******************************************************************/
1479
            if ((pHatch.LoopTypeAt(i) & HatchLoopTypes.Polyline) != 0)
1480
            {
1481
              dumpPolylineType(i, pHatch, indent + 2);
1482
            }
1483
            else
1484
            {
1485
              dumpEdgesType(i, pHatch, indent + 2);
1486
            }
1487
            /******************************************************************/
1488
            /* Dump Associated Objects                                        */
1489
            /******************************************************************/
1490
            if (pHatch.Associative)
1491
            {
1492
              writeLine(indent + 2, "Associated objects");
1493
              foreach (ObjectId id in pHatch.GetAssociatedObjectIdsAt(i))
1494
              {
1495
                writeLine(indent + 3, id.ObjectClass.Name, id.Handle);
1496
              }
1497
            }
1498
          }
1499

  
1500
          writeLine(indent, "Elevation", pHatch.Elevation);
1501
          writeLine(indent, "Normal", pHatch.Normal);
1502
          dumpEntityData(pHatch, indent, Program.xml.DocumentElement);
1490 1503
        }
1491
        /******************************************************************/
1492
        /* Dump Associated Objects                                        */
1493
        /******************************************************************/
1494
        if (pHatch.Associative)
1504

  
1505
        /************************************************************************/
1506
        /* Leader Dumper                                                          */
1507
        /************************************************************************/
1508
        void dump(Leader pLeader, int indent)
1495 1509
        {
1496
          writeLine(indent + 2, "Associated objects");
1497
          foreach (ObjectId id in pHatch.GetAssociatedObjectIdsAt(i))
1510
          writeLine(indent++, pLeader.GetRXClass().Name, pLeader.Handle);
1511
          writeLine(indent, "Dimension Style", pLeader.DimensionStyleName);
1512

  
1513
          writeLine(indent, "Annotation");
1514
          if (!pLeader.Annotation.IsNull)
1498 1515
          {
1499
            writeLine(indent + 3, id.ObjectClass.Name, id.Handle);
1516
            writeLine(indent++, pLeader.Annotation.ObjectClass.Name, pLeader.Annotation.Handle);
1500 1517
          }
1518
          writeLine(indent + 1, "Type", pLeader.AnnoType);
1519
          writeLine(indent + 1, "Height", pLeader.AnnoHeight);
1520
          writeLine(indent + 1, "Width", pLeader.AnnoWidth);
1521
          writeLine(indent + 1, "Offset", pLeader.AnnotationOffset);
1522
          writeLine(indent, "Has Arrowhead", pLeader.HasArrowHead);
1523
          writeLine(indent, "Has Hook Line", pLeader.HasHookLine);
1524
          writeLine(indent, "Splined", pLeader.IsSplined);
1525

  
1526
          for (int i = 0; i < pLeader.NumVertices; i++)
1527
          {
1528
            writeLine(indent, string.Format("Vertex {0}", i), pLeader.VertexAt(i));
1529
          }
1530
          writeLine(indent, "Normal", pLeader.Normal);
1531
          dumpCurveData(pLeader, indent, Program.xml.DocumentElement);
1501 1532
        }
1502
      }
1503

  
1504
      writeLine(indent, "Elevation", pHatch.Elevation);
1505
      writeLine(indent, "Normal", pHatch.Normal);
1506
      dumpEntityData(pHatch, indent, Program.xml.DocumentElement);
1507
    }
1508

  
1509
    /************************************************************************/
1510
    /* Leader Dumper                                                          */
1511
    /************************************************************************/
1512
    void dump(Leader pLeader, int indent)
1513
    {
1514
      writeLine(indent++, pLeader.GetRXClass().Name, pLeader.Handle);
1515
      writeLine(indent, "Dimension Style", pLeader.DimensionStyleName);
1516

  
1517
      writeLine(indent, "Annotation");
1518
      if (!pLeader.Annotation.IsNull)
1519
      {
1520
        writeLine(indent++, pLeader.Annotation.ObjectClass.Name, pLeader.Annotation.Handle);
1521
      }
1522
      writeLine(indent + 1, "Type", pLeader.AnnoType);
1523
      writeLine(indent + 1, "Height", pLeader.AnnoHeight);
1524
      writeLine(indent + 1, "Width", pLeader.AnnoWidth);
1525
      writeLine(indent + 1, "Offset", pLeader.AnnotationOffset);
1526
      writeLine(indent, "Has Arrowhead", pLeader.HasArrowHead);
1527
      writeLine(indent, "Has Hook Line", pLeader.HasHookLine);
1528
      writeLine(indent, "Splined", pLeader.IsSplined);
1529

  
1530
      for (int i = 0; i < pLeader.NumVertices; i++)
1531
      {
1532
        writeLine(indent, string.Format("Vertex {0}", i), pLeader.VertexAt(i));
1533
      }
1534
      writeLine(indent, "Normal", pLeader.Normal);
1535
      dumpCurveData(pLeader, indent, Program.xml.DocumentElement);
1536
    }
1537 1533

  
1538 1534
        /************************************************************************/
1539 1535
        /* Line Dumper                                                          */
1540 1536
        /************************************************************************/
1541 1537
        void dump(Line pLine, int indent, XmlNode node)
1542 1538
        {
1543
            if (node != null)
1539
            if (node != null && pLine != null && pLine.Length != 0)
1544 1540
            {
1545 1541
                XmlNode LineNode = Program.xml.CreateElement(pLine.GetRXClass().Name);
1542
                XmlAttribute LengthAttr = Program.xml.CreateAttribute("Length");
1543
                LengthAttr.Value = pLine.Length.ToString();
1544
                LineNode.Attributes.SetNamedItem(LengthAttr);
1546 1545

  
1547 1546
                XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle");
1548 1547
                HandleAttr.Value = pLine.Handle.ToString();
......
1592 1591

  
1593 1592
                node.AppendChild(LineNode);
1594 1593
            }
1594
            else
1595
            {
1596
                int d = 0;
1597
            }
1595 1598
        }
1596 1599

  
1597
    /************************************************************************/
1598
    /* MInsertBlock Dumper                                                  */
1599
    /************************************************************************/
1600
    void dump(MInsertBlock pMInsert, int indent, XmlNode node)
1601
    {
1602
      writeLine(indent++, pMInsert.GetRXClass().Name, pMInsert.Handle);
1600
        /************************************************************************/
1601
        /* MInsertBlock Dumper                                                  */
1602
        /************************************************************************/
1603
        void dump(MInsertBlock pMInsert, int indent, XmlNode node)
1604
        {
1605
          writeLine(indent++, pMInsert.GetRXClass().Name, pMInsert.Handle);
1603 1606

  
1604
      using (BlockTableRecord pRecord = (BlockTableRecord)pMInsert.BlockTableRecord.Open(OpenMode.ForRead))
1605
      {
1606
            writeLine(indent, "Name", pRecord.Name);
1607
            writeLine(indent, "Rows", pMInsert.Rows);
1608
            writeLine(indent, "Columns", pMInsert.Columns);
1609
            writeLine(indent, "Row Spacing", pMInsert.RowSpacing);
1610
            writeLine(indent, "Column Spacing", pMInsert.ColumnSpacing);
1611
            dumpBlockRefData(pMInsert, indent, node);
1612
      }
1613
    }
1607
          using (BlockTableRecord pRecord = (BlockTableRecord)pMInsert.BlockTableRecord.Open(OpenMode.ForRead))
1608
          {
1609
                writeLine(indent, "Name", pRecord.Name);
1610
                writeLine(indent, "Rows", pMInsert.Rows);
1611
                writeLine(indent, "Columns", pMInsert.Columns);
1612
                writeLine(indent, "Row Spacing", pMInsert.RowSpacing);
1613
                writeLine(indent, "Column Spacing", pMInsert.ColumnSpacing);
1614
                dumpBlockRefData(pMInsert, indent, node);
1615
          }
1616
        }
1614 1617

  
1615
    /************************************************************************/
1616
    /* Mline Dumper                                                         */
1617
    /************************************************************************/
1618
    void dump(Mline pMline, int indent)
1619
    {
1620
      writeLine(indent++, pMline.GetRXClass().Name, pMline.Handle);
1621
      writeLine(indent, "Style", pMline.Style);
1622
      writeLine(indent, "Closed", pMline.IsClosed);
1623
      writeLine(indent, "Scale", pMline.Scale);
1624
      writeLine(indent, "Suppress Start Caps", pMline.SupressStartCaps);
1625
      writeLine(indent, "Suppress End Caps", pMline.SupressEndCaps);
1626
      writeLine(indent, "Normal", pMline.Normal);
1618
        /************************************************************************/
1619
        /* Mline Dumper                                                         */
1620
        /************************************************************************/
1621
        void dump(Mline pMline, int indent)
1622
        {
1623
          writeLine(indent++, pMline.GetRXClass().Name, pMline.Handle);
1624
          writeLine(indent, "Style", pMline.Style);
1625
          writeLine(indent, "Closed", pMline.IsClosed);
1626
          writeLine(indent, "Scale", pMline.Scale);
1627
          writeLine(indent, "Suppress Start Caps", pMline.SupressStartCaps);
1628
          writeLine(indent, "Suppress End Caps", pMline.SupressEndCaps);
1629
          writeLine(indent, "Normal", pMline.Normal);
1627 1630

  
1628
      /********************************************************************/
1629
      /* Dump the segment data                                            */
1630
      /********************************************************************/
1631
      for (int i = 0; i < pMline.NumberOfVertices; i++)
1632
      {
1633
        writeLine(indent, "Segment", i);
1634
        writeLine(indent + 1, "Vertex", pMline.VertexAt(i));
1635
      }
1636
      dumpEntityData(pMline, indent, Program.xml.DocumentElement);
1637
    }
1638
    /************************************************************************/
1639
    /* MText Dumper                                                         */
1640
    /************************************************************************/
1641
    void dump(MText pMText, int indent)
1642
    {
1643
      writeLine(indent++, pMText.GetRXClass().Name, pMText.Handle);
1644
      writeLine(indent, "Contents", pMText.Contents);
1645
      writeLine(indent, "Location", pMText.Location);
1646
      writeLine(indent, "Height", pMText.TextHeight);
1647
      writeLine(indent, "Rotation", toDegreeString(pMText.Rotation));
1648
      writeLine(indent, "Text Style Id", pMText.TextStyleId);
1649
      writeLine(indent, "Attachment", pMText.Attachment);
1650
      writeLine(indent, "Background Fill On", pMText.BackgroundFill);
1651
      writeLine(indent, "Background Fill Color", pMText.BackgroundFillColor);
1652
      writeLine(indent, "Background Scale Factor", pMText.BackgroundScaleFactor);
1653
      writeLine(indent, "Background Transparency Method", pMText.BackgroundTransparency);
1654
      writeLine(indent, "X-Direction", pMText.Direction);
1655
      writeLine(indent, "Flow Direction", pMText.FlowDirection);
1656
      writeLine(indent, "Width", pMText.Width);
1657
      writeLine(indent, "Actual Height", pMText.ActualHeight);
1658
      writeLine(indent, "Actual Width", pMText.ActualWidth);
1659

  
1660
      Point3dCollection points = pMText.GetBoundingPoints();
1661
      writeLine(indent, "TL Bounding Point", points[0]);
1662
      writeLine(indent, "TR Bounding Point", points[1]);
1663
      writeLine(indent, "BL Bounding Point", points[2]);
1664
      writeLine(indent, "BR Bounding Point", points[3]);
1665
      writeLine(indent, "Normal", pMText.Normal);
1666

  
1667
      dumpEntityData(pMText, indent, Program.xml.DocumentElement);
1668
    }
1631
          /********************************************************************/
1632
          /* Dump the segment data                                            */
1633
          /********************************************************************/
1634
          for (int i = 0; i < pMline.NumberOfVertices; i++)
1635
          {
1636
            writeLine(indent, "Segment", i);
1637
            writeLine(indent + 1, "Vertex", pMline.VertexAt(i));
1638
          }
1639
          dumpEntityData(pMline, indent, Program.xml.DocumentElement);
1640
        }
1641

  
1642
        /************************************************************************/
1643
        /* MText Dumper                                                         */
1644
        /************************************************************************/
1645
        /// <summary>
1646
        /// convert MText to normal Text
1647
        /// </summary>
1648
        /// <param name="pMText"></param>
1649
        /// <param name="indent"></param>
1650
        /// <param name="node"></param>
1651
        void dump(MText pMText, int indent, XmlNode node)
1652
        {
1653
            DBObjectCollection objColl = new DBObjectCollection();
1654
            pMText.Explode(objColl);
1655
            foreach(var obj in objColl)
1656
            {
1657
                dumpTextData(obj as DBText, indent, node);
1658
            }
1659
        }
1669 1660

  
1670 1661
        /************************************************************************/
1671 1662
        /* Ordinate Dimension Dumper                                            */
......
1796 1787
            return null;
1797 1788
        }
1798 1789

  
1799
    /************************************************************************/
1800
    /* Ole2Frame                                                            */
1801
    /************************************************************************/
1802
    void dump(Ole2Frame pOle, int indent)
1803
    {
1804
      writeLine(indent++, pOle.GetRXClass().Name, pOle.Handle);
1805

  
1806
      Rectangle3d pos = (Rectangle3d)pOle.Position3d;
1807
      writeLine(indent, "Lower Left", pos.LowerLeft);
1808
      writeLine(indent, "Lower Right", pos.LowerRight);
1809
      writeLine(indent, "Upper Left", pos.UpperLeft);
1810
      writeLine(indent, "Upper Right", pos.UpperRight);
1811
      writeLine(indent, "Type", pOle.Type);
1812
      writeLine(indent, "User Type", pOle.UserType);
1813
      if (pOle.Type == Ole2Frame.ItemType.Link)
1814
      {
1815
        writeLine(indent, "Link Name", pOle.LinkName);
1816
        writeLine(indent, "Link Path", pOle.LinkPath);
1817
      }
1818
      writeLine(indent, "Output Quality", pOle.OutputQuality);
1819
      dumpEntityData(pOle, indent, Program.xml.DocumentElement);
1820
    }
1790
        /************************************************************************/
1791
        /* Ole2Frame                                                            */
1792
        /************************************************************************/
1793
        void dump(Ole2Frame pOle, int indent)
1794
        {
1795
          writeLine(indent++, pOle.GetRXClass().Name, pOle.Handle);
1796

  
1797
          Rectangle3d pos = (Rectangle3d)pOle.Position3d;
1798
          writeLine(indent, "Lower Left", pos.LowerLeft);
1799
          writeLine(indent, "Lower Right", pos.LowerRight);
1800
          writeLine(indent, "Upper Left", pos.UpperLeft);
1801
          writeLine(indent, "Upper Right", pos.UpperRight);
1802
          writeLine(indent, "Type", pOle.Type);
1803
          writeLine(indent, "User Type", pOle.UserType);
1804
          if (pOle.Type == Ole2Frame.ItemType.Link)
1805
          {
1806
            writeLine(indent, "Link Name", pOle.LinkName);
1807
            writeLine(indent, "Link Path", pOle.LinkPath);
1808
          }
1809
          writeLine(indent, "Output Quality", pOle.OutputQuality);
1810
          dumpEntityData(pOle, indent, Program.xml.DocumentElement);
1811
        }
1821 1812

  
1822
    /************************************************************************/
1823
    /* Point Dumper                                                         */
1824
    /************************************************************************/
1825
    void dump(DBPoint pPoint, int indent)
1826
    {
1827
      writeLine(indent++, pPoint.GetRXClass().Name, pPoint.Handle);
1828
      writeLine(indent, "Position", pPoint.Position);
1829
      writeLine(indent, "ECS Rotation", toDegreeString(pPoint.EcsRotation));
1830
      writeLine(indent, "Normal", pPoint.Normal);
1831
      writeLine(indent, "Thickness", pPoint.Thickness);
1832
      dumpEntityData(pPoint, indent, Program.xml.DocumentElement);
1833
    }
1813
        /************************************************************************/
1814
        /* Point Dumper                                                         */
1815
        /************************************************************************/
1816
        void dump(DBPoint pPoint, int indent)
1817
        {
1818
          writeLine(indent++, pPoint.GetRXClass().Name, pPoint.Handle);
1819
          writeLine(indent, "Position", pPoint.Position);
1820
          writeLine(indent, "ECS Rotation", toDegreeString(pPoint.EcsRotation));
1821
          writeLine(indent, "Normal", pPoint.Normal);
1822
          writeLine(indent, "Thickness", pPoint.Thickness);
1823
          dumpEntityData(pPoint, indent, Program.xml.DocumentElement);
1824
        }
1834 1825

  
1835
    /************************************************************************/
1836
    /* Polygon Mesh Dumper                                                  */
1837
    /************************************************************************/
1838
    void dump(PolygonMesh pPoly, int indent)
1839
    {
1840
      writeLine(indent++, pPoly.GetRXClass().Name, pPoly.Handle);
1841
      writeLine(indent, "m Size", pPoly.MSize);
1842
      writeLine(indent, "m-Closed", pPoly.IsMClosed);
1843
      writeLine(indent, "m Surface Density", pPoly.MSurfaceDensity);
1844
      writeLine(indent, "n Size", pPoly.NSize);
1845
      writeLine(indent, "n-Closed", pPoly.IsNClosed);
1846
      writeLine(indent, "n Surface Density", pPoly.NSurfaceDensity);
1847
      /********************************************************************/
1848
      /* dump vertices                                                    */
1849
      /********************************************************************/
1850
      int vertexCount = 0;
1851
      foreach (object o in pPoly)
1852
      {
1853
        PolygonMeshVertex pVertex = o as PolygonMeshVertex;
1854
        if (pVertex != null)
1826
        /************************************************************************/
1827
        /* Polygon Mesh Dumper                                                  */
1828
        /************************************************************************/
1829
        void dump(PolygonMesh pPoly, int indent)
1855 1830
        {
1856
          writeLine(indent, pVertex.GetRXClass().Name, vertexCount++);
1857
          writeLine(indent + 1, "Handle", pVertex.Handle);
1858
          writeLine(indent + 1, "Position", pVertex.Position);
1859
          writeLine(indent + 1, "Type", pVertex.VertexType);
1831
          writeLine(indent++, pPoly.GetRXClass().Name, pPoly.Handle);
1832
          writeLine(indent, "m Size", pPoly.MSize);
1833
          writeLine(indent, "m-Closed", pPoly.IsMClosed);
1834
          writeLine(indent, "m Surface Density", pPoly.MSurfaceDensity);
1835
          writeLine(indent, "n Size", pPoly.NSize);
1836
          writeLine(indent, "n-Closed", pPoly.IsNClosed);
1837
          writeLine(indent, "n Surface Density", pPoly.NSurfaceDensity);
1838
          /********************************************************************/
1839
          /* dump vertices                                                    */
1840
          /********************************************************************/
1841
          int vertexCount = 0;
1842
          foreach (object o in pPoly)
1843
          {
1844
            PolygonMeshVertex pVertex = o as PolygonMeshVertex;
1845
            if (pVertex != null)
1846
            {
1847
              writeLine(indent, pVertex.GetRXClass().Name, vertexCount++);
1848
              writeLine(indent + 1, "Handle", pVertex.Handle);
1849
              writeLine(indent + 1, "Position", pVertex.Position);
1850
              writeLine(indent + 1, "Type", pVertex.VertexType);
1851
            }
1852
          }
1853
          dumpEntityData(pPoly, indent, Program.xml.DocumentElement);
1860 1854
        }
1861
      }
1862
      dumpEntityData(pPoly, indent, Program.xml.DocumentElement);
1863
    }
1864 1855

  
1865 1856
        /************************************************************************/
1866 1857
        /* Polyline Dumper                                                      */
1867 1858
        /************************************************************************/
1868 1859
        void dump(Teigha.DatabaseServices.Polyline pPoly, int indent, XmlNode node)
1869 1860
        {
1870
            writeLine(indent++, pPoly.GetRXClass().Name, pPoly.Handle);
1871
            writeLine(indent, "Has Width", pPoly.HasWidth);
1872
            if (!pPoly.HasWidth)
1861
            if (pPoly != null && pPoly.Length != 0)
1873 1862
            {
1874
                writeLine(indent, "Constant Width", pPoly.ConstantWidth);
1875
            }
1876
            writeLine(indent, "Has Bulges", pPoly.HasBulges);
1877
            writeLine(indent, "Elevation", pPoly.Elevation);
1878
            writeLine(indent, "Normal", pPoly.Normal);
1879
            writeLine(indent, "Thickness", pPoly.Thickness);
1863
                writeLine(indent++, pPoly.GetRXClass().Name, pPoly.Handle);
1864
                writeLine(indent, "Has Width", pPoly.HasWidth);
1865
                if (!pPoly.HasWidth)
1866
                {
1867
                    writeLine(indent, "Constant Width", pPoly.ConstantWidth);
1868
                }
1880 1869

  
1881
            /********************************************************************/
1882
            /* dump vertices                                                    */
1883
            /********************************************************************/
1884
            if (node != null)
1885
            {
1886
                XmlNode PolylineNode = Program.xml.CreateElement(pPoly.GetRXClass().Name);
1887
                XmlAttribute CountAttr = Program.xml.CreateAttribute("Count");
1888
                CountAttr.Value = pPoly.NumberOfVertices.ToString();
1889
                PolylineNode.Attributes.SetNamedItem(CountAttr);
1870
                /********************************************************************/
1871
                /* dump vertices                                                    */
1872
                /********************************************************************/
1873
                if (node != null)
1874
                {
1875
                    XmlNode PolylineNode = Program.xml.CreateElement(pPoly.GetRXClass().Name);
1876
                    XmlAttribute LengthAttr = Program.xml.CreateAttribute("Length");
1877
                    LengthAttr.Value = pPoly.Length.ToString();
1878
                    PolylineNode.Attributes.SetNamedItem(LengthAttr);
1890 1879

  
1891
                XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle");
1892
                HandleAttr.Value = pPoly.Handle.ToString();
1893
                PolylineNode.Attributes.SetNamedItem(HandleAttr);
1880
                    XmlAttribute CountAttr = Program.xml.CreateAttribute("Count");
1881
                    CountAttr.Value = pPoly.NumberOfVertices.ToString();
1882
                    PolylineNode.Attributes.SetNamedItem(CountAttr);
1894 1883

  
1895
                for (int i = 0; i < pPoly.NumberOfVertices; i++)
1896
                {
1897
                    XmlNode VertexNode = Program.xml.CreateElement("Vertex");
1884
                    XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle");
1885
                    HandleAttr.Value = pPoly.Handle.ToString();
1886
                    PolylineNode.Attributes.SetNamedItem(HandleAttr);
1898 1887

  
1899
                    XmlAttribute SegmentTypeAttr = Program.xml.CreateAttribute("SegmentType");
1900
                    SegmentTypeAttr.Value = pPoly.GetSegmentType(i).ToString();
1888
                    XmlAttribute ClosedAttr = Program.xml.CreateAttribute("Closed");
1889
                    ClosedAttr.Value = pPoly.Closed.ToString();
1890
                    PolylineNode.Attributes.SetNamedItem(ClosedAttr);
1901 1891

  
1902
                    Point3d pt = pPoly.GetPoint3dAt(i);
1903
                    XmlAttribute XAttr = Program.xml.CreateAttribute("X");
1904
                    XAttr.Value = pt.X.ToString();
1905
                    VertexNode.Attributes.SetNamedItem(XAttr);
1892
                    for (int i = 0; i < pPoly.NumberOfVertices; i++)
1893
                    {
1894
                        XmlNode VertexNode = Program.xml.CreateElement("Vertex");
1906 1895

  
1907
                    XmlAttribute YAttr = Program.xml.CreateAttribute("Y");
1908
                    YAttr.Value = pt.Y.ToString();
1909
                    VertexNode.Attributes.SetNamedItem(YAttr);
1896
                        XmlAttribute SegmentTypeAttr = Program.xml.CreateAttribute("SegmentType");
1897
                        SegmentTypeAttr.Value = pPoly.GetSegmentType(i).ToString();
1910 1898

  
1911
                    XmlAttribute ZAttr = Program.xml.CreateAttribute("Z");
1912
                    ZAttr.Value = pt.Z.ToString();
1913
                    VertexNode.Attributes.SetNamedItem(ZAttr);
1899
                        Point3d pt = pPoly.GetPoint3dAt(i);
1900
                        XmlAttribute XAttr = Program.xml.CreateAttribute("X");
1901
                        XAttr.Value = pt.X.ToString();
1902
                        VertexNode.Attributes.SetNamedItem(XAttr);
1914 1903

  
1915
                    if (pPoly.HasWidth)
1916
                    {
1917
                        XmlAttribute StartWidthAttr = Program.xml.CreateAttribute("StartWidth");
1918
                        StartWidthAttr.Value = pPoly.GetStartWidthAt(i).ToString();
1919
                        VertexNode.Attributes.SetNamedItem(StartWidthAttr);
1904
                        XmlAttribute YAttr = Program.xml.CreateAttribute("Y");
1905
                        YAttr.Value = pt.Y.ToString();
1906
                        VertexNode.Attributes.SetNamedItem(YAttr);
1920 1907

  
1921
                        XmlAttribute EndWidthAttr = Program.xml.CreateAttribute("EndWidth");
1922
                        EndWidthAttr.Value = pPoly.GetEndWidthAt(i).ToString();
1923
                        VertexNode.Attributes.SetNamedItem(EndWidthAttr);
1924
                    }
1925
                    if (pPoly.HasBulges)
1926
                    {
1927
                        XmlAttribute BulgeAttr = Program.xml.CreateAttribute("Bulge");
1928
                        BulgeAttr.Value = pPoly.GetBulgeAt(i).ToString();
1929
                        VertexNode.Attributes.SetNamedItem(BulgeAttr);
1908
                        XmlAttribute ZAttr = Program.xml.CreateAttribute("Z");
1909
                        ZAttr.Value = pt.Z.ToString();
1910
                        VertexNode.Attributes.SetNamedItem(ZAttr);
1911

  
1912
                        if (pPoly.HasWidth)
1913
                        {
1914
                            XmlAttribute StartWidthAttr = Program.xml.CreateAttribute("StartWidth");
1915
                            StartWidthAttr.Value = pPoly.GetStartWidthAt(i).ToString();
1916
                            VertexNode.Attributes.SetNamedItem(StartWidthAttr);
1930 1917

  
1931
                        if (pPoly.GetSegmentType(i) == SegmentType.Arc)
1918
                            XmlAttribute EndWidthAttr = Program.xml.CreateAttribute("EndWidth");
1919
                            EndWidthAttr.Value = pPoly.GetEndWidthAt(i).ToString();
1920
                            VertexNode.Attributes.SetNamedItem(EndWidthAttr);
1921
                        }
1922
                        if (pPoly.HasBulges)
1932 1923
                        {
1933
                            XmlAttribute BulgeAngleAttr = Program.xml.CreateAttribute("BulgeAngle");
1934
                            BulgeAngleAttr.Value = pPoly.GetBulgeAt(i).ToString();
1935
                            VertexNode.Attributes.SetNamedItem(BulgeAngleAttr);
1924
                            XmlAttribute BulgeAttr = Program.xml.CreateAttribute("Bulge");
1925
                            BulgeAttr.Value = pPoly.GetBulgeAt(i).ToString();
1926
                            VertexNode.Attributes.SetNamedItem(BulgeAttr);
1927

  
1928
                            if (pPoly.GetSegmentType(i) == SegmentType.Arc)
1929
                            {
1930
                                XmlAttribute BulgeAngleAttr = Program.xml.CreateAttribute("BulgeAngle");
1931
                                BulgeAngleAttr.Value = pPoly.GetBulgeAt(i).ToString();
1932
                                VertexNode.Attributes.SetNamedItem(BulgeAngleAttr);
1933
                            }
1936 1934
                        }
1935

  
1936
                        PolylineNode.AppendChild(VertexNode);
1937 1937
                    }
1938 1938

  
1939
                    PolylineNode.AppendChild(VertexNode);
1939
                    dumpEntityData(pPoly, indent, PolylineNode);
1940
                    node.AppendChild(PolylineNode);
1940 1941
                }
1941

  
1942
                dumpEntityData(pPoly, indent, PolylineNode);
1943
                node.AppendChild(PolylineNode);
1942
            }
1943
            else
1944
            {
1945
                int d = 0;
1944 1946
            }
1945 1947
        }
1946 1948

  
......
2413 2415
                XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle");
2414 2416
                HandleAttr.Value = pEnt.Handle.ToString();
2415 2417
                EntNode.Attributes.SetNamedItem(HandleAttr);
2416

  
2418
                
2417 2419
                dumpEntityData(pEnt, indent, EntNode);
2418
                writeLine(indent, "WorldDraw()");
2419 2420
                using (Database db = pEnt.Database)
2420 2421
                {
2421 2422
                    /**********************************************************************/
......
2768 2769
        /************************************************************************/
2769 2770
        /* Text Dumper                                                          */
2770 2771
        /************************************************************************/
2771
        void dump(DBText pText, int indent, XmlNode node)
2772
        static void dump(DBText pText, int indent, XmlNode node)
2772 2773
        {
2773 2774
            if (node != null)
2774 2775
            {
......
3175 3176
        }
3176 3177
      }
3177 3178
    }
3179
    
3180
    /// <summary>
3181
    /// extract information from entity has given id
3182
    /// </summary>
3183
    /// <param name="id"></param>
3184
    /// <param name="indent"></param>
3185
    /// <param name="node">XmlNode</param>
3178 3186
    public void dumpEntity(ObjectId id, int indent, XmlNode node)
3179 3187
    {
3180
      /**********************************************************************/
3181
      /* Get a pointer to the Entity                                   */
3182
      /**********************************************************************/
3183
      using (Entity pEnt = (Entity)id.Open(OpenMode.ForRead, false, true))
3184
      {
3185 3188
        /**********************************************************************/
3186
        /* Dump the entity                                                    */
3189
        /* Get a pointer to the Entity                                   */
3187 3190
        /**********************************************************************/
3188
        writeLine();
3189
        // Protocol extensions are not supported in DD.NET (as well as in ARX.NET)
3190
        // so we just switch by entity type here
3191
        // (maybe it makes sense to make a map: type -> delegate)
3192
        switch (pEnt.GetRXClass().Name)
3191
        try
3193 3192
        {
3194
          case "AcDbAlignedDimension":
3195
            dump((AlignedDimension)pEnt, indent, node);
3196
            break;
3197
          case "AcDbArc":
3198
            dump((Arc)pEnt, indent, node);
3199
            break;
3200
          case "AcDbArcDimension":
3201
            dump((ArcDimension)pEnt, indent, node);
3202
            break;
3203
          case "AcDbBlockReference":
3204
            dump((BlockReference)pEnt, indent, node);
3205
            break;
3206
          case "AcDbBody":
3207
            dump((Body)pEnt, indent, node);
3208
            break;
3209
          case "AcDbCircle":
3210
            dump((Circle)pEnt, indent, node);
3211
            break;
3212
          case "AcDbPoint":
3213
            dump((DBPoint)pEnt, indent);
3214
            break;
3215
          case "AcDbText":
3216
            dump((DBText)pEnt, indent, node);
3217
            break;
3218
          case "AcDbDiametricDimension":
3219
            dump((DiametricDimension)pEnt, indent, node);
3220
            break;
3221
          case "AcDbViewport":
3222
            dump((Teigha.DatabaseServices.Viewport)pEnt, indent, node);
3223
            break;
3224
          case "AcDbEllipse":
3225
            dump((Ellipse)pEnt, indent, node);
3226
            break;
3227
          case "AcDbFace":
3228
            dump((Face)pEnt, indent, node);
3229
            break;
3230
          case "AcDbFcf":
3231
            dump((FeatureControlFrame)pEnt, indent);
3232
            break;
3233
          case "AcDbHatch":
3234
            dump((Hatch)pEnt, indent);
3235
            break;
3236
          case "AcDbLeader":
3237
            dump((Leader)pEnt, indent);
3238
            break;
3239
          case "AcDbLine":
3240
            dump((Line)pEnt, indent, node);
3241
            break;
3242
          case "AcDb2LineAngularDimension":
3243
            dump((LineAngularDimension2)pEnt, indent, node);
3244
            break;
3245
          case "AcDbMInsertBlock":
3246
            dump((MInsertBlock)pEnt, indent, node);
3247
            break;
3248
          case "AcDbMline":
3249
            dump((Mline)pEnt, indent);
3250
            break;
3251
          case "AcDbMText":
3252
            dump((MText)pEnt, indent);
3253
            break;
3254
          case "AcDbOle2Frame":
3255
            dump((Ole2Frame)pEnt, indent);
3256
            break;
3257
          case "AcDbOrdinateDimension":
3258
            dump((OrdinateDimension)pEnt, indent, node);
3259
            break;
3260
          case "AcDb3PointAngularDimension":
3261
            dump((Point3AngularDimension)pEnt, indent, node);
3262
            break;
3263
          case "AcDbPolyFaceMesh":
3264
            dump((PolyFaceMesh)pEnt, indent, node);
3265
            break;
3266
          case "AcDbPolygonMesh":
3267
            dump((PolygonMesh)pEnt, indent);
3268
            break;
3269
          case "AcDbPolyline":
3270
            dump((Teigha.DatabaseServices.Polyline)pEnt, indent, node);
3271
            break;
3272
          case "AcDb2dPolyline":
3273
            dump((Polyline2d)pEnt, indent, node);
3274
            break;
3275
          case "AcDb3dPolyline":
3276
            dump((Polyline3d)pEnt, indent, node);
3277
            break;
3278
          case "AcDbProxyEntity":
3279
            dump((ProxyEntity)pEnt, indent, node);
3280
            break;
3281
          case "AcDbRadialDimension":
3282
            dump((RadialDimension)pEnt, indent, node);
3283
            break;
3284
          case "AcDbRasterImage":
3285
            dump((RasterImage)pEnt, indent);
3286
            break;
3287
          case "AcDbRay":
3288
            dump((Ray)pEnt, indent);
3289
            break;
3290
          case "AcDbRegion":
3291
            dump((Region)pEnt, indent);
3292
            break;
3293
          case "AcDbRotatedDimension":
3294
            dump((RotatedDimension)pEnt, indent, node);
3295
            break;
3296
          case "AcDbShape":
3297
            dump((Shape)pEnt, indent);
3298
            break;
3299
          case "AcDb3dSolid":
3300
            dump((Solid3d)pEnt, indent, node);
3301
            break;
3302
          case "AcDbSpline":
3303
            dump((Spline)pEnt, indent);
3304
            break;
3305
          case "AcDbTable":
3306
            dump((Table)pEnt, indent);
3307
            break;
3308
          case "AcDbTrace":
3309
            dump((Trace)pEnt, indent);
3310
            break;
3311
          case "AcDbWipeout":
3312
            dump((Wipeout)pEnt, indent);
3313
            break;
3314
          case "AcDbXline":
3315
            dump((Xline)pEnt, indent);
3316
            break;
3317
          case "AcDbPdfReference":
3318
          case "AcDbDwfReference":
3319
          case "AcDbDgnReference":
3320
            dump((UnderlayReference)pEnt, indent);
3321
            break;
3322
          default:
3323
            dump(pEnt, indent, node);
3324
            break;
3325
        }
3326
        /* Dump the Xdata                                                     */
3327
        /**********************************************************************/
3328
        dumpXdata(pEnt.XData, indent);
3193
            using (Entity pEnt = (Entity)id.Open(OpenMode.ForRead, false, true))
3194
            {
3195
                /**********************************************************************/
3196
                /* Dump the entity                                                    */
3197
                /**********************************************************************/
3198
                writeLine();
3199
                // Protocol extensions are not supported in DD.NET (as well as in ARX.NET)
3200
                // so we just switch by entity type here
3201
                // (maybe it makes sense to make a map: type -> delegate)
3202
                switch (pEnt.GetRXClass().Name)
3203
                {
3204
                    case "AcDbAlignedDimension":
3205
                        dump((AlignedDimension)pEnt, indent, node);
3206
                        break;
3207
                    case "AcDbArc":
3208
                        dump((Arc)pEnt, indent, node);
3209
                        break;
3210
                    case "AcDbArcDimension":
3211
                        dump((ArcDimension)pEnt, indent, node);
3212
                        break;
3213
                    case "AcDbBlockReference":
3214
                        dump((BlockReference)pEnt, indent, node);
3215
                        break;
3216
                    case "AcDbBody":
3217
                        dump((Body)pEnt, indent, node);
3218
                        break;
3219
                    case "AcDbCircle":
3220
                        dump((Circle)pEnt, indent, node);
3221
                        break;
3222
                    case "AcDbPoint":
3223
                        dump((DBPoint)pEnt, indent);
3224
                        break;
3225
                    case "AcDbText":
3226
                        dump((DBText)pEnt, indent, node);
3227
                        break;
3228
                    case "AcDbDiametricDimension":
3229
                        dump((DiametricDimension)pEnt, indent, node);
3230
                        break;
3231
                    case "AcDbViewport":
3232
                        dump((Teigha.DatabaseServices.Viewport)pEnt, indent, node);
3233
                        break;
3234
                    case "AcDbEllipse":
3235
                        dump((Ellipse)pEnt, indent, node);
3236
                        break;
3237
                    case "AcDbFace":
3238
                        dump((Face)pEnt, indent, node);
3239
                        break;
3240
                    case "AcDbFcf":
3241
                        dump((FeatureControlFrame)pEnt, indent);
3242
                        break;
3243
                    case "AcDbHatch":
3244
                        dump((Hatch)pEnt, indent);
3245
                        break;
3246
                    case "AcDbLeader":
... 이 차이점은 표시할 수 있는 최대 줄수를 초과해서 이 차이점은 잘렸습니다.

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)