protected PlainstData CreatePlainerType(PlainstData cloned)
 {
     cloned.DimX = DimX.CreatePlainerType();
     cloned.DimY = DimY.CreatePlainerType();
     cloned.DimZ = DimZ.CreatePlainerType();
     return(cloned);
 }
Example #2
0
        /// <inheritdoc/>
        public override XElement GetXml(string rootElemName, bool suppressDefaults)
        {
            XElement rootElem = new XElement(rootElemName, new XAttribute("dimX", DimX.ToString(CultureInfo.InvariantCulture)),
                                             new XAttribute("dimY", DimY.ToString(CultureInfo.InvariantCulture)),
                                             new XAttribute("dimZ", DimZ.ToString(CultureInfo.InvariantCulture)));

            Validate(rootElem, XsdTypeName);
            return(rootElem);
        }
        public PlainstData CreatePlainerType()
        {
            var cloned = new PlainstData();

            cloned.DimX = DimX.CreatePlainerType();
            cloned.DimY = DimY.CreatePlainerType();
            cloned.DimZ = DimZ.CreatePlainerType();
            return(cloned);
        }
Example #4
0
 //Methods
 /// <inheritdoc/>
 protected override void Check()
 {
     if (DimX < 1)
     {
         throw new ArgumentException($"Invalid DimX {DimX.ToString(CultureInfo.InvariantCulture)}. DimX must be GE to 1.", "DimX");
     }
     if (DimY < 1)
     {
         throw new ArgumentException($"Invalid DimY {DimY.ToString(CultureInfo.InvariantCulture)}. DimY must be GE to 1.", "DimY");
     }
     if (DimZ < 1)
     {
         throw new ArgumentException($"Invalid DimZ {DimZ.ToString(CultureInfo.InvariantCulture)}. DimZ must be GE to 1.", "DimZ");
     }
     return;
 }
 public void LazyShadowToOnline()
 {
     DimX.LazyShadowToOnline();
     DimY.LazyShadowToOnline();
     DimZ.LazyShadowToOnline();
 }
 public void LazyOnlineToShadow()
 {
     DimX.LazyOnlineToShadow();
     DimY.LazyOnlineToShadow();
     DimZ.LazyOnlineToShadow();
 }
Example #7
0
        private void evScanbrcode(string ebarcode)
        {
            bool        flOkscan = false;
            ResulthScan rscan    = new ResulthScan();

            rscan.Barcode = ebarcode;


            Barcode.Invoke(new OutputText((s) => Barcode.Text = ebarcode), "newText");
            BrcScanner.SendingData = false;

            if (!checkBox1.Checked)
            {
                /*{
                 *      //BrcScanner.SendingData = false;
                 *      lblError.Invoke(new OutputText((s) => lblError.Text = "укажите измеритель"), "newText");
                 *      //flOkscan = true;
                 *      BrcScanner.SendingData = true;
                 *      return;
                 *
                 *  } */

                Weight.Invoke(new OutputText((s) => Weight.Text = ""), "newText");
            }
            DimX.Invoke(new OutputText((s) => DimX.Text         = ""), "newText");
            DimY.Invoke(new OutputText((s) => DimY.Text         = ""), "newText");
            DimZ.Invoke(new OutputText((s) => DimZ.Text         = ""), "newText");
            lblError.Invoke(new OutputText((s) => lblError.Text = ""), "newText");

            if (!checkBox1.Checked)
            {
                try
                {
                    flOkscan = flOkscan | DimScanner.Scan(ref rscan);
                    flOkscan = flOkscan | WeightScanner.Scan(ref rscan);
                    if (flOkscan)
                    {
                        System.Messaging.Message ordermsg = new System.Messaging.Message();
                        ordermsg.Formatter = new XmlMessageFormatter(new Type[] { typeof(string) });

                        //test only

                        /*rscan.Height = 12.3;
                         * rscan.Length = 10.3;
                         * rscan.Weight = 9.3;
                         * rscan.Width  = 7.2;*/

                        rscan.MeasureCreater = "65e29293-f4e2-11e5-85c0-005056b649b2";

                        JavaScriptSerializer serializer = new JavaScriptSerializer();
                        string json = serializer.Serialize(rscan);

                        //Uri connecturi = new Uri("activemq:tcp://localhost:61616");

                        //Console.WriteLine("About to connect to " + connecturi);

                        // NOTE: ensure the nmsprovider-activemq.config file exists in the executable folder.
                        IConnectionFactory factory = new NMSConnectionFactory("activemq:tcp://10.0.1.39:61616?wireFormat.tightEncodingEnabled=true");



                        /* ((Apache.NMS.ActiveMQ.ConnectionFactory)((Apache.NMS.NMSConnectionFactory)factory).ConnectionFactory).UserName = StartProgram.userNameMq;
                         * ((Apache.NMS.ActiveMQ.ConnectionFactory)((Apache.NMS.NMSConnectionFactory)factory).ConnectionFactory).Password = StartProgram.passwordMq;*/
                        using (IConnection connection = factory.CreateConnection(StartProgram.userNameMq, StartProgram.passwordMq))

                            using (ISession session = connection.CreateSession())
                            {
                                IDestination destination = SessionUtil.GetDestination(session, StartProgram.queueName);
                                Console.WriteLine("Using destination: " + destination);

                                // Create a consumer and producer
                                //using (IMessageConsumer consumer = session.CreateConsumer(destination));
                                using (IMessageProducer producer = session.CreateProducer(destination))

                                {
                                    connection.Start();
                                    producer.DeliveryMode = MsgDeliveryMode.Persistent;

                                    // Send a message
                                    ITextMessage request = session.CreateTextMessage(json);
                                    request.NMSCorrelationID          = "Store";
                                    request.Properties["NMSXGroupID"] = "StoreLibra";
                                    request.Properties["myHeader"]    = "Sending measurements";

                                    producer.Send(request);
                                }
                            }
                        //activeMq.IntializeActiveMQ();

                        //ActiveMQ.Publisher publisher;



                        /*ordermsg.Label = "ScanDimention";
                         * ordermsg.Priority = MessagePriority.Normal;
                         * ordermsg.Body = json;
                         * //для начала создадим очередь
                         * // Create the transacted MSMQ queue if necessary.
                         * MessageQueue Queue = new MessageQueue(StartProgram.queueName);
                         * Queue.Send(ordermsg);*/

                        Weight.Text = rscan.Weight.ToString();
                        DimX.Text   = rscan.Length.ToString();
                        DimY.Text   = rscan.Width.ToString();
                        DimZ.Text   = rscan.Height.ToString();
                    }
                    else
                    {
                        Weight.Invoke(new OutputText((s) => Weight.Text = ""), "newText");
                        DimX.Invoke(new OutputText((s) => DimX.Text     = ""), "newText");
                        DimY.Invoke(new OutputText((s) => DimY.Text     = ""), "newText");
                        DimZ.Invoke(new OutputText((s) => DimZ.Text     = ""), "newText");
                    }
                }
                catch (Exception error)
                {
                    log.Error(error.Message);
                    BrcScanner.SendingData = true;

                    this.lblError.Text = error.Message;
                }

                BrcScanner.SendingData = true;
            }
            else
            {
                try {
                    flOkscan = flOkscan | DoMeizure.Scan(ref rscan);

                    // Откроем повторно COM порт Cubiscan для получения новых порций событий
                    DoMeizure.Open(Settings.Default.PortCubiscan, 9600, 8);

                    if (flOkscan)
                    {
                        System.Messaging.Message ordermsg = new System.Messaging.Message();
                        ordermsg.Formatter = new XmlMessageFormatter(new Type[] { typeof(string) });

                        JavaScriptSerializer serializer = new JavaScriptSerializer();
                        string json = serializer.Serialize(rscan);

                        ordermsg.Label    = "ScanDimentionCubiscan";
                        ordermsg.Priority = MessagePriority.Normal;
                        ordermsg.Body     = json;

                        MessageQueue Queue = new MessageQueue(StartProgram.queueName);

                        Queue.Send(ordermsg);

                        Weight.Invoke(new OutputText((s) => Weight.Text = rscan.Weight.ToString()), "newText");

                        DimX.Invoke(new OutputText((s) => DimX.Text = rscan.Length.ToString() + " Д"), "newText");
                        DimY.Invoke(new OutputText((s) => DimY.Text = rscan.Width.ToString() + " Ш"), "newText");
                        DimZ.Invoke(new OutputText((s) => DimZ.Text = rscan.Height.ToString() + " В"), "newText");
                    }
                    else
                    {
                        Weight.Text = "";
                        DimX.Text   = "";
                        DimY.Text   = "";
                        DimZ.Text   = "";
                    }
                }
                catch (Exception error)
                {
                    log.Error(error.Message);
                    BrcScanner.SendingData = true;

                    this.lblError.Text = error.Message;

                    Weight.Invoke(new OutputText((s) => Weight.Text = ""), "newText");
                    DimX.Invoke(new OutputText((s) => Weight.Text   = ""), "newText");
                    DimY.Invoke(new OutputText((s) => Weight.Text   = ""), "newText");
                    DimZ.Invoke(new OutputText((s) => Weight.Text   = ""), "newText");

                    BrcScanner.SendingData = true;
                }

                BrcScanner.SendingData = true;
            }
        }
Example #8
0
        private void CreareBoundingBox()
        {
            // Initialize minimum and maximum corners of the bounding box to max and min values
            Vector3 Min = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
            Vector3 Max = new Vector3(float.MinValue, float.MinValue, float.MinValue);

            // Loop all parts of the mesh to get bounding box size.
            foreach (ModelMeshPart meshPart in Mesh.MeshParts)
            {
                // Vertex buffer parameters
                int VertexStride     = meshPart.VertexBuffer.VertexDeclaration.VertexStride;
                int VertexBufferSize = meshPart.NumVertices * VertexStride;

                // Get vertex data as float
                float[] VertexData = new float[VertexBufferSize / sizeof(float)];
                meshPart.VertexBuffer.GetData(VertexData);

                // Iterate through vertices (possibly) growing bounding box, all calculations are done in world space
                for (int i = 0; i < VertexBufferSize / sizeof(float); i += VertexStride / sizeof(float))
                {
                    Vector3 Position = new Vector3(VertexData[i], VertexData[i + 1], VertexData[i + 2]);

                    Min = Vector3.Min(Min, Position);
                    Max = Vector3.Max(Max, Position);
                }
            }
            BBox = new BoundingBox(Min, Max);

            // Compute dimensions and areas.
            ComputeDimensions();

            // Create bounding box vertices.
            Vector3[] Corners = BBox.GetCorners();
            BBoxVertices = new List <VertexPositionColor[]>()
            {
                GetFaceVertices(Corners, new int[] { 5, 1, 2, 5, 2, 6 }),   // right    ->  XPlus
                GetFaceVertices(Corners, new int[] { 4, 0, 3, 4, 3, 7 }),   // left     ->  XMinus
                GetFaceVertices(Corners, new int[] { 4, 5, 1, 4, 1, 0 }),   // bottom   ->  YPlus
                GetFaceVertices(Corners, new int[] { 3, 2, 6, 3, 6, 7 }),   // top      ->  YMinus
                GetFaceVertices(Corners, new int[] { 0, 1, 2, 0, 2, 3 }),   // front    ->  ZPlus
                GetFaceVertices(Corners, new int[] { 4, 5, 6, 4, 6, 7 }),   // back     ->  ZMinus
            };

            Console.WriteLine("\tCreated Bounding Box  of size " + DimX.ToString("F3") + " x " + DimY.ToString("F3") + " x " + DimZ.ToString("F3") + ".");
            Console.WriteLine("\t\tSurface area = " + GetBBoxTotalArea());
            Console.WriteLine("\t\tFace areas = " + GetBBoxFaceArea(AAFace.XMinus) + ", " + GetBBoxFaceArea(AAFace.YMinus) + ", " + GetBBoxFaceArea(AAFace.ZMinus) + ".");
        }