Inheritance: ENTITIE
Beispiel #1
0
    // //Update is called once per frame
    //void Update()
    //{
    //    if (GoView.Content.Zoom > LineLenght)
    //    {
    //        lr.enabled = false;
    //        return;
    //    }
    //    lr.enabled = true;
    //    //lr.SetWidth(GoView.Content.Zoom * ZoomAdjust, GoView.Content.Zoom * ZoomAdjust);
    //}
    //设置线段
    public void Set(DXFStructure dxf, LINE item, float ScaleX = 1, float ScaleY = 1)
    {
        var goLayer = GoView.Content.GetLayer(item.C8);
        if (goLayer != null)
        {
            lr.material = goLayer.LayerMaterial;
            ZoomAdjust = goLayer.ZoomAdjust;
        }

        gg = goLayer;

        lr.SetVertexCount(2);

        var p1 = new Vector3((float)item.C10 * ScaleX, (float)item.C20 * ScaleY, (float)item.C30);
        var p2 = new Vector3((float)item.C11 * ScaleX, (float)item.C21 * ScaleY, (float)item.C31);

        lr.SetPosition(0, p1);
        lr.SetPosition(1, p2);

        LineLenght = Vector2.Distance(p1, p2) * 2;

        this.gameObject.isStatic = true;

        if (GoView.Content.MaxX < p1.x)
            GoView.Content.MaxX = p1.x;
        if (GoView.Content.MinX > p1.x)
            GoView.Content.MinX = p1.x;

        if (GoView.Content.MaxY < p1.y)
            GoView.Content.MaxY = p1.y;
        if (GoView.Content.MinY > p1.y)
            GoView.Content.MinY = p1.y;
    }
 protected override Property ReadSonClass(Property prop)
 {
     if (prop.Code == 0 && prop.Value != "ENDSEC")
     {
         switch (prop.Value)
         {
             //case "C3DFACE":
             //case "C3DSOLID":
             //case "ACAD_PROXY_ENTITY":
             case "ARC":
                 var arc = new ARC(DXFData, prop);
                 ARCList.Add(arc);
                 return arc.ReadProperties();
             //case "ATTDEF":
             //case "ATTRIB":
             //case "BODY":
             case "CIRCLE":
                 var circle = new CIRCLE(DXFData, prop);
                 CIRCLEList.Add(circle);
                 return circle.ReadProperties();
             //case "DIMENSION":
             case "ELLIPSE":
                 var ellipes = new ELLIPSE(DXFData, prop);
                 ELLIPSEList.Add(ellipes);
                 return ellipes.ReadProperties();
             //case "HATCH":
             //case "HELIX":
             //case "IMAGE":
             case "INSERT":
                 var insert = new INSERT(DXFData, prop);
                  INSERTList.Add(insert);
                  return insert.ReadProperties();
             //case "LEADER":
             //case "LIGHT":
             case "LINE":
                 var line = new LINE(DXFData, prop);
                 LINEList.Add(line);
                 return line.ReadProperties();
             case "LWPOLYLINE":
                 var lwpolyline = new LWPOLYLINE(DXFData, prop);
                 LWPOLYLINEList.Add(lwpolyline);
                 return lwpolyline.ReadProperties();
             //case "MESH":
             //case "MLINE":
             //case "MLEADERSTYLE":
             //case "MLEADER":
             //case "MTEXT":
             //case "OLEFRAME":
             //case "OLE2FRAME":
             //case "POINT":
             //case "POLYLINE":
             //case "RAY":
             //case "REGION":
             //case "SECTION":
             //case "SEQEND":
             //case "SHAPE":
             //case "SOLID":
             //case "SPLINE":
             //case "SUN":
             //case "SURFACE":
             //case "TABLE":
             case "TEXT":
                 var text = new TEXT(DXFData, prop);
                 TEXTList.Add(text);
                 return text.ReadProperties();
             //case "TOLERANCE":
             //case "TRACE":
             //case "UNDERLAY":
             //case "VERTEX":
             //case "VIEWPORT":
             //case "WIPEOUT":
             //case "XLINE":
             default:
                 return CreateSonClass(new ENTITIE(DXFData, prop));
         }
     }
     else
     {
         return base.ReadSonClass(prop);
     }
 }
Beispiel #3
0
        protected override Property ReadSonClass(Property prop)
        {
            if (prop.Code == 0 && prop.Value != "ENDSEC")
            {
                switch (prop.Value)
                {
                //case "C3DFACE":
                //case "C3DSOLID":
                //case "ACAD_PROXY_ENTITY":
                case "ARC":
                    var arc = new ARC(DXFData, prop);
                    ARCList.Add(arc);
                    return(arc.ReadProperties());

                //case "ATTDEF":
                //case "ATTRIB":
                //case "BODY":
                case "CIRCLE":
                    var circle = new CIRCLE(DXFData, prop);
                    CIRCLEList.Add(circle);
                    return(circle.ReadProperties());

                //case "DIMENSION":
                case "ELLIPSE":
                    var ellipes = new ELLIPSE(DXFData, prop);
                    ELLIPSEList.Add(ellipes);
                    return(ellipes.ReadProperties());

                //case "HATCH":
                //case "HELIX":
                //case "IMAGE":
                case "INSERT":
                    var insert = new INSERT(DXFData, prop);
                    INSERTList.Add(insert);
                    return(insert.ReadProperties());

                //case "LEADER":
                //case "LIGHT":
                case "LINE":
                    var line = new LINE(DXFData, prop);
                    LINEList.Add(line);
                    return(line.ReadProperties());

                case "LWPOLYLINE":
                    var lwpolyline = new LWPOLYLINE(DXFData, prop);
                    LWPOLYLINEList.Add(lwpolyline);
                    return(lwpolyline.ReadProperties());

                //case "MESH":
                //case "MLINE":
                //case "MLEADERSTYLE":
                //case "MLEADER":
                //case "MTEXT":
                //case "OLEFRAME":
                //case "OLE2FRAME":
                //case "POINT":
                //case "POLYLINE":
                //case "RAY":
                //case "REGION":
                //case "SECTION":
                //case "SEQEND":
                //case "SHAPE":
                //case "SOLID":
                //case "SPLINE":
                //case "SUN":
                //case "SURFACE":
                //case "TABLE":
                case "TEXT":
                    var text = new TEXT(DXFData, prop);
                    TEXTList.Add(text);
                    return(text.ReadProperties());

                //case "TOLERANCE":
                //case "TRACE":
                //case "UNDERLAY":
                //case "VERTEX":
                //case "VIEWPORT":
                //case "WIPEOUT":
                //case "XLINE":
                default:
                    return(CreateSonClass(new ENTITIE(DXFData, prop)));
                }
            }
            else
            {
                return(base.ReadSonClass(prop));
            }
        }