예제 #1
0
        public bool     GetXYFromDXFEntity(DXFObject entity, bool write, bool first)
        {
            dxfPair.Log(4);

            double X = 0, Y = 0;

            for ( ; dxfPair != null;)
            {
                dxfPair = new DXFPair(dxSourcefFile, this);
                if (dxfPair == null)
                {
                    return(true);
                }

                if (dxfPair == 0)
                {
                    break;
                }

/*				if( first )
 *                              {
 *                                      if( dxfPair == 8 )
 *                                              EntityLog( "\t\t\t\t\t" + dxfPair.Value );
 *                                      if( dxfPair == 1 )
 *                                              EntityLog( "\t\t\t\t\t" + dxfPair.Value );
 *                              }
 */
                if (dxfPair == 10)
                {
                    X = Double.Parse(dxfPair.Value);
                }

                if (dxfPair == 20)
                {
                    Y = Double.Parse(dxfPair.Value);
                }

                if (dxfPair == 1)
                {
                    entity.text = dxfPair.Value;
                }

                if (dxfPair == 50)
                {
                    entity.angle = Single.Parse(dxfPair.Value);
                }
            }
            if (write)
            {
                entity.Add(new _DXFPoint(X, Y));
                EntityLog(X + "\t" + Y);
            }
            return(true);
        }
예제 #2
0
 private bool    ReadaSection( )
 {
     dxfPair.Log(0);
     dxfPair = new DXFPair(dxSourcefFile, this);
     for ( ; dxfPair != null;)
     {
         if (dxfPair == "ENDSEC")
         {
             dxfPair.Log(0);
             dxfPair = new DXFPair(dxSourcefFile, this);
             return(true);
         }
         dxfPair = new DXFPair(dxSourcefFile, this);
     }
     return(true);
 }
예제 #3
0
        public bool     ReadLine(DXFObject entity)
        {
            dxfPair.Log(4);

            double X1 = 0, Y1 = 0, X2 = 0, Y2 = 0;

            for ( ; dxfPair != null;)
            {
                dxfPair = new DXFPair(dxSourcefFile, this);
                if (dxfPair == null)
                {
                    return(true);
                }

                if (dxfPair == 0)
                {
                    break;
                }

/*				if( dxfPair == 8 )
 *                                      EntityLog( "\t\t\t\t\t" + dxfPair.Value );
 *                              if( dxfPair == 1 )
 *                                      EntityLog( "\t\t\t\t\t" + dxfPair.Value );
 */
                if (dxfPair == 10)
                {
                    X1 = Double.Parse(dxfPair.Value);
                }
                if (dxfPair == 20)
                {
                    Y1 = Double.Parse(dxfPair.Value);
                }
                if (dxfPair == 11)
                {
                    X2 = Double.Parse(dxfPair.Value);
                }
                if (dxfPair == 21)
                {
                    Y2 = Double.Parse(dxfPair.Value);
                }
            }
            EntityLog(Y1 + " " + X1 + " " + Y2 + " " + X2);
            entity.Add(new _DXFPoint(X1, Y1));
            entity.Add(new _DXFPoint(X2, Y2));
            return(true);
        }
예제 #4
0
        private bool SkipSections( )
        {
            dxfPair = new DXFPair(dxSourcefFile, this);
            for ( ; ;)
            {
                if (dxfPair == null)
                {
                    break;
                }

                if (dxfPair == "EOF")
                {
                    dxfPair.Log(0);
                    break;
                }
                if (dxfPair == "SECTION")
                {
                    dxfPair.Log(0);
                    dxfPair = new DXFPair(dxSourcefFile, this);
                    if (dxfPair == null)
                    {
                        return(false);
                    }

                    if (dxfPair != "ENTITIES")
                    {
                        if (!ReadaSection( ))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        dxfPair.Log(0);
                        dxfPair = new DXFPair(dxSourcefFile, this);
                        break;
                    }
                }
            }
            return(true);
        }
예제 #5
0
        private bool ReadEntities( )
        {
            dxfPair.Log(0);
            dxfPair = new DXFPair(dxSourcefFile, this);

            for ( ; dxfPair != null;)
            {
                if (!ReadaEntity( ))
                {
                    return(false);
                }

                if (dxfPair == "ENDSEC")
                {
                    dxfPair.Log(0);
                    dxfPair = new DXFPair(dxSourcefFile, this);
                    return(true);
                }
            }
            return(true);
        }
예제 #6
0
        private bool ScanSection()
        {
            dxfPair.Log(0);
            dxfPair = new DXFPair(dxSourcefFile, this);
            if (dxfPair == null)
            {
                return(false);
            }

            if (dxfPair == "HEADER")
            {
                return(ReadHeader( ));
            }
            if (dxfPair == "CLASSES")
            {
                return(ReadClasses( ));
            }
            if (dxfPair == "TABLES")
            {
                return(ReadTables( ));
            }
            if (dxfPair == "BLOCKS")
            {
                return(ReadBlocks( ));
            }
            if (dxfPair == "ENTITIES")
            {
                return(ReadEntities( ));
            }
            if (dxfPair == "THUMBNAILIMAGE")
            {
                return(ReadTNI( ));
            }
            if (dxfPair == "OBJECTS")
            {
                return(ReadObjects( ));
            }

            return(false);
        }
예제 #7
0
        public bool ScanAll( )
        {
            dxfPair = new DXFPair(dxSourcefFile, this);
            for ( ; ;)
            {
                if (dxfPair == null)
                {
                    break;
                }

                if (dxfPair == "EOF")
                {
                    dxfPair.Log(0);
                    break;
                }
                if (dxfPair == "SECTION")
                {
                    ScanSection();
                }
            }
            return(true);
        }
예제 #8
0
        private bool    ReadaEntity( )
        {
            if (dxfPair == "ENDSEC")
            {
                return(false);
            }

            if (dxfPair == "LINE")
            {
                current = new DXFObject(DXFUnitNative.LINE);
                EntityLog(dxfPair.Value, true);
                return(ReadLine(current));
            }

            if (dxfPair == "TEXT")
            {
                current = new DXFObject(DXFUnitNative.TEXT);
                EntityLog(dxfPair.Value, true);
                return(GetXYFromDXFEntity(current, true, true));
            }

            if (dxfPair == "POINT")
            {
                current = new DXFObject(DXFUnitNative.POINT);
                EntityLog(dxfPair.Value, true);
                return(GetXYFromDXFEntity(current, true, true));
            }

            if (dxfPair == "POLYLINE")
            {
                DXFFileReader.unitcount++;

                current = new DXFObject(DXFUnitNative.POLYLINE);
                EntityLog(dxfPair.Value, true);
                if (!GetXYFromDXFEntity(current, false, true))
                {
                    return(false);
                }

                for ( ;;)
                {
                    if (dxfPair == "VERTEX")
                    {
                        if (!GetXYFromDXFEntity(current, true, false))
                        {
                            break;
                        }
                        continue;
                    }
                    if (dxfPair == "SEQEND")
                    {
                        if (!GetXYFromDXFEntity(current, false, false))
                        {
                            break;
                        }
                        return(true);
                    }
                }
                return(true);
            }

            EntityLog("\n" + dxfPair.Value);
            dxfPair.Log(4);

            for ( ; dxfPair != null;)
            {
                dxfPair = new DXFPair(dxSourcefFile, this);
                if (dxfPair == null)
                {
                    return(true);
                }

//				if( dxfPair == 8 )
//					dxfPair.Log( 5 );

                if (dxfPair == 0)
                {
                    EntityLog("\n" + dxfPair.Value);
                    dxfPair.Log(4);
                    break;
                }
            }
            return(true);
        }