Ejemplo n.º 1
0
            /// <summary>
            /// Drawing method used to draw factory content
            /// </summary>
            /// <param name="graphics">Graphic environment parameters</param>
            public void Draw(PicGraphics graphics, PicFilter filter)
            {
                graphics.Initialize();

                // bounding box
                if (!graphics.DrawingBox.IsValid)
                {
                    // compute bounding box
                    using (PicVisitorBoundingBox visitor = new PicVisitorBoundingBox())
                    {
                        ProcessVisitor(visitor);
                        Box2D box = visitor.Box;
                        box.AddMarginRatio(0.01);
                        // set as drawing box
                        graphics.DrawingBox = box;
                    }
                }

                // first, draw cotation
                foreach (PicEntity entity in _entities)
                {
                    try
                    {
                        // cotation
                        PicCotation cotation = entity as PicCotation;
                        if (cotation != null && !cotation.Deleted && filter.Accept(entity))
                        {
                            cotation.Draw(graphics);
                        }
                    }
                    catch (Exception ex)
                    {
                        _log.Error(ex.Message);
                    }
                }
                // then other entities
                foreach (Object o in _entities)
                {
                    try
                    {
                        // drawable entities
                        PicDrawable drawable = o as PicDrawable;
                        if (drawable != null && !drawable.Deleted && !(drawable is PicCotation) && filter.Accept(drawable))
                        {
                            drawable.Draw(graphics);
                        }
                    }
                    catch (Exception ex)
                    {
                        _log.Error(ex.Message);
                    }
                }
                // cardboard format
                if (null != _cardboardFormat)
                {
                    _cardboardFormat.Draw(graphics);
                }

                graphics.Finish();
            }
Ejemplo n.º 2
0
        public void CreateEntities(PicFactory factory)
        {
            if (!(listBoxSolutions.SelectedItem is ImpositionSolution solution))
            {
                return;
            }
            solution.CreateEntities(factory);

            // insert dimensions
            short grp = 0;

            if (PicCotation.GetBBCotations(solution.Bbox, CotTypeBB, 0.1, out Vector2D pt0, out Vector2D pt1, out Vector2D pt2, out Vector2D pt3, out double delta0, out double delta1))
            {
                PicCotationDistance cotH = factory.AddCotation(PicCotation.CotType.COT_HORIZONTAL, grp, 0, pt0, pt1, delta0, "", 1) as PicCotationDistance;
                cotH.UseShortLines = true;
                cotH.Auto          = true;

                PicCotationDistance cotV = factory.AddCotation(PicCotation.CotType.COT_VERTICAL, grp, 0, pt2, pt3, delta1, "", 1) as PicCotationDistance;
                cotV.UseShortLines = true;
                cotV.Auto          = true;
            }


            if (null != Format && PicCotation.GetBBCotations(new Box2D(solution.CardboardPosition, solution.CardboardDimensions), CotTypeFormat, 0.1, out Vector2D ptf0, out Vector2D ptf1, out Vector2D ptf2, out Vector2D ptf3, out double deltaf0, out double deltaf1))
            {
                PicCotationDistance cotH = factory.AddCotation(PicCotation.CotType.COT_HORIZONTAL, grp, 0, ptf0, ptf1, deltaf0, "", 1) as PicCotationDistance;
                cotH.UseShortLines = true;
                cotH.Auto          = false;

                PicCotationDistance cotV = factory.AddCotation(PicCotation.CotType.COT_VERTICAL, grp, 0, ptf2, ptf3, deltaf1, "", 1) as PicCotationDistance;
                cotV.UseShortLines = true;
                cotV.Auto          = false;
            }
            factory.InsertCardboardFormat(solution.CardboardPosition, solution.CardboardDimensions);
        }
Ejemplo n.º 3
0
        private void CreateQuotationV(PicFactory factory, Vector2D pt0, Vector2D pt1, double xpos, short grp)
        {
            PicCotation cotation = factory.AddCotation(PicCotation.CotType.COT_VERTICAL, grp, 0, pt0, pt1, pt0.X - xpos, string.Empty, 1);

            cotation.Auto = true;
        }
Ejemplo n.º 4
0
        private void CreateQuotationH(PicFactory factory, Vector2D pt0, Vector2D pt1, double ypos, short grp)
        {
            PicCotation cotation = factory.AddCotation(PicCotation.CotType.COT_HORIZONTAL, grp, 0, pt0, pt1, ypos - pt0.Y, string.Empty, 1);

            cotation.Auto = true;
        }