Esempio n. 1
0
        public void DrawMember(MemberIncidence mi, vdDocument doc, double txtSize)
        {

            double length, factor;


            doc.Palette.Background = Color.White;
            vdLine line = new vdLine();
            vdText vtxtMemberNo = new vdText();

            line.SetUnRegisterDocument(doc);
            line.setDocumentDefaults();
            vtxtMemberNo.SetUnRegisterDocument(doc);
            vtxtMemberNo.setDocumentDefaults();


            line.PenColor = new vdColor(Color.Black);

            line.Layer = doc.Layers[0];
            doc.Layers[0].Frozen = false;

            line.StartPoint = mi.StartNode.Point;
            line.EndPoint = mi.EndNode.Point;
          

            line.ToolTip = string.Format("Member No : {0} [Nodes ({1}, {2})]",
                 mi.MemberNo,
                 mi.StartNode.NodeNo,
                 mi.EndNode.NodeNo);

            doc.ActionLayout.Entities.AddItem(line);




            length = line.Length();
            //factor = 22.2222d;
            //factor = length / 0.9d;

            //txtSize = length / factor;

            //txtSize = GetTextSize();

           
            vtxtMemberNo.TextString = mi.MemberNo.ToString();
            vtxtMemberNo.Layer = membersLay;
            vtxtMemberNo.Height = txtSize;
            vtxtMemberNo.PenColor = new vdColor(Color.Blue);
            vtxtMemberNo.InsertionPoint = (mi.StartNode.Point + mi.EndNode.Point) / 2;
            vtxtMemberNo.Layer = membersLay;
            vtxtMemberNo.ToolTip = string.Format("Member No : {0} [Nodes ({1}, {2})]",
                mi.MemberNo,
                mi.StartNode.NodeNo,
                mi.EndNode.NodeNo);

            doc.ActionLayout.Entities.AddItem(vtxtMemberNo);

            //doc.ZoomAll();
            //doc.Redraw(true);
        }
Esempio n. 2
0
        public void SetAlign()
        {
            vdFigure vdFig = null;
            vdLine   stln = null;
            vdLine   endln = null;
            object   ret = null;
            gPoint   EPT, SPT;
            gPoint   FSP; // First Start Point
            gPoint   FDP; // First Destination Point
            gPoint   SSP; // Second Start Point
            gPoint   SDP; // Second Destination Point

            vdSelection vdSel = null;

            document.Prompt("Select Entities:");
            ret = document.ActionUtility.getUserSelection();
            document.Prompt(null);
            if (ret == null || !(ret is vdSelection))
            {
                return;
            }
            vdSel = ret as vdSelection;

            document.Prompt("Enter First Source Point:");
            ret = document.ActionUtility.getUserPoint();
            document.Prompt(null);
            if (ret == null || !(ret is gPoint))
            {
                return;
            }
            FSP = ret as gPoint;

            document.Prompt("Enter First Destination Point:");
            ret = document.ActionUtility.getUserPoint();
            document.Prompt(null);
            if (ret == null || !(ret is gPoint))
            {
                return;
            }
            FDP = ret as gPoint;

            document.Prompt("Enter Second Source Point:");
            ret = document.ActionUtility.getUserPoint();
            document.Prompt(null);
            if (ret == null || !(ret is gPoint))
            {
                return;
            }
            SSP = ret as gPoint;

            document.Prompt("Enter Second Destination Point:");
            ret = document.ActionUtility.getUserPoint();
            document.Prompt(null);
            if (ret == null || !(ret is gPoint))
            {
                return;
            }
            SDP = ret as gPoint;

            //endln.StartPoint = FSP
            //stln.StartPoint = FDP
            //endln.EndPoint = SSP
            //stln.EndPoint = SDP


            FSP.z = 0.0;
            SSP.z = 0.0;
            FDP.z = 0.0;
            SDP.z = 0.0;

            stln  = new vdLine(FDP, SDP);
            endln = new vdLine(FSP, SSP);

            double scaleFactor = stln.Length() / endln.Length();

            document.CommandAction.CmdScale(vdSel, endln.StartPoint, scaleFactor);
            document.CommandAction.CmdMove(vdSel, endln.StartPoint, stln.StartPoint);
            double ang  = stln.StartPoint.GetAngle(stln.EndPoint);
            double ang1 = endln.StartPoint.GetAngle(endln.EndPoint);

            ang = ang - ang1;
            document.CommandAction.CmdRotate(vdSel, stln.StartPoint, ang);
        }
Esempio n. 3
0
        public override void FillShapeEntities(ref vdEntities entities)
        {
            //vdDocument document = entities.Document;
            //vdCircle circle = new vdCircle();
            //entities.AddItem(circle);
            //circle.MatchProperties(this, Document);
            //circle.Radius = mRadius;
            //circle.HatchProperties = mhatchprops;

            //if (mShowLines)
            //{
            //    gPoint cen = new gPoint();
            //    vdLine line1;
            //    double angle = 0.0;
            //    for (int i = 0; i < 4; i++)
            //    {
            //        line1 = new vdLine();
            //        line1.MatchProperties(this, Document);
            //        if (mhatchprops.FillMode == VdConstFill.VdFillModeNone)
            //        {
            //            line1.LineType = Document.LineTypes.Invisible;
            //        }
            //        line1.StartPoint = new gPoint(gPoint.Polar(cen, angle + mAngle, 3.0d * mRadius / 2.0d));
            //        line1.EndPoint = new gPoint(gPoint.Polar(cen, angle + mAngle, 2.0d * mRadius));
            //        angle += VectorDraw.Geometry.Globals.HALF_PI;
            //        entities.AddItem(line1);
            //    }
            //}

            gPoint EPT, SPT;

            SPT = StartPoint;
            EPT = EndPoint;

            vdLine line1 = new vdLine();

            //line1.SetUnRegisterDocument(document);
            //line1.setDocumentDefaults();
            line1.StartPoint = SPT;
            line1.EndPoint   = EPT;
            entities.AddItem(line1);

            vdLine line2 = new vdLine();

            //line2.SetUnRegisterDocument(document);
            //line2.setDocumentDefaults();
            line2.StartPoint = new gPoint(SPT.x, SPT.y - 1, SPT.z);
            line2.EndPoint   = new gPoint(EPT.x, EPT.y - 1, EPT.z);
            entities.AddItem(line2);


            ASTRAMemberLoad aline = new ASTRAMemberLoad();

            entities.AddItem(aline);
            aline.InitializeProperties();
            aline.setDocumentDefaults();
            aline.StartPoint = line2.StartPoint;
            aline.EndPoint   = line1.StartPoint;
            aline.arrowSize  = 0.3;


            double ll = ((line1.Length() / 5.0d) / line1.Length());
            double sx, sy, sz;
            double ex, ey, ez;

            sx = sy = sz = 0.0d;
            for (int j = 1; j <= 5; j++)
            {
                ASTRAMemberLoad aline1 = new ASTRAMemberLoad();
                entities.AddItem(aline1);
                aline1.InitializeProperties();
                aline1.setDocumentDefaults();
                aline1.arrowSize = 0.3;

                sx = (j * ll) * (line2.EndPoint.x - line2.StartPoint.x) + line2.StartPoint.x;
                sy = (j * ll) * (line2.EndPoint.y - line2.StartPoint.y) + line2.StartPoint.y;
                sz = (j * ll) * (line2.EndPoint.z - line2.StartPoint.z) + line2.StartPoint.z;

                aline1.StartPoint = new gPoint(sx, sy, sz);

                ex = (j * ll) * (line1.EndPoint.x - line1.StartPoint.x) + line1.StartPoint.x;
                ey = (j * ll) * (line1.EndPoint.y - line1.StartPoint.y) + line1.StartPoint.y;
                ez = (j * ll) * (line1.EndPoint.z - line1.StartPoint.z) + line1.StartPoint.z;
                aline1.EndPoint = new gPoint(ex, ey, ez);
            }
        }
Esempio n. 4
0
        public static void CmdASTRAMemberLoad(vdDocument document)
        {
            gPoint EPT, SPT;

            document.Prompt("Start Point:");
            object ret = document.ActionUtility.getUserPoint();

            document.Prompt(null);
            if (ret == null || !(ret is gPoint))
            {
                return;
            }
            SPT = ret as gPoint;

            ActionASTRAMemberLoad aFig = new ActionASTRAMemberLoad(SPT, document.ActiveLayOut);

            document.Prompt("End Point :");

            document.ActionAdd(aFig);
            StatusCode scode = aFig.WaitToFinish();

            document.Prompt(null);
            if (scode != VectorDraw.Actions.StatusCode.Success)
            {
                return;
            }

            EPT = aFig.Value as gPoint;



            vdLine line1 = new vdLine();

            line1.SetUnRegisterDocument(document);
            line1.setDocumentDefaults();
            line1.StartPoint = SPT;
            line1.EndPoint   = EPT;
            document.ActiveLayOut.Entities.AddItem(line1);

            vdLine line2 = new vdLine();

            line2.SetUnRegisterDocument(document);
            line2.setDocumentDefaults();
            line2.StartPoint = new gPoint(SPT.x, SPT.y - 1, SPT.z);
            line2.EndPoint   = new gPoint(EPT.x, EPT.y - 1, EPT.z);
            document.ActiveLayOut.Entities.AddItem(line2);


            ASTRAMemberLoad aline = new ASTRAMemberLoad();

            document.ActionLayout.Entities.AddItem(aline);
            document.UndoHistory.PushEnable(false);
            aline.InitializeProperties();
            aline.setDocumentDefaults();
            aline.StartPoint = line2.StartPoint;
            aline.EndPoint   = line1.StartPoint;
            aline.arrowSize  = 0.3;
            aline.Transformby(document.User2WorldMatrix);
            document.UndoHistory.PopEnable();
            document.ActionDrawFigure(aline);


            double ll = ((line1.Length() / 5.0d) / line1.Length());
            double sx, sy, sz;
            double ex, ey, ez;

            sx = sy = sz = 0.0d;
            for (int j = 1; j <= 5; j++)
            {
                ASTRAMemberLoad aline1 = new ASTRAMemberLoad();
                document.ActionLayout.Entities.AddItem(aline1);
                document.UndoHistory.PushEnable(false);
                aline1.InitializeProperties();
                aline1.setDocumentDefaults();
                aline1.arrowSize = 0.3;

                sx = (j * ll) * (line2.EndPoint.x - line2.StartPoint.x) + line2.StartPoint.x;
                sy = (j * ll) * (line2.EndPoint.y - line2.StartPoint.y) + line2.StartPoint.y;
                sz = (j * ll) * (line2.EndPoint.z - line2.StartPoint.z) + line2.StartPoint.z;

                aline1.StartPoint = new gPoint(sx, sy, sz);

                ex = (j * ll) * (line1.EndPoint.x - line1.StartPoint.x) + line1.StartPoint.x;
                ey = (j * ll) * (line1.EndPoint.y - line1.StartPoint.y) + line1.StartPoint.y;
                ez = (j * ll) * (line1.EndPoint.z - line1.StartPoint.z) + line1.StartPoint.z;

                aline1.EndPoint = new gPoint(ex, ey, ez);
                aline1.Transformby(document.User2WorldMatrix);
                document.UndoHistory.PopEnable();
                document.ActionDrawFigure(aline);
            }
            document.Redraw(true);
        }
Esempio n. 5
0
        public static void CmdASTRAMemberLoad3(vdDocument document, gPoint StartPoint, gPoint EndPoint)
        {
            gPoint EPT, SPT;

            SPT = StartPoint;

            EPT = EndPoint;



            vdLine line1 = new vdLine();

            line1.SetUnRegisterDocument(document);
            line1.setDocumentDefaults();
            line1.StartPoint = SPT;
            line1.EndPoint   = EPT;
            document.ActiveLayOut.Entities.AddItem(line1);

            vdLine line2 = new vdLine();

            line2.SetUnRegisterDocument(document);
            line2.setDocumentDefaults();
            line2.StartPoint = new gPoint(SPT.x, SPT.y - 1, SPT.z);
            line2.EndPoint   = new gPoint(EPT.x, EPT.y - 1, EPT.z);
            document.ActiveLayOut.Entities.AddItem(line2);


            ASTRAMemberLoad aline = new ASTRAMemberLoad();

            document.ActionLayout.Entities.AddItem(aline);
            document.UndoHistory.PushEnable(false);
            aline.InitializeProperties();
            aline.setDocumentDefaults();
            aline.StartPoint = line2.StartPoint;
            aline.EndPoint   = line1.StartPoint;
            aline.arrowSize  = 0.3;
            aline.Transformby(document.User2WorldMatrix);
            document.UndoHistory.PopEnable();
            document.ActionDrawFigure(aline);


            double ll = ((line1.Length() / 5.0d) / line1.Length());
            double sx, sy, sz;
            double ex, ey, ez;

            sx = sy = sz = 0.0d;
            for (int j = 1; j <= 5; j++)
            {
                ASTRAMemberLoad aline1 = new ASTRAMemberLoad();
                document.ActionLayout.Entities.AddItem(aline1);
                document.UndoHistory.PushEnable(false);
                aline1.InitializeProperties();
                aline1.setDocumentDefaults();
                aline1.arrowSize = 0.3;

                sx = (j * ll) * (line2.EndPoint.x - line2.StartPoint.x) + line2.StartPoint.x;
                sy = (j * ll) * (line2.EndPoint.y - line2.StartPoint.y) + line2.StartPoint.y;
                sz = (j * ll) * (line2.EndPoint.z - line2.StartPoint.z) + line2.StartPoint.z;

                aline1.StartPoint = new gPoint(sx, sy, sz);

                ex = (j * ll) * (line1.EndPoint.x - line1.StartPoint.x) + line1.StartPoint.x;
                ey = (j * ll) * (line1.EndPoint.y - line1.StartPoint.y) + line1.StartPoint.y;
                ez = (j * ll) * (line1.EndPoint.z - line1.StartPoint.z) + line1.StartPoint.z;

                aline1.EndPoint = new gPoint(ex, ey, ez);
                aline1.Transformby(document.User2WorldMatrix);
                document.UndoHistory.PopEnable();
                document.ActionDrawFigure(aline);
            }
            document.Redraw(true);
        }
Esempio n. 6
0
        public void DrawMember(MemberIncidence mi, vdDocument doc)
        {

            double length, factor, txtSize;


            doc.Palette.Background = Color.White;
            vdLine line = new vdLine();
            vdText vtxtStartNode = new vdText();
            vdText vtxtEndNode = new vdText();
            vdText vtxtMemberNo = new vdText();

            line.SetUnRegisterDocument(doc);
            line.setDocumentDefaults();
            vtxtStartNode.SetUnRegisterDocument(doc);
            vtxtStartNode.setDocumentDefaults();
            vtxtEndNode.SetUnRegisterDocument(doc);
            vtxtEndNode.setDocumentDefaults();
            vtxtMemberNo.SetUnRegisterDocument(doc);
            vtxtMemberNo.setDocumentDefaults();


            line.PenColor = new vdColor(Color.Black);
            line.StartPoint = mi.StartNode.Point;
            line.EndPoint = mi.EndNode.Point;
            //line.ToolTip = string.Format("Member No : {0} \nStart Node = {1} [X={2}, Y={3}, Z={4}]\nEnd Node = {5} [X={6}, Y={7}, Z={8}]",
            //    mi.MemberNo,
            //    mi.StartNode.NodeNo,
            //    mi.StartNode.Point.x,
            //    mi.StartNode.Point.y,
            //    mi.StartNode.Point.z,

            //    mi.EndNode.NodeNo,
            //    mi.EndNode.Point.x,
            //    mi.EndNode.Point.y,
            //    mi.EndNode.Point.z); 

            line.ToolTip = string.Format("Member No : {0} [Nodes ({1}, {2})]",
                 mi.MemberNo,
                 mi.StartNode.NodeNo,
                 mi.EndNode.NodeNo);

            doc.ActionLayout.Entities.AddItem(line);



            // Chiranjit Modified [2010 04 16], Kolkata, TechSOFT
            object jc_no = hash_joint_no[mi.StartNode.NodeNo];

            if (jc_no == null)
            {
                hash_joint_no.Add(mi.StartNode.NodeNo, mi.StartNode.NodeNo);
                vtxtEndNode.ToolTip = string.Format("Node No : {0} [X={1}, Y={2}, Z={3}]",
                    mi.StartNode.NodeNo,
                    mi.StartNode.Point.x,
                    mi.StartNode.Point.y,
                    mi.StartNode.Point.z);


                doc.ActionLayout.Entities.AddItem(vtxtStartNode);
            }


            jc_no = hash_joint_no[mi.EndNode.NodeNo];

            if (jc_no == null)
            {
                hash_joint_no.Add(mi.EndNode.NodeNo, mi.EndNode.NodeNo);
                vtxtEndNode.ToolTip = string.Format("Node No : {0} [X={1}, Y={2}, Z={3}]",
                    mi.EndNode.NodeNo,
                    mi.EndNode.Point.x,
                    mi.EndNode.Point.y,
                    mi.EndNode.Point.z);

                doc.ActionLayout.Entities.AddItem(vtxtEndNode);

            }


            //doc.ActionLayout.Entities.AddItem(vtxtStartNode);
            //doc.ActionLayout.Entities.AddItem(vtxtEndNode);
            doc.ActionLayout.Entities.AddItem(vtxtMemberNo);



            length = line.Length();
            //factor = 22.2222d;
            //factor = length / 0.9d;

            //txtSize = length / factor;

            txtSize = GetTextSize();

            vtxtStartNode.TextString = mi.StartNode.NodeNo.ToString();
            vtxtStartNode.Height = txtSize;
            //vtxtStartNode.Height = 0.9d;
            //vtxtStartNode.PenColor = new vdColor(Color.Green);
            vtxtStartNode.InsertionPoint = mi.StartNode.Point;
            vtxtStartNode.Layer = nodesLay;

            vtxtEndNode.TextString = mi.EndNode.NodeNo.ToString();
            vtxtEndNode.Height = txtSize;
            //vtxtEndNode.Height = 0.9d;
            //vtxtEndNode.PenColor = new vdColor(Color.Green);
            vtxtEndNode.InsertionPoint = mi.EndNode.Point;
            vtxtEndNode.Layer = nodesLay;

            vtxtMemberNo.TextString = mi.MemberNo.ToString();
            //vtxtMemberNo.Height = 0.9d;
            vtxtMemberNo.Height = txtSize;
            vtxtMemberNo.PenColor = new vdColor(Color.Blue);
            vtxtMemberNo.InsertionPoint = (mi.StartNode.Point + mi.EndNode.Point) / 2;
            vtxtMemberNo.Layer = membersLay;
            vtxtMemberNo.ToolTip = string.Format("Member No : {0} [Nodes ({1}, {2})]",
                mi.MemberNo,
                mi.StartNode.NodeNo,
                mi.EndNode.NodeNo);
            //doc.ZoomAll();
            //doc.Redraw(true);
        }