Пример #1
0
        public virtual void ParseGroupCode(DXFDocument doc, int groupcode, string value)
        {
            switch (groupcode)
            {
            case 0:
                createRecord(doc);
                break;

            case 5:
                currentRecord.Handle = value;
                break;

            case 70:
                currentRecord.Flags = int.Parse(value);
                break;

            case 105:
                currentRecord.DimStyleHandle = value;
                break;

            case 100:
                currentRecord.Classhierarchy.Add(value);
                break;
            }
        }
Пример #2
0
 public void ParseGroupCode(DXFDocument doc, int groupcode, string value)
 {
     switch (groupcode)
     {
         case 0:
             currentClass = new DXFClass();
             doc.Classes.Add(currentClass);
             break;
         case 1:
             currentClass.DXFRecord = value;
             break;
         case 2:
             currentClass.ClassName = value;
             break;
         case 3:
             currentClass.AppName = value;
             break;
         case 90:
             currentClass.ClassProxyCapabilities = (DXFClass.Caps)Enum.Parse(typeof(DXFClass.Caps), value);
             break;
         case 280:
             if (int.Parse(value) != 0)
                 currentClass.WasProxy = true;
             else
                 currentClass.WasProxy = false;
             break;
         case 281:
             if (int.Parse(value) != 0)
                 currentClass.IsEntity = true;
             else
                 currentClass.IsEntity = false;
             break;
     }
 }
Пример #3
0
 public override void ParseGroupCode(DXFDocument doc, int groupcode, string value)
 {
     base.ParseGroupCode(doc, groupcode, value);
     switch (groupcode)
     {
         case 2:
             _record.StyleName = value;
             break;
         case 40:
             _record.FixedHeight = double.Parse(value);
             break;
         case 41:
             _record.WidthFactor = double.Parse(value);
             break;
         case 50:
             _record.ObliqueAngle = double.Parse(value);
             break;
         case 71:
             _record.GenerationFlags = (DXFStyleRecord.TextGenerationFlags)Enum.Parse(typeof(DXFStyleRecord.TextGenerationFlags), value);
             break;
         case 42:
             _record.LastUsedHeight = double.Parse(value);
             break;
         case 3:
             _record.FontFileName = value;
             break;
         case 4:
             _record.BigFontFileName = value;
             break;
     }
 }
Пример #4
0
 public override void ParseGroupCode(DXFDocument doc, int groupcode, string value)
 {
     base.ParseGroupCode(doc, groupcode, value);
     switch (groupcode)
     {
         case 2:
             _record.StyleName = value;
             break;
         case 40:
             _record.FixedHeight = double.Parse(value);
             break;
         case 41:
             _record.WidthFactor = double.Parse(value);
             break;
         case 50:
             _record.ObliqueAngle = double.Parse(value);
             break;
         case 71:
             _record.GenerationFlags = (DXFStyleRecord.TextGenerationFlags)Enum.Parse(typeof(DXFStyleRecord.TextGenerationFlags), value);
             break;
         case 42:
             _record.LastUsedHeight = double.Parse(value);
             break;
         case 3:
             _record.FontFileName = value;
             break;
         case 4:
             _record.BigFontFileName = value;
             break;
     }
 }
Пример #5
0
 public void ParseGroupCode(DXFDocument doc, int groupcode, string value)
 {
     if (groupcode == 0)
     {
         if (current == null)
         {
             groups.Add(value + " OUTSIDE");
         }
         else
         {
             groups.Add(value);
         }
     }
     if (current == null)
     {
         if (groupcode == 0 && value == "BLOCK")
         {
             current      = new DXFBlock();
             container    = new DXFDocument();
             parsingBlock = true;
         }
     }
     else
     {
         if (parsingBlock)
         {
             if (groupcode == 0 && value == "ENDBLK")
             {
                 current.Children.AddRange(container.Entities);
                 doc.Blocks.Add(current);
                 current   = null;
                 container = null;
             }
             else if (groupcode == 0)
             {
                 parsingBlock = false;
                 parser.ParseGroupCode(container, groupcode, value);
             }
             else
             {
                 current.ParseGroupCode(groupcode, value);
             }
         }
         else
         {
             if (groupcode == 0 && value == "ENDBLK")
             {
                 current.Children.AddRange(container.Entities);
                 doc.Blocks.Add(current);
                 current   = null;
                 container = null;
             }
             else
             {
                 parser.ParseGroupCode(container, groupcode, value);
             }
         }
     }
 }
Пример #6
0
 public override void ParseGroupCode(DXFDocument doc, int groupcode, string value)
 {
     base.ParseGroupCode(doc, groupcode, value);
     if (groupcode == 2)
     {
         _currentRecord.BlockName = value;
     }
 }
Пример #7
0
 public override void ParseGroupCode(DXFDocument doc, int groupcode, string value)
 {
     base.ParseGroupCode(doc, groupcode, value);
     if (groupcode == 2)
     {
         _currentRecord.BlockName = value;
     }
 }
Пример #8
0
 public void ParseGroupCode(DXFDocument doc, int groupcode, string value)
 {
     if (Entities.Count == 0)
     {
         foreach (Type t in Assembly.GetCallingAssembly().GetTypes())
         {
             if (t.IsClass && !t.IsAbstract)
             {
                 object[] attrs = t.GetCustomAttributes(false);
                 foreach (object attr in attrs)
                 {
                     EntityAttribute casted = attr as EntityAttribute;
                     if (casted != null)
                     {
                         Entities.Add(casted.EntityName, t);
                     }
                 }
             }
         }
     }
     if (groupcode == 0)
     {
         if (value == "SEQEND")
         {
             if (stack.Count != 0)
             {
                 currentEntity = stack.Pop();
             }
         }
         if (Entities.ContainsKey(value))
         {
             if (currentEntity != null && currentEntity.HasChildren)
             {
                 stack.Push(currentEntity);
             }
             currentEntity = Activator.CreateInstance(Entities[value]) as DXFEntity;
             if (stack.Count > 0 && stack.Peek().HasChildren)
             {
                 stack.Peek().Children.Add(currentEntity);
             }
             else
             {
                 doc.Entities.Add(currentEntity);
             }
         }
         else
         {
             currentEntity = null;
             //TODO: warning
         }
     }
     if (currentEntity != null)
     {
         currentEntity.ParseGroupCode(groupcode, value);
     }
 }
Пример #9
0
 public override void ParseGroupCode(DXFDocument doc, int groupcode, string value)
 {
     base.ParseGroupCode(doc, groupcode, value);
     switch (groupcode)
     {
         case 2:
             _currentRecord.ApplicationName = value;
             break;
     }
 }
Пример #10
0
 public override void ParseGroupCode(DXFDocument doc, int groupcode, string value)
 {
     base.ParseGroupCode(doc, groupcode, value);
     switch (groupcode)
     {
     case 2:
         _currentRecord.ApplicationName = value;
         break;
     }
 }
Пример #11
0
 public void ParseGroupCode(DXFDocument doc, int groupcode, string value)
 {
     if (Entities.Count == 0)
     {
         foreach (Type t in Assembly.GetCallingAssembly().GetTypes())
         {
             if (t.IsClass && !t.IsAbstract)
             {
                 object[] attrs = t.GetCustomAttributes(false);
                 foreach(object attr in attrs)
                 {
                     EntityAttribute casted = attr as EntityAttribute;
                     if (casted != null)
                     {
                         Entities.Add(casted.EntityName, t);
                     }
                 }
             }
         }
     }
     if (groupcode == 0)
     {
         if (value == "SEQEND")
         {
             if (stack.Count != 0)
                 currentEntity = stack.Pop();
         }
         if (Entities.ContainsKey(value))
         {
             if (currentEntity!=null && currentEntity.HasChildren)
             {
                 stack.Push(currentEntity);
             }
             currentEntity = Activator.CreateInstance(Entities[value]) as DXFEntity;
             if (stack.Count>0 && stack.Peek().HasChildren)
             {
                 stack.Peek().Children.Add(currentEntity);
             }
             else
             {
                 doc.Entities.Add(currentEntity);
             }
         }
         else
         {
             currentEntity = null;
             //TODO: warning
         }
     }
     if (currentEntity != null)
     {
         currentEntity.ParseGroupCode(groupcode, value);
     }
 }
Пример #12
0
 public void ParseGroupCode(DXFDocument doc, int groupcode, string value)
 {
     if (groupcode == 0)
     {
         if (current == null)
             groups.Add(value + " OUTSIDE");
         else
             groups.Add(value);
     }
     if (current == null)
     {
         if (groupcode == 0 && value == "BLOCK")
         {
             current = new DXFBlock();
             container = new DXFDocument();
             parsingBlock = true;
         }
     }
     else
     {
         if (parsingBlock)
         {
             if (groupcode == 0 && value == "ENDBLK")
             {
                 current.Children.AddRange(container.Entities);
                 doc.Blocks.Add(current);
                 current = null;
                 container = null;
             }
             else if (groupcode == 0)
             {
                 parsingBlock = false;
                 parser.ParseGroupCode(container, groupcode, value);
             }
             else
                 current.ParseGroupCode(groupcode, value);
         }
         else
         {
             if (groupcode == 0 && value == "ENDBLK")
             {
                 current.Children.AddRange(container.Entities);
                 doc.Blocks.Add(current);
                 current = null;
                 container = null;
             }
             else
             {
                 parser.ParseGroupCode(container, groupcode, value);
             }
         }
     }
 }
Пример #13
0
        public void ParseGroupCode(DXFDocument doc, int groupcode, string value)
        {
            switch (groupcode)
            {
            case 0:
                currentClass = new DXFClass();
                doc.Classes.Add(currentClass);
                break;

            case 1:
                currentClass.DXFRecord = value;
                break;

            case 2:
                currentClass.ClassName = value;
                break;

            case 3:
                currentClass.AppName = value;
                break;

            case 90:
                currentClass.ClassProxyCapabilities = (DXFClass.Caps)Enum.Parse(typeof(DXFClass.Caps), value);
                break;

            case 280:
                if (int.Parse(value) != 0)
                {
                    currentClass.WasProxy = true;
                }
                else
                {
                    currentClass.WasProxy = false;
                }
                break;

            case 281:
                if (int.Parse(value) != 0)
                {
                    currentClass.IsEntity = true;
                }
                else
                {
                    currentClass.IsEntity = false;
                }
                break;
            }
        }
Пример #14
0
 public override void ParseGroupCode(DXFDocument doc, int groupcode, string value)
 {
     base.ParseGroupCode(doc, groupcode, value);
     switch (groupcode)
     {
         case 2:
             _record.LayerName = value;
             break;
         case 62:
             _record.Color = int.Parse(value);
             break;
         case 6:
             _record.LineType = value;
             break;
     }
 }
Пример #15
0
        public override void ParseGroupCode(DXFDocument doc, int groupcode, string value)
        {
            base.ParseGroupCode(doc, groupcode, value);
            switch (groupcode)
            {
            case 2:
                _record.UCSName = value;
                break;

            case 10:
                _record.Origin.X = double.Parse(value);
                break;

            case 20:
                _record.Origin.Y = double.Parse(value);
                break;

            case 30:
                _record.Origin.Z = double.Parse(value);
                break;

            case 11:
                _record.XAxis.X = double.Parse(value);
                break;

            case 21:
                _record.XAxis.Y = double.Parse(value);
                break;

            case 31:
                _record.XAxis.Z = double.Parse(value);
                break;

            case 12:
                _record.YAxis.X = double.Parse(value);
                break;

            case 22:
                _record.YAxis.Y = double.Parse(value);
                break;

            case 32:
                _record.YAxis.Z = double.Parse(value);
                break;
            }
        }
Пример #16
0
        public override void ParseGroupCode(DXFDocument doc, int groupcode, string value)
        {
            base.ParseGroupCode(doc, groupcode, value);
            switch (groupcode)
            {
            case 2:
                _record.LayerName = value;
                break;

            case 62:
                _record.Color = int.Parse(value);
                break;

            case 6:
                _record.LineType = value;
                break;
            }
        }
Пример #17
0
 public virtual void ParseGroupCode(DXFDocument doc, int groupcode, string value)
 {
     switch (groupcode)
     {
         case 0:
             createRecord(doc);
             break;
         case 5:
             currentRecord.Handle = value;
             break;
         case 70:
             currentRecord.Flags = int.Parse(value);
             break;
         case 105:
             currentRecord.DimStyleHandle = value;
             break;
         case 100:
             currentRecord.Classhierarchy.Add(value);
             break;
     }
 }
Пример #18
0
 public override void ParseGroupCode(DXFDocument doc, int groupcode, string value)
 {
     base.ParseGroupCode(doc, groupcode, value);
     switch (groupcode)
     {
         case 2:
             _record.UCSName = value;
             break;
         case 10:
             _record.Origin.X = double.Parse(value);
             break;
         case 20:
             _record.Origin.Y = double.Parse(value);
             break;
         case 30:
             _record.Origin.Z = double.Parse(value);
             break;
         case 11:
             _record.XAxis.X = double.Parse(value);
             break;
         case 21:
             _record.XAxis.Y = double.Parse(value);
             break;
         case 31:
             _record.XAxis.Z = double.Parse(value);
             break;
         case 12:
             _record.YAxis.X = double.Parse(value);
             break;
         case 22:
             _record.YAxis.Y = double.Parse(value);
             break;
         case 32:
             _record.YAxis.Z = double.Parse(value);
             break;
     }
 }
Пример #19
0
        public override void ParseGroupCode(DXFDocument doc, int groupcode, string value)
        {
            base.ParseGroupCode(doc, groupcode, value);
            switch (groupcode)
            {
            case 2:
                _record.VPortName = value;
                break;

            case 10:
                _record.LowerLeftCorner.X = double.Parse(value);
                break;

            case 20:
                _record.LowerLeftCorner.Y = double.Parse(value);
                break;

            case 11:
                _record.UpperRightCorner.X = double.Parse(value);
                break;

            case 21:
                _record.UpperRightCorner.Y = double.Parse(value);
                break;

            case 12:
                _record.Center.X = double.Parse(value);
                break;

            case 22:
                _record.Center.Y = double.Parse(value);
                break;

            case 13:
                _record.SnapBase.X = double.Parse(value);
                break;

            case 23:
                _record.SnapBase.Y = double.Parse(value);
                break;

            case 14:
                _record.SnapSpacing.X = double.Parse(value);
                break;

            case 24:
                _record.SnapSpacing.Y = double.Parse(value);
                break;

            case 15:
                _record.GridSpacing.X = double.Parse(value);
                break;

            case 25:
                _record.GridSpacing.Y = double.Parse(value);
                break;

            case 16:
                _record.Direction.X = double.Parse(value);
                break;

            case 26:
                _record.Direction.Y = double.Parse(value);
                break;

            case 36:
                _record.Direction.Z = double.Parse(value);
                break;

            case 17:
                _record.Target.X = double.Parse(value);
                break;

            case 27:
                _record.Target.Y = double.Parse(value);
                break;

            case 37:
                _record.Target.Z = double.Parse(value);
                break;

            case 40:
                _record.Height = double.Parse(value);
                break;

            case 41:
                _record.AspectRatio = double.Parse(value);
                break;

            case 42:
                _record.LensLength = double.Parse(value);
                break;

            case 43:
                _record.FrontClippingPlane = double.Parse(value);
                break;

            case 44:
                _record.BackClippingPlane = double.Parse(value);
                break;

            case 50:
                _record.SnapRotationAngle = double.Parse(value);
                break;

            case 51:
                _record.TwistAngle = double.Parse(value);
                break;

            case 71:
                _record.ViewMode = int.Parse(value);
                break;

            case 72:
                _record.CircleZoomPercent = int.Parse(value);
                break;

            case 73:
                _record.FastZoomSetting = int.Parse(value);
                break;

            case 74:
                _record.UCSICONSetting = int.Parse(value);
                break;

            case 75:
                _record.SnapEnabled = int.Parse(value);
                break;

            case 76:
                _record.GridEnabled = int.Parse(value);
                break;

            case 77:
                _record.SnapStyle = int.Parse(value);
                break;

            case 78:
                _record.SnapIsoPair = int.Parse(value);
                break;
            }
        }
Пример #20
0
        public void ParseGroupCode(DXFDocument doc, int groupcode, string value)
        {
            if (fields.Count == 0)
            {
                Type header = doc.Header.GetType();
                foreach (PropertyInfo info in header.GetProperties(BindingFlags.Public | BindingFlags.Instance))
                {
                    if (info.CanWrite && info.CanRead)
                    {
                        object[] attrs = info.GetCustomAttributes(true);
                        foreach (object attr in attrs)
                        {
                            HeaderAttribute casted = attr as HeaderAttribute;
                            if (casted != null)
                            {
                                fields[casted.Name] = info;
                            }
                        }
                    }
                }
            }

            if (groupcode == 9)
            {
                string name = value.Trim();
                if (fields.ContainsKey(name))
                {
                    currentVar = fields[name];
                }
                else
                {
                    currentVar = null;
                }
            }
            else if (currentVar != null)
            {
                //at first we need to differentiate the types: nullable vs string and nullable vs rest
                if (currentVar.PropertyType.Equals(typeof(string)))
                {
                    currentVar.SetValue(doc.Header, value, null);
                }
                else if (currentVar.PropertyType.IsGenericType && currentVar.PropertyType.GetGenericTypeDefinition().Equals(typeof(Nullable <>)))
                {
                    Type boxedType = currentVar.PropertyType.GetGenericArguments()[0];
                    if (boxedType.Equals(typeof(int)))
                    {
                        int?parsed;
                        if (value.ToLower().Contains('a') ||
                            value.ToLower().Contains('b') ||
                            value.ToLower().Contains('c') ||
                            value.ToLower().Contains('d') ||
                            value.ToLower().Contains('e') ||
                            value.ToLower().Contains('f'))
                        {
                            parsed = int.Parse(value, System.Globalization.NumberStyles.HexNumber);
                        }
                        else
                        {
                            parsed = int.Parse(value, System.Globalization.NumberStyles.Any);
                        }
                        currentVar.SetValue(doc.Header, parsed, null);
                    }
                    else if (boxedType.Equals(typeof(double)))
                    {
                        double?parsed = double.Parse(value);
                        currentVar.SetValue(doc.Header, parsed, null);
                    }
                    else if (boxedType.Equals(typeof(bool)))
                    {
                        int?parsed = int.Parse(value);
                        if (parsed != 0)
                        {
                            currentVar.SetValue(doc.Header, (bool?)true, null);
                        }
                        else
                        {
                            currentVar.SetValue(doc.Header, (bool?)false, null);
                        }
                    }
                    else if (boxedType.IsEnum)
                    {
                        object parsed = Enum.Parse(boxedType, value);
                        currentVar.SetValue(doc.Header, parsed, null);
                    }
                }
                else if (currentVar.PropertyType.Equals(typeof(DXFPoint)))
                {
                    DXFPoint p = (DXFPoint)currentVar.GetValue(doc.Header, null);
                    if (p == null)
                    {
                        p = new DXFPoint();
                        currentVar.SetValue(doc.Header, p, null);
                    }
                    switch (groupcode)
                    {
                    case 10:
                        p.X = double.Parse(value);
                        break;

                    case 20:
                        p.Y = double.Parse(value);
                        break;

                    case 30:
                        p.Z = double.Parse(value);
                        break;

                    default:
                        break;
                    }
                }
            }
        }
Пример #21
0
        public override void ParseGroupCode(DXFDocument doc, int groupcode, string value)
        {
            base.ParseGroupCode(doc, groupcode, value);
            switch (groupcode)
            {
            case 2:
                _record.ViewPortName = value;
                break;

            case 40:
                _record.Height = double.Parse(value);
                break;

            case 41:
                _record.Width = double.Parse(value);
                break;

            case 10:
                _record.Center.X = double.Parse(value);
                break;

            case 20:
                _record.Center.Y = double.Parse(value);
                break;

            case 11:
                _record.Direction.X = double.Parse(value);
                break;

            case 21:
                _record.Direction.Y = double.Parse(value);
                break;

            case 31:
                _record.Direction.Z = double.Parse(value);
                break;

            case 12:
                _record.Target.X = double.Parse(value);
                break;

            case 22:
                _record.Target.Y = double.Parse(value);
                break;

            case 32:
                _record.Target.Z = double.Parse(value);
                break;

            case 42:
                _record.LensLength = double.Parse(value);
                break;

            case 43:
                _record.FrontClippingPlane = double.Parse(value);
                break;

            case 44:
                _record.BackClippingPlane = double.Parse(value);
                break;

            case 50:
                _record.TwistAngle = double.Parse(value);
                break;

            case 71:
                _record.ViewMode = int.Parse(value);
                break;
            }
        }
Пример #22
0
 public void ParseGroupCode(DXFDocument doc, int groupcode, string value)
 {
     if (tablehandlers.Count == 0)
     {
         foreach (PropertyInfo info in doc.Tables.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
         {
             object[] attrs = info.GetCustomAttributes(true);
             foreach (object attr in attrs)
             {
                 TableAttribute casted = attr as TableAttribute;
                 if (casted != null)
                 {
                     tablehandlers[casted.TableName] = (ISectionParser)Activator.CreateInstance(casted.TableParser);
                 }
             }
         }
     }
     if (currentParser == null)
     {
         if (groupcode == 0 && value.Trim() == "TABLE")
         {
             waitingtableheader = true;
         }
         else if (waitingtableheader && groupcode == 2 && !ignoretable)
         {
             if (tablehandlers.ContainsKey(value.Trim()))
             {
                 currentParser = tablehandlers[value.Trim()];
                 waitingtableheader = false;
                 ignoretable = false;
                 firstrecordfound = false;
             }
             else
             {
                 //TODO: generate warning
                 ignoretable = true;
             }
         }
         else if (waitingtableheader && groupcode == 0 && value.Trim() == "ENDTAB")
         {
             waitingtableheader = false;
             ignoretable = false;
         }
     }
     else
     {
         if (groupcode == 0 && value.Trim() == "ENDTAB")
         {
             currentParser = null;
         }
         else
         {
             if (groupcode == 0)
             {
                 firstrecordfound = true;
             }
             if (firstrecordfound)
                 currentParser.ParseGroupCode(doc, groupcode, value);
         }
     }
 }
Пример #23
0
 protected override void createRecord(DXFDocument doc)
 {
     _record = new DXFUCSRecord();
     doc.Tables.UCS.Add(_record);
 }
Пример #24
0
 public override void ParseGroupCode(DXFDocument doc, int groupcode, string value)
 {
     base.ParseGroupCode(doc, groupcode, value);
     switch (groupcode)
     {
         case 2:
             _record.LineTypeName = value;
             break;
         case 3:
             _record.Description = value;
             break;
         case 72:
             _record.AlignmentCode = int.Parse(value);
             break;
         case 73:
             _record.ElementCount = int.Parse(value);
             break;
         case 40:
             _record.PatternLength = double.Parse(value);
             break;
         case 49:
             _subrecord = new DXFLineTypeRecord.LineTypeElement();
             _record.Elements.Add(_subrecord);
             _subrecord.Length = double.Parse(value);
             break;
         case 74:
             _subrecord.Flags = (DXFLineTypeRecord.ElementFlags)Enum.Parse(typeof(DXFLineTypeRecord.ElementFlags), value);
             break;
         case 75:
             _subrecord.ShapeNumber = int.Parse(value);
             break;
         case 340:
             _subrecord.Shape = value;
             break;
         case 46:
             _subrecord.Scalings.Add(double.Parse(value));
             break;
         case 50:
             _subrecord.Rotation = double.Parse(value);
             break;
         case 44:
             _subrecord.XOffsets.Add(double.Parse(value));
             break;
         case 45:
             _subrecord.YOffsets.Add(double.Parse(value));
             break;
         case 9:
             _subrecord.Text = value;
             break;
     }
 }
Пример #25
0
 protected override void createRecord(DXFDocument doc)
 {
     _currentRecord = new DXFAppIDRecord();
     doc.Tables.AppIDs.Add(_currentRecord);
 }
Пример #26
0
 public override void ParseGroupCode(DXFDocument doc, int groupcode, string value)
 {
     base.ParseGroupCode(doc, groupcode, value);
     switch (groupcode)
     {
         case 2:
             _record.ViewPortName = value;
             break;
         case 40:
             _record.Height = double.Parse(value);
             break;
         case 41:
             _record.Width = double.Parse(value);
             break;
         case 10:
             _record.Center.X = double.Parse(value);
             break;
         case 20:
             _record.Center.Y = double.Parse(value);
             break;
         case 11:
             _record.Direction.X = double.Parse(value);
             break;
         case 21:
             _record.Direction.Y = double.Parse(value);
             break;
         case 31:
             _record.Direction.Z = double.Parse(value);
             break;
         case 12:
             _record.Target.X = double.Parse(value);
             break;
         case 22:
             _record.Target.Y = double.Parse(value);
             break;
         case 32:
             _record.Target.Z = double.Parse(value);
             break;
         case 42:
             _record.LensLength = double.Parse(value);
             break;
         case 43:
             _record.FrontClippingPlane = double.Parse(value);
             break;
         case 44:
             _record.BackClippingPlane = double.Parse(value);
             break;
         case 50:
             _record.TwistAngle = double.Parse(value);
             break;
         case 71:
             _record.ViewMode = int.Parse(value);
             break;
     }
 }
Пример #27
0
 protected override void createRecord(DXFDocument doc)
 {
     _record = new DXFLineTypeRecord();
     doc.Tables.LineTypes.Add(_record);
 }
Пример #28
0
 protected override void createRecord(DXFDocument doc)
 {
     _record = new DXFLayerRecord();
     doc.Tables.Layers.Add(_record);
 }
Пример #29
0
 protected override void createRecord(DXFDocument doc)
 {
     _record = new DXFDimStyleRecord();
     doc.Tables.DimStyles.Add(_record);
 }
Пример #30
0
 //[TestMethod]
 public void TestMethod3()
 {
     DXFDocument doc = new DXFDocument();
     doc.Load(new MemoryStream(Properties.Resources.Untitled_2));
 }
Пример #31
0
 protected override void createRecord(DXFDocument doc)
 {
     _record = new DXFStyleRecord();
     doc.Tables.Styles.Add(_record);
 }
Пример #32
0
 public void ParseGroupCode(DXFDocument doc, int groupcode, string value)
 {
     if (tablehandlers.Count == 0)
     {
         foreach (PropertyInfo info in doc.Tables.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
         {
             object[] attrs = info.GetCustomAttributes(true);
             foreach (object attr in attrs)
             {
                 TableAttribute casted = attr as TableAttribute;
                 if (casted != null)
                 {
                     tablehandlers[casted.TableName] = (ISectionParser)Activator.CreateInstance(casted.TableParser);
                 }
             }
         }
     }
     if (currentParser == null)
     {
         if (groupcode == 0 && value.Trim() == "TABLE")
         {
             waitingtableheader = true;
         }
         else if (waitingtableheader && groupcode == 2 && !ignoretable)
         {
             if (tablehandlers.ContainsKey(value.Trim()))
             {
                 currentParser      = tablehandlers[value.Trim()];
                 waitingtableheader = false;
                 ignoretable        = false;
                 firstrecordfound   = false;
             }
             else
             {
                 //TODO: generate warning
                 ignoretable = true;
             }
         }
         else if (waitingtableheader && groupcode == 0 && value.Trim() == "ENDTAB")
         {
             waitingtableheader = false;
             ignoretable        = false;
         }
     }
     else
     {
         if (groupcode == 0 && value.Trim() == "ENDTAB")
         {
             currentParser = null;
         }
         else
         {
             if (groupcode == 0)
             {
                 firstrecordfound = true;
             }
             if (firstrecordfound)
             {
                 currentParser.ParseGroupCode(doc, groupcode, value);
             }
         }
     }
 }
Пример #33
0
 protected override void createRecord(DXFDocument doc)
 {
     _record = new DXFViewRecord();
     doc.Tables.Views.Add(_record);
 }
Пример #34
0
 protected abstract void createRecord(DXFDocument doc);
Пример #35
0
 protected abstract void createRecord(DXFDocument doc);
Пример #36
0
        public override void ParseGroupCode(DXFDocument doc, int groupcode, string value)
        {
            base.ParseGroupCode(doc, groupcode, value);
            switch (groupcode)
            {
            case 2:
                _record.LineTypeName = value;
                break;

            case 3:
                _record.Description = value;
                break;

            case 72:
                _record.AlignmentCode = int.Parse(value);
                break;

            case 73:
                _record.ElementCount = int.Parse(value);
                break;

            case 40:
                _record.PatternLength = double.Parse(value);
                break;

            case 49:
                _subrecord = new DXFLineTypeRecord.LineTypeElement();
                _record.Elements.Add(_subrecord);
                _subrecord.Length = double.Parse(value);
                break;

            case 74:
                _subrecord.Flags = (DXFLineTypeRecord.ElementFlags)Enum.Parse(typeof(DXFLineTypeRecord.ElementFlags), value);
                break;

            case 75:
                _subrecord.ShapeNumber = int.Parse(value);
                break;

            case 340:
                _subrecord.Shape = value;
                break;

            case 46:
                _subrecord.Scalings.Add(double.Parse(value));
                break;

            case 50:
                _subrecord.Rotation = double.Parse(value);
                break;

            case 44:
                _subrecord.XOffsets.Add(double.Parse(value));
                break;

            case 45:
                _subrecord.YOffsets.Add(double.Parse(value));
                break;

            case 9:
                _subrecord.Text = value;
                break;
            }
        }
Пример #37
0
 //[TestMethod]
 public void TestMethod1()
 {
     DXFDocument doc = new DXFDocument();
     doc.Load(new MemoryStream(Properties.Resources.LaptopStand));
 }
Пример #38
0
 protected override void createRecord(DXFDocument doc)
 {
     _currentRecord = new DXFAppIDRecord();
     doc.Tables.AppIDs.Add(_currentRecord);
 }
Пример #39
0
 public void TestMethod4()
 {
     DXFDocument doc = new DXFDocument();
     doc.Load(new MemoryStream(Properties.Resources.Hase));
 }
Пример #40
0
 public override void ParseGroupCode(DXFDocument doc, int groupcode, string value)
 {
     base.ParseGroupCode(doc, groupcode, value);
     if (groupcode == 2)
         _record.StyleName = value;
 }